Files
sx/issues/0140-comptime-type-construction-bail-unresolved-panic.sx
agra 3a062780f7 issue(0140): comptime type-construction bail panics instead of diagnosing
A failing declare/define (e.g. empty variant list) bails correctly in
the interp, but evalComptimeType swallows last_bail_detail via
`catch return null`; the decl poisons to .unresolved with no diagnostic
and reaches LLVM emission -> panic ("unresolved type reached LLVM
emission"), or hides behind a misleading downstream cascade.

Pre-existing (plain define path), surfaced while starting the make_enum
step. Blocks make_enum's computed (pointer-backed) []EnumVariant slice
decode. Repro + investigation prompt filed; CHECKPOINT-METATYPE marked
BLOCKED. Session paused pending fix per CLAUDE.md IMPASSABLE rule.
2026-06-16 22:59:49 +03:00

21 lines
831 B
Plaintext

// Repro for issue 0140 — a FAILING comptime type construction
// (`define` with an empty variant list) bails correctly in the interp
// ("comptime define(): enum has no variants"), but that bail is swallowed:
// `evalComptimeType` returns null, the decl is poisoned to `.unresolved`
// with NO diagnostic, and the `.unresolved` type reaches LLVM emission and
// PANICS ("unresolved type reached LLVM emission") instead of surfacing a
// clean error with the bail reason.
//
// Expected: a build-time diagnostic at the construction site naming the
// bail reason (e.g. "comptime type construction failed: enum has no
// variants"), exit 1, no panic.
#import "modules/std.sx";
#import "modules/std/meta.sx";
Empty :: define(declare("Empty"), .enum(.{ variants = .[] }));
main :: () -> i32 {
e : Empty = ---;
return 0;
}