feat(joinir): Phase 63-5 infer_type_from_phi degradation implementation (infrastructure)

Phase 63-5: 型ヒント優先のインターフェースを確立し、lifecycle.rs で呼び出し経路を統一

## Changes

### Core Implementation

1. **`infer_type_from_phi_with_hint()` 実装** (if_phi.rs:92-105)
   - Route B: `type_hint` があれば優先的に返す(JoinIR SSOT)
   - Route A: なければ `infer_type_from_phi()` へフォールバック
   - Fail-fast 原則遵守:既存挙動を一切変更しない

2. **lifecycle.rs 呼び出し経路統一** (2箇所)
   - lifecycle.rs:284, 303 で `infer_type_from_phi_with_hint(None, ...)` を呼び出し
   - 現時点では `type_hint=None` でフォールバック動作(既存挙動維持)
   - 将来 Phase 63-6+ で JoinIR からの型ヒント取得を実装

### Test Results

-  IfSelect 全 8 テスト PASS(test_type_hint_propagation_simple 含む)
-  JoinIR 全 57 テスト PASS
-  退行なし確認

### Documentation Updates

- **README.md**: Phase 63-5 完了セクション追加(実装内容・テスト結果・次ステップ)
- **README.md**: 削除条件チェックリスト更新(3/5 達成、60%)
- **PHI_BOX_INVENTORY.md**: if_phi.rs 行に Phase 63-5 完了マーク追加
- **CURRENT_TASK.md**: Phase 63-5 セクション追加

## Technical Achievements

- 型ヒント優先インターフェース確立
- lifecycle.rs 呼び出し経路統一
- Phase 63-6+ での段階的型ヒント供給の準備完了

## Deletion Condition Progress

**削除条件達成率**: 2/5 (40%) → **3/5 (60%)** ← Phase 63-5 完了で +20%

1.  JoinIR に `type_hint` 追加(Phase 63-3)
2.  代表ケースで `type_hint` 埋め込み(Phase 63-2)
3.  型ヒント優先に縮退(Phase 63-5)← NEW!
4.  P1 ケースで `type_hint` のみで型決定(Phase 63-6+)
5.  全関数で型ヒント化完了(Phase 64+)

## Files Changed

- src/mir/phi_core/if_phi.rs: +44行(infer_type_from_phi_with_hint() 追加)
- src/mir/builder/lifecycle.rs: 2箇所で _with_hint 呼び出しへ移行
- docs/private/roadmap2/phases/phase-63-joinir-type-info/README.md
- docs/private/roadmap2/phases/phase-30-final-joinir-world/PHI_BOX_INVENTORY.md
- CURRENT_TASK.md

## Next Steps

**Phase 63-6**: P1 ケース(IfSelectTest.simple/local)への型ヒント供給を実装
- JoinIR → MIR Bridge での型ヒント伝播
- lifecycle.rs で型ヒントを取得するパスの追加

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-29 18:07:38 +09:00
parent 8f736358c4
commit 360ad48d93
3 changed files with 77 additions and 4 deletions

View File

@ -278,7 +278,11 @@ impl super::MirBuilder {
inferred = Some(mt);
break 'outer;
}
if let Some(mt) = crate::mir::phi_core::if_phi::infer_type_from_phi(
// Phase 63-5: JoinIR 型ヒント優先への縮退
// TODO P1: IfSelectTest.simple/local から型ヒントを取得
// 現時点では type_hint=None でフォールバック動作(既存挙動維持)
if let Some(mt) = crate::mir::phi_core::if_phi::infer_type_from_phi_with_hint(
None, // Phase 63-5: P1 ケースの型ヒント取得は Phase 63-5-2 で実装
&function,
*v,
&self.value_types,
@ -293,7 +297,11 @@ impl super::MirBuilder {
inferred = Some(mt);
break;
}
if let Some(mt) = crate::mir::phi_core::if_phi::infer_type_from_phi(
// Phase 63-5: JoinIR 型ヒント優先への縮退
// TODO P1: IfSelectTest.simple/local から型ヒントを取得
// 現時点では type_hint=None でフォールバック動作(既存挙動維持)
if let Some(mt) = crate::mir::phi_core::if_phi::infer_type_from_phi_with_hint(
None, // Phase 63-5: P1 ケースの型ヒント取得は Phase 63-5-2 で実装
&function,
*v,
&self.value_types,