From bc184a9f02d15b1e67b1fb01048551667eec7a52 Mon Sep 17 00:00:00 2001 From: Joe Conigliaro Date: Wed, 11 Mar 2020 01:16:30 +1100 Subject: [PATCH] checker: properly update var info in AssignStmt --- vlib/v/checker/checker.v | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 1f1fd23447..36a3e31231 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -382,8 +382,8 @@ pub fn (c mut Checker) assign_stmt(assign_stmt mut ast.AssignStmt) { mut scope := c.file.scope.innermost(assign_stmt.pos.pos) for i, _ in assign_stmt.left { mut ident := assign_stmt.left[i] - mut var_info := ident.var_info() val_type := mr_info.types[i] + mut var_info := ident.var_info() var_info.typ = val_type ident.info = var_info assign_stmt.left[i] = ident @@ -418,12 +418,10 @@ pub fn (c mut Checker) assign_stmt(assign_stmt mut ast.AssignStmt) { c.error('assign stmt: cannot use `$val_type_sym.name` as `$var_type_sym.name`', assign_stmt.pos) } } - else { - mut ident_var_info := ident.var_info() - ident_var_info.typ = val_type - ident.info = ident_var_info - assign_stmt.left[i] = ident - } + mut ident_var_info := ident.var_info() + ident_var_info.typ = val_type + ident.info = ident_var_info + assign_stmt.left[i] = ident scope.override_var(ast.Var{ name: ident.name typ: val_type