-
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: nil Signature (?) deref in Completion #70634
Comments
This is a strange one: the nil deref is dominated by a non-nil check. |
Closely related to #70636. |
There's definitely a bug here though. The condition checked is against len(node.Results), but in the presence of ill typed code, the signature length need not match the length of the return statement.
My guess is that the compiler is somehow reporting the panic from the wrong call. |
Aha, well the bug I spotted is exactly #70636. Therefore, I'm not sure what this bug is. If it were a bug in the compiler's pclntab, I'd have expected it to always report the wrong function. |
FWIW, I can reproduce this exact crash with [email protected], and the repro from my fix for #70636. Therefore, this is a dupe. |
https://go.dev/cl/634038 is a reproducer for the problem that doesn't depend on telemetry. |
Issue created by stacks.
This stack
sZBuvA
was reported by telemetry:crash/crash
runtime.gopanic:+69
runtime.panicmem:=262
runtime.sigpanic:+19
go/types.(*Signature).Results:=94
golang.org/x/tools/gopls/internal/golang/completion.expectedReturnStmtType:+3
golang.org/x/tools/gopls/internal/golang/completion.expectedCandidate:+37
golang.org/x/tools/gopls/internal/golang/completion.Completion:+150
golang.org/x/tools/gopls/internal/server.(*server).Completion:+19
golang.org/x/tools/gopls/internal/protocol.serverDispatch:+193
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.ServerHandler.func3:+5
golang.org/x/tools/gopls/internal/lsprpc.(*streamServer).ServeStream.handshaker.func4:+52
golang.org/x/tools/gopls/internal/protocol.Handlers.MustReplyHandler.func1:+2
golang.org/x/tools/gopls/internal/protocol.Handlers.AsyncHandler.func2.2:+3
runtime.goexit:+0
Dups: mCLZHw
The text was updated successfully, but these errors were encountered: