Bug 219841

Summary: NewExpression : new MemberExpression : new SuperProperty throws early SyntaxError
Product: WebKit Reporter: bathos <valentinium>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: Safari 14   
Hardware: Unspecified   
OS: Unspecified   

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.