mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix multiple assign error
This commit is contained in:
parent
74cc2b2a68
commit
64ba59590e
@ -845,7 +845,7 @@ fn (mut g Gen) gen_assign_stmt(assign_stmt ast.AssignStmt) {
|
|||||||
}
|
}
|
||||||
mut is_multi := false
|
mut is_multi := false
|
||||||
// json_test failed w/o this check
|
// json_test failed w/o this check
|
||||||
if return_type != 0 {
|
if return_type != table.void_type && return_type != 0 {
|
||||||
sym := g.table.get_type_symbol(return_type)
|
sym := g.table.get_type_symbol(return_type)
|
||||||
// the left vs. right is ugly and should be removed
|
// the left vs. right is ugly and should be removed
|
||||||
is_multi = sym.kind == .multi_return || assign_stmt.left.len > assign_stmt.right.len ||
|
is_multi = sym.kind == .multi_return || assign_stmt.left.len > assign_stmt.right.len ||
|
||||||
|
6
vlib/v/tests/multiple_assign_test.v
Normal file
6
vlib/v/tests/multiple_assign_test.v
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
fn test_multiple_assign() {
|
||||||
|
a, b, c := 1, 2, 3
|
||||||
|
assert a == 1
|
||||||
|
assert b == 2
|
||||||
|
assert c == 3
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user