Skip to content

Indexing/element access on super avoids instance property checks #55899

Open

Description

Discovered in conversation at #55892 (comment)

class C {
    yadda = () => {};
}

class D extends C {
    badda() {
        super["yadda"]();
    }
}

new D().badda()

Currently there is no error for this code; however, if you switched it to a property access, you'd get the error introduced at #54056.

class C {
    yadda = () => {};
}

class D extends C {
    badda() {
        super.yadda(); // ❌ errors, as expected
    }
}

Activity

  1. added
    Effort: Casual
    on Sep 28, 2023
  2. Andarist commented on Sep 28, 2023

    @Andarist
    Contributor

    I imagine that there are also other bugs here. checkElementAccessExpression doesn't end up checking if it's accessing on super at any layer (from what I can see quickly) and checkPropertyAccessibilityAtLocation can produce 2 other diagnostics as well (within the isSuper branch)

  3. added
    Fix Available
    on Sep 28, 2023
  4. added
    Rescheduled
    on Jul 26, 2024
  5. added
    Domain: classes
    on Oct 16, 2025
  6. removed
    Fix Available
    on Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugDomain: classesEffort: CasualRescheduled

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions