Skip to content
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: crash in source.(*candidateInference).typeMatches #37615

Closed
l2dy opened this issue Mar 3, 2020 · 2 comments
Closed

x/tools/gopls: crash in source.(*candidateInference).typeMatches #37615

l2dy opened this issue Mar 3, 2020 · 2 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@l2dy
Copy link

l2dy commented Mar 3, 2020

What did you do?

Develop a Go program in Visual Studio Code and use IntelliSense (code completion).

What did you expect to see?

IntelliSense suggestions pop up when I type . after a struct object.

What did you see instead?

IntelliSense suggestions are missing and gopls crashed.

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x11a5cfb]

goroutine 7900 [running]:
go/types.(*operand).assignableTo(0xc000128db0, 0x0, 0x0, 0x0, 0x0, 0xc000129038)
	/usr/local/go/src/go/types/operand.go:219 +0xfb
go/types.AssignableTo(...)
	/usr/local/go/src/go/types/api.go:360
golang.org/x/tools/internal/lsp/source.(*candidateInference).typeMatches(0xc0076ee2a0, 0x0, 0x0, 0x1a05760, 0xc004cc8360, 0xc000128df8)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/source/completion.go:1972 +0xdf
golang.org/x/tools/internal/lsp/source.(*candidateInference).assigneesMatch(0xc0076ee2a0, 0xc000129038, 0xc004fcf6e0, 0x12)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/source/completion.go:2029 +0x19b
golang.org/x/tools/internal/lsp/source.(*completer).matchingCandidate(0xc0076ee200, 0xc000129038, 0xc000128f98)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/source/completion.go:1872 +0x119
golang.org/x/tools/internal/lsp/source.(*completer).found(0xc0076ee200, 0x1a247c0, 0xc001127770, 0x3ff0000000000000, 0x0, 0x0, 0x10000, 0x0, 0x0)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/source/completion.go:336 +0x128
golang.org/x/tools/internal/lsp/source.(*completer).methodsAndFields(0xc0076ee200, 0x1a05720, 0xc001127310, 0xc00d07a301, 0x0, 0x1ee8cdf, 0x1)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/source/completion.go:811 +0x15a
golang.org/x/tools/internal/lsp/source.(*completer).selector(0xc0076ee200, 0xc004ce6440, 0x0, 0x0)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/source/completion.go:700 +0x1f8
golang.org/x/tools/internal/lsp/source.Completion(0x1a12360, 0xc006b14840, 0x1a24540, 0xc008a208a0, 0x1a10a20, 0xc008a20840, 0x4051800000000000, 0x4042000000000000, 0x0, 0x0, ...)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/source/completion.go:576 +0x1213
golang.org/x/tools/internal/lsp.(*Server).completion(0xc0001e2900, 0x1a12360, 0xc006b22a20, 0xc008a20ae0, 0x0, 0x0, 0xc007146a50)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/completion.go:27 +0x6b0
golang.org/x/tools/internal/lsp.(*Server).Completion(0xc0001e2900, 0x1a12360, 0xc006b22a20, 0xc008a20ae0, 0xc008a20ae0, 0x0, 0x0)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/server_gen.go:24 +0x49
golang.org/x/tools/internal/lsp/protocol.serverHandler.Deliver(0x1a2cb40, 0xc0001e2900, 0x1a12360, 0xc006b22a20, 0xc003160080, 0xc000e11800, 0x1750000)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/lsp/protocol/tsserver.go:345 +0x2064
golang.org/x/tools/internal/jsonrpc2.(*Conn).Run.func1(0xc0073c5b60, 0xc003160080, 0xc0001a7260, 0x1a12360, 0xc006b22a20, 0x0, 0x0, 0xc007770020)
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/jsonrpc2/jsonrpc2.go:372 +0x160
created by golang.org/x/tools/internal/jsonrpc2.(*Conn).Run
	/Users/work/go/pkg/mod/golang.org/x/tools@v0.0.0-20200227200655-6862ededa516/internal/jsonrpc2/jsonrpc2.go:356 +0x850

Build info

golang.org/x/tools/gopls v0.3.3
    golang.org/x/tools/gopls@v0.3.3 h1:mTFqRDJQmpSsgDDWvbtGnSva1z9uX2XcDszSWa6DhBQ=
    github.com/BurntSushi/toml@v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
    github.com/sergi/go-diff@v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ=
    golang.org/x/mod@v0.1.1-0.20191105210325-c90efee705ee h1:WG0RUwxtNT4qqaXX3DPA8zHFNm/D9xaBpxzHt1WcA/E=
    golang.org/x/sync@v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
    golang.org/x/tools@v0.0.0-20200227200655-6862ededa516 h1:OX66ZzpltgCOuBSGdaeT77hS2z3ub2AB+EuGxvGRBLE=
    golang.org/x/xerrors@v0.0.0-20191011141410-1b5146add898 h1:/atklqdjdhuosWIl6AIbOeHJjicWYPqR9bpxqxYG2pA=
    honnef.co/go/tools@v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
    mvdan.cc/xurls/v2@v2.1.0 h1:KaMb5GLhlcSX+e+qhbRJODnUUBvlw01jt4yrjFIHAuA=

Go info

go version go1.14 darwin/amd64

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOOS="darwin"
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
@gopherbot gopherbot added this to the Unreleased milestone Mar 3, 2020
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Mar 3, 2020
@gopherbot
Copy link

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@stamblerre
Copy link
Contributor

Thank you for the report! I believe that this issue was fixed by https://go-review.googlesource.com/c/tools/+/221020, though that fix is not part of the gopls/v0.3.3 release. We will make sure this fix makes it into the next gopls version.

@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.4.0 Mar 3, 2020
@golang golang locked and limited conversation to collaborators Mar 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants