diff --git a/vlib/v/gen/cgen.v b/vlib/v/gen/cgen.v index e645ed666b..59ad7df00a 100644 --- a/vlib/v/gen/cgen.v +++ b/vlib/v/gen/cgen.v @@ -845,7 +845,7 @@ fn (mut g Gen) gen_assign_stmt(assign_stmt ast.AssignStmt) { } mut is_multi := false // 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) // the left vs. right is ugly and should be removed is_multi = sym.kind == .multi_return || assign_stmt.left.len > assign_stmt.right.len || diff --git a/vlib/v/tests/multiple_assign_test.v b/vlib/v/tests/multiple_assign_test.v new file mode 100644 index 0000000000..bf05c72590 --- /dev/null +++ b/vlib/v/tests/multiple_assign_test.v @@ -0,0 +1,6 @@ +fn test_multiple_assign() { + a, b, c := 1, 2, 3 + assert a == 1 + assert b == 2 + assert c == 3 +}