Files
scriptc/packages
Chris Tate 33cf76d36e Keep object and array literals that hold an evolving empty array on that array
An object or array literal that held an evolving `const xs = []` between
writes of different element types (`const box = { items: xs }` or
`const rows = [xs]` after `xs.push(1)`, before `xs.push("two")`) took the
element type the checker gives the array at that point, so it held a copy.
`box.items.length` and `box.items === xs` printed `1 false`, where Node
prints `2 true`. Such a literal now builds as a checked-dynamic literal that
keeps the array, and an unannotated binding of it takes the checked-dynamic
type. This covers shorthand properties (`{ xs }`), nested literals, spreads
of a literal holder, aliases of a holder and names destructured from one.
Element reads through an alias or holder (`rows[0]`, `alias[1]`) read the
checked-dynamic value instead of checking it against the checker's type,
which lists only the elements written before the alias or holder was taken.

A shorthand property now counts as a read of the array when its reads are
compared, so `{ xs }` before a write of another element type makes the
array checked-dynamic too.

Fixes #1641.
2026-10-22 21:23:57 -05:00
..
2026-10-22 18:44:10 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 18:44:10 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 18:44:10 -05:00
2026-10-22 11:14:27 -05:00
2026-10-22 11:14:27 -05:00