Introduce 'getTypeOfExpression' function#12396
Merged
ahejlsberg merged 3 commits intomasterfrom Nov 22, 2016
Merged
Conversation
mhegazy
approved these changes
Nov 22, 2016
Merged
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.
This PR introduces a new
getTypeOfExpressionfunction in the checker. UnlikecheckExpression, this function is simply concerned with computing the type and may not fully check all contained sub-expressions for errors. IngetTypeOfExpressionwe optimize for the common case of a call to a function with a single non-generic call signature where we can just fetch the return type without checking the arguments. Ideally, over time the entire family ofcheckXXXfunctions whould have a parameter that indicates whether full error checking is required such that we can perform more optimizations locally.Fixes #12319. Actually, #12319 was sort of fixed by #12362, but only when
--noImplicitAnyis not specified. For that reason we have the flag on in the regression test.