Conversation
SetFunctionName wraps a Symbol key's description in brackets, and a registered symbol's description is its key string, so a method keyed by Symbol.for('registered') is named '[registered]'. The existing tests only used unique symbols, which is how XS shipped a bug that dropped the brackets for registered ones.
|
8 new or modified tests were run on 7 engines.
|
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.
Closes #3436.
The method and accessor
fn-nametests check.namefor methods keyed by a unique symbol (Symbol('test262')gives[test262]) and by an anonymous one (the empty string), but never by a registered symbol fromSymbol.for. SetFunctionName treats both kinds the same way: a Symbol key becomes its [[Description]] in brackets, andSymbol.forstores its key string as the description. XS got this wrong for registered symbols and returned the description without brackets (Moddable-OpenSource/moddable#876), which is where this issue came from.This adds a
Symbol.for('registered')key next to the existing unique-symbol key in the eight tests that cover methods and accessors:Each gets the same
verifyPropertycheck as its unique-symbol neighbour, expecting[registered](orget [registered]/set [registered]).I left the
fn-name-arrow,-class,-cover,-fnand-gentests for property assignments like{ [sym]: function () {} }alone, since those reach SetFunctionName through NamedEvaluation, not DefineMethod, and the issue is about methods. Happy to extend them too if that is wanted.Checked locally with Node and engine262: all eight pass, and each one fails on both when its expected value is changed to the XS output (
registeredwithout brackets). Thanks to gibson042 for the report and the XS repro.LLM disclosure: Claude Opus 5.5 helped me find the gap, write the change and check it; I reviewed the result.