Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DanielRosenwasser opened this issue Sep 28, 2023 · 1 comment · May be fixed by #55903
Open

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

DanielRosenwasser opened this issue Sep 28, 2023 · 1 comment · May be fixed by #55903
Assignees
Labels
Bug A bug in TypeScript Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Fix Available A PR has been opened for this issue Help Wanted You can do this Rescheduled This issue was previously scheduled to an earlier milestone

Comments

@DanielRosenwasser
Copy link
Member

DanielRosenwasser commented Sep 28, 2023

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
    }
}
@DanielRosenwasser DanielRosenwasser added the Bug A bug in TypeScript label Sep 28, 2023
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 5.3.1 milestone Sep 28, 2023
@DanielRosenwasser DanielRosenwasser added Help Wanted You can do this Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". labels Sep 28, 2023
@Andarist
Copy link
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)

@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Sep 28, 2023
@RyanCavanaugh RyanCavanaugh added the Rescheduled This issue was previously scheduled to an earlier milestone label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Effort: Casual Good issue if you're already used to contributing to the codebase. Harder than "good first issue". Fix Available A PR has been opened for this issue Help Wanted You can do this Rescheduled This issue was previously scheduled to an earlier milestone
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@sandersn @DanielRosenwasser @RyanCavanaugh @Andarist @typescript-bot and others