iter mq.3: retire MethodNameCollision + multi-class E2E + DESIGN.md sync

Closes the module-qualified-class-names milestone. Deletes the
workspace-load workaround; the two-libraries case now resolves via
type-driven dispatch at the call site with explicit qualifier as the
LLM-author's disambiguation tool. Resolves both mq.2 known-debt items
(active_declared_constraints plumbing, (class,method) re-key). New
synth warnings channel emits class-method-shadowed-by-fn at all three
fn-precedence branches per spec section Class-fn collisions. Three new
E2E fixtures + integration tests cover the ambiguous, qualified, and
class-fn-shadow trajectories. DESIGN.md class-names paragraph rewritten,
new section Method dispatch added. Roadmap P2 marked done, milestone-24
unblocked for re-brainstorm.

9/9 tasks. 545 tests green. bench/compile_check.py + cross_lang.py
exit 0; bench/check.py exit 1 (2 noise-class regressions, runtime
uncoupled to typecheck iter).
This commit is contained in:
2026-05-13 02:19:21 +02:00
parent 90075715d9
commit 99d3968656
23 changed files with 1399 additions and 399 deletions
+19 -20
View File
@@ -80,9 +80,10 @@ context. Pick the next milestone from P1.)_
- context: brainstorm 2026-05-12 (iter 23.5 wrap); deferral
2026-05-13 (user-direction Option C after plan-recon flagged the
collision; iter 24.1 retained as standalone runtime infrastructure).
- depends on: P2 milestone "Module-qualified class names +
type-driven method dispatch" (retires the `MethodNameCollision`
workaround that drives the collision).
- ready for re-brainstorm — the `MethodNameCollision` workaround
that blocked the original spec retired in mq.3 (2026-05-13).
Fresh brainstorm re-derives the spec against the post-retirement
architecture (type-driven dispatch, class-ref canonical form).
## P2 — Medium-term
@@ -123,24 +124,22 @@ context. Pick the next milestone from P1.)_
classes beyond the prelude four; multi-parameter classes; superclass
chains; richer instance bodies. Deferred from milestone 22.
- context: JOURNAL 2026-05-09
- [ ] **\[milestone\]** Module-qualified class names + type-driven
method dispatch — retire the `MethodNameCollision` workaround
(`crates/ailang-core/src/workspace.rs:472`) that today keeps bare
class names viable by enforcing workspace-global method-name
uniqueness. Replaces name-driven method resolution
(`ModuleGlobals::class_methods: IndexMap<String, ClassMethodEntry>`,
`crates/ailang-check/src/lib.rs:983`; consumed by
`mono::rewrite_class_method_calls`, `crates/ailang-check/src/mono.rs:657`)
with type-driven dispatch — look up `eq` candidates by argument
type, pick the unique class instance, fail closed on ambiguity.
Once shipped, two libraries can each declare `class Eq` with their
own `eq`. Carries its own DESIGN spec: inference rules, ambiguity
diagnostics, and the canonical-form extension for class-reference
fields (`InstanceDef.class`, `SuperclassRef.class`, `Constraint.class`)
that the canonical-type-names milestone explicitly out-of-scoped.
- [x] **\[milestone\]** Module-qualified class names + type-driven
method dispatch — retired the `MethodNameCollision` workaround;
shipped 2026-05-13 as iters mq.1 (canonical-form extension for
class-ref fields + workspace-internal qualification), mq.2 (type-
driven dispatch mechanism installed: `method_to_candidate_classes`
inverse index, multi-candidate `ResidualConstraint`,
`resolve_method_dispatch` 5-step rule, `AmbiguousMethodResolution` +
`UnknownClass` diagnostics), and mq.3 (retirement + multi-class E2E
+ `class-method-shadowed-by-fn` warning + DESIGN.md sync). Two
libraries can now each declare `class Eq` with their own `eq`;
cross-class method ambiguity is resolved at the call site via
type-driven dispatch with `<module>.<Class>.<method>` as the
disambiguation form.
- context: `docs/specs/2026-05-10-canonical-type-names.md` "Out of
scope: Class names" — the workaround is named there so it stays
visible until this milestone retires it.
scope: Class names" — the workaround was named there so it
stayed visible until this milestone retired it.
- [ ] **\[todo\]** Boehm full retirement — remove the transitional
Boehm GC path now that RC + uniqueness is the canonical memory
story.