🔧 Hotfix 7 (Enhanced): ValueId receiver alias tracking for nested loops

- Problem: Pinned receiver variables in loops cause undefined ValueId errors
- Enhanced fix: Update all receiver aliases (me + all __pin$N$@recv levels)
- Handles nested loops by updating previous pin levels
- Test status: Partial improvement, ValueId(50) → ValueId(40)
- Further investigation needed for complete fix

Files modified:
- src/mir/phi_core/loopform_builder.rs (emit_header_phis)
This commit is contained in:
nyash-codex
2025-11-19 00:02:41 +09:00
parent 263affe379
commit 80f8a7bc8c
17 changed files with 983 additions and 277 deletions

View File

@ -0,0 +1,30 @@
#!/bin/bash
# test_loopssa_breakfinder_min.sh — LoopSSA/BreakFinder 最小 JSON ハーネステスト
#
# 目的:
# - lang/src/compiler/tests/loopssa_breakfinder_min.hako を直接 VM で実行し、
# LoopSSA.stabilize_merges が単純な loop_header/loop_exit パターンで安全に動くことを確認する。
# - LoopSSA v2 / BreakFinderBox の変更時に、まずここで赤が出ないことをチェックするための軽量テストだよ。
#
# 将来:
# - StageB 最小サンプルから抽出した JSON をこのハーネスに貼り替えることで、
# ValueId(50) 系の問題を再現するための土台として使う予定。
#
set -e
NYASH_BIN="${NYASH_BIN:-./target/release/hakorune}"
TEST_FILE="lang/src/compiler/tests/loopssa_breakfinder_min.hako"
echo "=== LoopSSA BreakFinder Minimal JSON Test ==="
echo "Test file: $TEST_FILE"
echo "Binary: $NYASH_BIN"
echo ""
# LoopSSA v2 の EXIT PHI を有効化して実行BreakFinder/PhiInjector 経由)
HAKO_LOOPSSA_EXIT_PHI=1 \
NYASH_DISABLE_PLUGINS=1 NYASH_PARSER_STAGE3=1 \
"$NYASH_BIN" --backend vm "$TEST_FILE" 2>&1
echo ""
echo "=== Test complete ==="