Fix #16778 - use previous type and not declared type#17381
Merged
weswigham merged 2 commits intoJul 26, 2017
Conversation
…nd not declared type
b4b404b to
6c6d1c2
Compare
sandersn
approved these changes
Jul 26, 2017
Member
sandersn
left a comment
There was a problem hiding this comment.
I found a better name for prevType: computedType. Otherwise looks good.
| prevType.flags & TypeFlags.Union && | ||
| isMatchingReference(reference, (<PropertyAccessExpression>expr).expression) && | ||
| isDiscriminantProperty(declaredType, (<PropertyAccessExpression>expr).name.escapedText); | ||
| isDiscriminantProperty(prevType, (<PropertyAccessExpression>expr).name.escapedText); |
Member
There was a problem hiding this comment.
prevType has a specific name elsewhere in the control flow code. I'll go find out what it is.
Member
|
Note: I would have been a lot more enthusiastic about this fix if you had used our real Node code from the compiler in the test. |
Member
Author
That would have been significantly greater than the minimum required code to repro and examine the bug. XD |
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.
Fixes #16778.
isMatchingReferenceDiscriminantneeded to use the previous type witnessed for the reference in question rather than its declared type to check if it was discriminable.