Skip to content

Conversation

@ahejlsberg
Copy link
Member

Fixes #5861.

@ahejlsberg
Copy link
Member Author

A bit more context on the fix. We previously would consider two type parameters identical if they were different type parameters but had identical constraints (but, oddly, wouldn't consider them assignable to each other). This of course isn't right, but it sort of worked when we were comparing constraints in generic signatures which was really the only time it would come up. However, we now sometimes need to compare type parameters for identity during union and intersection type inference (because of #5738) and we want different type parameters to actually be considered different, so we have to remove this logic. The effect is that we won't check whether type parameter constraints are identical when comparing generic signatures, as explained here.

Copy link
Contributor

Choose a reason for hiding this comment

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

could you remove the error comment

@sandersn
Copy link
Member

sandersn commented Dec 2, 2015

Could you also add a test for the case that type parameter constraints are not identical, but we don't check? It would be good to have as documentation in case do we go back and decide to start checking.

@sandersn
Copy link
Member

sandersn commented Dec 2, 2015

👍

ahejlsberg added a commit that referenced this pull request Dec 3, 2015
@ahejlsberg ahejlsberg merged commit 3bb5dc6 into master Dec 3, 2015
@ahejlsberg ahejlsberg deleted the unionTypeParameterInference branch December 3, 2015 20:23
ahejlsberg added a commit that referenced this pull request Dec 3, 2015
Fix union type parameter inference
Conflicts:
	src/compiler/checker.ts
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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.

5 participants