Files
hakorune/src/mir/builder/control_flow/joinir/legacy
nyash-codex d5a36cf818 refactor(joinir): Phase 132-R0 - Continuation SSOT + legacy isolation
**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>
2025-12-18 21:52:21 +09:00
..

Legacy JoinIR Routing

残す理由

  • 既存コードパスとの互換性維持: Pattern 1-4 の段階的移行中は legacy routing が必要
  • 段階的移行のための過渡期対応: Normalized shadow が全ケースをカバーするまでの橋渡し
  • 回帰テスト基盤: 既存の動作を保持しながら新しい routing を並行開発

撤去条件

以下の条件がすべて満たされたときに legacy routing を削除する:

  1. Normalized shadow が全ケースをカバー: Phase 131+ の normalized loop(true) パターンが完全に動作
  2. Pattern 1-4 が完全に安定: 既存のループパターンすべてが新 routing で動作
  3. 回帰テストが完全にカバー: 既存テストがすべて新 routing でパス
  4. 依存箇所がゼロ: routing.rs の fallback path が完全に削除済み

依存箇所

現在 legacy routing を使用している箇所:

  • routing.rs の fallback path: Pattern 1-4 が新 routing で処理できない場合の退避経路
  • テストケース: 一部のテストが legacy routing を前提としている可能性

移行ステップ(将来)

  1. Phase 132+: Pattern 1-4 の新 routing 完成
  2. Phase 135+: 回帰テスト全通過確認
  3. Phase 140+: routing.rs の fallback path 削除
  4. Phase 145+: legacy/ ディレクトリ削除

ファイル構成

  • routing_legacy_binding.rs: Legacy binding system既存コード
  • mod.rs: Module exportこのファイル
  • README.md: このファイル(削除条件・移行計画)