diff --git a/vlib/compiler/if_match.v b/vlib/compiler/if_match.v index bda01455c5..04c3200f0e 100644 --- a/vlib/compiler/if_match.v +++ b/vlib/compiler/if_match.v @@ -12,6 +12,11 @@ import ( fn (p mut Parser) match_statement(is_expr bool) string { p.check(.key_match) p.fspace() + is_mut := p.tok == .key_mut + if is_mut { + p.next() + p.fspace() + } typ,expr := p.tmp_expr() if typ.starts_with('array_') { p.error('arrays cannot be compared') @@ -140,7 +145,7 @@ fn (p mut Parser) match_statement(is_expr bool) string { p.register_var(Var{ name: 'it' typ: sum_child_type+'*' - is_mut: true + is_mut: is_mut ptr: true }) } diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 6c1cf8365a..9ea0aeae6d 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -197,6 +197,7 @@ fn (c &Checker) stmt(node ast.Stmt) { } ast.VarDecl { typ := c.expr(it.expr) + // it.typ = typ // println('checker: var decl $typ.name it.typ=$it.typ.name $it.pos.line_nr') /* if typ.kind != .void {