From 0cb1aa270e23754e4beb8223cfa433290aa2e660 Mon Sep 17 00:00:00 2001 From: agra Date: Wed, 17 Jun 2026 04:36:51 +0300 Subject: [PATCH] docs(metatype): issue 0140 resolved; make_enum unblocked --- current/CHECKPOINT-METATYPE.md | 39 ++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/current/CHECKPOINT-METATYPE.md b/current/CHECKPOINT-METATYPE.md index 679eada2..25a6f819 100644 --- a/current/CHECKPOINT-METATYPE.md +++ b/current/CHECKPOINT-METATYPE.md @@ -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