mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-31 07:23:06 +08:00
A union that is a Set element or a Map key was a tagged box in the whole program, because the C map hashes and compares union keys by tag and payload. One `Set<Node | undefined>` made every `Node | undefined` value of the program a box, at every read. A union whose arms all compare by identity (records, class instances, arrays, functions), beside at most one undefined and one null arm, now keeps its pointer representation in collections too. The map keys such a union by reference: the pointer carries the identity, and NULL and the null sentinel are two more distinct keys. Unions with a string or another value arm keep their boxes, and library builds keep the earlier rule. The tests of the box paths keep their unions boxed through a new `boxedUnions` emission option instead of a Set of each union.