feat(mir): Phase 84-2 CopyTypePropagator for Copy chain type propagation
- Add CopyTypePropagator box (ChatGPT Pro design) for fixed-point Copy instruction type propagation - Integrate into lifecycle.rs before return type inference - Case D reduced from 12 to 9 (25% reduction) Implementation: - src/mir/phi_core/copy_type_propagator.rs: New box with fixed-point loop - src/mir/phi_core/mod.rs: Add module export - src/mir/builder/lifecycle.rs: Call propagator before return inference Test results: - Baseline: 494 passed, 33 failed (was 489/34) - Case D: 9 remaining (from 12) - Unit tests: 4/4 passed Remaining 9 Case D breakdown: - GroupA: Loop Edge Copy (7 cases) - PHI incoming needs Copy trace - GroupB: Multi-level PHI (2 cases) - Recursive PHI resolution needed Phase 84-3 will address GroupA with Edge Copy tracing in GenericTypeResolver. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -43,6 +43,8 @@ use crate::mir::join_ir::lowering::type_hint_policy::TypeHintPolicy;
|
||||
use crate::mir::join_ir::lowering::generic_type_resolver::GenericTypeResolver;
|
||||
// Phase 83: P3-D 既知メソッド戻り値型推論箱
|
||||
use crate::mir::join_ir::lowering::method_return_hint::MethodReturnHintBox;
|
||||
// Phase 84-2: Copy命令型伝播箱(ChatGPT Pro設計)
|
||||
use crate::mir::phi_core::copy_type_propagator::CopyTypePropagator;
|
||||
|
||||
// Phase 82: dev ガード用ヘルパー - Case 分類ロジック統一化
|
||||
//
|
||||
@ -303,6 +305,12 @@ impl super::MirBuilder {
|
||||
let mut module = self.current_module.take().unwrap();
|
||||
let mut function = self.current_function.take().unwrap();
|
||||
function.metadata.value_types = self.value_types.clone();
|
||||
// Phase 84-2: Copy命令型伝播(return型推論の前に実行)
|
||||
//
|
||||
// Loop exit や If merge の edge copy で発生する型欠如を解消する。
|
||||
// Copy チェーン: v1 → v2 → v3 で v1 の型が既知なら v2, v3 にも伝播。
|
||||
CopyTypePropagator::propagate(&function, &mut self.value_types);
|
||||
|
||||
// Phase 82-5: lifecycle.rs バグ修正 - terminator の Return のみをチェック
|
||||
// 問題: instructions を先に走査すると、中間値(const void 等)を誤って推論対象にしてしまう
|
||||
// 解決: terminator の Return のみをチェックし、実際の戻り値を正しく推論する
|
||||
|
||||
Reference in New Issue
Block a user