Bug 219841 - NewExpression : new MemberExpression : new SuperProperty throws early SyntaxError
Summary: NewExpression : new MemberExpression : new SuperProperty throws early SyntaxE...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari 14
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-13 15:15 PST by bathos
Modified: 2020-12-13 15:46 PST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bathos 2020-12-13 15:15:17 PST
(See similar, but not identical, V8 issue: https://bugs.chromium.org/p/v8/issues/detail?id=11261)

What steps will reproduce the problem?

```
let obj = ({ __proto__: { x: class {} }, y() { return new super.x; } });
```

What is the expected output?

A normal completion whose value is a new object.

What do you see instead?

An early SyntaxError is thrown.

Notes

This is a valid NewExpression. SpiderMonkey exhibits the expected behavior. V8 doesn’t, but instead of an early SyntaxError, it throws a ReferenceError only if `obj.y()` is called.

This is not specific to object literals or absent parentheses. The same behavior  can be observed using class syntax to establish the HomeObject, e.g.

```
class Sup { static SupProperty = class {} }
class Sub extends Sup { static SubProperty() { return new super.supProperty(); } }
Sub.subProperty();
```
Comment 1 bathos 2020-12-13 15:19:31 PST
Test262 issue: https://github.com/tc39/test262/issues/2920
Comment 2 bathos 2020-12-13 15:46:37 PST
Apologies, I hadn’t realized this was tested in Safari 12.1. In 14.1 TP, it appears this has been fixed.