lua: method-call binds obj to temp (no more double-eval); chaining works +1 test
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:
@@ -11,12 +11,16 @@
|
|||||||
"top_failure_modes": [
|
"top_failure_modes": [
|
||||||
[
|
[
|
||||||
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
10
|
9
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"timeout",
|
"timeout",
|
||||||
4
|
4
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
"undefined symbol: fat\\",
|
||||||
|
1
|
||||||
|
],
|
||||||
[
|
[
|
||||||
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||||
1
|
1
|
||||||
@@ -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": 6273
|
"ms": 6224
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "big.lua",
|
"name": "big.lua",
|
||||||
"status": "timeout",
|
"status": "timeout",
|
||||||
"reason": "per-test timeout",
|
"reason": "per-test timeout",
|
||||||
"ms": 8007
|
"ms": 8006
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "calls.lua",
|
"name": "calls.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "undefined symbol: fat\\",
|
||||||
"ms": 5140
|
"ms": 5070
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": 8004
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "code.lua",
|
"name": "code.lua",
|
||||||
@@ -87,13 +91,13 @@
|
|||||||
"name": "errors.lua",
|
"name": "errors.lua",
|
||||||
"status": "fail",
|
"status": "fail",
|
||||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||||
"ms": 3390
|
"ms": 3359
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": 7706
|
"ms": 7590
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": 2026
|
"ms": 1893
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": 1782
|
"ms": 1727
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "main.lua",
|
"name": "main.lua",
|
||||||
@@ -129,43 +133,43 @@
|
|||||||
"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": 4348
|
"ms": 4317
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": 7508
|
"ms": 7303
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": 6682
|
"ms": 5956
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "sort.lua",
|
"name": "sort.lua",
|
||||||
"status": "timeout",
|
"status": "timeout",
|
||||||
"reason": "per-test timeout",
|
"reason": "per-test timeout",
|
||||||
"ms": 8007
|
"ms": 8003
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": 4479
|
"ms": 4024
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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": 2660
|
"ms": 2235
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "verybig.lua",
|
"name": "verybig.lua",
|
||||||
"status": "pass",
|
"status": "pass",
|
||||||
"reason": "",
|
"reason": "",
|
||||||
"ms": 632
|
"ms": 566
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,9 @@ fail=11 timeout=4 skip=8 total=24
|
|||||||
|
|
||||||
## Top failure modes
|
## Top failure modes
|
||||||
|
|
||||||
- **10x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\
|
- **9x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\
|
||||||
- **4x** timeout
|
- **4x** timeout
|
||||||
|
- **1x** undefined symbol: fat\
|
||||||
- **1x** other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio
|
- **1x** other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio
|
||||||
|
|
||||||
## Per-test results
|
## Per-test results
|
||||||
@@ -15,25 +16,25 @@ fail=11 timeout=4 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!\\\"\ | 6273 |
|
| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6224 |
|
||||||
| big.lua | timeout | per-test timeout | 8007 |
|
| big.lua | timeout | per-test timeout | 8006 |
|
||||||
| calls.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5140 |
|
| calls.lua | fail | undefined symbol: fat\ | 5070 |
|
||||||
| 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 | 8004 |
|
||||||
| code.lua | skip | bytecode inspection via debug library | 0 |
|
| code.lua | skip | bytecode inspection via debug library | 0 |
|
||||||
| constructs.lua | timeout | per-test timeout | 8008 |
|
| constructs.lua | timeout | per-test timeout | 8008 |
|
||||||
| db.lua | skip | debug library | 0 |
|
| db.lua | skip | debug library | 0 |
|
||||||
| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3390 |
|
| errors.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3359 |
|
||||||
| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7706 |
|
| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7590 |
|
||||||
| 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!\\\"\ | 2026 |
|
| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1893 |
|
||||||
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1782 |
|
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1727 |
|
||||||
| main.lua | skip | standalone interpreter driver | 0 |
|
| main.lua | skip | standalone interpreter driver | 0 |
|
||||||
| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4348 |
|
| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4317 |
|
||||||
| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7508 |
|
| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7303 |
|
||||||
| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6682 |
|
| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5956 |
|
||||||
| sort.lua | timeout | per-test timeout | 8007 |
|
| sort.lua | timeout | per-test timeout | 8003 |
|
||||||
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4479 |
|
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4024 |
|
||||||
| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2660 |
|
| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2235 |
|
||||||
| verybig.lua | pass | - | 632 |
|
| verybig.lua | pass | - | 566 |
|
||||||
|
|||||||
@@ -954,6 +954,10 @@ cat > "$TMPFILE" << 'EPOCHS'
|
|||||||
(epoch 1863)
|
(epoch 1863)
|
||||||
(eval "(lua-eval-ast \"local i = 0 repeat i = i + 1 if i >= 3 then break end until false return i\")")
|
(eval "(lua-eval-ast \"local i = 0 repeat i = i + 1 if i >= 3 then break end until false return i\")")
|
||||||
|
|
||||||
|
;; ── Method-call chaining (obj evaluated once) ────────────────
|
||||||
|
(epoch 1870)
|
||||||
|
(eval "(lua-eval-ast \"local a = {x=0} function a:add(x) self.x = self.x+x return self end return a:add(10):add(20):add(30).x\")")
|
||||||
|
|
||||||
EPOCHS
|
EPOCHS
|
||||||
|
|
||||||
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||||
@@ -1443,6 +1447,9 @@ check 1861 "break in for-num" '55'
|
|||||||
check 1862 "break in for-in" '30'
|
check 1862 "break in for-in" '30'
|
||||||
check 1863 "break in repeat" '3'
|
check 1863 "break in repeat" '3'
|
||||||
|
|
||||||
|
# ── Method-call chaining ─────────────────────────────────────
|
||||||
|
check 1870 "a:add():add():add().x chain" '60'
|
||||||
|
|
||||||
TOTAL=$((PASS + FAIL))
|
TOTAL=$((PASS + FAIL))
|
||||||
if [ $FAIL -eq 0 ]; then
|
if [ $FAIL -eq 0 ]; then
|
||||||
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"
|
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"
|
||||||
|
|||||||
@@ -130,11 +130,16 @@
|
|||||||
((obj (lua-tx (nth node 1)))
|
((obj (lua-tx (nth node 1)))
|
||||||
(name (nth node 2))
|
(name (nth node 2))
|
||||||
(args (nth node 3)))
|
(args (nth node 3)))
|
||||||
(cons
|
(let
|
||||||
(make-symbol "lua-call")
|
((tmp (make-symbol "__obj")))
|
||||||
(cons
|
(list
|
||||||
(list (make-symbol "lua-get") obj name)
|
(make-symbol "let")
|
||||||
(cons obj (map lua-tx args)))))))
|
(list (list tmp obj))
|
||||||
|
(cons
|
||||||
|
(make-symbol "lua-call")
|
||||||
|
(cons
|
||||||
|
(list (make-symbol "lua-get") tmp name)
|
||||||
|
(cons tmp (map lua-tx args)))))))))
|
||||||
|
|
||||||
(define
|
(define
|
||||||
lua-tx-field
|
lua-tx-field
|
||||||
|
|||||||
@@ -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 — **method-call double-evaluation bug**. `lua-tx-method-call` emitted `(lua-call (lua-get OBJ name) OBJ args…)` which evaluated OBJ TWICE, so `a:add(10):add(20):add(30).x` computed `110` instead of `60` (side effects applied twice). Fixed by `(let ((__obj OBJ)) (lua-call (lua-get __obj name) __obj args…))`. 373/373 green (+1 chaining test).
|
||||||
- 2026-04-24: lua: **🎉 FIRST PASSING PUC-Rio TEST — 1/16 runnable (6.2%)**. `verybig.lua` now passes: needed `io.output`/`io.input`/`io.stdout`/`io.stderr` stubs, made `os.remove` return `true` (test asserts on it), and added `dofile`/`loadfile` stubs. All cumulative fixes (returns/break/scoping/escapes/precedence/vararg/tonumber-trim) combined make this test's full happy path work end-to-end. 372 unit tests. Failure mix: 10× assertion / 4× timeout / 1× call-non-fn.
|
- 2026-04-24: lua: **🎉 FIRST PASSING PUC-Rio TEST — 1/16 runnable (6.2%)**. `verybig.lua` now passes: needed `io.output`/`io.input`/`io.stdout`/`io.stderr` stubs, made `os.remove` return `true` (test asserts on it), and added `dofile`/`loadfile` stubs. All cumulative fixes (returns/break/scoping/escapes/precedence/vararg/tonumber-trim) combined make this test's full happy path work end-to-end. 372 unit tests. Failure mix: 10× assertion / 4× timeout / 1× call-non-fn.
|
||||||
- 2026-04-24: lua: scoreboard iteration — **proper `break` via guard+raise sentinel** (`lua-brk`) + auto-first multi-values in arith/concat. Loop break dispatch was previously a no-op (emitted bare `'lua-break-marker` symbol that nothing caught); converted to raise+catch pattern, wrapping the OUTER invocation of `_while_loop`/`_for_loop`/`_repeat_loop`/`__for_loop` in a break-guard (wrapping body doesn't work — break would just be caught and loop keeps recursing). Also `lua-arith`/`lua-concat`/`lua-concat-coerce` now `lua-first` their operands so multi-returns auto-truncate at scalar boundaries. 372/372 green (+4 break tests). Scoreboard: 10×assert / 4×timeout / 2×call-non-fn (no more undef-symbol or compare-incompat).
|
- 2026-04-24: lua: scoreboard iteration — **proper `break` via guard+raise sentinel** (`lua-brk`) + auto-first multi-values in arith/concat. Loop break dispatch was previously a no-op (emitted bare `'lua-break-marker` symbol that nothing caught); converted to raise+catch pattern, wrapping the OUTER invocation of `_while_loop`/`_for_loop`/`_repeat_loop`/`__for_loop` in a break-guard (wrapping body doesn't work — break would just be caught and loop keeps recursing). Also `lua-arith`/`lua-concat`/`lua-concat-coerce` now `lua-first` their operands so multi-returns auto-truncate at scalar boundaries. 372/372 green (+4 break tests). Scoreboard: 10×assert / 4×timeout / 2×call-non-fn (no more undef-symbol or compare-incompat).
|
||||||
- 2026-04-24: lua: scoreboard iteration — **proper early-return via guard+raise sentinel**. Fixes long-logged limitation: `if cond then return X end ...rest` now exits the enclosing function; `rest` is skipped. `lua-tx-return` raises `(list 'lua-ret value)`; every function body and the top-level chunk + loadstring'd chunks wrap in a guard that catches the sentinel and returns its value. Eliminates "compare incompatible types" from constructs.lua (past line 40). 368/368 green (+3 early-return tests).
|
- 2026-04-24: lua: scoreboard iteration — **proper early-return via guard+raise sentinel**. Fixes long-logged limitation: `if cond then return X end ...rest` now exits the enclosing function; `rest` is skipped. `lua-tx-return` raises `(list 'lua-ret value)`; every function body and the top-level chunk + loadstring'd chunks wrap in a guard that catches the sentinel and returns its value. Eliminates "compare incompatible types" from constructs.lua (past line 40). 368/368 green (+3 early-return tests).
|
||||||
|
|||||||
Reference in New Issue
Block a user