test(0140): pin comptime type-construction bail diagnostic (examples/1179)
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.
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
// 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;
|
||||
}
|
||||
Reference in New Issue
Block a user