-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: don't report deprecation diagnostics for type names in type switches or type assertions #66884
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I wonder what is the generalization of this classification of symbol references into two classes that we might call "analytic" (deconstructors: type switches, comparisons, etc) and "synthetic" (constructors: var decls, literals, calls, etc)? |
Is there no case where the deprecation notice is useful in type switch or comparison? |
I think the case for this notice being useful here is slim -- the example you suggest would be better handled by some sort of search for inexhaustive type switches. We aim for very low false positives, so I think we should suppress this diagnostic. |
Should the use for type assertion, comparison be also suppressed? Should there be an option? The current analyzer suppresses information about the usage in the same package for the same reason but I keep receiving questions related to this. Just got another one - #40447 (comment) I think this is one of the analyzers where people have different taste and need. |
I don't think we're going to change this. I'm going to disable the deprecated analyzer for my own use, because info level diagnostics are still too noisy in my editor. |
While working on gopls, we have a few places where (for example)
*ast.Object
or*ast.Scope
are handled in a type switch or type assertion, and thedeprecated
analyzer produces informational diagnostics for their usage. These diagnostics are generally not actionable, since the deprecated types may be present in input and still need to be handled. I think we should suppress deprecation notices in type switches or type assertions.CC @hyangah @adonovan
The text was updated successfully, but these errors were encountered: