lua: unary-minus/^ precedence (^ binds tighter); parse-pow-chain helper +3 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:
@@ -211,6 +211,8 @@
|
||||
(lua-tok-type t)
|
||||
" "
|
||||
(lua-tok-value t))))))))
|
||||
(define parse-pow-chain
|
||||
(fn () (let ((lhs (parse-primary))) (parse-binop-rhs 10 lhs))))
|
||||
(set!
|
||||
parse-unary
|
||||
(fn
|
||||
@@ -228,7 +230,7 @@
|
||||
(begin
|
||||
(advance-tok!)
|
||||
(list (quote lua-unop) "not" (parse-unary))))
|
||||
(else (parse-primary)))))
|
||||
(else (parse-pow-chain)))))
|
||||
(define
|
||||
parse-binop-rhs
|
||||
(fn
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
"top_failure_modes": [
|
||||
[
|
||||
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
10
|
||||
9
|
||||
],
|
||||
[
|
||||
"timeout",
|
||||
@@ -21,6 +21,10 @@
|
||||
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||
2
|
||||
],
|
||||
[
|
||||
"other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to compare incompat",
|
||||
1
|
||||
],
|
||||
[
|
||||
"other: Unhandled exception: \\\"Not callable: nil (kont=10 frames)\\",
|
||||
1
|
||||
@@ -43,7 +47,7 @@
|
||||
"name": "attrib.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 5719
|
||||
"ms": 6000
|
||||
},
|
||||
{
|
||||
"name": "big.lua",
|
||||
@@ -55,7 +59,7 @@
|
||||
"name": "calls.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 4548
|
||||
"ms": 4946
|
||||
},
|
||||
{
|
||||
"name": "checktable.lua",
|
||||
@@ -78,8 +82,8 @@
|
||||
{
|
||||
"name": "constructs.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 4153
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to compare incompat",
|
||||
"ms": 4533
|
||||
},
|
||||
{
|
||||
"name": "db.lua",
|
||||
@@ -91,13 +95,13 @@
|
||||
"name": "errors.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Not callable: nil (kont=10 frames)\\",
|
||||
"ms": 2938
|
||||
"ms": 3217
|
||||
},
|
||||
{
|
||||
"name": "events.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 6598
|
||||
"ms": 7215
|
||||
},
|
||||
{
|
||||
"name": "files.lua",
|
||||
@@ -115,13 +119,13 @@
|
||||
"name": "literals.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 1859
|
||||
"ms": 1901
|
||||
},
|
||||
{
|
||||
"name": "locals.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||
"ms": 1687
|
||||
"ms": 1693
|
||||
},
|
||||
{
|
||||
"name": "main.lua",
|
||||
@@ -133,19 +137,19 @@
|
||||
"name": "math.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 3774
|
||||
"ms": 4095
|
||||
},
|
||||
{
|
||||
"name": "nextvar.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 6637
|
||||
"ms": 7177
|
||||
},
|
||||
{
|
||||
"name": "pm.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 5886
|
||||
"ms": 6048
|
||||
},
|
||||
{
|
||||
"name": "sort.lua",
|
||||
@@ -157,19 +161,19 @@
|
||||
"name": "strings.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 4040
|
||||
"ms": 3990
|
||||
},
|
||||
{
|
||||
"name": "vararg.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"assertion failed!\\\\\\\"\\",
|
||||
"ms": 2064
|
||||
"ms": 2249
|
||||
},
|
||||
{
|
||||
"name": "verybig.lua",
|
||||
"status": "fail",
|
||||
"reason": "other: Unhandled exception: \\\"Unhandled exception: \\\\\\\"lua: attempt to call non-functio",
|
||||
"ms": 545
|
||||
"ms": 572
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -5,9 +5,10 @@ fail=13 timeout=3 skip=8 total=24
|
||||
|
||||
## Top failure modes
|
||||
|
||||
- **10x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\
|
||||
- **9x** other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\
|
||||
- **3x** timeout
|
||||
- **2x** other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio
|
||||
- **1x** other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to compare incompat
|
||||
- **1x** other: Unhandled exception: \"Not callable: nil (kont=10 frames)\
|
||||
|
||||
## Per-test results
|
||||
@@ -16,25 +17,25 @@ fail=13 timeout=3 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 | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5719 |
|
||||
| attrib.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6000 |
|
||||
| big.lua | timeout | per-test timeout | 8006 |
|
||||
| calls.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4548 |
|
||||
| calls.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4946 |
|
||||
| checktable.lua | skip | internal debug helpers | 0 |
|
||||
| closure.lua | timeout | per-test timeout | 8003 |
|
||||
| code.lua | skip | bytecode inspection via debug library | 0 |
|
||||
| constructs.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4153 |
|
||||
| constructs.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to compare incompat | 4533 |
|
||||
| db.lua | skip | debug library | 0 |
|
||||
| errors.lua | fail | other: Unhandled exception: \"Not callable: nil (kont=10 frames)\ | 2938 |
|
||||
| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6598 |
|
||||
| errors.lua | fail | other: Unhandled exception: \"Not callable: nil (kont=10 frames)\ | 3217 |
|
||||
| events.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7215 |
|
||||
| files.lua | skip | io library | 0 |
|
||||
| gc.lua | skip | collectgarbage / finalisers | 0 |
|
||||
| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1859 |
|
||||
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1687 |
|
||||
| literals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 1901 |
|
||||
| locals.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 1693 |
|
||||
| main.lua | skip | standalone interpreter driver | 0 |
|
||||
| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3774 |
|
||||
| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6637 |
|
||||
| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 5886 |
|
||||
| math.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4095 |
|
||||
| nextvar.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 7177 |
|
||||
| pm.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 6048 |
|
||||
| sort.lua | timeout | per-test timeout | 8007 |
|
||||
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 4040 |
|
||||
| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2064 |
|
||||
| verybig.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 545 |
|
||||
| strings.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 3990 |
|
||||
| vararg.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"assertion failed!\\\"\ | 2249 |
|
||||
| verybig.lua | fail | other: Unhandled exception: \"Unhandled exception: \\\"lua: attempt to call non-functio | 572 |
|
||||
|
||||
@@ -928,6 +928,14 @@ cat > "$TMPFILE" << 'EPOCHS'
|
||||
(epoch 1831)
|
||||
(eval "(lua-eval-ast \"if \\\"\\\\09912\\\" == \\\"c12\\\" then return 1 else return 0 end\")")
|
||||
|
||||
;; ── Unary-minus / ^ precedence (Lua spec: ^ tighter than -) ──
|
||||
(epoch 1840)
|
||||
(eval "(lua-eval-ast \"return -2^2\")")
|
||||
(epoch 1841)
|
||||
(eval "(lua-eval-ast \"return 2^3^2\")")
|
||||
(epoch 1842)
|
||||
(eval "(lua-eval-ast \"if -2^2 == -4 then return 1 else return 0 end\")")
|
||||
|
||||
EPOCHS
|
||||
|
||||
OUTPUT=$(timeout 60 "$SX_SERVER" < "$TMPFILE" 2>/dev/null)
|
||||
@@ -1401,6 +1409,11 @@ check 1821 "arg[i] access" '60'
|
||||
check 1830 "\\65 → A" '"A"'
|
||||
check 1831 "\\099 + 12 → c12" '1'
|
||||
|
||||
# ── Unary-minus / ^ precedence (Lua: ^ tighter than unary -) ──
|
||||
check 1840 "-2^2 = -4" '-4'
|
||||
check 1841 "2^3^2 = 512 (right-assoc)" '512'
|
||||
check 1842 "-2^2 == -4 true" '1'
|
||||
|
||||
TOTAL=$((PASS + FAIL))
|
||||
if [ $FAIL -eq 0 ]; then
|
||||
echo "ok $PASS/$TOTAL Lua-on-SX tests passed"
|
||||
|
||||
Reference in New Issue
Block a user