go/internal/lsp/source/completion
Muir Manders ffc70b9ac1 lsp/completion: fix ranking of *types.PkgName candidates
In Go 1.18 types.AssignableTo() started reporting that an invalid type
is assignable to any interface. *types.PkgName (i.e. an import at the
top of the file) has an invalid type for its Type(), so we started
thinking all in scope imports were great candidates when the expected
type was an interface.

Fix by wrapping the AssignableTo (and AssertableTo) to explicitly
return false if either operand is invalid.

Updates golang/go#53595

Change-Id: Ie5a84b7f410ff5c73c6b7870e052bafaf3e21e99
Reviewed-on: https://go-review.googlesource.com/c/tools/+/415595
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
2022-07-01 14:13:48 +00:00
..
builtin.go lsp/completion: support completing to Elem() types 2021-06-09 15:58:30 +00:00
completion.go lsp/completion: fix ranking of *types.PkgName candidates 2022-07-01 14:13:48 +00:00
deep_completion.go all: fix spelling 2022-04-04 19:50:34 +00:00
deep_completion_test.go
definition.go internal/lsp/source: remove workaround for newline terminated files 2022-06-01 15:40:59 +00:00
format.go gopls: remove usage of golang.org/x/xerrors 2022-04-20 15:33:22 +00:00
fuzz.go internal/completion: default to regular completion for f.Fuzz without f.Add 2022-03-16 01:41:57 +00:00
keywords.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
labels.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
literal.go lsp/completion: fix func literals with type params 2022-04-26 14:19:52 +00:00
package.go internal/lsp/source: eliminate ColumnMapper.PointSpan in favor of Pos 2022-06-01 19:19:59 +00:00
package_test.go internal/lsp/source/completion: suggest only valid package names 2021-04-27 19:53:45 +00:00
postfix_snippets.go gopls: add range over channel postfix completion 2022-07-01 14:13:36 +00:00
printf.go all: fix spelling 2022-04-04 19:50:34 +00:00
printf_test.go internal/lsp/source/completion: remove "completion_" prefix from files 2020-10-30 17:45:15 +00:00
snippet.go internal/lsp: add snippet completion for function type parameters 2022-03-09 15:55:38 +00:00
statements.go gopls, internal/lsp: gofmt 2022-04-12 17:41:31 +00:00
util.go lsp/completion: fix ranking of *types.PkgName candidates 2022-07-01 14:13:48 +00:00
util_test.go