Enter signature scope in SerializeReturnTypeForSignature#3572
Open
jakebailey wants to merge 2 commits intomainfrom
Open
Enter signature scope in SerializeReturnTypeForSignature#3572jakebailey wants to merge 2 commits intomainfrom
jakebailey wants to merge 2 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
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
enterSignatureScopehelper and reuse it for signature-to-declaration serialization. - Enter signature scope in
NodeBuilder.SerializeReturnTypeForSignatureso return type serialization sees the correct type parameter/parameter scope. - Update/clean up submodule baseline expectations, including removing now-unnecessary
.difffiles.
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3570