Repository navigation
Conversation
A line terminator after get, set or static, or between a method name and its parameter list, does not end the element as a field, since only async and accessor have a [no LineTerminator here] restriction. Also covers a method named static, and a getter whose name is on the next line but that has no parameter list.
|
8 new or modified tests were run on 7 engines.
|
Contributor
Author
|
The failures in the engine table are engine bugs, reproduced outside the harness with small snippets:
V8, SpiderMonkey, JavaScriptCore and GraalJS pass all 8. |
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.
test262 checks that a semicolon is inserted between a field named
getorsetand a generator method on the next line (grammar-field-named-get-followed-by-generator-asi.jsand itssetsibling). It does not check the other side: when the token on the next line can continue the element, no semicolon is inserted, because onlyasyncandaccessorare followed by [no LineTerminator here].engine262 gets these wrong, and nothing in the suite catches it. This adds, next to the two existing ASI tests in
class/elements/syntax/valid:getorset, a line break, then a name: a getter or setter (prototype, static, computed and private)static, a line break, then a method, generator, async method or getter: a static methodstatic, a line break, then a field name: a static fieldstatic, asstatic(),static static()andstaticwith(on the next line(: a method, form,getandsetget, a line break, then a name with no parameter list (generated, class declaration and expression)I could not find an existing test for a class method named
static. The onlystatic()methods in the suite are object literal methods instaging/sm/class/methDefn.js.I found this while reviewing #5134: with the escapes removed from its cases, engine262 read
get, a line break anda() {}as a field and a method.Results, default and strict mode:
The engine262 fix is engine262/engine262#368.
Lint is clean. To check that each test can fail, I ran mutated copies: flipping the key expectation in each positive test, and giving the getter in the negative test its parameter list. All of them fail on all four engines.
LLM disclosure: Claude Opus 5.5 helped me find the gap, write the tests and check them; I reviewed the result.