docs(metatype): declare()-never-defined validation done

This commit is contained in:
agra
2026-06-17 06:34:26 +03:00
parent c185dbdd13
commit fe6799545a

View File

@@ -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).