Closed
Description
gopls version: v0.7.3
gopls flags:
update flags: proxy
extension version: 2021.10.2813
go version: 1.16.9
environment: Visual Studio Code linux
initialization error: undefined
issue timestamp: Mon, 01 Nov 2021 09:01:20 GMT
restart history:
Mon, 01 Nov 2021 07:28:07 GMT: activation (enabled: true)
ATTENTION: PLEASE PROVIDE THE DETAILS REQUESTED BELOW.
Describe what you observed.
panic: interface conversion: types.Type is *types.Basic, not *types.Signature goroutine 137 [running]: golang.org/x/tools/internal/lsp/source/completion.enclosingFunction(0xc007332c00, 0x9, 0x10, 0xc00ad5cf50, 0x0) completion.go:1698 0x350 golang.org/x/tools/internal/lsp/source/completion.Completion(0x10beb38, 0xc00ad66990, 0x10d2ab8, 0xc00aa22000, 0x10c2a38, 0xc00aa4d1a0, 0xe0000000b, 0x3ff0000000000000, 0x0, 0x0, ...) completion.go:508 0x8e6 golang.org/x/tools/internal/lsp.(*Server).completion(0xc000770900, 0x10beb38, 0xc00043a080, 0xc00ad5cdc0, 0x0, 0x0, 0x0) completion.go:32 0xf7a golang.org/x/tools/internal/lsp.(*Server).Completion(0xc000770900, 0x10beb38, 0xc00043a080, 0xc00ad5cdc0, 0xc00ad5cdc0, 0x0, 0x0) server_gen.go:32 0x49 golang.org/x/tools/internal/lsp/protocol.serverDispatch(0x10beb38, 0xc00043a080, 0x10d5fa0, 0xc000770900, 0xc00ad66630, 0x10beda0, 0xc00043a000, 0x0, 0x0, 0x10ad180) tsserver.go:382 0x2784 golang.org/x/tools/internal/lsp/protocol.ServerHandler.func1(0x10beb38, 0xc00043a080, 0xc00ad66630, 0x10beda0, 0xc00043a000, 0x0, 0xc0580913dbbb4300) protocol.go:154 0xc5 golang.org/x/tools/internal/lsp/lsprpc.handshaker.func1(0x10beb38, 0xc00043a080, 0xc00ad66630, 0x10beda0, 0xc00043a000, 0x0, 0x0) lsprpc.go:506 0x459 golang.org/x/tools/internal/jsonrpc2.MustReplyHandler.func1(0x10beb38, 0xc00043a080, 0xc00043e180, 0x10beda0, 0xc00043a000, 0xb8ef95b8ef94b8ef, 0xefb0b8ef99b8ef96) handler.go:35 0xd7 golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1.2(0xc000038f60, 0xc000434930, 0xc000114d40, 0x10beb38, 0xc00043a080, 0xc00043e180, 0x10beda0, 0xc00043a000) handler.go:103 0x86 created by golang.org/x/tools/internal/jsonrpc2.AsyncHandler.func1 handler.go:100 0x173 [Error - 5:01:03 PM]
OPTIONAL: If you would like to share more information, you can attach your complete gopls logs.
NOTE: THESE MAY CONTAIN SENSITIVE INFORMATION ABOUT YOUR CODEBASE.
DO NOT SHARE LOGS IF YOU ARE WORKING IN A PRIVATE REPOSITORY.
<OPTIONAL: ATTACH LOGS HERE>
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
findleyr commentedon Nov 3, 2021
It's generally an invariant that functions have *Signature type, concerning that it was violated here. I wonder if our AST mangling went wrong.
Nevertheless, we can make that code more defensive.
[-]gopls: automated issue report (crash)[/-][+]x/tools/gopls: panic in completion.enclosingFunction[/+]gopherbot commentedon Nov 17, 2021
Change https://golang.org/cl/364675 mentions this issue:
internal/lsp/source/completion: avoid invalid AST in enclosingSignature
internal/lsp/source/completion: avoid invalid AST in enclosingSignature
findleyr commentedon Nov 19, 2021
This should be fixed at tip.