test262: Array conformance fixes (wave 15) - #79
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Array.prototype.join — undefined separator defaults to ","
Per ES2023 §23.1.3.18 step 3, an
undefinedseparator argument must default to the single comma ",", NOT be coerced via ToString (which would yield the string "undefined").The runtime's
array_join/2calledto_string(Sep)unconditionally, so:[0,1,2,3].join(undefined)produced "0undefined1undefined2undefined3" instead of the spec-correct "0,1,2,3".undefinedat runtime hit the same bug.A
nullseparator 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 thenew Test262Errorharness-class gap, so validated via a spec-driven unit test in js_compiler_test instead).Tests
Added
wave15_array_join_undefined_separator_testcovering the undefined/no-arg/null/explicit-separator and undefined-element cases. Fulljs_compiler_testgreen; only the 3 pre-existing WASM .wat fixture failures remain.