lua: Lua 5.0-style arg auto-binding in vararg functions; assert-counter diagnostic +2 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

This commit is contained in:
2026-04-24 20:44:39 +00:00
parent 1d3a93b0ca
commit 46741a9643
6 changed files with 70 additions and 31 deletions

View File

@@ -916,6 +916,12 @@ cat > "$TMPFILE" << 'EPOCHS'
(epoch 1812)
(eval "(lua-eval-ast \"local x = 10 if false then elseif true then local x = 99 end return x\")")
;; ── Lua 5.0-style `arg` table in vararg functions ─────────────
(epoch 1820)
(eval "(lua-eval-ast \"function f(a, ...) return arg.n end return f({}, 1, 2, 3)\")")
(epoch 1821)
(eval "(lua-eval-ast \"function f(a, ...) return arg[1] + arg[2] + arg[3] end return f({}, 10, 20, 30)\")")
EPOCHS
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
@@ -1381,6 +1387,10 @@ check 1810 "if then local shadows" '10'
check 1811 "else local shadows" '10'
check 1812 "elseif local shadows" '10'
# ── Lua 5.0-style `arg` table in vararg functions ─────────────
check 1820 "arg.n in vararg fn" '3'
check 1821 "arg[i] access" '60'
TOTAL=$((PASS + FAIL))
if [ $FAIL -eq 0 ]; then
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"