diff --git a/src/mir/phi_core/if_phi.rs b/src/mir/phi_core/if_phi.rs index 9a3cd97a..ee5f0226 100644 --- a/src/mir/phi_core/if_phi.rs +++ b/src/mir/phi_core/if_phi.rs @@ -107,27 +107,36 @@ pub fn infer_type_from_phi_with_hint( /// Infer return type by scanning for a Phi that defines `ret_val` and /// verifying that all incoming values have the same type in `types`. /// -/// # Phase 57 責務明示(削除予定だが現時点では保持) +/// # Phase 65-5: P3-C フォールバック専用(Phase 66+ まで保持) /// -/// ## 責務 +/// ## Phase 65 完了後の位置づけ /// -/// 型情報が Unknown のブランチを最低限救う「最後の砦」。 -/// PHI 命令の incoming values から統一された型を推論する。 +/// **P1/P2/P3-A/P3-B は JoinIR 型ヒント経路で型決定完了!** /// -/// ## 使用箇所 +/// - **P1**: If Select パターン(Phase 63-6) +/// - **P2**: If Merge パターン(Phase 64-3) +/// - **P3-A**: StringBox メソッド(Phase 65-2-A) +/// - **P3-B**: Box コンストラクタ(Phase 65-2-B) /// -/// - `infer_type_from_phi_with_hint` からのフォールバック呼び出し(Phase 63-5) -/// - 直接呼び出しは Phase 63-5 で段階的に削減予定 +/// これらのケースでは lifecycle.rs の `is_type_hint_target()` 判定により、 +/// `get_phi_type_hint()` → `infer_type_from_phi_with_hint()` 経由で +/// type_hint を優先使用する。 /// -/// ## 将来の削除条件 +/// ## 現在の責務(P3-C フォールバック専用) /// -/// JoinIR 側に型情報(`Option`)を持たせた後、 -/// この関数は不要になる。現時点では lifecycle.rs が依存しているため保持。 +/// **P3-C(ジェネリック型推論)専用のフォールバック**として保持。 /// -/// ## 削除時の移行先 +/// - ArrayBox.get() の要素型推論 +/// - MapBox.get() の値型推論 +/// - その他のジェネリック型パラメータ推論 /// -/// - JoinIR の型アノテーション(Phase 63-2/63-3 で基盤実装済み) -/// - または MIR Builder の型伝播強化 +/// これらは Phase 66+ で型変数システムを導入するまで、 +/// 従来の PHI 解析フォールバックが必要。 +/// +/// ## Phase 66+ での削除計画 +/// +/// P3-C のジェネリック型推論システムが完成し、全ケースで +/// JoinIR 型ヒント経由の型決定が可能になった時点で削除。 /// pub fn infer_type_from_phi( function: &MirFunction,