Bug 193057 - Extending a bound function of a non-costructor should throw a TypeError
Summary: Extending a bound function of a non-costructor should throw a TypeError
Status: RESOLVED DUPLICATE of bug 144093
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari 12
Hardware: Mac macOS 10.14
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-12-29 10:47 PST by webkit
Modified: 2020-05-11 14:31 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description webkit 2018-12-29 10:47:45 PST
Attempting to extend a bound function whose underlying function is not a constructor (like an arrow function, a generator, etc.) should result in a TypeError as per the specification (https://www.ecma-international.org/ecma-262/9.0/index.html#sec-runtime-semantics-classdefinitionevaluation).

// Test case

const A = (_=>_).bind();
A.prototype = null;
class B extends A {}

// Expected behavior: TypeError should be thrown
// Actual behavior: No error is thrown
Comment 1 Ross Kirsling 2020-04-14 13:47:42 PDT
Looking through our failure list, this doesn't appear to have a test262 test.

Would you be interested in adding one there?
https://github.com/tc39/test262
Comment 2 Alexey Shvayka 2020-05-11 14:31:09 PDT
(In reply to Ross Kirsling from comment #1)
> Looking through our failure list, this doesn't appear to have a test262 test.

JSC doesn't perform IsConstructor during ClassDefinitionEvaluation, failing https://test262.report/browse/language/statements/class/subclass/class-definition-superclass-generator.js. https://webkit.org/b/144093 should fix it.

I am adding a few more tests with bound/proxied arrow/async functions in https://github.com/tc39/test262/pull/2619.

*** This bug has been marked as a duplicate of bug 144093 ***