Skip to content

Commit

Permalink
cgen: fix mutable comptimeselector usage (fix #20027) (#20134)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Dec 11, 2023
1 parent d1c5c79 commit 850e768
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
4 changes: 1 addition & 3 deletions vlib/v/checker/check_types.v
Expand Up @@ -930,9 +930,7 @@ fn (mut c Checker) infer_fn_generic_types(func ast.Fn, mut node ast.CallExpr) {
}
}
}

if arg.expr.is_auto_deref_var()
|| (arg.expr is ast.ComptimeSelector && arg.expr.left.is_auto_deref_var()) {
if arg.expr.is_auto_deref_var() {
typ = typ.deref()
}
// resolve &T &&T ...
Expand Down
3 changes: 0 additions & 3 deletions vlib/v/gen/c/fn.v
Expand Up @@ -1166,9 +1166,6 @@ fn (mut g Gen) resolve_comptime_args(func ast.Fn, mut node_ ast.CallExpr, concre
&& param_typ_sym.kind == .array {
comptime_args[k] = g.get_generic_array_element_type(arg_sym.info as ast.Array)
}
if call_arg.expr.left.is_auto_deref_var() {
comptime_args[k] = comptime_args[k].deref()
}
if param_typ.nr_muls() > 0 && comptime_args[k].nr_muls() > 0 {
comptime_args[k] = comptime_args[k].set_nr_muls(0)
}
Expand Down

0 comments on commit 850e768

Please sign in to comment.