Skip to content

Enter signature scope in SerializeReturnTypeForSignature#3572

Open
jakebailey wants to merge 2 commits intomainfrom
jabaile/fix-3570
Open

Enter signature scope in SerializeReturnTypeForSignature#3572
jakebailey wants to merge 2 commits intomainfrom
jabaile/fix-3570

Conversation

@jakebailey
Copy link
Copy Markdown
Member

Fixes #3570

Copilot AI review requested due to automatic review settings April 24, 2026 02:38
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 fixes a declaration emit regression (issue #3570) where type parameters could be renamed/serialized in a way that produced invalid .d.ts output (e.g., references to an undefined T_1). The fix ensures the node builder enters the correct signature scope when serializing a signature’s return type, aligning output with the TypeScript submodule baselines.

Changes:

  • Introduce enterSignatureScope helper and reuse it for signature-to-declaration serialization.
  • Enter signature scope in NodeBuilder.SerializeReturnTypeForSignature so return type serialization sees the correct type parameter/parameter scope.
  • Update/clean up submodule baseline expectations, including removing now-unnecessary .diff files.

Reviewed changes

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

Show a summary per file
File Description
testdata/baselines/reference/submodule/conformance/typeParametersAvailableInNestedScope3.js.diff Removed baseline diff now that output matches the TypeScript submodule reference.
testdata/baselines/reference/submodule/conformance/typeParametersAvailableInNestedScope3.js Updated expected output to the now-correct generic parameter naming/visibility behavior.
testdata/baselines/reference/submodule/compiler/declarationEmitShadowing.js.diff Removed baseline diff after fixing incorrect type parameter reference that caused TS2304.
testdata/baselines/reference/submodule/compiler/declarationEmitShadowing.js Updated expected .d.ts output to avoid undefined type parameter references.
testdata/baselines/reference/submodule/compiler/declarationEmitNestedGenerics.js.diff Removed baseline diff now that nested generic naming matches the submodule reference.
testdata/baselines/reference/submodule/compiler/declarationEmitNestedGenerics.js Updated expected nested generic signature output to the corrected naming.
internal/checker/nodebuilderscopes.go Added enterSignatureScope helper to centralize entering signature scope.
internal/checker/nodebuilderimpl.go Updated signature-to-declaration serialization to use enterSignatureScope.
internal/checker/nodebuilder.go Updated SerializeReturnTypeForSignature to enter signature scope before serializing the return type.

@jakebailey jakebailey requested a review from weswigham April 24, 2026 15:46
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.

Baselines: Declaration emit type parameter renaming bug (regression)

2 participants