From afb1fee252ee8e3d7143d81dd19aba52e06e5955 Mon Sep 17 00:00:00 2001 From: agra Date: Wed, 17 Jun 2026 06:42:27 +0300 Subject: [PATCH] docs(metatype): validation story complete (use-before-define subsumed) --- current/CHECKPOINT-METATYPE.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/current/CHECKPOINT-METATYPE.md b/current/CHECKPOINT-METATYPE.md index 96fc1b23..92e9d087 100644 --- a/current/CHECKPOINT-METATYPE.md +++ b/current/CHECKPOINT-METATYPE.md @@ -93,12 +93,16 @@ Pick any (independent): add `` .`struct ``/`` .`tuple `` to the `TypeInfo` enum in `meta.sx`, teach `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`); ~~`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). +- ~~**Validation + loud diagnostics**~~ — COMPLETE. duplicate variant names + (`examples/1180`); `declare()` never `define()`d (`examples/1181`, was a + `verifySizes` panic); by-value self-reference for both source (`1178`) and + CONSTRUCTED (`1182`) types via `checkInfiniteSize`. **use-before-define needs no + new check** — it's subsumed by the existing guards: a by-value cycle → + `checkInfiniteSize` ("infinitely sized"); an unfinished slot → declare-never- + defined; a bad/non-Type payload → a 0140 clean bail; a forward reference resolves + correctly via in-place slot mutation (`updatePreservingKey`); a `*Name` pointer + needs no layout. Probes `.sx-tmp/probe_ubd{1..4}.sx` confirmed: no remaining + crash or silent-corruption, only clean diagnostics / correct results. ### make_enum follow-ups (deferred capability gaps — NOT crashes; clean diagnostics) `make_enum` itself is DONE (see Last completed step). Remaining adjacent @@ -131,6 +135,12 @@ capabilities would let the variant list be built more freely; both error cleanly `examples/1178` locks it). ## Log +- **Validation story COMPLETE.** use-before-define needs no new check — subsumed + by `checkInfiniteSize` (by-value cycles), declare-never-defined (unfinished + slots), 0140 bails (bad payloads), and in-place slot mutation (forward refs); + `*Name` pointer use needs no layout. Probed `.sx-tmp/probe_ubd{1..4}.sx`: all + clean diagnostics / correct results, no crash. `examples/1182` locks the + by-value self-ref rejection for CONSTRUCTED enums (companion to source `1178`). - **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