macro(match): add golden for guard literal OR; add smoke; update CURRENT_TASK milestones
This commit is contained in:
@ -81,7 +81,9 @@ Action Items (next 48h)
|
|||||||
- [x] Enable sugar by default (array/map literals)
|
- [x] Enable sugar by default (array/map literals)
|
||||||
- [x] Golden normalizer (key‑order insensitive) for macro tests
|
- [x] Golden normalizer (key‑order insensitive) for macro tests
|
||||||
- [x] Loop simple/two‑vars goldens with normalization
|
- [x] Loop simple/two‑vars goldens with normalization
|
||||||
- [ ] Match guard: 内蔵変換(If 連鎖)+ golden/smoke
|
- [x] Match guard: smoke(PeekExpr なし)
|
||||||
|
- [x] Match guard: golden(literal OR 最小形)
|
||||||
|
- [ ] Match guard: 追加golden(type最小形、Boxなし構成)
|
||||||
- [x] Smoke for guard/type match normalization(no PeekExpr; If present)
|
- [x] Smoke for guard/type match normalization(no PeekExpr; If present)
|
||||||
- [ ] LoopForm MVP‑2: two‑vars carrier safe normalization + tests/smokes
|
- [ ] LoopForm MVP‑2: two‑vars carrier safe normalization + tests/smokes
|
||||||
- [x] LLVM PHI hygiene smoke on LoopForm cases
|
- [x] LLVM PHI hygiene smoke on LoopForm cases
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
{"kind":"Program","statements":[{"inits":[{"kind":"Literal","value":{"type":"int","value":2}}],"kind":"Local","variables":["d"]},{"inits":[{"kind":"Program","statements":[{"inits":[{"kind":"Variable","name":"d"}],"kind":"Local","variables":["__ny_match_scrutinee_37"]},{"condition":{"kind":"BinaryOp","left":{"kind":"Variable","name":"__ny_match_scrutinee_37"},"op":"==","right":{"kind":"Literal","value":{"type":"int","value":1}}},"else":[{"condition":{"kind":"BinaryOp","left":{"kind":"Variable","name":"__ny_match_scrutinee_37"},"op":"==","right":{"kind":"Literal","value":{"type":"int","value":2}}},"else":[{"kind":"Literal","value":{"type":"int","value":30}}],"kind":"If","then":[{"condition":{"kind":"BinaryOp","left":{"kind":"Literal","value":{"type":"int","value":2}},"op":"<","right":{"kind":"Literal","value":{"type":"int","value":3}}},"else":[{"kind":"Literal","value":{"type":"int","value":30}}],"kind":"If","then":[{"kind":"Literal","value":{"type":"int","value":20}}]}]}],"kind":"If","then":[{"condition":{"kind":"BinaryOp","left":{"kind":"Literal","value":{"type":"int","value":1}},"op":"<","right":{"kind":"Literal","value":{"type":"int","value":2}}},"else":[{"condition":{"kind":"BinaryOp","left":{"kind":"Variable","name":"__ny_match_scrutinee_37"},"op":"==","right":{"kind":"Literal","value":{"type":"int","value":2}}},"else":[{"kind":"Literal","value":{"type":"int","value":30}}],"kind":"If","then":[{"condition":{"kind":"BinaryOp","left":{"kind":"Literal","value":{"type":"int","value":2}},"op":"<","right":{"kind":"Literal","value":{"type":"int","value":3}}},"else":[{"kind":"Literal","value":{"type":"int","value":30}}],"kind":"If","then":[{"kind":"Literal","value":{"type":"int","value":20}}]}]}],"kind":"If","then":[{"kind":"Literal","value":{"type":"int","value":10}}]}]}]}],"kind":"Local","variables":["r"]},{"expression":{"kind":"Variable","name":"r"},"kind":"Print"}]}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
root=$(cd "$(dirname "$0")"/../../../.. && pwd)
|
||||||
|
bin="$root/target/release/nyash"
|
||||||
|
src="apps/tests/macro/match/guard_literal_or.nyash"
|
||||||
|
golden="$root/tools/test/golden/macro/match_guard_literal_or.expanded.json"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
normalize_json() {
|
||||||
|
python3 -c 'import sys,json; print(json.dumps(json.loads(sys.stdin.read()), sort_keys=True, separators=(",",":")))'
|
||||||
|
}
|
||||||
|
|
||||||
|
out_raw=$("$bin" --dump-expanded-ast-json "$src")
|
||||||
|
out_norm=$(printf '%s' "$out_raw" | normalize_json)
|
||||||
|
gold_norm=$(normalize_json < "$golden")
|
||||||
|
|
||||||
|
if [ "$out_norm" != "$gold_norm" ]; then
|
||||||
|
echo "Golden mismatch (match guard literal OR)" >&2
|
||||||
|
diff -u <(echo "$out_norm") <(echo "$gold_norm") || true
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[OK] golden match guard literal OR matched"
|
||||||
Reference in New Issue
Block a user