Skip to content

isValidMethodAccess: Instantiate signature this type if necessary #21722

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

Merged
1 commit merged into from
Mar 6, 2018

Conversation

ghost
Copy link

@ghost ghost commented Feb 7, 2018

Fixes #21711

@ghost ghost requested a review from sandersn February 7, 2018 16:14
@@ -11191,7 +11194,7 @@ namespace ts {
}

function createInferenceContext(signature: Signature, flags: InferenceFlags, compareTypes?: TypeComparer, baseInferences?: InferenceInfo[]): InferenceContext {
const inferences = baseInferences ? map(baseInferences, cloneInferenceInfo) : map(signature.typeParameters, createInferenceInfo);
const inferences = baseInferences ? baseInferences.map(cloneInferenceInfo) : signature.typeParameters.map(createInferenceInfo);
Copy link
Author

Choose a reason for hiding this comment

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

Looks like this function should never be called if signature.typeParameters is undefined, since we expect inferences to always be defined elsewhere.

@ghost ghost force-pushed the completionsMethodWithThisParameter_instantiate branch from 952e29b to bc54e99 Compare March 5, 2018 22:20
return signatureThisType;
}
const context = createInferenceContext(sig.typeParameters, sig, InferenceFlags.None);
inferTypes(context.inferences, actualThisType, signatureThisType);
Copy link
Member

Choose a reason for hiding this comment

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

It's a little weird to do limited inference here, but maybe it makes sense because this is called solely for completions? The inference and instantiation will happen later, and lead to an error, in normal compilation.

Copy link
Author

Choose a reason for hiding this comment

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

Since the call expression doesn't actually exist (we're just considering adding the completion, all that exists so far is obj.), this won't have a corresponding normal compilation.

@ghost ghost merged commit a138985 into master Mar 6, 2018
@ghost ghost deleted the completionsMethodWithThisParameter_instantiate branch March 6, 2018 18:18
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
This pull request was closed.
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.

1 participant