Skip to content
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

Fix stack overflow related to contextual signature instantiations #17634

Merged
merged 2 commits into from
Aug 7, 2017

Conversation

ahejlsberg
Copy link
Member

With this PR we properly propagate a type comparison function through to the type inference process used in contextual signature instantiation, such that type comparisons done during constraint checking become aware of other type comparisons already in progress.

Fixes #17148.

@ahejlsberg
Copy link
Member Author

@RyanCavanaugh @rbuckton @sandersn We should get this into 2.5 RC.

Copy link
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

One follow-up question

@@ -10670,7 +10671,7 @@ namespace ts {
const constraint = getConstraintOfTypeParameter(context.signature.typeParameters[index]);
if (constraint) {
const instantiatedConstraint = instantiateType(constraint, context);
if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
Copy link
Member

Choose a reason for hiding this comment

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

is there anywhere else this could be used in place of a hard-coded call? I looked around and didn't see any, but I wonder if you noticed any while making this fix.

@ahejlsberg ahejlsberg merged commit 3118e81 into master Aug 7, 2017
@ahejlsberg ahejlsberg deleted the fixSignatureStackOverflow branch August 7, 2017 21:00
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
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.

4 participants