parser: fix weird minus after comment parse error in arrays (#8912)
parent
fcc2094719
commit
51125541c7
|
@ -14,4 +14,10 @@ fn only_comments_array() {
|
|||
fn array_pre_comments() {
|
||||
_ := [/* 2, */ 3]
|
||||
_ := [/* 4, */ /* 5, */ 6]
|
||||
_ := [/* cmt */ -4]
|
||||
}
|
||||
|
||||
fn negative_num_after_comment_expr() {
|
||||
// This caused a bug where the ´-´ was parsed as InfixExpr and not as part of an IntegerLiteral
|
||||
_ := [1, /* cmt */ -4]
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ pub fn (mut p Parser) expr(precedence int) ast.Expr {
|
|||
}
|
||||
.comment {
|
||||
node = p.comment()
|
||||
return node
|
||||
}
|
||||
.dot {
|
||||
// .enum_val
|
||||
|
|
Loading…
Reference in New Issue