js-on-sx: raise JS TypeError for non-callable callee, undefined()
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 59s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 59s
Calling a non-callable raised an OCaml-level Eval_error "Not callable" that JS try/catch couldn't intercept. Added a (js-function? callable) precheck in js-apply-fn that raises a TypeError instance via (js-new-call TypeError (list msg)) so e instanceof TypeError is true. Same swap for the undefined() branch in js-call-plain (was raising a bare string). built-ins/String: 71/99 → 73/99 (canonical), 74/99 → 75/99 (isolated). conformance.sh: 148/148.
This commit is contained in:
@@ -425,30 +425,44 @@
|
||||
(fn-val args)
|
||||
(let
|
||||
((callable (if (and (dict? fn-val) (contains? (keys fn-val) "__callable__")) (get fn-val "__callable__") fn-val)))
|
||||
(cond
|
||||
((= (len args) 0) (callable))
|
||||
((= (len args) 1) (callable (nth args 0)))
|
||||
((= (len args) 2) (callable (nth args 0) (nth args 1)))
|
||||
((= (len args) 3)
|
||||
(callable (nth args 0) (nth args 1) (nth args 2)))
|
||||
((= (len args) 4)
|
||||
(callable (nth args 0) (nth args 1) (nth args 2) (nth args 3)))
|
||||
((= (len args) 5)
|
||||
(callable
|
||||
(nth args 0)
|
||||
(nth args 1)
|
||||
(nth args 2)
|
||||
(nth args 3)
|
||||
(nth args 4)))
|
||||
((= (len args) 6)
|
||||
(callable
|
||||
(nth args 0)
|
||||
(nth args 1)
|
||||
(nth args 2)
|
||||
(nth args 3)
|
||||
(nth args 4)
|
||||
(nth args 5)))
|
||||
(else (apply callable args))))))
|
||||
(if
|
||||
(not (js-function? callable))
|
||||
(raise
|
||||
(js-new-call
|
||||
TypeError
|
||||
(list (str (str fn-val) " is not a function"))))
|
||||
(cond
|
||||
((= (len args) 0) (callable))
|
||||
((= (len args) 1) (callable (nth args 0)))
|
||||
((= (len args) 2)
|
||||
(callable (nth args 0) (nth args 1)))
|
||||
((= (len args) 3)
|
||||
(callable
|
||||
(nth args 0)
|
||||
(nth args 1)
|
||||
(nth args 2)))
|
||||
((= (len args) 4)
|
||||
(callable
|
||||
(nth args 0)
|
||||
(nth args 1)
|
||||
(nth args 2)
|
||||
(nth args 3)))
|
||||
((= (len args) 5)
|
||||
(callable
|
||||
(nth args 0)
|
||||
(nth args 1)
|
||||
(nth args 2)
|
||||
(nth args 3)
|
||||
(nth args 4)))
|
||||
((= (len args) 6)
|
||||
(callable
|
||||
(nth args 0)
|
||||
(nth args 1)
|
||||
(nth args 2)
|
||||
(nth args 3)
|
||||
(nth args 4)
|
||||
(nth args 5)))
|
||||
(else (apply callable args)))))))
|
||||
|
||||
;; ── Relational comparisons ────────────────────────────────────────
|
||||
|
||||
@@ -608,7 +622,7 @@
|
||||
(fn-val args)
|
||||
(cond
|
||||
((js-undefined? fn-val)
|
||||
(error "TypeError: undefined is not a function"))
|
||||
(raise (js-new-call TypeError (list "undefined is not a function"))))
|
||||
((and (dict? fn-val) (contains? (keys fn-val) "__callable__"))
|
||||
(js-call-with-this :js-undefined (get fn-val "__callable__") args))
|
||||
(else (js-call-with-this :js-undefined fn-val args)))))
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
{
|
||||
"totals": {
|
||||
"pass": 71,
|
||||
"fail": 22,
|
||||
"pass": 73,
|
||||
"fail": 20,
|
||||
"skip": 1,
|
||||
"timeout": 6,
|
||||
"total": 100,
|
||||
"runnable": 99,
|
||||
"pass_rate": 71.7
|
||||
"pass_rate": 73.7
|
||||
},
|
||||
"categories": [
|
||||
{
|
||||
"category": "built-ins/String",
|
||||
"total": 100,
|
||||
"pass": 71,
|
||||
"fail": 22,
|
||||
"pass": 73,
|
||||
"fail": 20,
|
||||
"skip": 1,
|
||||
"timeout": 6,
|
||||
"pass_rate": 71.7,
|
||||
"pass_rate": 73.7,
|
||||
"top_failures": [
|
||||
[
|
||||
"Test262Error (assertion failed)",
|
||||
@@ -31,11 +31,11 @@
|
||||
6
|
||||
],
|
||||
[
|
||||
"Unhandled: Not callable: \\\\\\",
|
||||
2
|
||||
"ReferenceError (undefined symbol)",
|
||||
1
|
||||
],
|
||||
[
|
||||
"ReferenceError (undefined symbol)",
|
||||
"SyntaxError (parse/unsupported syntax)",
|
||||
1
|
||||
]
|
||||
]
|
||||
@@ -54,10 +54,6 @@
|
||||
"Timeout",
|
||||
6
|
||||
],
|
||||
[
|
||||
"Unhandled: Not callable: \\\\\\",
|
||||
2
|
||||
],
|
||||
[
|
||||
"ReferenceError (undefined symbol)",
|
||||
1
|
||||
@@ -68,6 +64,6 @@
|
||||
]
|
||||
],
|
||||
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
|
||||
"elapsed_seconds": 375.3,
|
||||
"elapsed_seconds": 280.3,
|
||||
"workers": 1
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
# test262 scoreboard
|
||||
|
||||
Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33`
|
||||
Wall time: 375.3s
|
||||
Wall time: 280.3s
|
||||
|
||||
**Total:** 71/99 runnable passed (71.7%). Raw: pass=71 fail=22 skip=1 timeout=6 total=100.
|
||||
**Total:** 73/99 runnable passed (73.7%). Raw: pass=73 fail=20 skip=1 timeout=6 total=100.
|
||||
|
||||
## Top failure modes
|
||||
|
||||
- **10x** Test262Error (assertion failed)
|
||||
- **8x** TypeError: not a function
|
||||
- **6x** Timeout
|
||||
- **2x** Unhandled: Not callable: \\\
|
||||
- **1x** ReferenceError (undefined symbol)
|
||||
- **1x** SyntaxError (parse/unsupported syntax)
|
||||
|
||||
@@ -18,14 +17,14 @@ Wall time: 375.3s
|
||||
|
||||
| Category | Pass | Fail | Skip | Timeout | Total | Pass % |
|
||||
|---|---:|---:|---:|---:|---:|---:|
|
||||
| built-ins/String | 71 | 22 | 1 | 6 | 100 | 71.7% |
|
||||
| built-ins/String | 73 | 20 | 1 | 6 | 100 | 73.7% |
|
||||
|
||||
## Per-category top failures (min 10 runnable, worst first)
|
||||
|
||||
### built-ins/String (71/99 — 71.7%)
|
||||
### built-ins/String (73/99 — 73.7%)
|
||||
|
||||
- **10x** Test262Error (assertion failed)
|
||||
- **8x** TypeError: not a function
|
||||
- **6x** Timeout
|
||||
- **2x** Unhandled: Not callable: \\\
|
||||
- **1x** ReferenceError (undefined symbol)
|
||||
- **1x** SyntaxError (parse/unsupported syntax)
|
||||
|
||||
Reference in New Issue
Block a user