1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

checker: fix dumping match expr (#15869)

This commit is contained in:
yuyi 2022-09-25 16:21:14 +08:00 committed by GitHub
parent 5cc9d7b347
commit 50fb5de926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 0 deletions

View File

@ -2179,6 +2179,7 @@ pub fn (mut c Checker) expr(node_ ast.Expr) ast.Type {
return c.concat_expr(mut node) return c.concat_expr(mut node)
} }
ast.DumpExpr { ast.DumpExpr {
c.expected_type = ast.string_type
node.expr_type = c.expr(node.expr) node.expr_type = c.expr(node.expr)
c.check_expr_opt_call(node.expr, node.expr_type) c.check_expr_opt_call(node.expr, node.expr_type)
etidx := node.expr_type.idx() etidx := node.expr_type.idx()

View File

@ -0,0 +1 @@
[vlib/v/tests/inout/dump_match_expr.vv:3] ast.MatchExpr: 1

View File

@ -0,0 +1,8 @@
fn main() {
i := 1
dump(match i {
0 { '0' }
1 { '1' }
else { '2' }
})
}