From 95ae915c0cd188adf7c0427b22aaf4de78223ac5 Mon Sep 17 00:00:00 2001 From: Kris Cherven <50562493+krischerven@users.noreply.github.com> Date: Sun, 19 Apr 2020 14:46:48 -0400 Subject: [PATCH] checker/parser: fix outdated error messages --- vlib/v/checker/checker.v | 2 +- vlib/v/parser/for.v | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/v/checker/checker.v b/vlib/v/checker/checker.v index 63eceba190..9c5c7f5673 100644 --- a/vlib/v/checker/checker.v +++ b/vlib/v/checker/checker.v @@ -335,7 +335,7 @@ fn (c mut Checker) assign_expr(assign_expr mut ast.AssignExpr) { scope := c.file.scope.innermost(assign_expr.pos.pos) if v := scope.find_var(it.name) { if !v.is_mut { - c.error('`$it.name` is immutable, declare it with `mut`', assign_expr.pos) + c.error('`$it.name` is immutable, declare it with `var` to assign to it', assign_expr.pos) } } } diff --git a/vlib/v/parser/for.v b/vlib/v/parser/for.v index 9fc87ba1f6..f6ff6f78f4 100644 --- a/vlib/v/parser/for.v +++ b/vlib/v/parser/for.v @@ -24,7 +24,7 @@ fn (var p Parser) for_stmt() ast.Stmt { is_inf: true } } else if p.tok.kind in [.key_mut, .key_var] { - p.error('`mut` is not needed in for loops') + p.error('`var` is not needed in for loops') } else if p.peek_tok.kind in [.decl_assign, .assign, .semicolon] || p.tok.kind == .semicolon { // `for i := 0; i < 10; i++ {` var init := ast.Stmt{}