diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 2eb3d85fe0..36cdf0f89c 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -2179,6 +2179,7 @@ pub fn (mut c Checker) expr(node_ ast.Expr) ast.Type { return c.concat_expr(mut node) } ast.DumpExpr { + c.expected_type = ast.string_type node.expr_type = c.expr(node.expr) c.check_expr_opt_call(node.expr, node.expr_type) etidx := node.expr_type.idx() diff --git a/vlib/v/tests/inout/dump_match_expr.out b/vlib/v/tests/inout/dump_match_expr.out new file mode 100644 index 0000000000..61d6143983 --- /dev/null +++ b/vlib/v/tests/inout/dump_match_expr.out @@ -0,0 +1 @@ +[vlib/v/tests/inout/dump_match_expr.vv:3] ast.MatchExpr: 1 diff --git a/vlib/v/tests/inout/dump_match_expr.vv b/vlib/v/tests/inout/dump_match_expr.vv new file mode 100644 index 0000000000..359200ef8a --- /dev/null +++ b/vlib/v/tests/inout/dump_match_expr.vv @@ -0,0 +1,8 @@ +fn main() { + i := 1 + dump(match i { + 0 { '0' } + 1 { '1' } + else { '2' } + }) +}