From ea30b6815dcd7759aa2408943bf0b63283807c7e Mon Sep 17 00:00:00 2001 From: Brummel Date: Sat, 9 May 2026 22:45:02 +0200 Subject: [PATCH] =?UTF-8?q?iter=2022c:=20journal=20entry=20=E2=80=94=20mil?= =?UTF-8?q?estone-22=20acceptance=20fixture=20+=20mono=20pass=20user-ADT?= =?UTF-8?q?=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/JOURNAL.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/docs/JOURNAL.md b/docs/JOURNAL.md index 2da1ad2..964048b 100644 --- a/docs/JOURNAL.md +++ b/docs/JOURNAL.md @@ -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.