test262 icon indicating copy to clipboard operation
test262 copied to clipboard

Test for NewExpression -> new MemberExpression -> new SuperProperty

Open bathos opened this issue 5 years ago • 1 comments

Currently, V8 exhibits different behavior from JSC and SpiderMonkey for this construction.

When I first wrote this, I reported that JSC exhibited a third behavior (early SyntaxError). However this appears to be fixed in JSC as of 14.1 TP, making V8 the outlier.

In V8, a runtime ReferenceError is thrown when the expression is evaluated (chromium issue). In JSC and SpiderMonkey, no error is thrown and behavior is, as far as I’m aware, correct.

Examples:

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

class X { static get x() { return class {} } }
class Y extends X { static y() { return new super.x() } }
Y.y(); // ReferenceError thrown

I cloned Test262 and started poking around to see if maybe I could author a coherent test, but I figured I should open an issue first to confirm that the SpiderMonkey/JSC behavior is the correct one.

bathos avatar Dec 13 '20 23:12 bathos

It seems like a valid case. I'd need to run through the tests to find something but I believe the search will be challenging for the object methods.

One way to potentially find equivalent tests would be searching for failures in V8 runs for the class and objects tests. Although, I'm not finding anything like it so far.

E.g.

  • super usage in class statements, no cases covering class static properties https://test262.report/browse/language/statements/class/super?date=2020-12-13&engines=v8
  • object folder, with method definitions, no failures in that folder. https://test262.report/browse/language/expressions/object?date=2020-12-13&engines=v8

Note that you would need to avoid the __proto__ due to annex b being separated, but that's not a blocker for the test.

leobalter avatar Dec 14 '20 19:12 leobalter