Commit 3d5e261
committed
Fix compiler crash when passing an array literal to
`detect_values_element_type` in the array literal element-type
inference only stripped a top-level `this->` arrow from the element
type extracted from an interface's `values()` method. When the element
type came from a type alias that expanded into a union (such as
`ByteSeq = (String | Array[U8] val)` in `ByteSeqIter`), the viewpoint
pass distributed the `this->` across the union members. The top-level
check then saw a `TK_UNIONTYPE` and left the arrows in place. The
unstripped arrows reached code generation and tripped an assertion in
`type_append` at `codegen/genname.c`.
`detect_apply_element_type` already used the recursive
`strip_this_arrow` helper for the same reason. The values-based
strategy now does too, bringing the two paths into parity.
Closes #2701
Closes #2790OutStream.writev
1 parent ecf59a1 commit 3d5e261
File tree
4 files changed
+57
-5
lines changed- .release-notes
- src/libponyc/expr
- test/full-program-tests
- array-infer-from-values-interface-type-alias-element
- array-infer-from-values-local-interface-type-alias-element
4 files changed
+57
-5
lines changedLines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
128 | 126 | | |
129 | 127 | | |
130 | 128 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
0 commit comments