Files
hakorune/src/mir/join_ir/lowering
nyash-codex 84129a7ed4 feat(joinir): Phase 80-B/C/D - Pattern3/4 BindingId wiring + E2E tests (dev-only)
Task 80-B (P1): Pattern3 (if-sum) BindingId registration
- pattern3_with_if_phi.rs: Added BindingId→ValueId registration
- Loop var + condition bindings registration (lines 131-159)
- Debug logs: [phase80/p3] tags
- Follows Pattern2 template structure

Task 80-C (P2): Pattern4 (continue) BindingId registration
- pattern4_with_continue.rs: Pass binding_map to lowerer (lines 341-352)
- loop_with_continue_minimal.rs: Added BindingId→ValueId registration (lines 206-230)
- Loop var + condition bindings registration
- Debug logs: [phase80/p4] tags
- Follows Pattern2 template structure

Task 80-D (P3): E2E tests for BindingId lookup
- tests/normalized_joinir_min.rs: Added 2 new tests (lines 2182-2222)
- test_phase80_p3_bindingid_lookup_works(): Pattern3 verification
- test_phase80_p4_bindingid_lookup_works(): Pattern4 verification
- Manual fallback detection via NYASH_JOINIR_DEBUG=1

Task P4: Cleanup
- Fixed unused variable warnings (loop_var_join_id → _loop_var_join_id)
- Fixed unnecessary mut warning (cargo fix auto-applied)
- pattern2_with_break.rs: Clean up pre-existing unused warning

Result: BindingId operational across Pattern2/3/4
Tests: 970/970 PASS (baseline, E2E tests in normalized_dev feature)
Design: dev-only, dual-path maintained, zero production impact

Phase 74-80 complete: BindingId migration fully operational across all patterns

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-13 18:05:14 +09:00
..

JoinIR Lowering (ExprLowerer / ScopeManager / Envs)

このディレクトリは JoinIR lowering の中でも、条件式や環境まわりの箱ExprLowerer, ScopeManager, ConditionEnv, LoopBodyLocalEnv, UpdateEnv など)を扱う層だよ。コードを触るときは、以下の最小ルールを守ってね。

  • ExprLowerer は ScopeManager 経由のみ で名前解決する。ConditionEnv / LoopBodyLocalEnv / CapturedEnv / CarrierInfo に直接触らない。
  • 条件式から UpdateEnv を参照しない。UpdateEnv はキャリア更新専用で、header/break/continue 条件は ScopeManager→ConditionEnv で完結させる。
  • ConditionEnv は「条件で参照する JoinIR ValueId だけ」を持つ。body-local を直接入れず、必要なら昇格ScopeManager に解決を任せる。
  • Fail-Fast 原則: Unsupported/NotFound は明示エラーにして、by-name ヒューリスティックや静かなフォールバックは禁止。

名前解決の境界SSOT

このディレクトリの ScopeManager は「JoinIR lowering の中で」名前を ValueId に解決するための箱だよ。 同じ “名前” でも、MIR 側の束縛寿命とは問題が違うので混ぜない。

  • MIRSSA/束縛寿命): src/mir/builder/vars/*{...} のレキシカルスコープと local のシャドウイングを管理する。
  • JoinIR loweringこの層: ScopeManagerConditionEnv/LoopBodyLocalEnv/CapturedEnv/CarrierInfo を束ねて解決順序を固定する。
  • 解析箱: LoopConditionScopeBox は「条件が参照して良いスコープか」を判定する箱で、名前解決そのものはしない。

詳しい境界ルールは docs/development/current/main/phase238-exprlowerer-scope-boundaries.md を参照してね。***