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

Cache generic signature instantiations #12064

Merged
merged 2 commits into from
Nov 8, 2016
Merged

Conversation

ahejlsberg
Copy link
Member

This PR adds caching of generic signature instantiations. We already cache instantiations of generic classes, interfaces, and type aliases, but oddly we have never done similar caching of generic signature instantiations. Other than just reducing redundant work, this should have a positive effect on generic signatures that return anonymous types (or instantiations of type aliases for anonymous types) since those continually manufacture new type identities.

@@ -25,8 +25,6 @@ tests/cases/compiler/promisePermutations.ts(106,19): error TS2345: Argument of t
Types of parameters 'cb' and 'value' are incompatible.
Type 'string' is not assignable to type '<T>(a: T) => T'.
tests/cases/compiler/promisePermutations.ts(109,19): error TS2345: Argument of type '(cb: <T>(a: T) => T) => IPromise<string>' is not assignable to parameter of type '(value: string) => IPromise<string>'.
Types of parameters 'cb' and 'value' are incompatible.
Copy link
Member

Choose a reason for hiding this comment

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

Isnt this error something we want to show even if we are using cached signature

Copy link
Member Author

Choose a reason for hiding this comment

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

We have already shown it in a previous elaboration. The reason it is going away is that we do a better job of sharing identical types, so you'll see less redundant elaborations. This is the expected behavior.

@ahejlsberg ahejlsberg merged commit 8f568d4 into master Nov 8, 2016
@ahejlsberg ahejlsberg deleted the cacheSignatureInstantiations branch November 8, 2016 01:16
@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