Commit 24120e7
committed
cgen: fix mut generic param indirection under -new-generic-solver
The new generic solver pre-resolves a `mut x T` parameter's type to the
concrete type, dropping the .generic flag, so fn_decl_params skipped adding
the pointer level: it emitted `T x` while the caller passes `&x` and the body
derefs `*x` (C error: pointer expected). Decide the indirection from orig_typ,
which still carries the generic T and resolves via cur_concrete_types.
Fixes all vlib/flag tests and 17 vlib/v/tests/generics tests under
-new-generic-solver; the default compiler is unaffected (self-compiles, all
normal generics tests still pass). Widen the regression test's count tolerance,
since it now also runs on macOS (after the vfmt CI fix), where the absolute
failure count differs from linux.1 parent 14f3516 commit 24120e7
2 files changed
Lines changed: 15 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2028 | 2028 | | |
2029 | 2029 | | |
2030 | 2030 | | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
2031 | 2036 | | |
2032 | | - | |
| 2037 | + | |
2033 | 2038 | | |
2034 | 2039 | | |
2035 | 2040 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
72 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
79 | | - | |
80 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
| |||
0 commit comments