js-on-sx: TypeError-on-not-callable uses type-of, not (str fn-val)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 56s

Formatting wrapper dicts with (str fn-val) recursively walks the
proto chain through SX inspect — for String/Number wrappers whose
prototype contains lambdas this hangs. Switched the message to
(type-of fn-val), e.g. "dict is not a function". Less specific
but always terminates.
built-ins/String: 73/99 → 75/99 (canonical). conformance.sh:
148/148.
This commit is contained in:
2026-05-07 16:54:06 +00:00
parent 843c3a7e5e
commit 95fb5ef8ef
4 changed files with 22 additions and 20 deletions

View File

@@ -430,7 +430,7 @@
(raise
(js-new-call
TypeError
(list (str (str fn-val) " is not a function"))))
(list (str (type-of fn-val) " is not a function"))))
(cond
((= (len args) 0) (callable))
((= (len args) 1) (callable (nth args 0)))

View File

@@ -1,33 +1,33 @@
{
"totals": {
"pass": 73,
"fail": 20,
"pass": 75,
"fail": 18,
"skip": 1,
"timeout": 6,
"total": 100,
"runnable": 99,
"pass_rate": 73.7
"pass_rate": 75.8
},
"categories": [
{
"category": "built-ins/String",
"total": 100,
"pass": 73,
"fail": 20,
"pass": 75,
"fail": 18,
"skip": 1,
"timeout": 6,
"pass_rate": 73.7,
"pass_rate": 75.8,
"top_failures": [
[
"Test262Error (assertion failed)",
10
],
[
"TypeError: not a function",
8
"Timeout",
6
],
[
"Timeout",
"TypeError: not a function",
6
],
[
@@ -47,11 +47,11 @@
10
],
[
"TypeError: not a function",
8
"Timeout",
6
],
[
"Timeout",
"TypeError: not a function",
6
],
[
@@ -64,6 +64,6 @@
]
],
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
"elapsed_seconds": 280.3,
"elapsed_seconds": 382.7,
"workers": 1
}

View File

@@ -1,15 +1,15 @@
# test262 scoreboard
Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33`
Wall time: 280.3s
Wall time: 382.7s
**Total:** 73/99 runnable passed (73.7%). Raw: pass=73 fail=20 skip=1 timeout=6 total=100.
**Total:** 75/99 runnable passed (75.8%). Raw: pass=75 fail=18 skip=1 timeout=6 total=100.
## Top failure modes
- **10x** Test262Error (assertion failed)
- **8x** TypeError: not a function
- **6x** Timeout
- **6x** TypeError: not a function
- **1x** ReferenceError (undefined symbol)
- **1x** SyntaxError (parse/unsupported syntax)
@@ -17,14 +17,14 @@ Wall time: 280.3s
| Category | Pass | Fail | Skip | Timeout | Total | Pass % |
|---|---:|---:|---:|---:|---:|---:|
| built-ins/String | 73 | 20 | 1 | 6 | 100 | 73.7% |
| built-ins/String | 75 | 18 | 1 | 6 | 100 | 75.8% |
## Per-category top failures (min 10 runnable, worst first)
### built-ins/String (73/99 — 73.7%)
### built-ins/String (75/99 — 75.8%)
- **10x** Test262Error (assertion failed)
- **8x** TypeError: not a function
- **6x** Timeout
- **6x** TypeError: not a function
- **1x** ReferenceError (undefined symbol)
- **1x** SyntaxError (parse/unsupported syntax)

View File

@@ -158,6 +158,8 @@ Each item: implement → tests → update progress. Mark `[x]` when tests green.
Append-only record of completed iterations. Loop writes one line per iteration: date, what was done, test count delta.
- 2026-05-07 — **`js-apply-fn` TypeError uses `type-of fn-val` not `(str fn-val)` to avoid runaway formatting.** Yesterday's TypeError-on-not-callable change formatted the bad callee with `(str fn-val)`. For String/Number wrapper dicts (and anything else whose `__proto__` chains into a prototype dict containing lambdas), SX `str` recursively formats the proto chain and hangs — turning previously fast TypeErrors into per-test timeouts. Switched to `(type-of fn-val)` (e.g. "dict is not a function"). Less specific but always terminates. built-ins/String: 73/99 → 75/99 (canonical). conformance.sh: 148/148.
- 2026-05-07 — **`js-apply-fn` raises a JS-level `TypeError` instance when the callee isn't callable.** Calling a non-callable (`'a'()`, `(1+2)()`, etc.) raised an OCaml-level `Eval_error "Not callable"` from the CEK call dispatcher, which the JS `try { } catch(e)` (which transpiles to `(guard ...)`) couldn't intercept. Added a `(js-function? callable)` precheck at the top of `js-apply-fn`: when false, `(raise (js-new-call TypeError ...))` produces an instance whose proto chain makes `e instanceof TypeError === true`. Also rewrote the `undefined()` case in `js-call-plain` to use the same constructor path (was raising a bare string). built-ins/String: 71/99 → 73/99 (canonical), 74/99 → 75/99 (isolated). conformance.sh: 148/148.
- 2026-05-07 — **`js-dict-get-walk` falls back to `Object.prototype` when an object has no `__proto__`.** Object literals (`{}`, `{a:1}`) didn't carry a `__proto__` link, so `({}).toString()` couldn't find `Object.prototype.toString` — and overriding `Object.prototype.toString` had no effect on plain objects. Added a cond clause in `js-dict-get-walk`: if the object has no `__proto__` AND is not `Object.prototype` itself, walk into `Object.prototype`. Termination guaranteed because Object.prototype is the recursion base case. Now `({}).toString() === "[object Object]"`, override of `Object.prototype.toString` propagates to plain objects, and `({a:1}).hasOwnProperty('a') === true`. built-ins/String: 69/99 → 71/99 (canonical), 71/99 → 74/99 (isolated). conformance.sh: 148/148.