Commit 4d497e7
Handle Array slice assignment (ary[start, len] = val) in builtin
Previously, Array#[]= with 3 arguments (slice assignment) fell through
to RBS overload resolution, where both (int, int, Elem) and
(int, int, Array[Elem]) overloads matched. The Elem overload caused
the assigned array to be treated as an element, creating deeply nested
union types like Array[Array[Array[Integer]]].
Now the builtin handles 3-argument []= by using SplatBox to extract
element types from the assigned value and merge them into the array's
element type, preventing type nesting.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent d31fa4b commit 4d497e7
2 files changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
72 | 86 | | |
73 | 87 | | |
74 | 88 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments