## 🎯 完了タスク ✅ Task 1: LoopForm v2 最小ユニットテスト全緑化(4/4パス) ✅ Task 2: program_v0 PHI trace スクリプト全緑化(5/5パス) ✅ Task 3: Stage-B 風ループ Rust テスト全緑化(2/2パス) 🔧 Task 4: Stage-1 using resolver (1/3パス、UsingStatement対応完了) ## 📝 主要修正 ### 1. ValueId(0)を無効値として予約 - **src/mir/function.rs**: MirFunction::new() で next_value_id を1から開始 - **src/mir/builder/stmts.rs**: build_local_statement で next_value_id() 使用 - **理由**: LoopForm v2 が ValueId(0) を無効値の sentinel として使用 - **効果**: SSA 構築時の ValueId 衝突を完全に防止 ### 2. Unreachable block 許容をデフォルト化 - **src/mir/verification/cfg.rs**: 到達可能性チェック削除 - **src/config/env.rs**: NYASH_VERIFY_ALLOW_UNREACHABLE 環境変数削除 - **src/tests/mir_loopform_exit_phi.rs**: 環境変数設定削除 - **理由**: break/continue/return の後の unreachable block は正当 - switch_to_unreachable_block_with_void() で意図的に作成 - LLVM IR の `unreachable` 命令と同じ標準的手法 - 削除は DCE (Dead Code Elimination) パスの仕事 - **効果**: 環境変数を減らしてシンプル化 ### 3. UsingStatement の MIR Builder 対応 - **src/mir/builder/exprs.rs**: UsingStatement → void 変換を追加 - **理由**: namespace 解決は parser/runner レベルで完了済み - **効果**: using 文を含むコードが MIR コンパイル可能に ### 4. スモークテストスクリプト修正 - **tools/smokes/v2/profiles/quick/core/phase2034/*.sh**: 5ファイル - **修正内容**: 二重コマンド置換のシンタックスエラー修正 - 誤: `out="$(out="$(COMMAND)"; rc=$?` - 正: `out="$(COMMAND)"; rc=$?` ## 🧪 テスト結果 - mir_loopform_exit_phi: 4/4パス ✅ - program_v0_*_phi_trace_vm: 5/5パス ✅ - mir_stageb_loop_break_continue: 2/2パス ✅ - mir_stage1_using_resolver: 1/3パス (残り2つは dominator violation) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Hakorune Smoke Tests v2 — Guide (Nyash-compatible)
Overview
- Entry:
tools/smokes/v2/run.sh— unified runner for quick/integration/full. - Profiles:
quick— fast developer checks.integration— VM↔LLVM parity, basic stability.full— comprehensive matrix.
🎯 Two Baselines (Runbook)
これから開発の基準となる2つのベースライン:
📦 VM ライン(Rust VM - 既定)
用途: 開発・デバッグ・検証用(高速・型安全)
# ビルド
cargo build --release
# 一括スモークテスト
tools/smokes/v2/run.sh --profile quick
# 個別スモークテスト
tools/smokes/v2/run.sh --profile quick --filter "<glob>"
# 例: --filter "core/json_query_min_vm.sh"
# 単発実行(参考)
$NYASH_BIN --backend vm apps/APP/main.hako
⚡ llvmlite ライン(LLVMハーネス)
用途: 本番・最適化・配布用(実証済み安定性)
前提: Python3 + llvmlite
pip install llvmlite # 未導入の場合
実行手順:
# ビルド(LLVM_SYS_180_PREFIX不要!)
cargo build --release --features llvm
# 一括スモークテスト
tools/smokes/v2/run.sh --profile integration
# 個別スモークテスト
tools/smokes/v2/run.sh --profile integration --filter "<glob>"
# 単発実行
NYASH_LLVM_USE_HARNESS=1 $NYASH_BIN --backend llvm apps/tests/peek_expr_block.hako
# 有効化確認
$NYASH_BIN --version | rg -i 'features.*llvm'
💡 重要: 両方のラインのテストが通ることで、MIR14統一アーキテクチャの品質を保証!
🔁 QuickでAST/LLVM系も実行したいとき
通常、quick は LLVM未ビルド時に AST/LLVM系テストを自動で SKIP します。
Quickでも実行したい場合は、先に LLVM 有効でビルドしてください:
LLVM_SYS_180_PREFIX=$(llvm-config-18 --prefix) cargo build --release --features llvm
tools/smokes/v2/run.sh --profile quick
テストランナーは LLVM 非対応時にヒントを出力します(buildコマンドの案内)。
Notes
- Using resolution: prefer nyash.toml aliases (SSOT). Some tests may enable
NYASH_ALLOW_USING_FILE=1internally for convenience. - Plugin warnings are informational; smokes are designed to pass without dynamic plugins.
- Harness single-run may take longer due to link+exec; integration profile includes generous timeouts.
- Binary selection in scripts: always use
$NYASH_BIN(the runner sets it totarget/release/hakorunewhen present, otherwise falls back tonyash). - Branding: user‑visible messages prefer “Hakorune”; the legacy
nyashbinary remains for compatibility but may be gated(HAKO_ALLOW_NYASH=1)。
Dev Mode (defaults)
- In v2 smokes, the
quickprofile exportsNYASH_DEV=1by default.- This enables CLI
--dev-equivalent defaults inside Nyash:- AST using ON (SSOT + AST prelude merge)
- Operator Boxes in observe mode (no adoption)
- Minimal diagnostics; output parity is preserved
- This enables CLI
- You can also run manually with
nyash --dev script.hako.
Common commands
- Quick suite (auto
NYASH_DEV=1):tools/smokes/v2/run.sh --profile quick
- Focus JSON smokes:
tools/opbox-json.sh(Roundtrip/Nested, plugins disabled, generous timeout)
- One-off program (VM):
$NYASH_BIN --backend vm --dev apps/APP/main.hako
Key env knobs
NYASH_DEV=1— enable dev defaults (same effect as--dev).SMOKES_DEFAULT_TIMEOUT— per test timeout seconds (default 15 for quick).SMOKES_PLUGIN_MODE=dynamic|static— plugin mode for preflight (auto by default).SMOKES_FORCE_CONFIG=rust_vm_dynamic|llvm_static— force backend config.SMOKES_NOTIFY_TAIL— lines to show on failure tail (default 80).
Notes
- Dev defaults are designed to be non-intrusive: tests remain behavior‑compatible.
- To repro outside smokes, either pass
--devor exportNYASH_DEV=1.
Heavy JSON probes
- Heavy JSON tests (nested/roundtrip/query_min) run a tiny parser probe first.
- The probe's stdout last non-empty line is trimmed and compared to
ok. - If not
ok, the test is SKIP (parser unavailable), not FAIL. This avoids false negatives due to environment noise or optional dependencies.