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:
nyash-codex
2025-12-02 19:37:01 +09:00
parent 40dfbc68a8
commit 4ef5eec162
10 changed files with 1667 additions and 33 deletions

View File

@ -2,10 +2,14 @@
## 概要
Phase 83 で Case D が 20件 → **24件**増加(調査時点)。
本レポートでは全 24 件の Case D 失敗を詳細に分析し、不足している型推論パターンを特定する
Phase 83 で Case D が 20 件 → **15 件**減少MethodReturnHintBox 実装)。
その後 Phase 84-1Const 命令型アノテーション追加)で **12 件**、Phase 84-2CopyTypePropagator 導入)で **9 件** まで削減された
**重要な発見**: 主要な原因は **Const命令の型アテーション欠如** である。
本レポート自体は「24 件あった調査時点」の分析ログとして残しつつ、
現在は Const 欠如グループと単純な Copy チェーンは解消され、残りは主に PHI を含む複雑なパターンであることが判明している。
**重要な発見(当時)**: 主要な原因は **Const命令の型アテーション欠如** である。
**補足(現在)**: Const 命令については 40dfbc68 で修正済み、Copy 伝播については CopyTypePropagatorPhase 84-2で整理済み。
---
@ -15,7 +19,7 @@ Phase 83 で Case D が 20件 → **24件** に増加(調査時点)。
NYASH_PHI_FALLBACK_DISABLED=1 cargo test --release --lib 2>&1
```
**テスト結果**: 471 passed; **52 failed** (うち Case D は24件)
**テスト結果(当時)**: 471 passed; **52 failed** (うち Case D は24件)
---