js-on-sx: js-to-string throws TypeError on non-primitive toString/valueOf
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 52s

Per ECMA, String(obj) should throw TypeError when both
obj.toString() and obj.valueOf() return objects. Was returning
"[object Object]" instead, silently swallowing the spec violation.
Replaced the inner fallback with (raise (js-new-call TypeError ...)).
Preserves the outer "[object Object]" for the case where there's
no toString lambda. Fixes S8.12.8_A1.
built-ins/String: 75/99 → 77/99 (canonical, best run).
conformance.sh: 148/148.
This commit is contained in:
2026-05-07 17:44:30 +00:00
parent 95fb5ef8ef
commit f4b0ebf353
4 changed files with 26 additions and 20 deletions

View File

@@ -1259,7 +1259,11 @@
((result2 (js-call-with-this v valueof-fn ())))
(if
(= (type-of result2) "dict")
"[object Object]"
(raise
(js-new-call
TypeError
(list
"Cannot convert object to primitive value")))
(js-to-string result2)))
"[object Object]"))
(js-to-string result)))

View File

@@ -1,26 +1,26 @@
{
"totals": {
"pass": 75,
"fail": 18,
"pass": 77,
"fail": 16,
"skip": 1,
"timeout": 6,
"total": 100,
"runnable": 99,
"pass_rate": 75.8
"pass_rate": 77.8
},
"categories": [
{
"category": "built-ins/String",
"total": 100,
"pass": 75,
"fail": 18,
"pass": 77,
"fail": 16,
"skip": 1,
"timeout": 6,
"pass_rate": 75.8,
"pass_rate": 77.8,
"top_failures": [
[
"Test262Error (assertion failed)",
10
12
],
[
"Timeout",
@@ -28,7 +28,7 @@
],
[
"TypeError: not a function",
6
2
],
[
"ReferenceError (undefined symbol)",
@@ -44,7 +44,7 @@
"top_failure_modes": [
[
"Test262Error (assertion failed)",
10
12
],
[
"Timeout",
@@ -52,7 +52,7 @@
],
[
"TypeError: not a function",
6
2
],
[
"ReferenceError (undefined symbol)",
@@ -64,6 +64,6 @@
]
],
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
"elapsed_seconds": 382.7,
"elapsed_seconds": 361.8,
"workers": 1
}

View File

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