lua: unpack treats explicit nil i/j as missing (defaults to 1 and #t)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled

This commit is contained in:
2026-04-25 00:31:03 +00:00
parent fd32bcf547
commit 1b34d41b33
4 changed files with 62 additions and 54 deletions

View File

@@ -1552,23 +1552,25 @@
(define
lua-unpack
(fn (&rest args)
(let ((t (first args))
(i (if (> (len args) 1) (nth args 1) 1))
(j (if (> (len args) 2) (nth args 2) (lua-len (first args)))))
(cond
((> i j) nil)
(else
(let ((out (list (quote lua-multi))))
(begin
(define
loop
(fn (k)
(when (<= k j)
(begin
(set! out (append out (list (get t (str k)))))
(loop (+ k 1))))))
(loop i)
out)))))))
(let ((t (first args)))
(let ((i-raw (if (> (len args) 1) (nth args 1) nil))
(j-raw (if (> (len args) 2) (nth args 2) nil)))
(let ((i (if (= i-raw nil) 1 i-raw))
(j (if (= j-raw nil) (lua-len t) j-raw)))
(cond
((> i j) nil)
(else
(let ((out (list (quote lua-multi))))
(begin
(define
loop
(fn (k)
(when (<= k j)
(begin
(set! out (append out (list (get t (str k)))))
(loop (+ k 1))))))
(loop i)
out)))))))))
(define
lua-table-maxn

View File

@@ -1,8 +1,8 @@
{
"totals": {
"pass": 1,
"fail": 7,
"timeout": 8,
"fail": 9,
"timeout": 6,
"skip": 8,
"total": 24,
"runnable": 16,
@@ -11,16 +11,20 @@
"top_failure_modes": [
[
"timeout",
8
6
],
[
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
4
5
],
[
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
2
],
[
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: module 'C' not found\\\\\\\"\\",
1
],
[
"undefined symbol: fat\\",
1
@@ -41,21 +45,21 @@
},
{
"name": "attrib.lua",
"status": "timeout",
"reason": "per-test timeout",
"ms": 8000
"status": "fail",
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: module 'C' not found\\\\\\\"\\",
"ms": 6985
},
{
"name": "big.lua",
"status": "timeout",
"reason": "per-test timeout",
"ms": 8007
"ms": 8008
},
{
"name": "calls.lua",
"status": "fail",
"reason": "undefined symbol: fat\\",
"ms": 6732
"ms": 5721
},
{
"name": "checktable.lua",
@@ -67,7 +71,7 @@
"name": "closure.lua",
"status": "timeout",
"reason": "per-test timeout",
"ms": 8005
"ms": 8008
},
{
"name": "code.lua",
@@ -91,7 +95,7 @@
"name": "errors.lua",
"status": "fail",
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
"ms": 4579
"ms": 4667
},
{
"name": "events.lua",
@@ -115,13 +119,13 @@
"name": "literals.lua",
"status": "fail",
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
"ms": 2829
"ms": 2950
},
{
"name": "locals.lua",
"status": "fail",
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
"ms": 2598
"ms": 2366
},
{
"name": "main.lua",
@@ -133,19 +137,19 @@
"name": "math.lua",
"status": "fail",
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
"ms": 6606
"ms": 4991
},
{
"name": "nextvar.lua",
"status": "timeout",
"reason": "per-test timeout",
"ms": 8008
"ms": 8007
},
{
"name": "pm.lua",
"status": "timeout",
"reason": "per-test timeout",
"ms": 8009
"status": "fail",
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
"ms": 6697
},
{
"name": "sort.lua",
@@ -157,19 +161,19 @@
"name": "strings.lua",
"status": "fail",
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
"ms": 6228
"ms": 4493
},
{
"name": "vararg.lua",
"status": "fail",
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
"ms": 3087
"ms": 2541
},
{
"name": "verybig.lua",
"status": "pass",
"reason": "",
"ms": 1058
"ms": 1187
}
]
}

View File

@@ -1,13 +1,14 @@
# Lua-on-SX conformance scoreboard
**Pass rate:** 1/16 runnable (6.2%)
fail=7 timeout=8 skip=8 total=24
fail=9 timeout=6 skip=8 total=24
## Top failure modes
- **8x** timeout
- **4x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\
- **6x** timeout
- **5x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\
- **2x** other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio
- **1x** other: Unhandled exception: \"Unhandled exception: \\\"lua: module 'C' not found\\\"\
- **1x** undefined symbol: fat\
## Per-test results
@@ -16,25 +17,25 @@ fail=7 timeout=8 skip=8 total=24
|---|---|---|---:|
| all.lua | skip | driver uses dofile to chain other tests | 0 |
| api.lua | skip | requires testC (C debug library) | 0 |
| attrib.lua | timeout | per-test timeout | 8000 |
| big.lua | timeout | per-test timeout | 8007 |
| calls.lua | fail | undefined symbol: fat\ | 6732 |
| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: module 'C' not found\\\"\ | 6985 |
| big.lua | timeout | per-test timeout | 8008 |
| calls.lua | fail | undefined symbol: fat\ | 5721 |
| checktable.lua | skip | internal debug helpers | 0 |
| closure.lua | timeout | per-test timeout | 8005 |
| closure.lua | timeout | per-test timeout | 8008 |
| code.lua | skip | bytecode inspection via debug library | 0 |
| constructs.lua | timeout | per-test timeout | 8007 |
| db.lua | skip | debug library | 0 |
| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4579 |
| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4667 |
| events.lua | timeout | per-test timeout | 8007 |
| files.lua | skip | io library | 0 |
| gc.lua | skip | collectgarbage / finalisers | 0 |
| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2829 |
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 2598 |
| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2950 |
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 2366 |
| main.lua | skip | standalone interpreter driver | 0 |
| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 6606 |
| nextvar.lua | timeout | per-test timeout | 8008 |
| pm.lua | timeout | per-test timeout | 8009 |
| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 4991 |
| nextvar.lua | timeout | per-test timeout | 8007 |
| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6697 |
| sort.lua | timeout | per-test timeout | 8007 |
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6228 |
| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3087 |
| verybig.lua | pass | - | 1058 |
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4493 |
| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2541 |
| verybig.lua | pass | - | 1187 |