pyvm: implement TypeOp(check) + strict match-guard smokes; parser: guard support in match; llvm: PHI wiring at block head + incoming normalization; docs: AGENTS LLVM/PHI + guard policy; add tests; plan: refactor parse_box_declaration + TODO triage + clone reduction + CLI split + LLVM builder split; update CURRENT_TASK.md

This commit is contained in:
Selfhosting Dev
2025-09-19 10:52:57 +09:00
parent e55ce363c3
commit 7dfd55bfdb
22 changed files with 2622 additions and 86 deletions

View File

@ -49,18 +49,26 @@ unset code
# 7) Match expr block: assert output and exit code
OUT=$(NYASH_VM_USE_PY=1 "$BIN" --backend vm "$ROOT_DIR/apps/tests/peek_expr_block.nyash" 2>&1 || true)
if echo "$OUT" | rg -q 'found one'; then
:
else
echo "[warn] match expr block output mismatch; will check exit code only" >&2
fi
echo "$OUT" | rg -q 'found one' || fail "PyVM: match expr block output" "$OUT"
NYASH_VM_USE_PY=1 "$BIN" --backend vm "$ROOT_DIR/apps/tests/peek_expr_block.nyash" >/dev/null 2>&1 || code=$?
code=${code:-0}
[[ "$code" -eq 1 ]] && pass "PyVM: match expr block (print+exit=1)" || fail "PyVM: match expr block exit" "exit=$code"
unset code
# 8) Match return value (temporarily skipped; covered by block form)
# OUT=$(run_pyvm "$ROOT_DIR/apps/tests/peek_return_value.nyash" || true)
# echo "$OUT" | rg -q '^1$' && pass "PyVM: match return value" || fail "PyVM: match return value" "$OUT"
# 8) Match guard (type) — strict check
OUT=$(NYASH_VM_USE_PY=1 "$BIN" --backend vm "$ROOT_DIR/apps/tests/match_guard_type_basic.nyash" 2>&1 || true)
echo "$OUT" | rg -q '^gt3$' || fail "PyVM: match guard (type) output" "$OUT"
NYASH_VM_USE_PY=1 "$BIN" --backend vm "$ROOT_DIR/apps/tests/match_guard_type_basic.nyash" >/dev/null 2>&1 || code=$?
code=${code:-0}
[[ "$code" -eq 1 ]] && pass "PyVM: match guard (type) exit=1" || fail "PyVM: match guard (type) exit" "exit=$code"
unset code
# 9) Match guard (literal) — first guard fails, second arm matches
OUT=$(NYASH_VM_USE_PY=1 "$BIN" --backend vm "$ROOT_DIR/apps/tests/match_guard_lit_basic.nyash" 2>&1 || true)
echo "$OUT" | rg -q '^yes$' || fail "PyVM: match guard (lit) output" "$OUT"
NYASH_VM_USE_PY=1 "$BIN" --backend vm "$ROOT_DIR/apps/tests/match_guard_lit_basic.nyash" >/dev/null 2>&1 || code=$?
code=${code:-0}
[[ "$code" -eq 9 ]] && pass "PyVM: match guard (lit) exit=9" || fail "PyVM: match guard (lit) exit" "exit=$code"
unset code
echo "All PyVM Stage-2 smokes PASS" >&2