From 35206ee85b0a132c1b3195e97752299d49b5ebc9 Mon Sep 17 00:00:00 2001 From: jugglinmike <mike@mikepennisi.com> Date: Mon, 11 Jul 2016 16:46:03 -0400 Subject: [PATCH] Add test for subclassing bound functions (#720) The semantics under test have been incorrectly implemented by the SpiderMonkey engine. --- .../class/subclass/bound-function.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/language/statements/class/subclass/bound-function.js diff --git a/test/language/statements/class/subclass/bound-function.js b/test/language/statements/class/subclass/bound-function.js new file mode 100644 index 0000000000..92f7de5503 --- /dev/null +++ b/test/language/statements/class/subclass/bound-function.js @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +esid: sec-runtime-semantics-classdefinitionevaluation +es6id: 14.5.14 +description: SuperClass may be a bound function object +info: | + [...] + 5. If ClassHeritageopt is not present, then + [...] + 6. Else, + [...] + e. If superclass is null, then + [...] + f. Else if IsConstructor(superclass) is false, throw a TypeError exception. + g. Else, + i. Let protoParent be ? Get(superclass, "prototype"). + ii. If Type(protoParent) is neither Object nor Null, throw a TypeError + exception. + iii. Let constructorParent be superclass. + [...] +---*/ + +var bound = function() {}.bind(); +bound.prototype = {}; + +class C extends bound {} + +assert.sameValue(Object.getPrototypeOf(new C()), C.prototype); -- GitLab