lua: loadstring returns compiled fn (errors propagate cleanly); parse-fail → (nil, err)
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:
@@ -1500,9 +1500,12 @@
|
|||||||
(define
|
(define
|
||||||
lua-loadstring
|
lua-loadstring
|
||||||
(fn (src)
|
(fn (src)
|
||||||
(let ((compiled (lua-transpile src)))
|
(guard
|
||||||
(fn (&rest args)
|
(e (true (list (quote lua-multi) nil (str e))))
|
||||||
(eval-expr (list (make-symbol "let") (list) compiled))))))
|
(let ((compiled (lua-transpile src)))
|
||||||
|
(let ((wrapped (list (make-symbol "fn") (list (make-symbol "&rest") (make-symbol "__args"))
|
||||||
|
(list (make-symbol "let") (list) compiled))))
|
||||||
|
(eval-expr wrapped))))))
|
||||||
|
|
||||||
(define loadstring lua-loadstring)
|
(define loadstring lua-loadstring)
|
||||||
(define load lua-loadstring)
|
(define load lua-loadstring)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"top_failure_modes": [
|
"top_failure_modes": [
|
||||||
[
|
[
|
||||||
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
11
|
10
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"timeout",
|
"timeout",
|
||||||
@@ -20,6 +20,10 @@
|
|||||||
[
|
[
|
||||||
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||||
2
|
2
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"other: Unhandled exception: \\\"Not callable: nil (kont=10 frames)\\",
|
||||||
|
1
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"results": [
|
"results": [
|
||||||
@@ -39,19 +43,19 @@
|
|||||||
"name": "attrib.lua",
|
"name": "attrib.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 5800
|
"ms": 5841
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "big.lua",
|
"name": "big.lua",
|
||||||
"status": "timeout",
|
"status": "timeout",
|
||||||
"reason": "per-test timeout",
|
"reason": "per-test timeout",
|
||||||
"ms": 8007
|
"ms": 8008
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "calls.lua",
|
"name": "calls.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 4877
|
"ms": 4666
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "checktable.lua",
|
"name": "checktable.lua",
|
||||||
@@ -63,7 +67,7 @@
|
|||||||
"name": "closure.lua",
|
"name": "closure.lua",
|
||||||
"status": "timeout",
|
"status": "timeout",
|
||||||
"reason": "per-test timeout",
|
"reason": "per-test timeout",
|
||||||
"ms": 8007
|
"ms": 8008
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "code.lua",
|
"name": "code.lua",
|
||||||
@@ -75,7 +79,7 @@
|
|||||||
"name": "constructs.lua",
|
"name": "constructs.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 4365
|
"ms": 4155
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "db.lua",
|
"name": "db.lua",
|
||||||
@@ -86,14 +90,14 @@
|
|||||||
{
|
{
|
||||||
"name": "errors.lua",
|
"name": "errors.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Not callable: nil (kont=10 frames)\\",
|
||||||
"ms": 3188
|
"ms": 3155
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "events.lua",
|
"name": "events.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 7039
|
"ms": 6725
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "files.lua",
|
"name": "files.lua",
|
||||||
@@ -111,13 +115,13 @@
|
|||||||
"name": "literals.lua",
|
"name": "literals.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 1873
|
"ms": 1787
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "locals.lua",
|
"name": "locals.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||||
"ms": 1713
|
"ms": 1539
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "main.lua",
|
"name": "main.lua",
|
||||||
@@ -129,19 +133,19 @@
|
|||||||
"name": "math.lua",
|
"name": "math.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 4010
|
"ms": 3892
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "nextvar.lua",
|
"name": "nextvar.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 6632
|
"ms": 6711
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "pm.lua",
|
"name": "pm.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 5609
|
"ms": 5734
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sort.lua",
|
"name": "sort.lua",
|
||||||
@@ -153,19 +157,19 @@
|
|||||||
"name": "strings.lua",
|
"name": "strings.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 3655
|
"ms": 3937
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "vararg.lua",
|
"name": "vararg.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 2039
|
"ms": 2096
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "verybig.lua",
|
"name": "verybig.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||||
"ms": 537
|
"ms": 533
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -5,9 +5,10 @@ fail=13 timeout=3 skip=8 total=24
|
|||||||
|
|
||||||
## Top failure modes
|
## Top failure modes
|
||||||
|
|
||||||
- **11x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\
|
- **10x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\
|
||||||
- **3x** timeout
|
- **3x** timeout
|
||||||
- **2x** other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio
|
- **2x** other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio
|
||||||
|
- **1x** other: Unhandled exception: \"Not callable: nil (kont=10 frames)\
|
||||||
|
|
||||||
## Per-test results
|
## Per-test results
|
||||||
|
|
||||||
@@ -15,25 +16,25 @@ fail=13 timeout=3 skip=8 total=24
|
|||||||
|---|---|---|---:|
|
|---|---|---|---:|
|
||||||
| all.lua | skip | driver uses dofile to chain other tests | 0 |
|
| all.lua | skip | driver uses dofile to chain other tests | 0 |
|
||||||
| api.lua | skip | requires testC (C debug library) | 0 |
|
| api.lua | skip | requires testC (C debug library) | 0 |
|
||||||
| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5800 |
|
| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5841 |
|
||||||
| big.lua | timeout | per-test timeout | 8007 |
|
| big.lua | timeout | per-test timeout | 8008 |
|
||||||
| calls.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4877 |
|
| calls.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4666 |
|
||||||
| checktable.lua | skip | internal debug helpers | 0 |
|
| checktable.lua | skip | internal debug helpers | 0 |
|
||||||
| closure.lua | timeout | per-test timeout | 8007 |
|
| closure.lua | timeout | per-test timeout | 8008 |
|
||||||
| code.lua | skip | bytecode inspection via debug library | 0 |
|
| code.lua | skip | bytecode inspection via debug library | 0 |
|
||||||
| constructs.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4365 |
|
| constructs.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4155 |
|
||||||
| db.lua | skip | debug library | 0 |
|
| db.lua | skip | debug library | 0 |
|
||||||
| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3188 |
|
| errors.lua | fail | other: Unhandled exception: \"Not callable: nil (kont=10 frames)\ | 3155 |
|
||||||
| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7039 |
|
| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6725 |
|
||||||
| files.lua | skip | io library | 0 |
|
| files.lua | skip | io library | 0 |
|
||||||
| gc.lua | skip | collectgarbage / finalisers | 0 |
|
| gc.lua | skip | collectgarbage / finalisers | 0 |
|
||||||
| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1873 |
|
| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1787 |
|
||||||
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1713 |
|
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1539 |
|
||||||
| main.lua | skip | standalone interpreter driver | 0 |
|
| main.lua | skip | standalone interpreter driver | 0 |
|
||||||
| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4010 |
|
| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3892 |
|
||||||
| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6632 |
|
| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6711 |
|
||||||
| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5609 |
|
| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5734 |
|
||||||
| sort.lua | timeout | per-test timeout | 8007 |
|
| sort.lua | timeout | per-test timeout | 8007 |
|
||||||
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3655 |
|
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3937 |
|
||||||
| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2039 |
|
| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2096 |
|
||||||
| verybig.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 537 |
|
| verybig.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 533 |
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ Each item: implement → tests → tick box → update progress log.
|
|||||||
|
|
||||||
_Newest first. Agent appends on every commit._
|
_Newest first. Agent appends on every commit._
|
||||||
|
|
||||||
|
- 2026-04-24: lua: scoreboard iteration — **`loadstring` error propagation**. When `loadstring(s)()` was implemented as `eval-expr ( (let () compiled))`, SX's `eval-expr` wrapped any propagated `raise` as "Unhandled exception: X" — so `error('hi')` inside a loadstring'd chunk came out as that wrapped string instead of the clean `"hi"` Lua expects. Fix: transpile source once into a lambda AST, `eval-expr` it ONCE to get a callable fn value, return that — subsequent calls propagate raises cleanly. Guarded parse-failure path returns `(nil, err)` per Lua convention. vararg.lua now runs past assert #18; errors.lua past parse stage.
|
||||||
- 2026-04-24: lua: scoreboard iteration — `table.sort` O(n²) insertion-sort → **quicksort** (Lomuto partition). 1000-element sorts finish in ms; but `sort.lua` uses 30k elements and still times out even at 90s (metamethod-heavy interpreter overhead). Correctness verified on 1000/5000 element random arrays.
|
- 2026-04-24: lua: scoreboard iteration — `table.sort` O(n²) insertion-sort → **quicksort** (Lomuto partition). 1000-element sorts finish in ms; but `sort.lua` uses 30k elements and still times out even at 90s (metamethod-heavy interpreter overhead). Correctness verified on 1000/5000 element random arrays.
|
||||||
- 2026-04-24: lua: scoreboard iteration — `dostring(s)` alias for `loadstring(s)()` (Lua 5.0 compat used by literals.lua). Diagnosed `locals.lua` call-non-fn at call #18 → `getfenv/setfenv` stub-return pattern fails `assert(getfenv(foo("")) == a)` (need real env tracking, deferred). Tokenizer long-string-leading-NL rule verified correct.
|
- 2026-04-24: lua: scoreboard iteration — `dostring(s)` alias for `loadstring(s)()` (Lua 5.0 compat used by literals.lua). Diagnosed `locals.lua` call-non-fn at call #18 → `getfenv/setfenv` stub-return pattern fails `assert(getfenv(foo("")) == a)` (need real env tracking, deferred). Tokenizer long-string-leading-NL rule verified correct.
|
||||||
- 2026-04-24: lua: scoreboard iteration — Lua 5.0-style `arg` auto-binding inside vararg functions (some PUC-Rio tests still rely on it). `lua-varargs-arg-table` builds `{1=v1, 2=v2, …, n=count}`; transpile adds `arg` binding alongside `__varargs` when `is-vararg`. Diagnosis done with assert-counter instrumentation — literals.lua fails at #4 (long-string NL rule), vararg.lua was at #2 (arg table — FIXED), attrib.lua at #9, locals.lua now past asserts into call-non-fn. 360 tests.
|
- 2026-04-24: lua: scoreboard iteration — Lua 5.0-style `arg` auto-binding inside vararg functions (some PUC-Rio tests still rely on it). `lua-varargs-arg-table` builds `{1=v1, 2=v2, …, n=count}`; transpile adds `arg` binding alongside `__varargs` when `is-vararg`. Diagnosis done with assert-counter instrumentation — literals.lua fails at #4 (long-string NL rule), vararg.lua was at #2 (arg table — FIXED), attrib.lua at #9, locals.lua now past asserts into call-non-fn. 360 tests.
|
||||||
|
|||||||
Reference in New Issue
Block a user