Fixed anyFunctionType leak - #64131
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Two regression cases duplicate fn coverage instead of exercising the intended fn2 scenarios.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Fixes cached anyFunctionType leakage during contextual return-type computation.
Changes:
- Recomputes return types without
CheckModeSkipContextSensitive. - Adds compiler regression cases and diagnostic/type/symbol baselines.
File summaries
| File | Description |
|---|---|
tsc/internal/checker/checker.go |
Prevents context-sensitive return types from leaking anyFunctionType. |
tsc/testdata/tests/cases/compiler/contextualTypingGenericFunction2.ts |
Adds regression scenarios. |
tsc/testdata/baselines/reference/compiler/contextualTypingGenericFunction2.errors.txt |
Records expected diagnostics. |
tsc/testdata/baselines/reference/compiler/contextualTypingGenericFunction2.types |
Records inferred types. |
tsc/testdata/baselines/reference/compiler/contextualTypingGenericFunction2.symbols |
Records symbol information. |
Review details
Suppressed comments (1)
tsc/testdata/tests/cases/compiler/contextualTypingGenericFunction2.ts:57
- This calls
fnagain and duplicatesresult3, leaving the corresponding inferred incompatible-return scenario untested forfn2. Change this call tofn2and regenerate the baselines.
export const result6 = fn({
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
TypeScript Bot (@typescript-bot) test it |
|
Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
|
Jake Bailey (@jakebailey) Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
recreates #61980
fixes #61979