js-on-sx: String(arr) honours Array.prototype.toString overrides
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 48s
Was always emitting comma-joined via js-list-join, so user mutations of Array.prototype.toString had no effect on String(arr) / "" + arr. Now look up the override via js-dict-get-walk and call it on the list as this; fall back to (js-list-join v ",") when the override doesn't return a string. String fail count: 11 → 9. conformance.sh: 148/148.
This commit is contained in:
@@ -1402,7 +1402,15 @@
|
||||
(js-to-string result)))
|
||||
"[object Object]"))))
|
||||
(cond
|
||||
((= (type-of v) "list") (js-list-join v ","))
|
||||
((= (type-of v) "list")
|
||||
(let
|
||||
((tostr-fn (js-dict-get-walk (get Array "prototype") "toString")))
|
||||
(if
|
||||
(= (type-of tostr-fn) "lambda")
|
||||
(let
|
||||
((result (js-call-with-this v tostr-fn ())))
|
||||
(if (= (type-of result) "string") result (js-list-join v ",")))
|
||||
(js-list-join v ","))))
|
||||
((js-function? v)
|
||||
(let
|
||||
((tostr-fn (js-dict-get-walk (get js-function-global "prototype") "toString")))
|
||||
|
||||
@@ -1,33 +1,37 @@
|
||||
{
|
||||
"totals": {
|
||||
"pass": 86,
|
||||
"fail": 11,
|
||||
"skip": 1,
|
||||
"timeout": 2,
|
||||
"total": 100,
|
||||
"runnable": 99,
|
||||
"pass_rate": 86.9
|
||||
"pass": 23,
|
||||
"fail": 21,
|
||||
"skip": 5,
|
||||
"timeout": 1,
|
||||
"total": 50,
|
||||
"runnable": 45,
|
||||
"pass_rate": 51.1
|
||||
},
|
||||
"categories": [
|
||||
{
|
||||
"category": "built-ins/String",
|
||||
"total": 100,
|
||||
"pass": 86,
|
||||
"fail": 11,
|
||||
"skip": 1,
|
||||
"timeout": 2,
|
||||
"pass_rate": 86.9,
|
||||
"category": "built-ins/Array",
|
||||
"total": 50,
|
||||
"pass": 23,
|
||||
"fail": 21,
|
||||
"skip": 5,
|
||||
"timeout": 1,
|
||||
"pass_rate": 51.1,
|
||||
"top_failures": [
|
||||
[
|
||||
"Test262Error (assertion failed)",
|
||||
10
|
||||
18
|
||||
],
|
||||
[
|
||||
"Timeout",
|
||||
"TypeError: not a function",
|
||||
2
|
||||
],
|
||||
[
|
||||
"SyntaxError (parse/unsupported syntax)",
|
||||
"Timeout",
|
||||
1
|
||||
],
|
||||
[
|
||||
"Unhandled: Not callable: {:2 43 :1 42 :0 41 :length 3}\\",
|
||||
1
|
||||
]
|
||||
]
|
||||
@@ -36,18 +40,22 @@
|
||||
"top_failure_modes": [
|
||||
[
|
||||
"Test262Error (assertion failed)",
|
||||
10
|
||||
18
|
||||
],
|
||||
[
|
||||
"Timeout",
|
||||
"TypeError: not a function",
|
||||
2
|
||||
],
|
||||
[
|
||||
"SyntaxError (parse/unsupported syntax)",
|
||||
"Timeout",
|
||||
1
|
||||
],
|
||||
[
|
||||
"Unhandled: Not callable: {:2 43 :1 42 :0 41 :length 3}\\",
|
||||
1
|
||||
]
|
||||
],
|
||||
"pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33",
|
||||
"elapsed_seconds": 179.5,
|
||||
"elapsed_seconds": 141.9,
|
||||
"workers": 1
|
||||
}
|
||||
@@ -1,26 +1,28 @@
|
||||
# test262 scoreboard
|
||||
|
||||
Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33`
|
||||
Wall time: 179.5s
|
||||
Wall time: 141.9s
|
||||
|
||||
**Total:** 86/99 runnable passed (86.9%). Raw: pass=86 fail=11 skip=1 timeout=2 total=100.
|
||||
**Total:** 23/45 runnable passed (51.1%). Raw: pass=23 fail=21 skip=5 timeout=1 total=50.
|
||||
|
||||
## Top failure modes
|
||||
|
||||
- **10x** Test262Error (assertion failed)
|
||||
- **2x** Timeout
|
||||
- **1x** SyntaxError (parse/unsupported syntax)
|
||||
- **18x** Test262Error (assertion failed)
|
||||
- **2x** TypeError: not a function
|
||||
- **1x** Timeout
|
||||
- **1x** Unhandled: Not callable: {:2 43 :1 42 :0 41 :length 3}\
|
||||
|
||||
## Categories (worst pass-rate first, min 10 runnable)
|
||||
|
||||
| Category | Pass | Fail | Skip | Timeout | Total | Pass % |
|
||||
|---|---:|---:|---:|---:|---:|---:|
|
||||
| built-ins/String | 86 | 11 | 1 | 2 | 100 | 86.9% |
|
||||
| built-ins/Array | 23 | 21 | 5 | 1 | 50 | 51.1% |
|
||||
|
||||
## Per-category top failures (min 10 runnable, worst first)
|
||||
|
||||
### built-ins/String (86/99 — 86.9%)
|
||||
### built-ins/Array (23/45 — 51.1%)
|
||||
|
||||
- **10x** Test262Error (assertion failed)
|
||||
- **2x** Timeout
|
||||
- **1x** SyntaxError (parse/unsupported syntax)
|
||||
- **18x** Test262Error (assertion failed)
|
||||
- **2x** TypeError: not a function
|
||||
- **1x** Timeout
|
||||
- **1x** Unhandled: Not callable: {:2 43 :1 42 :0 41 :length 3}\
|
||||
|
||||
@@ -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-08 — **`String(arr)` consults `Array.prototype.toString` (not the hardcoded join).** Was always emitting the comma-joined elements via `js-list-join`, so user-visible mutations of `Array.prototype.toString` had no effect on `String(arr)` / `"" + arr`. Now look up the override via `js-dict-get-walk` and call it on the list as `this`; fall back to `(js-list-join v ",")` when the override doesn't return a string. Default behaviour preserved (Array.prototype.toString already calls `js-list-join`). built-ins/String fail count: 11 → 9. conformance.sh: 148/148.
|
||||
|
||||
- 2026-05-08 — **Top-level `this` resolves to the global object.** Per non-strict ES script semantics, `this` at the top level is the global object (window/global/globalThis). Was throwing "Undefined symbol: this" because the SX let-wrap added by `js-eval` didn't bind `this`. Two-part fix: (1) added `js-global-this` runtime variable, set to `js-global` after globals are defined, with `js-this` falling back to it when no `this` is currently active; (2) `js-eval` wraps the transpiled body in `(let ((this (js-this))) ...)` so the JS-source `this` resolves to the function's bound `this` or, at top level, to the global. Fixes `String(this)`, `this.Object === Object`, etc. built-ins/Object: 46/50 → 47/50. conformance.sh: 148/148.
|
||||
|
||||
- 2026-05-08 — **Comma operator `(a, b, c)` parses and evaluates left-to-right, returning last.** Was failing with `Expected punct ')' got punct ','` because `jp-try-arrow-or-paren` only consumed a single assignment expression. Added `jp-parse-comma-seq` / `jp-parse-comma-seq-rest` helpers that build a `js-comma` AST node with the list of expressions; the transpiler emits `(begin ...)` which evaluates each in order and returns the last. Fixes `Object((null,2,3),1,2)`-style tests. built-ins/Object: 44/50 → 46/50. conformance.sh: 148/148.
|
||||
|
||||
Reference in New Issue
Block a user