lua: vararg ... transpile (spreads in call+table last pos); 6x transpile-unsup fixed +6 tests
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
This commit is contained in:
@@ -888,6 +888,20 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 1604)
|
||||
(eval "(lua-eval-ast \"package.preload.noret = function() end local r = require(\\\"noret\\\") return type(r)\")")
|
||||
|
||||
;; ── Phase 7: vararg `...` (scoreboard iteration) ──────────────
|
||||
(epoch 1700)
|
||||
(eval "(lua-eval-ast \"local function f(...) return ... end local a, b, c = f(1, 2, 3) return a + b + c\")")
|
||||
(epoch 1701)
|
||||
(eval "(lua-eval-ast \"local function f(...) local t = {...} return t[2] end return f(10, 20, 30)\")")
|
||||
(epoch 1702)
|
||||
(eval "(lua-eval-ast \"local function f(a, ...) return a + select(\\\"#\\\", ...) end return f(10, 1, 2, 3)\")")
|
||||
(epoch 1703)
|
||||
(eval "(lua-eval-ast \"local function f(...) return select(2, ...) end local a, b = f(10, 20, 30) return a + b\")")
|
||||
(epoch 1704)
|
||||
(eval "(lua-eval-ast \"local function sum(...) local s = 0 for _, v in ipairs({...}) do s = s + v end return s end return sum(1, 2, 3, 4, 5)\")")
|
||||
(epoch 1705)
|
||||
(eval "(lua-eval-ast \"local function f(a, b, ...) return a * 100 + b * 10 + select(\\\"#\\\", ...) end return f(7, 8, 1, 2, 3)\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1336,6 +1350,14 @@ check 1602 "require unknown module errors" '1'
|
||||
check 1603 "package.loaded populated" '42'
|
||||
check 1604 "nil return caches as true" '"boolean"'
|
||||
|
||||
# ── Phase 7: vararg `...` (scoreboard iteration) ──────────────
|
||||
check 1700 "f(...) return ... unpack" '6'
|
||||
check 1701 "{...} table from vararg" '20'
|
||||
check 1702 "f(a, ...) + select(#,...)" '13'
|
||||
check 1703 "select(2, ...) unpack" '50'
|
||||
check 1704 "sum via ipairs({...})" '15'
|
||||
check 1705 "f(a, b, ...) mixed" '783'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user