From 66f13c95d5f35dc34b8f5eb4b97eb9d4d417e2e6 Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 7 May 2026 12:45:06 +0000 Subject: [PATCH] js-on-sx: js-to-string emits comma-joined elements for SX lists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit String([1,2,3]) was returning "(1 2 3)" (the SX (str v) fallback in js-to-string fell through for SX lists). Replaced the fallback with a list-typed branch that delegates to (js-list-join v ","). Fixes String(arr), "" + arr, and any implicit array-to-string coercion. built-ins/String: 65/99 → 67/99. conformance.sh: 148/148. --- lib/js/runtime.sx | 2 +- lib/js/test262-scoreboard.json | 38 +++++++++++++++------------------- lib/js/test262-scoreboard.md | 19 ++++++++--------- plans/js-on-sx.md | 2 ++ 4 files changed, 29 insertions(+), 32 deletions(-) diff --git a/lib/js/runtime.sx b/lib/js/runtime.sx index 6e4f1591..0421519e 100644 --- a/lib/js/runtime.sx +++ b/lib/js/runtime.sx @@ -1231,7 +1231,7 @@ "[object Object]")) (js-to-string result))) "[object Object]")))) - (str v)))))) + (if (= (type-of v) "list") (js-list-join v ",") (str v))))))) (define js-template-concat diff --git a/lib/js/test262-scoreboard.json b/lib/js/test262-scoreboard.json index 852e7b94..722624e3 100644 --- a/lib/js/test262-scoreboard.json +++ b/lib/js/test262-scoreboard.json @@ -1,34 +1,30 @@ { "totals": { - "pass": 65, - "fail": 28, + "pass": 67, + "fail": 19, "skip": 1, - "timeout": 6, + "timeout": 13, "total": 100, "runnable": 99, - "pass_rate": 65.7 + "pass_rate": 67.7 }, "categories": [ { "category": "built-ins/String", "total": 100, - "pass": 65, - "fail": 28, + "pass": 67, + "fail": 19, "skip": 1, - "timeout": 6, - "pass_rate": 65.7, + "timeout": 13, + "pass_rate": 67.7, "top_failures": [ [ "Test262Error (assertion failed)", - 16 - ], - [ - "TypeError: not a function", - 8 + 15 ], [ "Timeout", - 6 + 13 ], [ "Unhandled: Not callable: \\\\\\", @@ -37,6 +33,10 @@ [ "ReferenceError (undefined symbol)", 1 + ], + [ + "SyntaxError (parse/unsupported syntax)", + 1 ] ] } @@ -44,15 +44,11 @@ "top_failure_modes": [ [ "Test262Error (assertion failed)", - 16 - ], - [ - "TypeError: not a function", - 8 + 15 ], [ "Timeout", - 6 + 13 ], [ "Unhandled: Not callable: \\\\\\", @@ -68,6 +64,6 @@ ] ], "pinned_commit": "d5e73fc8d2c663554fb72e2380a8c2bc1a318a33", - "elapsed_seconds": 353.1, + "elapsed_seconds": 580.2, "workers": 1 } \ No newline at end of file diff --git a/lib/js/test262-scoreboard.md b/lib/js/test262-scoreboard.md index 40d688ce..1a4b35ea 100644 --- a/lib/js/test262-scoreboard.md +++ b/lib/js/test262-scoreboard.md @@ -1,15 +1,14 @@ # test262 scoreboard Pinned commit: `d5e73fc8d2c663554fb72e2380a8c2bc1a318a33` -Wall time: 353.1s +Wall time: 580.2s -**Total:** 65/99 runnable passed (65.7%). Raw: pass=65 fail=28 skip=1 timeout=6 total=100. +**Total:** 67/99 runnable passed (67.7%). Raw: pass=67 fail=19 skip=1 timeout=13 total=100. ## Top failure modes -- **16x** Test262Error (assertion failed) -- **8x** TypeError: not a function -- **6x** Timeout +- **15x** Test262Error (assertion failed) +- **13x** Timeout - **2x** Unhandled: Not callable: \\\ - **1x** ReferenceError (undefined symbol) - **1x** SyntaxError (parse/unsupported syntax) @@ -18,14 +17,14 @@ Wall time: 353.1s | Category | Pass | Fail | Skip | Timeout | Total | Pass % | |---|---:|---:|---:|---:|---:|---:| -| built-ins/String | 65 | 28 | 1 | 6 | 100 | 65.7% | +| built-ins/String | 67 | 19 | 1 | 13 | 100 | 67.7% | ## Per-category top failures (min 10 runnable, worst first) -### built-ins/String (65/99 — 65.7%) +### built-ins/String (67/99 — 67.7%) -- **16x** Test262Error (assertion failed) -- **8x** TypeError: not a function -- **6x** Timeout +- **15x** Test262Error (assertion failed) +- **13x** Timeout - **2x** Unhandled: Not callable: \\\ - **1x** ReferenceError (undefined symbol) +- **1x** SyntaxError (parse/unsupported syntax) diff --git a/plans/js-on-sx.md b/plans/js-on-sx.md index 5fc77465..e2416d89 100644 --- a/plans/js-on-sx.md +++ b/plans/js-on-sx.md @@ -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-to-string` of arrays returns comma-joined elements, not SX list source.** `String([1,2,3])` was returning `"(1 2 3)"` (SX `(str v)` formatting) — should be `"1,2,3"`. Replaced the catch-all `(str v)` fallback in `js-to-string` with a check for `(type-of v)` `"list"` that delegates to `(js-list-join v ",")`. Fixes `String(new Array(...))`, `"" + arr`, and any implicit array-to-string coercion. built-ins/String 65/99 → 67/99. conformance.sh: 148/148. + - 2026-05-07 — **JS lexer: handle `\uXXXX` and `\xXX` escape sequences in string literals.** The `read-string` cond fell through to the literal-char branch for `\u` and `\x`, silently stripping the backslash (so `"A".length` returned 5 instead of 1). Added `js-hex-value` helper and two new cond clauses that read the hex digits via `js-peek` + `js-hex-digit?`, compute the code point, and emit it via `char-from-code`. Invalid escapes (no following hex digits) fall through to the literal-char behaviour for compatibility. With test isolation (`--restart-every 1`) built-ins/String 65/99 → 68/99. Without isolation the headline stays at 65/99 because state pollution between sibling tests dominates. conformance.sh: 148/148. - 2026-05-07 — **Bump test262 runner default per-test timeout 5s→15s.** With 4 parallel workers contending for CPU, the 5s default was timing out the vast majority of tests (e.g. 85/99 on built-ins/String). Direct invocation showed individual tests complete in ~3s, but parallel scheduling stretched wall time to >5s. Bumping to 15s makes the scoreboard usable: built-ins/String 14.1% → 65.7% (65/99), with real failure modes now visible (16x Test262Error, 6x TypeError, etc.) instead of "85x Timeout" drowning the signal. Regenerated scoreboard to reflect the new state. conformance.sh: 148/148.