Skip to content

Port TS#62283: Clear SkipGenericFunctions in yield expression checking#2745

Merged
jakebailey merged 2 commits intomainfrom
copilot/port-github-pr-62283
Feb 12, 2026
Merged

Port TS#62283: Clear SkipGenericFunctions in yield expression checking#2745
jakebailey merged 2 commits intomainfrom
copilot/port-github-pr-62283

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 10, 2026

Ports microsoft/TypeScript#62283.

silentNeverType was leaking into inferred generator types when yield expressions contained inner generic function calls. The CheckModeSkipGenericFunctions flag was being passed through to checkExpression for yield operands, causing generic calls to return silentNeverType instead of being properly resolved.

  • Clear CheckModeSkipGenericFunctions from checkMode in checkAndAggregateYieldOperandTypes when checking yield expressions, matching the existing pattern used for return expressions and arrow body expressions
  • The other two parts of TS#62283 (removing silentNeverIterationTypes and early silentNeverType returns) were already absent in the Go port
// Before
yieldExprType = c.checkExpressionEx(yieldExpr.Expression(), checkMode)
// After
yieldExprType = c.checkExpressionEx(yieldExpr.Expression(), checkMode & ^CheckModeSkipGenericFunctions)

Baseline impact: genericCallAtYieldExpressionInGenericCall1 drops from 7 errors to 3 (removes spurious TS2488 errors), generator types correctly infer number instead of any/never. genericCallAtYieldExpressionInGenericCall2 error diff eliminated entirely.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…or types

Clear CheckModeSkipGenericFunctions flag when checking yield expressions
in checkAndAggregateYieldOperandTypes, preventing silentNeverType from
leaking into inferred generator types based on inner generic calls.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI changed the title [WIP] Port silentNeverType leak fix for generator types Port TS#62283: Clear SkipGenericFunctions in yield expression checking Feb 11, 2026
Copilot AI requested a review from jakebailey February 11, 2026 00:07
@jakebailey jakebailey marked this pull request as ready for review February 11, 2026 00:33
Copilot AI review requested due to automatic review settings February 11, 2026 00:33
Copy link
Copy Markdown
Contributor

Copilot AI left a 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#62283, fixing a type inference bug where silentNeverType was leaking into generator return types when yield expressions contained generic function calls. The fix clears the CheckModeSkipGenericFunctions flag when checking yield operands, matching the existing pattern used for return statements and arrow function bodies.

Changes:

  • Clear CheckModeSkipGenericFunctions in checkAndAggregateYieldOperandTypes when checking yield expression operands to prevent silentNeverType from incorrectly propagating into inferred generator types

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/checker/checker.go Added flag clearing (checkMode & ^CheckModeSkipGenericFunctions) when checking yield expression operands in checkAndAggregateYieldOperandTypes, matching the pattern used for return and arrow expressions
testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.errors.txt Removed spurious TS2488 error (entire error file now empty)
testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall2.errors.txt.diff Reflects removal of spurious TS2488 error
testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt Error count reduced from 7 to 3, removing spurious TS2488 errors from yield expressions
testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.errors.txt.diff Shows reduction in errors and correction of type inference (Generator instead of Generator)
testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types Generator types now correctly infer number instead of any for yield type parameter
testdata/baselines/reference/submodule/compiler/genericCallAtYieldExpressionInGenericCall1.types.diff Shows improved type inference in generator return types

@jakebailey
Copy link
Copy Markdown
Member

I'll note that this also "ports" microsoft/TypeScript#61317 in that microsoft/TypeScript#62283 effectively reverted the former and used a different fix.

@jakebailey jakebailey added this pull request to the merge queue Feb 12, 2026
Merged via the queue into main with commit b7a6163 Feb 12, 2026
26 checks passed
@jakebailey jakebailey deleted the copilot/port-github-pr-62283 branch February 12, 2026 17:51
Copilot AI added a commit that referenced this pull request Feb 25, 2026
#2745)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI added a commit that referenced this pull request Feb 26, 2026
#2745)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI added a commit that referenced this pull request Feb 26, 2026
#2745)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot AI added a commit that referenced this pull request Feb 26, 2026
#2745)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants