From 8df7637853285293a6f474314ee5369f1f0e3fb3 Mon Sep 17 00:00:00 2001 From: joe-conigliaro Date: Sun, 3 May 2020 14:22:41 +1000 Subject: [PATCH] checker: dont re match/cast with position() when already cast to sum type --- vlib/v/checker/checker.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index de05c32d16..c262d7154e 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -470,7 +470,7 @@ pub fn (mut c Checker) infix_expr(infix_expr mut ast.InfixExpr) table.Type { fn (mut c Checker) fail_if_immutable(expr ast.Expr) { match expr { ast.Ident { - scope := c.file.scope.innermost(expr.position().pos) + scope := c.file.scope.innermost(it.pos.pos) if v := scope.find_var(it.name) { if !v.is_mut && !v.typ.is_ptr() { c.error('`$it.name` is immutable, declare it with `mut` to make it mutable', @@ -490,7 +490,7 @@ fn (mut c Checker) fail_if_immutable(expr ast.Expr) { ast.SelectorExpr { // retrieve table.Field if it.expr_type == 0 { - c.error('0 type in SelectorExpr', expr.position()) + c.error('0 type in SelectorExpr', it.pos) return } typ_sym := c.table.get_type_symbol(it.expr_type)