diff --git a/CURRENT_TASK.md b/CURRENT_TASK.md index ad942978..5306c193 100644 --- a/CURRENT_TASK.md +++ b/CURRENT_TASK.md @@ -82,6 +82,7 @@ Action Items (next 48h) - [x] Golden normalizer (key‑order insensitive) for macro tests - [x] Loop simple/two‑vars goldens with normalization - [ ] Match guard: 内蔵変換(If 連鎖)+ golden/smoke +- [x] Smoke for guard/type match normalization(no PeekExpr; If present) - [ ] LoopForm MVP‑2: two‑vars carrier safe normalization + tests/smokes - [x] LLVM PHI hygiene smoke on LoopForm cases - [x] LLVM PHI hygiene smoke on If cases diff --git a/tools/test/smoke/macro/match_guard_type_smoke.sh b/tools/test/smoke/macro/match_guard_type_smoke.sh new file mode 100644 index 00000000..bb6c6b32 --- /dev/null +++ b/tools/test/smoke/macro/match_guard_type_smoke.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +set -euo pipefail + +root=$(cd "$(dirname "$0")"/../../../.. && pwd) +bin="$root/target/release/nyash" +src="apps/tests/match_guard_type_basic.nyash" + +if [ ! -x "$bin" ]; then + echo "nyash binary not found at $bin; build first (cargo build --release)" >&2 + exit 1 +fi + +export NYASH_MACRO_ENABLE=1 + +out=$("$bin" --dump-expanded-ast-json "$src") + +# Expect: no PeekExpr remains and If exists +if echo "$out" | rg -q '"kind":"PeekExpr"'; then + echo "[FAIL] Expanded AST still contains PeekExpr for guard-type match" >&2 + exit 2 +fi + +if ! echo "$out" | rg -q '"kind":"If"'; then + echo "[FAIL] Expanded AST has no If; expected If-chain after normalization" >&2 + exit 2 +fi + +echo "[OK] match guard/type normalization smoke passed" +