Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Apr 25, 2024
1 parent 903a585 commit 87e877f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions vlib/v/checker/fn.v
Original file line number Diff line number Diff line change
Expand Up @@ -1278,8 +1278,12 @@ fn (mut c Checker) fn_call(mut node ast.CallExpr, mut continue_check &bool) ast.
} else {
if param.is_mut {
tok := param.specifier()
c.error('function `${node.name}` parameter `${param.name}` is `${tok}`, so use `${tok} ${call_arg.expr}` instead',
call_arg.expr.pos())
param_sym := c.table.sym(param.typ)
if !(param_sym.info is ast.Struct && param_sym.info.attrs.any(it.name == 'params'
&& !it.has_arg)) {
c.error('function `${node.name}` parameter `${param.name}` is `${tok}`, so use `${tok} ${call_arg.expr}` instead',
call_arg.expr.pos())
}
} else {
c.fail_if_unreadable(call_arg.expr, arg_typ, 'argument')
}
Expand Down

0 comments on commit 87e877f

Please sign in to comment.