Typeck Inference Completeness: Empty-Container Phase-Contract + Body-Inference Gaps + Dispatch + Fallback
12 sections
Overview
Close the typeck inference completeness gap end-to-end so the test suite reaches failed: 0 via localized compiler fixes, never by mechanical test annotation. The plan began as "empty-container typeck phase-contract enforcement" (BUG-04-074) and expanded when §06.2C investigation (2026-04-23) revealed the remaining 28-file E2005 ledger was not one "polymorphic-constructor class" but seven distinct typeck gaps sharing only the E2005 symptom. Deliver all gap fixes as ONE coherent system:
In Progress
5 sections
Diagnostics + Spec-Test Audit
>
Close-out + Supersession (absorbs BUG-04-085 investigation)
>
Body-Inference Gaps — try-block BD-2, def-impl Self, Result<T,user-Error> LHS,
Close 5 typeck body-inference gaps discovered during §06.2C investigation (2026-04-23)
Dispatch-on-Rigid-Receiver Gaps — file splits, generic-param bound-chain, capability-method dispatch
>
Inference Fallback for Unconstrained Bottom-Instantiable Roots — polymorphic-constructor defaulting
>
Completed
6 sections
AST-based Value Restriction
Extract a two-helper SSOT (`should_generalize` policy decision + `maybe_generalize` apply-the-decision) and migrate all 3 let-generalization sites to call `maybe_generalize`, so only direct non-capturing lambda initializers generalize — all other initializers (empty lists, block-wrapped lambdas, variable aliases, conditionals producing functions, capturing lambdas via any ExprKind child position) become monomorphic. `body_captures_outer` carries `_ => true` conservative default so unknown ExprKind shapes default to capture (soundness direction).
Validator Module — validate_body_types()
>
Bodies-Pass Integration
>
Codegen Defense-in-Depth Assertions
Insert an `assert_no_unresolved_type_vars` call at the single upstream codegen seam (`ori_llvm::function_compiler::process_arc_function` + the lambda counterpart in `declare_and_process_lambda`) so that any `Tag::Var` surviving the typeck → ARC → codegen boundary is caught immediately with a typed error, a clear diagnostic, and integration with the existing `ORI_VERIFY_ARC` plumbing — NOT a collection of 4 fragile consumer-site hooks that bypass the seam. A small number of secondary pre-seam hooks (at the 4 monomorphization entry points) remain ONLY to localize the diagnostic to the pre-realization IR; the load-bearing gate is the seam hook.
Test Matrix + Semantic Pins
>
Codegen Poly-Lambda Monomorphization (absorbs BUG-04-042)
>