docs(metatype): issue 0139 resolved; by-value self-ref rejection done

This commit is contained in:
agra
2026-06-16 22:25:11 +03:00
parent 2f0905b407
commit d0a2967f18
2 changed files with 16 additions and 15 deletions

View File

@@ -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

View File

@@ -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