WP58: A discriminated union as a generic's type argument
State: Landed · Done: 1 of 1
Stages
- S1: lift NL2533 —
Box<Shape>,Result<Shape, E>, a generic call bound to a union andgetOrInsert/reserveon aMap<K, Shape>compile and run; a variant enters the union with a bitcast at every generic payload site, soBox<Shape>is the same IR as a hand-writtenShapeBox(docs/IR_COOKBOOK.md), andResult<Shape, string>allocates a fifth less than the wrapper it replaces (docs/BENCHMARKS.md)
A union is still refused as a Set element or Map key (NL2353), a generic class as a variant (NL2522), a variant stored through a generic field (NL2534), and across the C header and N-API boundary (NL4009); docs/LANGUAGE.md lists the rest.
Next
Nothing scheduled.

