Fix panic when @callback/@overload @param has a qualified name#3922
Open
Copilot wants to merge 4 commits into
Open
Fix panic when @callback/@overload @param has a qualified name#3922Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
Guard needCollisionCheckForIdentifier against non-Identifier nodes (e.g., QualifiedName from @param x.y) to match TypeScript's behavior where the function only accepts Identifier | undefined. Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/435989fa-39a8-4d7a-aeca-6166b6e55db8 Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix panic when @callback/@overload @param has a qualified name
Fix panic when @callback/@overload @param has a qualified name
May 16, 2026
jakebailey
reviewed
May 16, 2026
…clarations Sub-property JSDoc params like @param x.y have QualifiedNames and describe properties of a parent parameter, not standalone parameters. The reparser should skip these instead of creating ParameterDeclarations with QualifiedNames, which is the root cause of the panic. Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/6da36b57-11b5-459e-a9e2-b5a1b47f5943 Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
jakebailey
approved these changes
May 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a JSDoc reparser crash by avoiding creation of invalid ParameterDeclaration nodes for qualified @param names in callback/overload signatures.
Changes:
- Skips qualified JSDoc parameter names when reparsing signatures.
- Adds a compiler regression test for qualified
@paramnames in callbacks. - Adds reference symbols/types baselines for the new test.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
internal/parser/reparser.go |
Skips qualified JSDoc parameter names during signature reparsing. |
testdata/tests/cases/compiler/jsdocCallbackParamQualifiedName.ts |
Adds regression coverage for qualified callback params. |
testdata/baselines/reference/compiler/jsdocCallbackParamQualifiedName.symbols |
Adds symbols baseline for the new test. |
testdata/baselines/reference/compiler/jsdocCallbackParamQualifiedName.types |
Adds types baseline for the new test. |
Comment on lines
+6
to
+15
| /** | ||
| * @callback cb | ||
| * @param x.y | ||
| */ | ||
|
|
||
| /** | ||
| * @callback cb2 | ||
| * @param {object} x | ||
| * @param {string} x.y | ||
| */ |
Contributor
Author
There was a problem hiding this comment.
Added an @overload test case with a qualified @param x.y in dac3328.
Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/9169ebac-be22-4565-a138-50bf451ec3bd Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
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.
The reparser was converting all JSDoc
@paramtags to ParameterDeclarations when reparsing@callback/@overloadsignatures, including sub-property params like@param x.ywhich have QualifiedNames. A ParameterDeclaration should never have a QualifiedName as its name (TypeScript types it asIdentifier | BindingPattern). This caused a panic whencheckCollisionsForDeclarationNameeventually calledNode.Text()on the QualifiedName, which doesn't handle that type.Analysis
In TypeScript, JSDoc callback params remain as JSDocParameterTags in a JSDocSignature, so the checker never sees ParameterDeclarations with QualifiedNames. In Corsa's reparser (
internal/parser/reparser.go), all JSDoc params were being converted to ParameterDeclarations—including sub-property params like@param x.y. These sub-property params describe properties of a parent parameter, not standalone parameters, and should not become ParameterDeclarations.Fix
@callbackand@overloadscenarios with qualified paramsCopilot Checklist
I successfully ran these commands at the end of my session, and they completed without error: