docs(metatype): type_info($T) enum reflection done; update plan/checkpoint

This commit is contained in:
agra
2026-06-16 22:53:52 +03:00
parent 1ffda415c2
commit 52b0dc2a9a
2 changed files with 47 additions and 10 deletions

View File

@@ -10,7 +10,8 @@ Comptime type metaprogramming with the smallest possible compiler surface:
- **`define(handle, info) -> Type`** — fill a declared handle's body from a
`TypeInfo` *value*, and return the handle (so the one-shot form chains).
- **`type_info($T) -> TypeInfo`** — reflect a type INTO data (the inverse of
`define`'s decode). *Pending.*
`define`'s decode). *Done for enums* (`interp.zig:reflectTypeInfo`,
`examples/0619`); struct/tuple widening pending.
- **`field_type($T, i) -> Type`** — the i-th field / variant-payload / element
type of `$T`. *Done.*
@@ -109,10 +110,12 @@ while red. Examples: `06xx` (comptime), `11xx` (diagnostics).
- [ ] **`make_enum(variants: []EnumVariant)`** sx helper over a COMPUTED
(non-literal) variant list — exercises the interpreter decoding a value-arg
slice in `define`.
- [ ] **`type_info($T) -> TypeInfo`** — reflect a type INTO a value (inverse of
`define`'s decode): widen `TypeInfo` past `` `enum `` (struct/tuple) AND
construct a `[]EnumVariant`-style value in the interpreter. Bails loudly today
in `call.zig:tryLowerReflectionCall`. Round-trips through `define` once it lands.
- [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).