x/tools/gopls: failed *types.Func type assertion in populateCommentCompletions
Opened this issue · 4 comments
adonovan commented
#!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 failedVery similar to #70889.
This stack QTs-mg was reported by telemetry:
crash/crashruntime.gopanic:+69runtime.panicdottypeE:=275runtime.panicdottypeI:+5golang.org/x/tools/gopls/internal/golang/completion.(*completer).populateCommentCompletions:+84golang.org/x/tools/gopls/internal/golang/completion.(*completer).collectCompletions:+12golang.org/x/tools/gopls/internal/golang/completion.Completion:+152golang.org/x/tools/gopls/internal/server.(*server).Completion:+19golang.org/x/tools/gopls/internal/protocol.serverDispatch:+193golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3runtime.goexit:+0
golang.org/x/tools/gopls@v0.17.1 go1.23.3 darwin/arm64 neovim (1)
Dups: LQqDuQ
gabyhelp commented
Related Issues
- x/tools/gopls: completion: failed type assertion in inferExpectedTypeArg #70889 (closed)
- x/tools/gopls: Completion: failed type assertion in completer.item #71044
- x/tools/gopls: OOB index crash in completion.expectedReturnStmtType #70636 (closed)
- x/tools/gopls: nil Signature (?) deref in Completion #70634 (closed)
- x/tools/gopls: Completion: "ZeroString for unexpected type" panic #70744 (closed)
- x/tools/gopls: stubmethods: nil deref of FuncType.Results in fromReturnStmt #70967 (closed)
- x/tools/gopls: crash in Hover (telemetry) #69362
- x/tools/gopls: Hover: nil deref in parseDocLink #70635 (closed)
- x/tools/gopls: Rename: crash due to Info.Defs[id]=nil bug in checkStructField #70968
- x/tools/gopls: CodeAction: nil panic in findMatchingDiagnostics #71028 (closed)
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)
gopherbot commented
Change https://go.dev/cl/642877 mentions this issue: gopls/internal/golang/completion: debugging missing func def
adonovan commented
This stack LQqDuQ was reported by telemetry:
gopls/buggolang.org/x/tools/gopls/internal/util/bug.report:+35golang.org/x/tools/gopls/internal/util/bug.Reportf:+1golang.org/x/tools/gopls/internal/golang/completion.(*completer).populateCommentCompletions.func1:=1086golang.org/x/tools/gopls/internal/golang/completion.(*completer).populateCommentCompletions:+98golang.org/x/tools/gopls/internal/golang/completion.(*completer).collectCompletions:+12golang.org/x/tools/gopls/internal/golang/completion.Completion:+163golang.org/x/tools/gopls/internal/server.(*server).Completion:+19golang.org/x/tools/gopls/internal/protocol.serverDispatch:+193golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3runtime.goexit:+0
golang.org/x/tools/gopls@v0.18.0 go1.23.4 linux/amd64 neovim (1)
adonovan commented
The latest stack indicates the recently added bug.Reportf call is reached and c.pgf is indeed a member of CompiledGoFiles.