-
Notifications
You must be signed in to change notification settings - Fork 716
Port TS PR 61668 - Fix type variable leaks and cache inconsistencies #1795
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ports TypeScript PR #61668, which fixes type variable leaks and cache inconsistencies in generic type inference. The changes focus on improving how type parameters are handled in signature instantiation to prevent incorrect type variable leakage between different inference contexts.
Key Changes:
- Simplified single signature type handling by removing the separate
SingleSignatureType
struct and treating these as anonymous types - Enhanced outer return type mapping to prevent circular inferences and type parameter leaks
- Improved type mapper creation for better isolation of type parameters across inference contexts
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
:
File | Description |
---|---|
internal/checker/types.go |
Removed SingleSignatureType struct and simplified type handling |
internal/checker/checker.go |
Modified signature instantiation logic and added outer return mapper functionality |
internal/checker/inference.go |
Added createOuterReturnMapper function for better type parameter isolation |
internal/checker/nodebuilderimpl.go |
Updated function call to remove outer type parameters parameter |
internal/checker/jsx.go |
Updated JSX signature creation calls to match new API |
internal/testrunner/compiler_runner.go |
Removed test skip for now-working inference test |
testdata/baselines/reference/submodule/compiler/*.types |
Updated type inference test baselines showing improved behavior |
This reverts commit dbc501f.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with the suggested changes.
Ports microsoft/TypeScript#61668.
I am not 100% sure this is correct. Might need @ahejlsberg to attempt it.