checker: make missing `mut` before an argument a warning

pull/7103/head
Alexander Medvednikov 2020-12-02 23:58:06 +01:00
parent 4b94c29c91
commit 1037d3a383
1 changed files with 2 additions and 2 deletions

View File

@ -1294,7 +1294,7 @@ pub fn (mut c Checker) call_method(mut call_expr ast.CallExpr) table.Type {
} else { } else {
if param.is_mut && (!arg.is_mut || param.typ.share() != arg.share) { if param.is_mut && (!arg.is_mut || param.typ.share() != arg.share) {
tok := arg.share.str() tok := arg.share.str()
c.error('`$call_expr.name` parameter `$param.name` is `$tok`, you need to provide `$tok` e.g. `$tok arg${i + c.warn('`$call_expr.name` parameter `$param.name` is `$tok`, you need to provide `$tok` e.g. `$tok arg${i +
1}`', arg.expr.position()) 1}`', arg.expr.position())
} }
} }
@ -1566,7 +1566,7 @@ pub fn (mut c Checker) call_fn(mut call_expr ast.CallExpr) table.Type {
} else { } else {
if arg.is_mut && (!call_arg.is_mut || arg.typ.share() != call_arg.share) { if arg.is_mut && (!call_arg.is_mut || arg.typ.share() != call_arg.share) {
tok := call_arg.share.str() tok := call_arg.share.str()
c.error('`$call_expr.name` parameter `$arg.name` is `$tok`, you need to provide `$tok` e.g. `$tok arg${i + c.warn('`$call_expr.name` parameter `$arg.name` is `$tok`, you need to provide `$tok` e.g. `$tok arg${i +
1}`', call_arg.expr.position()) 1}`', call_arg.expr.position())
} }
} }