From d0a2967f1893cf445ed7c715266534e5a9dc3e50 Mon Sep 17 00:00:00 2001 From: agra Date: Tue, 16 Jun 2026 22:25:11 +0300 Subject: [PATCH] docs(metatype): issue 0139 resolved; by-value self-ref rejection done --- current/CHECKPOINT-METATYPE.md | 22 +++++++++++----------- current/PLAN-METATYPE.md | 9 +++++---- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/current/CHECKPOINT-METATYPE.md b/current/CHECKPOINT-METATYPE.md index 9e58f319..5743c72f 100644 --- a/current/CHECKPOINT-METATYPE.md +++ b/current/CHECKPOINT-METATYPE.md @@ -55,21 +55,21 @@ Pick any (independent): `define`'s decode); widen `TypeInfo` past `` `enum `` + construct a `[]EnumVariant` value in the interp. Bails loudly today in `call.zig:tryLowerReflectionCall`. Its own focused effort. -- **Validation + loud diagnostics** — duplicate variant names, by-VALUE - self-reference (`payload = List` not `*List` → infinite size), a `declare()` - never `define()`d (hard error), use-before-define. +- **Validation + loud diagnostics** (remaining) — duplicate variant names, a + `declare()` never `define()`d (hard error), use-before-define. (By-value + self-reference already rejected — issue 0139.) ## Known issues -- **issue 0139 — by-value self-reference segfaults** (`typeSizeBytes` infinite - recursion). A by-VALUE self-referential type (`payload = List` instead of - `*List`) stack-overflows instead of emitting a loud "infinite size" diagnostic. - PRE-EXISTING (a hand-written source enum `enum { node: Bad; leaf }` crashes - identically) — a general type-system gap, not specific to declare/define. Closes - the F5 "by-VALUE self-reference rejected" item for the comptime path once fixed. - Filed `issues/0139-byvalue-self-reference-segfault.md`; session stopped here per - the CLAUDE.md IMPASSABLE rule (do not work around / roll forward after filing). +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.) ## Log +- **By-value self-reference rejected (issue 0139, F5 partial).** New + `checkInfiniteSize` pass (Pass 1g) detects by-VALUE containment cycles (source + + comptime types, direct + mutual), emits a loud "infinitely sized" diagnostic, + and breaks the cycle (was a `typeSizeBytes` stack-overflow segfault). `*Self` + (pointer) stays valid. `examples/1178` locks the message. Suite green (675). - **Self-reference done.** `declare(name)` + `preregisterForwardTypes` (forward type + alias before body lowers) → `*Name` resolves; recursive `*List` enum constructs, matches through the pointer, and traverses recursively. `0618` locks diff --git a/current/PLAN-METATYPE.md b/current/PLAN-METATYPE.md index d0b348f1..17cf62a6 100644 --- a/current/PLAN-METATYPE.md +++ b/current/PLAN-METATYPE.md @@ -113,10 +113,11 @@ while red. Examples: `06xx` (comptime), `11xx` (diagnostics). `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. -- [ ] **Validation + loud diagnostics** — duplicate variant names, by-VALUE - self-reference (`payload = List` not `*List` → infinite size), a `declare()` - never `define()`d (hard error), use-before-define. Emit at the - `intern`/`internNominal` choke point; never a broken type. +- [~] **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. ## Risks / watch