Commit 31c69c5
committed
Preserve list type in
- When `array_splice` is called on a constant array with only integer keys and
a non-constant replacement, the builder degradation caused `isList` to be
incorrectly set to `No` (via non-null key in `setOffsetValueType`).
- After building the result, check whether all keys in the original constant
array were integers. If so, intersect the result with `AccessoryArrayListType`
since `array_splice` always re-indexes integer keys.
- The fix is applied per-replacement-variant before the final union, so it
correctly handles cases where the replacement is a union of arrays.
- Added regression test covering constant arrays with integer keys (the reported
bug), list replacements, and string-key arrays (already correct).
- Probed `sliceArray`, `IntersectionType::spliceArray`,
`AccessoryArrayListType::spliceArray`, sort functions, and
`ConstantTypeHelper` for analogous issues — none found in the same pattern.ConstantArrayType::spliceArray when all keys are integers1 parent 3bbe87b commit 31c69c5
2 files changed
Lines changed: 62 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1194 | 1194 | | |
1195 | 1195 | | |
1196 | 1196 | | |
| 1197 | + | |
| 1198 | + | |
1197 | 1199 | | |
1198 | 1200 | | |
1199 | 1201 | | |
| |||
1271 | 1273 | | |
1272 | 1274 | | |
1273 | 1275 | | |
1274 | | - | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
1275 | 1281 | | |
1276 | 1282 | | |
1277 | 1283 | | |
| |||
| 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 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
0 commit comments