Skip to content

super.m() ignores a patched or relinked parent prototype #11760

Description

@proggeramlug

super.m() calls the method as declared in the class body and ignores a later patch of the parent prototype.

class B { m() { return 2; } }
class C extends B { n() { return super.m() + 10; } }
(B.prototype as any).m = () => 3;
console.log(new C().n());   // node: 13   perry: 12

Per spec, super.m is a property lookup on [[HomeObject]].[[GetPrototypeOf]]() (here B.prototype), so it must see the patch and also a relinked prototype (Object.setPrototypeOf(C.prototype, X)). perry appears to bind super.m() statically to B's declared method.

Found while fixing #11758; related to the prototype-relink work in #11738.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions