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

Add inference priority for mapped type keys #22246

Merged
merged 4 commits into from
Mar 5, 2018

Conversation

weswigham
Copy link
Member

The new priority causes union inference, similar to the return type inference priority.

Fixes #22242

@weswigham weswigham force-pushed the multiple-inferences-then-choose-them-all branch from 381012e to f48dfb0 Compare February 28, 2018 23:56
Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

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

Apart from my spelling nit, this looks good. Just tackle this.

AlwaysStrict = 1 << 4, // Always use strict rules for contravariant inferences
NakedTypeVariable = 1 << 0, // Naked type variable in union or intersection type
HomomorphicMappedType = 1 << 1, // Reverse inference for hoimomorphic mapped type
MappedType = 1 << 2, // Reverse inference for mapped type
Copy link
Member

Choose a reason for hiding this comment

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

MappedTypeConstraint

@weswigham
Copy link
Member Author

@DanielRosenwasser done. Build break is fixed by #22247

The new priority causes union inference, similarly to return type
@weswigham weswigham force-pushed the multiple-inferences-then-choose-them-all branch from 8046705 to 9e12919 Compare March 1, 2018 01:56
NoConstraints = 1 << 3, // Don't infer from constraints of instantiable types
AlwaysStrict = 1 << 4, // Always use strict rules for contravariant inferences
NakedTypeVariable = 1 << 0, // Naked type variable in union or intersection type
HomomorphicMappedType = 1 << 1, // Reverse inference for hoimomorphic mapped type
Copy link
Member

Choose a reason for hiding this comment

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

typo: homomorphic.
Also I think it would be more accurate to say "inference made to a reverse" instead of "reverse inference for" on this line and the next.

@weswigham weswigham merged commit 53ae507 into master Mar 5, 2018
@weswigham weswigham deleted the multiple-inferences-then-choose-them-all branch March 5, 2018 21:19
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants