WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
215966
[JSC] super property with new should be accepted
https://bugs.webkit.org/show_bug.cgi?id=215966
Summary
[JSC] super property with new should be accepted
Yusuke Suzuki
Reported
2020-08-28 20:18:34 PDT
[JSC] super property with new should be accepted
Attachments
Patch
(4.82 KB, patch)
2020-08-28 20:20 PDT
,
Yusuke Suzuki
no flags
Details
Formatted Diff
Diff
Patch
(8.68 KB, patch)
2020-08-28 22:47 PDT
,
Yusuke Suzuki
ross.kirsling
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2020-08-28 20:20:30 PDT
Created
attachment 407522
[details]
Patch
Yusuke Suzuki
Comment 2
2020-08-28 20:21:43 PDT
Interestingly, there is no test262 tests for that.
Alexey Shvayka
Comment 3
2020-08-28 22:18:19 PDT
Comment on
attachment 407522
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=407522&action=review
This is a great find! I've vetted ~130 LOC between the previous and current check location, everything looks correct.
> Source/JavaScriptCore/ChangeLog:8 > + While we should reject `new super` / `new super()`, we should accept `new super.property`.
Should we explain why by linking the grammar?
https://tc39.es/ecma262/#prod-SuperProperty
is a child production of
https://tc39.es/ecma262/#prod-MemberExpression
, unlike
https://tc39.es/ecma262/#prod-SuperCall
.
> Source/JavaScriptCore/parser/Parser.cpp:4977 > + semanticFailIfTrue(baseIsSuper, "Cannot use new with super");
There are 2 error messages that refer invalid super() as "super call" rather than just "super". It would be nice to follow that.
> JSTests/stress/super-and-new.js:42 > + shouldBe(typeof (new super["hey2"]()), "object");
A few more ideas on test coverage: ``` new async.super(); new new.target.super(); new super.super``; ?. ```
Alexey Shvayka
Comment 4
2020-08-28 22:19:11 PDT
(In reply to Yusuke Suzuki from
comment #2
)
> Interestingly, there is no test262 tests for that.
No open issue either. We should definitely add one since V8 8.4 experiences the same bug. SpiderMonkey is correct.
Yusuke Suzuki
Comment 5
2020-08-28 22:32:27 PDT
Comment on
attachment 407522
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=407522&action=review
Thanks!
>> Source/JavaScriptCore/ChangeLog:8 >> + While we should reject `new super` / `new super()`, we should accept `new super.property`. > > Should we explain why by linking the grammar? >
https://tc39.es/ecma262/#prod-SuperProperty
is a child production of
https://tc39.es/ecma262/#prod-MemberExpression
, unlike
https://tc39.es/ecma262/#prod-SuperCall
.
Sounds good, added.
>> Source/JavaScriptCore/parser/Parser.cpp:4977 >> + semanticFailIfTrue(baseIsSuper, "Cannot use new with super"); > > There are 2 error messages that refer invalid super() as "super call" rather than just "super". > It would be nice to follow that.
Sounds good. Changed.
>> JSTests/stress/super-and-new.js:42 >> + shouldBe(typeof (new super["hey2"]()), "object"); > > A few more ideas on test coverage: > > ``` > new async.super(); > new new.target.super(); > new super.super``; > ?. > ```
Added.
Yusuke Suzuki
Comment 6
2020-08-28 22:32:56 PDT
(In reply to Alexey Shvayka from
comment #4
)
> (In reply to Yusuke Suzuki from
comment #2
) > > Interestingly, there is no test262 tests for that. > > No open issue either. We should definitely add one since V8 8.4 experiences > the same bug. SpiderMonkey is correct.
Interesting! We should contribute it to test262.
Yusuke Suzuki
Comment 7
2020-08-28 22:47:35 PDT
Created
attachment 407528
[details]
Patch
Ross Kirsling
Comment 8
2020-08-28 23:08:42 PDT
Comment on
attachment 407528
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=407528&action=review
r=me
> LayoutTests/ChangeLog:9 > + * js/class-syntax-super-expected.txt: > + * js/script-tests/class-syntax-super.js:
Hmm, should we move this file out of LayoutTests while we're at it?
Yusuke Suzuki
Comment 9
2020-08-29 00:08:45 PDT
Comment on
attachment 407528
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=407528&action=review
>> LayoutTests/ChangeLog:9 >> + * js/script-tests/class-syntax-super.js: > > Hmm, should we move this file out of LayoutTests while we're at it?
Yeah, I think we should do that in a separate patch.
Yusuke Suzuki
Comment 10
2020-08-29 00:09:01 PDT
Mac-debug-wk1 failure is WebAudio ones we already know.
Yusuke Suzuki
Comment 11
2020-08-29 00:11:48 PDT
Committed
r266322
: <
https://trac.webkit.org/changeset/266322
>
Radar WebKit Bug Importer
Comment 12
2020-08-29 00:12:14 PDT
<
rdar://problem/67983175
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug