fix(mir): Phase 25.1m - Continue PHI修正 & Bug A main(args)ループ修正

**Phase 25.1m: Continue PHI修正**
- seal_phis に continue_snapshots 入力を追加 (loopform_builder.rs)
- LoopShape::debug_validate に continue/break エッジ検証追加 (control_form.rs)
- test_seal_phis_includes_continue_snapshots テスト追加
- 実証テスト成功: balanced scan loop で 228回イテレーション確認

**Bug A修正: main(args) でループ未実行問題**
- LoopBuilder::build_loop で entry → preheader への jump 追加
- decls.rs でデュアル関数作成時のブロック接続修正
- mir_static_main_args_loop.rs テスト追加

**パーサー改善**:
- parser_box.hako に HAKO_PARSER_PROG_MAX ガード追加(無限ループ対策)

🎉 成果:
- Continue 文の PHI predecessor mismatch エラー完全解消
- main(args) パラメータ有りループが正常動作
- Stage-B balanced scan で continue 正常動作確認 (228回イテレーション)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-19 08:04:43 +09:00
parent b086933acb
commit a95fedf26a
10 changed files with 547 additions and 42 deletions

View File

@ -318,8 +318,9 @@ impl<'a> LoopBuilder<'a> {
// 📦 Hotfix 6: Add CFG predecessor for header from latch (same as legacy version)
crate::mir::builder::loops::add_predecessor(self.parent_builder, header_id, latch_id)?;
// Pass 4: Seal PHIs with latch values
loopform.seal_phis(self, actual_latch_id)?;
// Pass 4: Seal PHIs with latch + continue values
let continue_snaps = self.continue_snapshots.clone();
loopform.seal_phis(self, actual_latch_id, &continue_snaps)?;
// Exit block
self.set_current_block(exit_id)?;