Semantic Diff

#9008 Box Some of a constant case represented by undefined

1 commit

d8db3c6ebb93d50ae095b58c670b79cd388988b4..pr-9008

b5836debf · cknitt + Claude · Oct 24, 2026, 06:10 UTC

Box Some of a constant case represented by undefined

Why

Some(U) with @as(undefined) U compiled to plain undefined when U was a constant, so it was None, while Some(v) with v = U passed at run time stayed distinct (#8954).

A constant constructor whose literal is undefined is now a none for const_some_none_depth, so Some of it is boxed like Some(None). This holds for untagged and tagged variants alike. The spec's known bug is gone, and rule 12 states the case.

modifiedJS

@unboxed type u = | @as(undefined) U | V(string)let x: option<u> = Some(U)
js
Before
After
let x = undefined;let x = Primitive_option.some(undefined);