Add inference priority for mapped type keys#22246
Merged
Merged
Conversation
381012e to
f48dfb0
Compare
DanielRosenwasser
requested changes
Mar 1, 2018
Member
DanielRosenwasser
left a comment
There was a problem hiding this comment.
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 |
Member
Author
|
@DanielRosenwasser done. Build break is fixed by #22247 |
The new priority causes union inference, similarly to return type
8046705 to
9e12919
Compare
sandersn
approved these changes
Mar 1, 2018
| 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 |
Member
There was a problem hiding this comment.
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.
DanielRosenwasser
approved these changes
Mar 3, 2018
ahejlsberg
approved these changes
Mar 5, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The new priority causes union inference, similar to the return type inference priority.
Fixes #22242