Repository navigation
analysis/code: handle selectors on instantiated generic types - #1822
Closed
moisesvega wants to merge 1 commit into
Closed
moisesvega wants to merge 1 commit into
moisesvega wants to merge 1 commit into
Conversation
`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
Owner
|
Merged as 22c3391 |
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 #1821.
SelectorNamepanicked on selectors whose operand is an instantiatedgeneric type (
*ast.IndexExpr/*ast.IndexListExpr). SA1019 hits thisbecause 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.