420703d321
A monomorphic `(new Counter 42)` over a user-defined ADT that declares a `new` fn passed `ail check` but crashed `ail build --alloc=rc` with `unknown variable: Counter.new` (RED-pinned in1eff055). Root: the `Term::New` desugar lowers a no-type-arg monomorphic `(new Counter 42)` to `(app Counter.new 42)` — a type-scoped `Var` callee `Counter.new`. The checker resolves that dotted callee via its TypeDef-first ladder (so check is clean), but codegen had no equivalent resolution: the name was absent from the import map and the current module's def list, so it fell through to `CodegenError::UnknownVar`. The user `new` fn body IS codegen'd — only the dotted call-site failed to resolve. The error surfaced first in the arg-type pre-pass (`synth_with_extras`'s dotted-Var branch), which `lower_term`'s `Term::Let` arm runs before lowering the call. Fix (crates/ailang-codegen/src/lib.rs, all `// #53`): - New `Emitter::type_home_module(type_name)`: returns the module declaring the named TypeDef (current module first, then any import target) by scanning `module_ctor_index` for a matching `CtorRef.type_name`. This mirrors the checker's TypeDef-first ladder. - A dotted `T.def` fallback (resolve via the type's home module) added to the three sites that needed it: `resolve_top_level_fn` (the fn-pointer / lower_app resolution path), `is_static_callee` (its lockstep partner), and the `synth_with_extras` dotted-Var branch (the path that actually fired for this fixture). Lockstep (CLAUDE.md `lower_app` ↔ `is_static_callee`): `is_static_callee` now returns true for a dotted `T.def` whose `T` is a user ADT declared in this or an imported module, exactly matching `resolve_top_level_fn`'s new fallback — so no name is claimed static without being lowerable. Distinct root from #51 (the polymorphic `(new T <elem> …)` type-arg drop,ee4107c) — that fix deliberately left the monomorphic app-lowering path unchanged; this completes it. Verification: the #53 pin (crates/ail/tests/user_adt_new_mono_pin.rs) is green; the original 3-module reproducer examples/fieldtest/kem_2_counter_new.ail builds, runs, prints 42; ailang-codegen/check/core suites, the intercepts bijection, and both hash-pins are green; full workspace green. closes #53