You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 154c49e
Browse filesBrowse the repository at this point in the historyBrowse files
Fix a stack overflow on option of a recursive @unboxed variant (#9019)
Stop at recursion when checking whether a variant can be undefined
Why:
Deciding whether `option` of a recursive `@unboxed` variant can be
unboxed walked the payload types without remembering the variants it
was in, so `Recur(t)` sent it into `t` forever and the compiler died
with a stack overflow (#9018).
The walk remembers the variant declarations it is in. A variant met again
adds no way to be undefined, since a value reaches `undefined` through
finitely many unboxed payloads, so the answer comes from its other cases.
JS modified (option of a recursive unboxed variant):
Example:
@unboxed type rec t = Recur(t) | End
let x: option<t> = Some(End)
Before (js): Fatal error: exception Stack overflow
After (js): let x = "End";
Fixes#9018
Claude-Session: https://claude.ai/code/session_01CMkrYaktctdKc4M41WF36t
Signed-off-by: Christoph Knittel <ck@cca.io>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
0 commit comments