Files
AILang/docs/journals/2026-05-11-iter-23.4-prep.md
T

2.9 KiB

iter 23.4-prep — checker prerequisites for prelude free fns

Date: 2026-05-11 Branch: iter/23.4-prep Status: DONE Tasks completed: 2 of 2

Summary

Closes two localised checker gaps that BLOCKED iter 23.4 mid-flight:

  • Gap 2 (Task 1): linearity::check_module's globals-construction loop now iterates Def::Class methods and registers each method type in the globals map. Previously, a borrow-mode fn that forwarded its borrow-mode params into a class-method call fired consume-while-borrowed false positives, because callee_arg_modes defaulted to Consume when it could not find the method's param_modes. Def::Instance stays a no-op: instance method bodies are walked separately via Def::Fn after monomorphisation, per the comment in the new arm.

  • Gap 1 (Task 2): the Term::Var { name } lookup ladder in synth grows one new branch between the class-method arm and the dot-qualified arm. It iterates env.imports.values() to find a free-fn match in any implicitly-imported module's flat-globals table; on hit, it qualifies any owner-module-local Type::Cons via the existing qualify_local_types helper (mirror of the dot-qualified arm). Today the prelude is the only implicit import, so single-match-wins is unambiguous; the code comment names the future revisit point for multi-implicit-import ambiguity.

Both fixes are intra-crate and additive — no schema change, no new diagnostic, no new workspace plumbing. iter 23.4's five prelude free fns (ne/lt/le/gt/ge) can now ship against the existing plan unchanged.

Per-task subjects

  • iter 23.4-prep.1: linearity — register Def::Class method types in globals
  • iter 23.4-prep.2: check — bare-name fall-through to implicit-imported free fns

Concerns

  • No E2E fixture added under examples/. The plan's own "Plan self-review" identifies the two RED-first tests (one in linearity.rs, one in lib.rs's check_workspace-level test module) as the iter-23.4-prep-shaped coverage. The natural E2E surface (a fixture calling bare ne 1 2 against the prelude) cannot land until iter 23.4 ships the prelude free fns themselves — both examples/prelude.ail.json and the consumer fixture are out of scope for this iter. iter 23.4's E2E coverage is the right place; flagging here so the next iter does not inherit "no E2E for the prep iter" as unrecorded debt.

Known debt

  • The Task 2 branch's mod_name first-match-wins rule remains ambiguous-by-design as long as prelude is the singleton implicit import. If a second implicit import lands in a future milestone, this branch needs a duplicate-detection diagnostic ("name X resolves through implicit imports A and B, qualify the call"). The code comment names the revisit point.

Blocked detail

N/A — DONE.

Commits

c10acf0a..aef4ab84

Stats

bench/orchestrator-stats/2026-05-11-iter-23.4-prep.json