journal: ct.3 codegen + mono cleanup

This commit is contained in:
2026-05-11 09:40:26 +02:00
parent 666c78468f
commit 4530548bb3
+73
View File
@@ -14307,3 +14307,76 @@ tests + the existing workspace test surface cover the
invariants; the canonical E2E demonstration of the
iter-23.3-Task-4 bug closure happens in ct.4 with the recreated
`compare_primitives_smoke.ail.json` fixture).
## 2026-05-11 — Iteration ct.3: codegen + mono cleanup
Three tasks landed, plus one orchestrator-level tidy from
quality-review feedback:
- **ct.3.1** (`a8a58cc`, tidy `05d0cce`): deleted the
`lookup_ctor_by_type` imports-walk fallback in
`crates/ailang-codegen/src/lib.rs`. Two-branch direct lookup
remains: qualified via `import_map`
`module_ctor_index[target_module]` (with `cref.type_name ==
suffix` check); bare via `module_ctor_index[self.module_name]`
(with `cref.type_name == type_name` check). Both hard-error on
miss. Symmetric to ct.2.3's `Term::Ctor` synth fix on the
typecheck side. The lookup function's docstring and the
surrounding lockstep-rationale comment were refreshed; the
small `-tidy` followup dropped a dated "ct.3 Task 1:" comment
prefix flagged by the quality reviewer.
- **ct.3.2** (`9149801`): narrowed
`apply_per_module_ctor_index_overlay` to `env.types` only and
renamed it to `apply_per_module_types_overlay`. The
`env.ctor_index` half of the original 22c overlay became
decorative after ct.2.2 stopped consulting the index from
Pattern::Ctor; the `env.types` half is still load-bearing for
Term::Ctor bare-name lookup in mono's re-run synth. Both call
sites updated, the rationale comment rewritten to drop the
obsolete Pattern::Ctor framing, the now-unused `CtorRef` import
dropped, and the dangling rustdoc link in
`build_workspace_env`'s docstring re-pointed to the new
function name.
- **ct.3.3** (`666c784`): retired the obsolete "parity with
`ambiguous-type` diagnostic" paragraph in the
`MigrateCanonicalTypes` doc-comment
(`crates/ail/src/main.rs`). The diagnostic it referenced was
removed in ct.2.3.
All four obsolete mechanisms named in the ct.1 JOURNAL entry are
now gone:
- Pattern::Ctor imports-fallback (ct.2.2).
- Term::Ctor synth imports-fallback (ct.2.3).
- codegen `lookup_ctor_by_type` imports-fallback (ct.3.1).
- mono `apply_per_module_ctor_index_overlay`'s `env.ctor_index`
half (ct.3.2 narrowing).
Only ct.4 remains in the canonical-type-names milestone:
DESIGN.md amendments to Decision 2, hash-pinned regression test
re-baseline for the two migrated cross-module fixtures, prose
round-trip extension covering the qualifier-trim-on-print
behaviour, and the optional
`examples/compare_primitives_smoke.ail.json` recreation that
demonstrates end-to-end closure of the iter-23.3-Task-4 bug
through the full pipeline (parse → typecheck → mono → codegen
→ run).
Out of scope this iter, deliberately:
- Codegen `lookup_ctor_in_pattern` (lib.rs:1790) — uses
imports-walk but has no scrutinee type to type-anchor; would
require plumbing Type through pattern lowering, a structurally
bigger refactor than ct.3's scope.
- The codegen `lower_workspace_inner` implicit-prelude
`import_map` entry (iter 23.2.4 fix `be882c4`) — different
problem (fn-name resolution for mono symbols, not Type::Con
names).
- `check_in_workspace`'s analogous per-module overlay in
`crates/ailang-check/src/lib.rs:1234` — its `env.ctor_index`
half still serves the duplicate-detection diagnostic at
workspace-build time, not the runtime ctor lookup; narrowing
it would be a separate concern with its own correctness
rationale.
Workspace at iter-ct.3 close: full `cargo build --workspace` and
`cargo test --workspace` green (451 tests, 0 failed). Test count
unchanged from ct.2 — this iter is pure code deletion + doc tidy.