From 86feced560fe64d54448ed90e66c631c19cf2e7c Mon Sep 17 00:00:00 2001 From: agra Date: Wed, 17 Jun 2026 08:08:56 +0300 Subject: [PATCH] =?UTF-8?q?docs(metatype):=20refresh=20PLAN=20Status=20?= =?UTF-8?q?=E2=80=94=20surface=20complete,=200141=20deferred?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- current/PLAN-METATYPE.md | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/current/PLAN-METATYPE.md b/current/PLAN-METATYPE.md index 4c36fd93..b45b8e54 100644 --- a/current/PLAN-METATYPE.md +++ b/current/PLAN-METATYPE.md @@ -107,20 +107,31 @@ while red. Examples: `06xx` (comptime), `11xx` (diagnostics). before the body lowers). `examples/0618` (recursive `*List`: construct, match through the pointer, recursive traversal). Mutual recursion / by-value-self-ref rejection fall out of the same mechanism (F5 adds the loud by-value check). -- [ ] **`make_enum(variants: []EnumVariant)`** sx helper over a COMPUTED - (non-literal) variant list — exercises the interpreter decoding a value-arg - slice in `define`. -- [x] **`type_info($T) -> TypeInfo`** (enum-only) — reflect an `enum`/`tagged_union` - INTO a value (inverse of `define`'s decode): `interp.zig:reflectTypeInfo` - constructs the `.enum(EnumInfo{ variants })` Value `defineEnum` decodes, so - `define(declare(n), type_info(T))` round-trips. `examples/0619`. Non-enum args - rejected loudly at lower time. **Still pending:** widen `TypeInfo` past - `` `enum `` (struct/tuple variants) + the matching `define` decode arms. -- [~] **Validation + loud diagnostics** — by-VALUE self-reference DONE - (`checkInfiniteSize` Pass 1g: loud "infinitely sized" diagnostic + cycle - break, covers source + comptime types; `examples/1178`, issue 0139 resolved). - Still pending: duplicate variant names, a `declare()` never `define()`d - (hard error), use-before-define. +- [x] **`make_enum(name, variants: []EnumVariant)`** — the general enum constructor + over a COMPUTED (value, non-literal) variant list. Pure sx in `meta.sx`; + exercises `define` decoding a value-arg slice. `examples/0620` (array-literal + local) / `0624` (generic builder). +- [x] **Comptime slice over a non-string aggregate** — `arr[lo..hi]` over an array + yields a real slice value at comptime (`base_ty` threaded onto `Subslice`; + open-ended `hi` folded to the array's static length; `subsliceElements`). + `examples/0621`. +- [x] **`type_info($T) -> TypeInfo`** — reflect `enum`/`tagged_union`/`struct`/`tuple` + INTO a value (inverse of `define`'s decode); `define` decodes all three back + (`defineEnum`/`defineStruct`/`defineTuple`, dispatched on the TypeInfo tag). + Round-trips: `examples/0619` (enum) / `0622` (struct) / `0623` (tuple). The + reflect/construct triad is complete. +- [x] **Generic type-fn body locals** — a generic `($T) -> Type` comptime-evaluates + its FULL body (prelude statements + return), so a local before the return + resolves (`createComptimeFunctionWithPrelude` / `evalComptimeTypeBody`). + `examples/0624`. +- [x] **Validation + loud diagnostics** — by-value self-reference (`checkInfiniteSize`, + source `1178` + constructed `1182`; issue 0139), duplicate variant/field names + (`1180`), `declare()` never `define()`d (`1181`, was a `verifySizes` panic), + and the 0140 bail-surfacing (`1179`). use-before-define is subsumed by these + (no new check needed). Validation story COMPLETE. +- [ ] **Comptime `List` growth** (issue 0141, DEFERRED) — `List(T).append` at + comptime bails (two layers: null comptime allocator at scanDecls + `*T` + slot_ptr `struct_get`). Non-blocking; array-literal locals cover the use case. ## Risks / watch