1
0
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:
yuyi 2020-05-11 14:45:11 +08:00 committed by GitHub
parent 74cc2b2a68
commit 64ba59590e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -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 ||

View File

@ -0,0 +1,6 @@
fn test_multiple_assign() {
a, b, c := 1, 2, 3
assert a == 1
assert b == 2
assert c == 3
}