issue(0140): comptime type-construction bail panics instead of diagnosing

A failing declare/define (e.g. empty variant list) bails correctly in
the interp, but evalComptimeType swallows last_bail_detail via
`catch return null`; the decl poisons to .unresolved with no diagnostic
and reaches LLVM emission -> panic ("unresolved type reached LLVM
emission"), or hides behind a misleading downstream cascade.

Pre-existing (plain define path), surfaced while starting the make_enum
step. Blocks make_enum's computed (pointer-backed) []EnumVariant slice
decode. Repro + investigation prompt filed; CHECKPOINT-METATYPE marked
BLOCKED. Session paused pending fix per CLAUDE.md IMPASSABLE rule.
This commit is contained in:
agra
2026-06-16 22:59:49 +03:00
parent 52b0dc2a9a
commit 3a062780f7
3 changed files with 165 additions and 5 deletions

View File

@@ -74,10 +74,15 @@ 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
Pick any (independent):
**BLOCKED on issue 0140** for the make_enum path (see Known issues). The other
two are unblocked:
- **`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).
(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.
- **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
@@ -87,9 +92,17 @@ Pick any (independent):
self-reference already rejected — issue 0139.)
## Known issues
None. (issue 0139 — by-value self-reference segfault — RESOLVED: `checkInfiniteSize`
Pass 1g emits a loud "infinitely sized" diagnostic + breaks the cycle; covers
source + comptime types; `examples/1178` locks it.)
- **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 0139 — by-value self-reference segfault — RESOLVED (`checkInfiniteSize`
Pass 1g emits a loud "infinitely sized" diagnostic + breaks the cycle;
`examples/1178` locks it).
## Log
- **`type_info($T)` reflection done (enum round-trip).** New `BuiltinId.type_info`;