plan: loop-recur.2 — typecheck semantics (Component 4)
Second of three iterations of the standalone loop/recur milestone. Replaces the iter-1 synth CheckError::Internal stub with real binder typing + positional recur arity/type checking via a loop_stack frame, a new private verify_loop_body tail-position pass (sibling of the spec-frozen verify_tail_positions), and the four Recur* diagnostics. Three Boss design calls baked into the plan header: (1) RecurTypeMismatch is an Assign-style structural subst-compare not a unify-propagate (so the dedicated code fires point-exactly per spec acceptance); (2) loop_stack element type is Vec<Type> (positional, not name-keyed IndexMap — recur rebinds by position; binder names enter ordinary locals like Term::Let); (3) diagnostic-code precedence is by pass ordering (synth before verify_loop_body), already correct, no explicit logic needed. Every code step literal — synth signature/threading, the two real arms, verify_loop_body full body, four negative .ail.json fixtures, carve-out 13->17 + stale-header fix, pin harness, ct1 F2 sibling — all verified against read source. Codegen stays the iter-1 stub (iter 3). Self-review: reused iter-1's loop_sum_to.ail as the positive-check fixture rather than create a near-duplicate.
This commit is contained in: