From fe6799545ae0957f29919fc6e1946eda9127ace6 Mon Sep 17 00:00:00 2001 From: agra Date: Wed, 17 Jun 2026 06:34:26 +0300 Subject: [PATCH] docs(metatype): declare()-never-defined validation done --- current/CHECKPOINT-METATYPE.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/current/CHECKPOINT-METATYPE.md b/current/CHECKPOINT-METATYPE.md index 66badfb8..96fc1b23 100644 --- a/current/CHECKPOINT-METATYPE.md +++ b/current/CHECKPOINT-METATYPE.md @@ -94,8 +94,11 @@ Pick any (independent): `reflectTypeInfo` to build them, and teach `defineEnum` (→ a `defineType`) to decode them. Round-trips a struct through `define` once it lands. - **Validation + loud diagnostics** (remaining) — ~~duplicate variant names~~ DONE - (`define` bails naming the dup; `examples/1180`). Still pending: a `declare()` - never `define()`d (hard error at end of comptime), use-before-define. + (`define` bails naming the dup; `examples/1180`); ~~`declare()` never + `define()`d~~ DONE (`evalComptimeType` rejects a zero-variant result; was a + `verifySizes` panic; `examples/1181`). Still pending: use-before-define (using a + declared-but-not-yet-defined slot's LAYOUT mid-construction; `*Name` pointer use + is fine and by-VALUE self-ref is already caught by `checkInfiniteSize`/issue 0139). ### make_enum follow-ups (deferred capability gaps — NOT crashes; clean diagnostics) `make_enum` itself is DONE (see Last completed step). Remaining adjacent @@ -128,6 +131,11 @@ capabilities would let the variant list be built more freely; both error cleanly `examples/1178` locks it). ## Log +- **declare()-never-defined validation.** A bare `declare("X")` with no `define` + left a zero-field nominal slot that panicked at codegen (`verifySizes`). + `evalComptimeType` now detects a zero-variant `tagged_union` result and emits a + clean diagnostic naming the type. Self-reference (declared slot completed by + `define`) is unaffected. `examples/1181` locks it. Suite green (681). - **Duplicate variant-name validation.** Two same-named variants in a constructed enum used to silently succeed (ambiguous construction/match). `defineEnum` now bails naming the duplicate; `evalComptimeType` renders it (post-0140).