golang/go

x/tools/gopls: failed *types.Func type assertion in populateCommentCompletions

Opened this issue · 4 comments

#!stacks
"panicdottypeI" && "populateCommentCompletions:+84" ||
// post CL 642877:
"bug.Reportf" && "populateCommentCompletions.func1:=1086" && "populateCommentCompletions:+98"

Issue created by stacks.

		case *ast.FuncDecl:
			c.addFieldItems(node.Recv)
			c.addFieldItems(node.Type.Params)
			c.addFieldItems(node.Type.Results)

			// collect receiver struct fields
			if node.Recv != nil {
				sig := c.pkg.TypesInfo().Defs[node.Name].(*types.Func).Signature() // <-- type assert failed

Very similar to #70889.

This stack QTs-mg was reported by telemetry:

golang.org/x/tools/gopls@v0.17.1 go1.23.3 darwin/arm64 neovim (1)

Dups: LQqDuQ

Change https://go.dev/cl/642877 mentions this issue: gopls/internal/golang/completion: debugging missing func def

The latest stack indicates the recently added bug.Reportf call is reached and c.pgf is indeed a member of CompiledGoFiles.