diff --git a/vlib/v/checker/assign.v b/vlib/v/checker/assign.v index ea399fb609..1987f34859 100644 --- a/vlib/v/checker/assign.v +++ b/vlib/v/checker/assign.v @@ -17,7 +17,7 @@ pub fn (mut c Checker) assign_stmt(mut node ast.AssignStmt) { mut right_len := node.right.len mut right_type0 := ast.void_type for i, mut right in node.right { - if right in [ast.CallExpr, ast.IfExpr, ast.LockExpr, ast.MatchExpr] { + if right in [ast.CallExpr, ast.IfExpr, ast.LockExpr, ast.MatchExpr, ast.DumpExpr] { if right in [ast.IfExpr, ast.MatchExpr] && node.left.len == node.right.len && !is_decl && node.left[i] in [ast.Ident, ast.SelectorExpr] && !node.left[i].is_blank_ident() { c.expected_type = c.expr(node.left[i]) diff --git a/vlib/v/checker/tests/assign_with_dump_multireturn_value.out b/vlib/v/checker/tests/assign_with_dump_multireturn_value.out new file mode 100644 index 0000000000..88dd6c2386 --- /dev/null +++ b/vlib/v/checker/tests/assign_with_dump_multireturn_value.out @@ -0,0 +1,6 @@ +vlib/v/checker/tests/assign_with_dump_multireturn_value.vv:5:3: error: assignment mismatch: 1 variable(s) 2 value(s) + 3 | } + 4 | + 5 | x := dump(two_returns()) + | ~~ + 6 | println(x) diff --git a/vlib/v/checker/tests/assign_with_dump_multireturn_value.vv b/vlib/v/checker/tests/assign_with_dump_multireturn_value.vv new file mode 100644 index 0000000000..e687cd6570 --- /dev/null +++ b/vlib/v/checker/tests/assign_with_dump_multireturn_value.vv @@ -0,0 +1,6 @@ +fn two_returns() (string, string) { + return 'hello', 'world' +} + +x := dump(two_returns()) +println(x)