iter 22c: journal entry — milestone-22 acceptance fixture + mono pass user-ADT fix

This commit is contained in:
2026-05-09 22:45:02 +02:00
parent 5c5180fc48
commit ea30b6815d
+47
View File
@@ -11708,3 +11708,50 @@ both in the same iter.
a where show : (a borrow) -> Str`, `instance Show Int`, the
`int_to_str` C-runtime primitive, codegen wiring, and an end-to-end
`show 42` fixture printing `42` through the mono pass.
## 2026-05-09 — Iteration 22c: Milestone-22 acceptance fixture (and a mono-pass bug)
The 22c user-class e2e fixture lands `examples/test_22c_user_class_e2e.ail.json`:
a user `class Foo a where foo : (a borrow) -> Int`, a user ADT
`IntBox = MkIntBox Int`, an `instance Foo IntBox` whose body matches
on the ctor and returns the wrapped int, and `main = do io/print_int
(foo (MkIntBox 42))`. Stdout `42`.
**The fixture surfaced a real bug** in the 22b.3 monomorphisation
pass: `build_workspace_env` (`crates/ailang-check/src/mono.rs:367+`)
populated `env.module_types` but not `env.types` or `env.ctor_index`,
so `synth`-replay on an instance method body that referenced a
user-defined ADT failed with `unknown type: IntBox`. Every prior
22b.3 fixture used primitive instance types (Int / Bool), so the
gap was invisible until 22c. Fixed RED-first per CLAUDE.md.
**Per-task subjects (mirror commit messages):**
- `test: red for monomorphise_workspace unknown type on user ADT`
(`59e86b3`) — fixture + e2e test, FAILED for the right reason
(`unknown type: IntBox`).
- `fix: mono pass seeds env.types and env.ctor_index for user ADTs`
(`5c5180f`) — minimal fix in `build_workspace_env`, mirrors
`check_in_workspace` (`lib.rs:1099-1128`) for the same two tables.
RED test now green; full workspace tests green; bench gates 0/0/0.
**Why this is a meaningful close, not a "just-fixture iter":**
when the 22c plan was written it explicitly anticipated this
candidate ("Most likely candidates: mono pass on instance where
the type is a user ADT"). The fact that the gap surfaced exactly
where the plan flagged it is evidence the milestone scope was
understood; the fix is local (24 LOC, one function) and the
related sites in `lib.rs` are reachable only through paths that
already populate the env correctly. No collateral is implied.
**Milestone-22 acceptance check (final):**
1. ✓ 22b.1 + 22b.2 + 22b.3 + 22b.4a + 22c JOURNAL entries committed.
2. (pending) Audit suite — `audit` skill runs next.
3. ✓ 22c user-class fixture compiles, runs, prints `42`.
4. ✓ Round-trip filter retired in 22b.4a; all `examples/*.ail.json`
pass round-trip.
**Bench gates:** all three exited 0/0/0.
**Next step:** dispatch `audit` skill to close milestone 22.