Move the issue 0140 repro into the feature suite as a regression test. Asserts the build-gating diagnostic 'comptime type construction failed: comptime define(): enum has no variants' at the construction site, exit 1 — locking out the prior 'unresolved type reached LLVM emission' panic.
20 lines
871 B
Plaintext
20 lines
871 B
Plaintext
// A comptime type construction (declare/define, reflection) that bails in the
|
|
// interpreter must surface a build-gating DIAGNOSTIC naming the reason — not
|
|
// poison the decl to `.unresolved` silently and let that crash at LLVM emission
|
|
// or hide behind a downstream cascade. Here `define` is handed an empty variant
|
|
// list; the interp bails "enum has no variants", and `evalComptimeType` renders
|
|
// that at the construction site (exit 1, no panic).
|
|
//
|
|
// Regression (issue 0140): before the fix this panicked with "unresolved type
|
|
// reached LLVM emission" (exit 134), because the interp's bail detail was
|
|
// dropped (`catch return null`) and `.unresolved` reached codegen unannounced.
|
|
#import "modules/std.sx";
|
|
#import "modules/std/meta.sx";
|
|
|
|
Empty :: define(declare("Empty"), .enum(.{ variants = .[] }));
|
|
|
|
main :: () -> i32 {
|
|
e : Empty = ---;
|
|
return 0;
|
|
}
|