Closed adonovan closed 2 months ago
Related Issues and Documentation
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
So KeyOf(recv)
returns hasMethods = false. This means methodSetInfo returned Mask=0. The Mask has at least one bit set if the loop executes at all, so NewMethodSet(EnsurePointer(t)) must indeed be empty. How can the method set of a type be empty if the query started from a method of that type? Hmm... what if there are two methods, or a field and a method, that conflict?
$ cat a.go
package p
type E struct { X int }
func (E) X() {} // offset #45 is "X"
$ gopls references ./a.go:#45
gopls: KeyOf(*golang.org/x/tools.E)={} yet func (golang.org/x/tools.E).X() is a method
exit status 2
Bingo.
Change https://go.dev/cl/605015 mentions this issue: gopls/internal/golang: downgrade assertion in methodsets index
This stack
WrwN7A
was reported by telemetry:Issue created by golang.org/x/tools/gopls/internal/telemetry/cmd/stacks.