docs(metatype): issue 0140 resolved; make_enum unblocked

This commit is contained in:
agra
2026-06-17 04:36:51 +03:00
parent 4da6add334
commit 0cb1aa270e

View File

@@ -74,15 +74,17 @@ in the always-loaded prelude interns them into every module's type table and
shifts every `.ir` snapshot. On-demand import keeps the prelude clean.
## Next step
**BLOCKED on issue 0140** for the make_enum path (see Known issues). The other
two are unblocked:
Pick any (independent):
- **`make_enum(variants: []EnumVariant)`** sx helper over a COMPUTED (non-literal)
variant list — exercises the interpreter decoding a value-arg slice in `define`
(vs. the literal `.[ … ]` the current examples use). **BLOCKED:** a computed
(pointer-backed) `[]EnumVariant` slice from a local var / `List` does not decode
in `defineEnum`/`decodeVariantElements`, and the resulting interp bail is
SWALLOWED (panic / misleading cascade, no root reason) — issue 0140. Fix 0140
first so the decode failure surfaces cleanly, THEN implement the slice decode.
variant list — exercises the interpreter decoding a value-arg slice in `define`.
**UNBLOCKED** (issue 0140 fixed — decode failures now surface a clean diagnostic
at the construction site instead of a panic/cascade). Remaining work: a computed
(pointer-backed) `[]EnumVariant` slice from a local var / `List` still does not
DECODE in `defineEnum`/`decodeVariantElements` — that decoder needs to follow a
`slot_ptr`/`heap_ptr` data field (today it only reads an inline `.aggregate`).
Probes: `.sx-tmp/probe_me2.sx` (sliced local array → bail "TypeError"),
`.sx-tmp/probe_makeenum.sx` (List → bail "struct_get: base has no fields"); the
inline-literal-param form already works (`.sx-tmp/probe_me3.sx`).
- **Widen `type_info` / `TypeInfo` past `` `enum ``** — struct/tuple variants:
add `` .`struct ``/`` .`tuple `` to the `TypeInfo` enum in `meta.sx`, teach
`reflectTypeInfo` to build them, and teach `defineEnum` (→ a `defineType`) to
@@ -92,19 +94,24 @@ two are unblocked:
self-reference already rejected — issue 0139.)
## Known issues
- **issue 0140 (OPEN) — a failing comptime type construction panics instead of
diagnosing.** `evalComptimeType` (`comptime.zig:~457`) swallows the interp's
`last_bail_detail` via `catch return null`; callers poison to `.unresolved`
with no diagnostic, and `.unresolved` reaches LLVM emission → panic ("unresolved
type reached LLVM emission"), or rides behind a misleading downstream cascade.
Pre-existing (plain `define` path; surfaced while starting make_enum). Repro:
`issues/0140-*.sx`. Blocks the make_enum computed-slice step. **Session paused
pending the fix** per the CLAUDE.md IMPASSABLE rule.
- issue 0140 comptime type-construction bail panicked instead of diagnosing —
RESOLVED. `evalComptimeType` now clears `last_bail_detail` before the interp
call and, on the `catch`, emits a build-gating `.err` at the construction span
("comptime type construction failed: {detail}") before returning the
`.unresolved` poison — so the reason is shown and no unresolved type reaches
emission unannounced. `examples/1179` locks it.
- issue 0139 — by-value self-reference segfault — RESOLVED (`checkInfiniteSize`
Pass 1g emits a loud "infinitely sized" diagnostic + breaks the cycle;
`examples/1178` locks it).
## Log
- **issue 0140 fixed.** A comptime type-construction bail (`declare`/`define`/
reflection) used to panic at LLVM emission ("unresolved type reached LLVM
emission") or hide behind a cascade — `evalComptimeType` swallowed the interp's
`last_bail_detail`. Now it clears the detail before the call and renders a
build-gating `.err` at the construction span on the `catch`. `examples/1179`
locks the empty-variants case. Suite green (677). Unblocks make_enum (its
computed-slice decode failures now surface cleanly).
- **`type_info($T)` reflection done (enum round-trip).** New `BuiltinId.type_info`;
`lower/call.zig` resolves `$T`, rejects non-enum loudly, emits the builtin;
`interp.zig:reflectTypeInfo` constructs the exact nested-aggregate Value