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

Separate intersection type resolution process for publicly and non-publicly accessible mixin construct signatures #45810

Closed
wants to merge 2 commits into from

Conversation

rafasofizada
Copy link

Fixes #42264

In checker.ts > resolveIntersectionTypeMembers(), instead of discarding and merging all mixin constructor signatures, we do so only for mixins with publicly accessible constructor signatures. Private or protected constructor signatures of mixins are not discarded/merged, and instead are added to the intersection type's constructor signatures.

Details on bug cause are provided in my comment to the bug report.

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Sep 10, 2021
@ghost
Copy link

ghost commented Sep 10, 2021

CLA assistant check
All CLA requirements met.

@rafasofizada rafasofizada changed the title Mixin accessibility Separate intersection type resolution process for publicly and non-publicly accessible mixin construct signatures Sep 10, 2021
Copy link
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the implementation looks like an improvement - I feel like a lot of this implementation is relying on us only considering mixins actually mixins if they only have exactly one construct signature - but I guess for now that's a safe enough assumption to make, seeing as we make it elsewhere. Maybe @ahejlsberg would have a more nuanced opinion about how different constructor visibilities should interact, but combining only all the public ones (while keeping the private signatures in for relationships' sake) seems fine to me. The inheritance of protected construct signatures from mixins might be a little odd in practice, though (I think you'd be able to use a protected mixin constructor signature so long as you're constructing a subtype instance within a subtype of the class you're mixing, which might be weird and way too loose).

@andrewbranch up to you if this should hit the beta/rc pipeline or be held longer/discussed at some point~

@andrewbranch
Copy link
Member

Looks like a breaking change, so we’ll at least hold off until 4.6, which should give us some time to talk about it some and see if anyone else has feedback.

@andrewbranch andrewbranch requested a review from rbuckton October 4, 2021 18:48
@gabritto gabritto removed their request for review February 17, 2022 20:08
@gabritto gabritto removed their assignment Feb 17, 2022
@sandersn sandersn requested a review from ahejlsberg February 18, 2022 01:04
@sandersn
Copy link
Member

@weswigham your review on this is very old, but it was positive. Should we take this change after all?

@sandersn
Copy link
Member

This PR is now two years old. @weswigham @andrewbranch do you think this is worth taking? I'm not sure if it needs more discussion or if we just forgot about it.

@sandersn
Copy link
Member

I'm going to close this for now since it's quite stale.

@sandersn sandersn closed this Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Mixin classes with private/protected constructors are subclassable
6 participants