golang/go

x/tools/gopls: Hover: nil deref in golang.StdSymbolOf

Closed this issue · 5 comments

#!stacks
"runtime.sigpanic" && "hover:+472"

Issue created by stacks.

	// Handle Method.
	if fn, _ := obj.(*types.Func); fn != nil {
		isPtr, named := typesinternal.ReceiverNamed(fn.Signature().Recv())         //   --panic--
		if isPackageLevel(named.Obj()) {
			for _, s := range symbols {

This stack J7Opuw was reported by telemetry:

golang.org/x/tools/gopls@v0.17.1 go1.23.4 darwin/arm64 vscode (1)
golang.org/x/tools/gopls@v0.17.0 go1.23.4 linux/amd64 vscode (1)

Dups: 9xr_OA

I assume there's the usual off-by-one in the line numbering and that the actual panic is the named.Obj dereference.

Change https://go.dev/cl/638597 mentions this issue: gopls/internal/golang: check for nil ReceiverNamed