feat(joinir): Phase 66-68 GenericTypeResolver + JoinIR First Chapter Wrap
Phase 66: P3-C ジェネリック型推論箱化 - generic_type_resolver.rs 新設 (180行) - is_generic_method(): ArrayBox.get/pop/first/last, MapBox.get 判定 - resolve_from_phi(): PHI解析によるジェネリック型推論 - TypeHintPolicy::is_p3c_target() 追加 - P1/P2/P3-A/P3-B 以外を P3-C 候補として判定 Phase 67: P3-C 実利用への一歩 - phase67_generic_type_resolver.rs テスト追加 (3テスト) - lifecycle.rs に P3-C 経路フック追加 - GenericTypeResolver を P3-C 対象関数で優先使用 - A/B テストで旧経路との一致確認 (11 tests PASS) Phase 68: JoinIR First Chapter Wrap (ドキュメント整理) - 68-1: phase-30 README.md に Section 9 追加 (JoinIR 第1章完了サマリー) - 68-2: README.md に JoinIR status セクション追加 - 68-3: CURRENT_TASK.md スリム化 (351→132行, 62%削減) - 68-4: PHI_BOX_INVENTORY.md に Phase 66-67 完了セクション追加 Phase 69-1: Trio 棚卸し - phase69-1-trio-inventory.md 作成 - Trio 使用箇所の完全棚卸し完了 (削減見込み 457-707行) 🐱 JoinIR 第1章完了!4つの柱確立: - Structure (LoopForm) - Scope (LoopScopeShape) - JoinIR (Select/IfMerge/Loop) - Type Hints (P1-P3-C) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -38,6 +38,8 @@ fn has_main_static(ast: &ASTNode) -> bool {
|
||||
// - ✅ テスト可能:各 Phase 独立テスト
|
||||
// - ✅ 拡張容易:Phase 66+ で P3-C 追加が簡単
|
||||
use crate::mir::join_ir::lowering::type_hint_policy::TypeHintPolicy;
|
||||
// Phase 67: P3-C ジェネリック型推論箱
|
||||
use crate::mir::join_ir::lowering::generic_type_resolver::GenericTypeResolver;
|
||||
|
||||
impl super::MirBuilder {
|
||||
/// Unified declaration indexing (Phase A): collect symbols before lowering
|
||||
@ -290,17 +292,37 @@ impl super::MirBuilder {
|
||||
break 'outer;
|
||||
}
|
||||
// Phase 65.5: TypeHintPolicy 使用(箱化モジュール)
|
||||
// Phase 67: P3-C 経路を GenericTypeResolver に委譲
|
||||
let hint = if TypeHintPolicy::is_target(&function.signature.name) {
|
||||
TypeHintPolicy::extract_phi_type_hint(&function, *v)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if let Some(mt) = crate::mir::phi_core::if_phi::infer_type_from_phi_with_hint(
|
||||
hint, // Phase 63-6-3: P1 の場合は PHI の type_hint、それ以外は None
|
||||
&function,
|
||||
*v,
|
||||
&self.value_types,
|
||||
) {
|
||||
// Phase 67: P3-C 対象なら GenericTypeResolver を優先使用
|
||||
if hint.is_none() && TypeHintPolicy::is_p3c_target(&function.signature.name) {
|
||||
if let Some(mt) = GenericTypeResolver::resolve_from_phi(
|
||||
&function,
|
||||
*v,
|
||||
&self.value_types,
|
||||
) {
|
||||
if std::env::var("NYASH_P3C_DEBUG").is_ok() {
|
||||
eprintln!(
|
||||
"[lifecycle/p3c] {} type inferred via GenericTypeResolver: {:?}",
|
||||
function.signature.name, mt
|
||||
);
|
||||
}
|
||||
inferred = Some(mt);
|
||||
break 'outer;
|
||||
}
|
||||
}
|
||||
if let Some(mt) =
|
||||
crate::mir::phi_core::if_phi::infer_type_from_phi_with_hint(
|
||||
hint, // Phase 63-6-3: P1 の場合は PHI の type_hint、それ以外は None
|
||||
&function,
|
||||
*v,
|
||||
&self.value_types,
|
||||
)
|
||||
{
|
||||
inferred = Some(mt);
|
||||
break 'outer;
|
||||
}
|
||||
@ -312,11 +334,29 @@ impl super::MirBuilder {
|
||||
break;
|
||||
}
|
||||
// Phase 65.5: TypeHintPolicy 使用(箱化モジュール)
|
||||
// Phase 67: P3-C 経路を GenericTypeResolver に委譲
|
||||
let hint = if TypeHintPolicy::is_target(&function.signature.name) {
|
||||
TypeHintPolicy::extract_phi_type_hint(&function, *v)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
// Phase 67: P3-C 対象なら GenericTypeResolver を優先使用
|
||||
if hint.is_none() && TypeHintPolicy::is_p3c_target(&function.signature.name) {
|
||||
if let Some(mt) = GenericTypeResolver::resolve_from_phi(
|
||||
&function,
|
||||
*v,
|
||||
&self.value_types,
|
||||
) {
|
||||
if std::env::var("NYASH_P3C_DEBUG").is_ok() {
|
||||
eprintln!(
|
||||
"[lifecycle/p3c] {} type inferred via GenericTypeResolver: {:?}",
|
||||
function.signature.name, mt
|
||||
);
|
||||
}
|
||||
inferred = Some(mt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if let Some(mt) = crate::mir::phi_core::if_phi::infer_type_from_phi_with_hint(
|
||||
hint, // Phase 63-6-3: P1 の場合は PHI の type_hint、それ以外は None
|
||||
&function,
|
||||
|
||||
Reference in New Issue
Block a user