Skip to content

Commit

Permalink
checker: fix fn call with option call argument in autofree mode (#19515)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyi98 committed Oct 7, 2023
1 parent d20ed23 commit f3e4963
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vlib/v/checker/fn.v
Expand Up @@ -531,7 +531,8 @@ fn (mut c Checker) call_expr(mut node ast.CallExpr) ast.Type {
if arg.typ != ast.string_type {
continue
}
if arg.expr in [ast.Ident, ast.StringLiteral, ast.SelectorExpr] {
if arg.expr in [ast.Ident, ast.StringLiteral, ast.SelectorExpr]
|| (arg.expr is ast.CallExpr && arg.expr.or_block.kind != .absent) {
// Simple expressions like variables, string literals, selector expressions
// (`x.field`) can't result in allocations and don't need to be assigned to
// temporary vars.
Expand Down

0 comments on commit f3e4963

Please sign in to comment.