Skip to content

test262: Array conformance fixes (wave 15) - #79

Merged
hiett merged 1 commit into
experiment/js-frontendfrom
js262/wave15-Array
Jul 15, 2026
Merged

test262: Array conformance fixes (wave 15)#79
hiett merged 1 commit into
experiment/js-frontendfrom
js262/wave15-Array

Conversation

@hiett

@hiett hiett commented Jul 15, 2026

Copy link
Copy Markdown
Owner

Array.prototype.join — undefined separator defaults to ","

Per ES2023 §23.1.3.18 step 3, an undefined separator argument must default to the single comma ",", NOT be coerced via ToString (which would yield the string "undefined").

The runtime's array_join/2 called to_string(Sep) unconditionally, so:

  • [0,1,2,3].join(undefined) produced "0undefined1undefined2undefined3" instead of the spec-correct "0,1,2,3".
  • A variable that is undefined at runtime hit the same bug.

A null separator is still ToString'd normally (to "null"), and holes / null / undefined ELEMENTS still render as the empty string — both matching the spec.

Mirrors test262 built-ins/Array/prototype/join/S15.4.4.5_A1.2_T2.js (currently blocked in the runner by the new Test262Error harness-class gap, so validated via a spec-driven unit test in js_compiler_test instead).

Tests

Added wave15_array_join_undefined_separator_test covering the undefined/no-arg/null/explicit-separator and undefined-element cases. Full js_compiler_test green; only the 3 pre-existing WASM .wat fixture failures remain.

Per ES2023 §23.1.3.18 step 3, when the separator argument is undefined the
join separator defaults to the single comma "," rather than being coerced
via ToString (which would yield "undefined"). The runtime was calling
to_string/1 unconditionally, so [1, 2].join(undefined) produced
"1undefined2" instead of "1,2". A null separator is still ToString'd
normally (to "null"), matching the spec.
@hiett
hiett merged commit 8cc2154 into experiment/js-frontend Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant