-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Fixed anyFunctionType
leak
#61980
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
base: main
Are you sure you want to change the base?
Fixed anyFunctionType
leak
#61980
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 pull request fixes a bug that caused an anyFunctionType leak in the type checker. The changes update the contextual function checking logic and refine the checkMode usage to prevent caching of unintended return types.
- Default checkMode is now explicitly provided in the function signature.
- Simplified conditional checks and modified the return type computation to mask out CheckMode.SkipContextSensitive.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
File | Description |
---|---|
tests/cases/compiler/contextualTypingGenericFunction2.ts | Added tests to verify that inappropriate type inference in callback functions is now caught. |
tests/baselines/reference/contextualTypingGenericFunction2.* | Updated baselines to match the expected errors from the fixed type checking logic. |
src/compiler/checker.ts | Updated contextuallyCheckFunctionExpressionOrObjectLiteralMethod to use default checkMode and fixed return type computation to avoid caching anyFunctionType leaks. |
Comments suppressed due to low confidence (4)
src/compiler/checker.ts:9115
- Removing the redundant existence check for checkMode improves readability now that a default is provided.
) {
src/compiler/checker.ts:9115
- The explicit default value for checkMode enhances clarity; please ensure that existing call sites behave correctly with this default.
) {
src/compiler/checker.ts:9115
- The simplified condition using checkMode enhances consistency with previous changes; ensure the logical behavior remains as expected.
) {
@typescript-bot test it |
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
@jakebailey Here are the results of running the user tests with tsc comparing Everything looks good! |
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@jakebailey Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
fixes #61979