From 47715d36152f17b354fee18ccdcae3484764ee01 Mon Sep 17 00:00:00 2001 From: nyash-codex Date: Sun, 30 Nov 2025 06:21:07 +0900 Subject: [PATCH] =?UTF-8?q?feat(joinir):=20Phase=2065-3=20lifecycle.rs=20P?= =?UTF-8?q?3-A/P3-B=E7=B5=B1=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 65-3 完了:lifecycle.rs で P1/P2/P3-A/P3-B 統一処理 ## 実装内容 ### 1. is_type_hint_target() 拡張 - **P3-A 追加**: `read_quoted*` で StringBox メソッド対応(P2 と重複) - substring/length 型ヒントが P2 経路で既にカバー済み - **P3-B 追加**: `NewBoxTest.*` で NewBox コンストラクタ対応 - ArrayBox/StringBox/MapBox 等の型ヒント対応 ### 2. P1/P2/P3-A/P3-B 統一経路確認 - すべて同じ経路で `get_phi_type_hint()` → `infer_type_from_phi_with_hint()` 通過 - 段階的拡大のため関数名フィルタで制御(箱理論) ## テスト状況 - ✅ ビルド: 0 エラー - ⏳ P3-B A/B テスト: Phase 65-4 で追加予定 ## 次のステップ - Phase 65-4: 削除条件 5/5 達成確認(P3-B テスト追加) --- 🌟 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- CURRENT_TASK.md | 2 +- src/mir/builder/lifecycle.rs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index b854e55f..00cb91b7 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -279,7 +279,7 @@ - **P1/P2 両方で JoinIR 型ヒント → lifecycle.rs → 型推論の経路確立** - `is_type_hint_target()` で関数名フィルタを箱化 - 箱理論「まず箱に切り出す」原則の実践 -- 次のステップ: Phase 65 で P3 ケース実装、削除条件 5/5 達成へ +- 次のステップ: Phase 65 で P3-A/B ケース実装(Method/Box 戻り値)、P3-C は Phase 66+ に分離 --- diff --git a/src/mir/builder/lifecycle.rs b/src/mir/builder/lifecycle.rs index 45f63396..ba8cb8c0 100644 --- a/src/mir/builder/lifecycle.rs +++ b/src/mir/builder/lifecycle.rs @@ -61,7 +61,7 @@ fn get_phi_type_hint( None } -/// Phase 64-3: P1/P2 型ヒント対象判定 +/// Phase 65-3: P1/P2/P3-A/P3-B 型ヒント対象判定 /// /// 関数名が型ヒント使用対象かどうかを判定する。 /// 箱理論: 段階的拡大のため、関数名フィルタで制御 @@ -72,6 +72,12 @@ fn get_phi_type_hint( /// # P2 対象(Phase 64-3 追加) /// - `IfMergeTest.*` - If Merge パターンのテスト関数 /// - `read_quoted*` - selfhost の read_quoted 系関数 +/// +/// # P3-A 対象(Phase 65-3 追加) +/// - `read_quoted*` - StringBox メソッド (substring/length) 使用(P2 と重複) +/// +/// # P3-B 対象(Phase 65-3 追加) +/// - `NewBoxTest.*` - NewBox コンストラクタテスト関数 fn is_type_hint_target(func_name: &str) -> bool { // P1: If Select テスト関数 if func_name.starts_with("IfSelectTest.") { @@ -81,10 +87,14 @@ fn is_type_hint_target(func_name: &str) -> bool { if func_name.starts_with("IfMergeTest.") { return true; } - // P2: selfhost read_quoted 系関数 + // P2/P3-A: selfhost read_quoted 系関数(StringBox メソッドも含む) if func_name.contains("read_quoted") { return true; } + // P3-B: NewBox コンストラクタテスト関数 + if func_name.starts_with("NewBoxTest.") { + return true; + } false }