8000 analysis/code: handle selectors on instantiated generic types by moisesvega · Pull Request #1822 · dominikh/go-tools · GitHub
[go: up one dir, main page]

Skip to content
1 < 8000 /div>

analysis/code: handle selectors on instantiated generic types - #1822

Closed
moisesvega wants to merge 1 commit into
dominikh:masterfrom
moisesvega:sa1019-generic-composite-lit-panic
Closed

moisesvega wants to merge 1 commit into
dominikh:masterfrom
moisesvega:sa1019-generic-composite-lit-panic

Conversation

@moisesvega
@moisesvega moisesvega commented Oct 1, 2026 •
Copy link
Copy Markdown
Contributor

Fixes #1821.

SelectorName panicked on selectors whose operand is an instantiated
generic type (*ast.IndexExpr / *ast.IndexListExpr). SA1019 hits this
because it builds selectors from a struct literal's type to check the
literal's keys.

Handling those two cases fixes the panic for any selector on an
instantiated generic type, not just the ones SA1019 builds. The name now
includes the type arguments, e.g. (example.com/a.Params[int]).Old.

`SelectorName` panicked with "unsupported selector" for any selector
whose operand is an instantiated generic type. SA1019 synthesizes such
selectors from the type of a struct literal to check its keys, so
staticcheck crashed on composite literals of generic structs that set
a deprecated field.

Closes: dominikhgh-1821
@dominikh
dominikh commented Oct 9, 2026
Copy link
Copy Markdown
Owner

Merged as 22c3391

@dominikh dominikh closed this Oct 9, 2026
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.

SA1019: "unsupported selector" panic on generic struct literal with deprecated field

2 participants

0