checker: make missing `mut` before an argument a warning
parent
4b94c29c91
commit
1037d3a383
|
@ -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())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue