refactor(edgecfg): add Frag/ExitKind API entrypoint (Phase 264 design-first)
Phase 264 P0: EdgeCFG Fragment 入口API作成(実装置換なし) - 入口フォルダ作成: src/mir/builder/control_flow/edgecfg/api/ - コア型定義: ExitKind, EdgeStub, Frag - 合成関数シグネチャ: seq, if_, loop_, cleanup(中身TODO、pub(crate)) - 最小テスト: 3個のユニットテスト追加(frag.rs) - ドキュメント連動: edgecfg-fragments.md に実装入口追記 制約遵守: - 既存 pattern6/7/8 未改変 - merge/EdgeCFG 未改変 - 既存LoopId使用(control_form.rs に PartialOrd, Ord 追加) - MIR側EdgeArgs使用(JoinIRと混線回避) - BTreeMap採用(決定的順序保証、Phase 69-3 教訓) 次フェーズ: Phase 265 で Pattern8 適用時に compose::loop_ を実装 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -1,24 +1,46 @@
|
||||
# Self Current Task — Now (main)
|
||||
|
||||
## 2025-12-21:Phase 263 P0(Pattern2 LoopBodyLocal fallback 修正)✅
|
||||
## 2025-12-21:Phase 263 P0.2(Pattern2 promotion API SSOT)✅
|
||||
|
||||
- **Goal**: Pattern2 で処理できない LoopBodyLocal を検出したら Pattern2 全体を早期終了(部分的な処理続行は禁止)
|
||||
- **修正内容**:
|
||||
- `promote_step_box.rs`: 戻り値を `Result<Option<_>, String>` に変更、Reject を二分化(対象外 → Ok(None)、対象だが未対応 → Err)
|
||||
- `pattern2_lowering_orchestrator.rs`: Ok(None) 検出で早期 return
|
||||
- Fail-Fast 原則: 対象外は Ok(None) で後続経路へ、対象だが未対応は Err で即座に失敗
|
||||
- **Goal**: Pattern2 の “Reject/continue/fallback の揺れ” を **型 + 入口SSOT**で封じ、部分続行(後段で落ちる)を構造で不可能にする
|
||||
- **実装**:
|
||||
- `PromoteDecision::{Promoted, NotApplicable, Freeze}`(Option 多重を撤去)
|
||||
- `pattern2/api/` を入口SSOTとして新設し、`try_promote(...)` を **単一参照点**に固定
|
||||
- **効果**:
|
||||
- `NotApplicable` は **必ず** `Ok(None)` で Pattern2 全体を抜ける(後続経路へ)
|
||||
- `Freeze` は **必ず** Fail-Fast(close-but-unsupported のみ即死)
|
||||
- **検証結果**:
|
||||
- cargo test --lib: **1368/1368 PASS** ✅ (1367→1368 に改善)
|
||||
- quick smoke: **45/46 PASS** ✅ (大幅改善!)
|
||||
- エラーメッセージ変化: `[cf_loop/pattern2] Variable not found: seg` → `[joinir/freeze] Loop lowering failed` (Pattern2 が正しく abort)
|
||||
- **Commit**: `93022e7e1` - fix(pattern2): abort entire Pattern2 on unpromoted LoopBodyLocal instead of partial execution
|
||||
- cargo test --lib: **1368/1368 PASS** ✅
|
||||
- quick smoke: **45/46 PASS** ✅(既知 1 件は別論点)
|
||||
- **Commits**:
|
||||
- `abdb860e7`(P0.1): PromoteDecision 導入(Option 揺れの撤去)
|
||||
- `e17902a44`(P0.2): `pattern2/api/` で入口SSOT物理固定
|
||||
- **詳細**: `docs/development/current/main/phases/phase-263/README.md`
|
||||
|
||||
## 2025-12-21:Phase 264 P0(EdgeCFG Fragment 入口作成)✅
|
||||
|
||||
**目的**: Frag/ExitKind を一次概念にする入口APIを用意(実装置換は次フェーズ)
|
||||
|
||||
**完了内容**:
|
||||
- 入口フォルダ作成: `src/mir/builder/control_flow/edgecfg/api/`
|
||||
- コア型定義: `ExitKind`, `EdgeStub`, `Frag`
|
||||
- 合成関数シグネチャ: `seq`, `if_`, `loop_`, `cleanup`(中身TODO)
|
||||
- 最小テスト: 3個のユニットテスト追加
|
||||
- ドキュメント連動: `edgecfg-fragments.md` に入口情報追記
|
||||
|
||||
**重要**: 既存実装(pattern6/7/8, merge/EdgeCFG)は未改変。
|
||||
入口だけ固定し、適用は quick 復旧後の次フェーズで実施。
|
||||
|
||||
**次のステップ**:
|
||||
- Phase 265: Pattern8 を Frag 合成に移行(最小適用)
|
||||
- Phase 266: Pattern6/7 への展開(再利用確認)
|
||||
|
||||
**詳細**: `docs/development/current/main/phases/phase-264/README.md` + `docs/development/current/main/design/edgecfg-fragments.md`
|
||||
|
||||
## Next (planned)
|
||||
|
||||
- Phase 259: `StringUtils.is_integer/1`(nested-if + loop)を JoinIR で受理して `--profile quick` を進める
|
||||
- Phase 260: block-parameterized CFG へ向けた "edge-args terminator 併存導入"(大工事 / Strangler)
|
||||
- Phase 259.x: Me receiver SSOT(`variable_map["me"]`)を API 化して `"this"`/`"me"` 混同を構造で潰す
|
||||
- Phase 265(planned): Pattern8 を Frag 合成に移行し、ExitKind+Frag の実装適用を開始(`compose::loop_` 実装)
|
||||
- Phase 266(planned): catch/cleanup / cleanup/defer / async を "exit-edge 正規化" で追加できる形へ(設計: `docs/development/current/main/design/exception-cleanup-async.md`)
|
||||
- Phase 141 P2+: Call/MethodCall 対応(effects + typing を分離して段階投入、ANF を前提に順序固定)
|
||||
- Phase 143-loopvocab P3+: 条件スコープ拡張(impure conditions 対応)
|
||||
- 詳細: `docs/development/current/main/30-Backlog.md`
|
||||
|
||||
Reference in New Issue
Block a user