parser: fix the position of the multi variable += assign error (#7584)
parent
90175e95d3
commit
e27252bef5
|
@ -106,7 +106,7 @@ fn (mut p Parser) partial_assign_stmt(left []ast.Expr, left_comments []ast.Comme
|
|||
for r in right {
|
||||
has_cross_var = p.check_cross_variables(left, r)
|
||||
if op !in [.assign, .decl_assign] {
|
||||
p.error('unexpected $op.str(), expecting := or = or comma')
|
||||
p.error_with_pos('unexpected $op.str(), expecting := or = or comma', pos)
|
||||
return ast.Stmt{}
|
||||
}
|
||||
if has_cross_var {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
vlib/v/parser/tests/multi_argumented_assign_err.vv:3:10: error: unexpected +=, expecting := or = or comma
|
||||
1 | fn main() {
|
||||
2 | mut a, mut b, mut c := 0,1, 2
|
||||
3 | a, b, c += 1, 2, 4
|
||||
| ~~
|
||||
4 | println('$a $b $c')
|
||||
5 | }
|
|
@ -0,0 +1,5 @@
|
|||
fn main() {
|
||||
mut a, mut b, mut c := 0,1, 2
|
||||
a, b, c += 1, 2, 4
|
||||
println('$a $b $c')
|
||||
}
|
Loading…
Reference in New Issue