**Task 1: Continuation SSOT 一本化** ✅ - Add JoinInlineBoundary::default_continuations() - Replace all BTreeSet::from([JoinFuncId::new(2)]) hardcoding (7 locations) - Single source of truth for continuation function IDs **Task 2: merge 契約 docs SSOT 化** ✅ - New: src/mir/builder/control_flow/joinir/merge/README.md - Document continuation contracts, skip conditions, forbidden behaviors - Prohibit by-name/by-id classification **Task 3: テスト配置正規化** ✅ - New: src/mir/builder/control_flow/joinir/merge/tests/continuation_contract.rs - Move tests from instruction_rewriter.rs to dedicated test file - Add 4 test cases (Case A-D) **Task 4: legacy 導線隔離** ✅ - New: src/mir/builder/control_flow/joinir/legacy/ - Move routing_legacy_binding.rs → legacy/routing_legacy_binding.rs - Add legacy/README.md with removal conditions - No cfg(feature="legacy") (docs-only isolation for now) **Task 5: ノイズ除去** ✅ - Remove unused imports (ConstValue, MirInstruction) - Clean warnings in touched files Changes: - src/mir/join_ir/lowering/inline_boundary.rs: +default_continuations() - src/mir/builder/control_flow/joinir/merge/README.md: +140 lines - src/mir/builder/control_flow/joinir/merge/tests/: +180 lines - src/mir/builder/control_flow/joinir/legacy/: +3 files Test results: - cargo test --lib: 1176 PASS - All Phase 131/132/97 smokes: PASS Benefits: - Continuation definition centralized (SSOT) - Merge contracts documented and tested - Legacy code path clearly isolated - Code quality improved (warnings reduced) Related: Phase 132 infrastructure improvements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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 側の束縛寿命とは問題が違うので混ぜない。
- MIR(SSA/束縛寿命):
src/mir/builder/vars/*が{...}のレキシカルスコープとlocalのシャドウイングを管理する。 - JoinIR lowering(この層):
ScopeManagerがConditionEnv/LoopBodyLocalEnv/CapturedEnv/CarrierInfoを束ねて解決順序を固定する。 - 解析箱:
LoopConditionScopeBoxは「条件が参照して良いスコープか」を判定する箱で、名前解決そのものはしない。
詳しい境界ルールは docs/development/current/main/phase238-exprlowerer-scope-boundaries.md を参照してね。***