From c536b402a27dad501841d0e6a04cd35b6994bf0b Mon Sep 17 00:00:00 2001 From: Selfhosting Dev Date: Sat, 20 Sep 2025 05:01:58 +0900 Subject: [PATCH] macro(match): add guard/type normalization smoke; update CURRENT_TASK progress --- CURRENT_TASK.md | 1 + .../smoke/macro/match_guard_type_smoke.sh | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 tools/test/smoke/macro/match_guard_type_smoke.sh 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" +