Fix javascript signature instantiation#18440
Merged
Merged
Conversation
getSignatureInstantation takes a parameter that tells whether the signature comes from Javascript and therefore is allowed to pass fewer than the required number of type arguments. (Defaults are chosen if this is the case.) Previously, getInstantiatedConstructorsForTypeArguments forgot to provide this argument, and constructors with insufficient type arguments would cause a crash because getSignatureInstantiation would not know to fill in the missing type arguments.
ghost
reviewed
Sep 13, 2017
| * @param minTypeArgumentCount The minimum number of required type arguments. | ||
| */ | ||
| function fillMissingTypeArguments(typeArguments: Type[] | undefined, typeParameters: TypeParameter[] | undefined, minTypeArgumentCount: number, location?: Node) { | ||
| function fillMissingTypeArguments(typeArguments: Type[] | undefined, typeParameters: TypeParameter[] | undefined, minTypeArgumentCount: number, isJavaScript?: boolean) { |
There was a problem hiding this comment.
Probably better to just make isJavascript required (same for other one)
Member
Author
There was a problem hiding this comment.
I agree that required parameters are generally better; I'm not convinced that they're an improvement for fillMissingTypeArguments. There are 7 calls, 2 of which are so deep in instantiation that they have to call isInJavascriptFile on a node that may or may not be relevant. One of the 6 calls to getSignatureInstantiation is like this too.
I pushed the change so we can look at it and decide if it's worthwhile.
This is a bit wordy, but will probably prevent bugs similar to #18254 in the future.
DanielRosenwasser
approved these changes
Sep 19, 2017
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 #18254
getSignatureInstantationtakes a parameter that tells whether the signature comes from Javascript and therefore is allowed to pass fewer than the required number of type arguments. (Defaults are chosen if this is the case.)Previously,
getInstantiatedConstructorsForTypeArgumentsforgot to provide this argument, and constructors with insufficient type arguments would cause a crash becausegetSignatureInstantiationwould not know to fill in the missing type arguments.