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

Reduce away intersections that aren't assignable to constituents in CFA #37724

Closed
wants to merge 2 commits into from

Conversation

ahejlsberg
Copy link
Member

Fixes #37659.

@weswigham
Copy link
Member

weswigham commented Mar 31, 2020

@ahejlsberg shouldn't A & B be assignable to A in this case? A & B by definition has all of A's private fields, no?

@ahejlsberg
Copy link
Member Author

@weswigham Well, yes, but A and B also have a conflicting private member x and we consider it an error to access conflicting members (introduced years ago in #13990). The access happens as we're checking the properties from the whole intersection against the properties of each of A and B, a check that was introduced recently in #37195.

@ahejlsberg
Copy link
Member Author

@weswigham We're basically trying to have it both ways. It would seem reasonable for A & B to be assignable to A and B even with the conflicting private properties, yet we rely on an error being issued in the link below as an early warning that a mixin produced an invalid type.

https://github.com/microsoft/TypeScript/pull/13990/files#diff-4b0cabe62740b5899b9a7850e502007aR95

@ahejlsberg
Copy link
Member Author

Superceded by #37762.

@ahejlsberg ahejlsberg closed this Apr 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[3.9.0-beta] OR'd types seem to get ANDed because of assertions
2 participants