-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
x/tools/gopls: "type name %q without type spec" bug in Hover (via telemetry) #64241
Comments
This stack indicates that obj is a TypeName (Name or alias, but not a TypeParam), but the spec returned by findDeclInfo was not a TypeSpec. I can't explain how this can happen. (At first I assume it was due to obj.Pos() being NoPos, which can happen for "unsafe" package members; they are not caught by the obj.Pkg() == nil check because they do have a package. That is indeed a bug, but it's not this bug.) |
Conceivably another case of AST fixing perturbing positions? (See related #64479.) |
I wrote a program that ran findDeclInfo on every TypeName in kubernetes plus its dependencies, and not a single call returned spec=nil. This lends support to the idea that it's related to ill-formed files and AST repair. |
Change https://go.dev/cl/558255 mentions this issue: |
Thanks for investigating. With the above CL, this is good to bump to v0.16. |
Updates golang/go#64241 Change-Id: If799f3454f628421f03f055eb003442bb90fe656 Reviewed-on: https://go-review.googlesource.com/c/tools/+/558255 Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Well, #66314 shows that AST repair is not to blame. One thought: is this an alias to a TypeParam, and therefore not a TypeParam under the |
This stack
Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks. |
This stack
Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks. |
Still no idea what could cause this, short of a bug in findDeclInfo. Note that in gopls@v0.16.1, we were already using Unalias, so something related to type parameters and Unalias seems unlikely. This hasn't recurred recently, even with many gopls users, so let's wait and see. |
This stack
A-IqbA
was reported by telemetry:hover:133 is https://cs.opensource.google/go/x/tools/+/refs/tags/gopls/v0.14.1:gopls/internal/lsp/source/hover.go;l=225 is
Reported using golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.
Dups: G_PnXA gzmDpA 4fCWeg
The text was updated successfully, but these errors were encountered: