Commit 4b038d7
committed
fix: restrict inside_cast_in_heap to interface types only
The original fix set inside_cast_in_heap for both sum types and
interfaces when packing values into arrays/variadic args. However,
setting it for sum types caused the compiler to fail self-compilation:
struct init codegen in struct.v line 100 uses inside_cast_in_heap > 0
to add memdup wrapping, which breaks for sum type arrays like
[]ast.Expr used pervasively in the compiler itself.
Restrict to .interface only since:
- The regression test (#26760) only involves interface values
- Interface casts use HEAP() macro (safe) vs & (dangling pointer risk)
- Sum type casts use ADDR() macro which already calls memdup
Fixes self-compilation failure while preserving the variadic interface
chain forwarding fix.1 parent f4b032a commit 4b038d7
2 files changed
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
97 | | - | |
| 98 | + | |
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2863 | 2863 | | |
2864 | 2864 | | |
2865 | 2865 | | |
2866 | | - | |
2867 | | - | |
| 2866 | + | |
| 2867 | + | |
2868 | 2868 | | |
2869 | 2869 | | |
2870 | 2870 | | |
| |||
2876 | 2876 | | |
2877 | 2877 | | |
2878 | 2878 | | |
2879 | | - | |
| 2879 | + | |
2880 | 2880 | | |
2881 | 2881 | | |
2882 | 2882 | | |
| |||
0 commit comments