mirror of https://github.com/golang/go.git
internal/lsp/source/completion: exclude 'any' from lexical results
The predeclared 'any' type is only valid when completing constraints. We should support that properly, but for now exclude it from results so that our completion tests don't fail on Go 1.18. For golang/go#47669 Change-Id: I7852f844684a6c03da90bf367d45d732e5d1e9bb Reviewed-on: https://go-review.googlesource.com/c/tools/+/341850 Trust: Robert Findley <rfindley@google.com> Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
9f4956114f
commit
d52cb71cca
|
|
@ -1263,6 +1263,7 @@ func (c *completer) lexical(ctx context.Context) error {
|
|||
// Filter it out from completion results to stabilize tests.
|
||||
// TODO(rFindley) update (or remove) our handling for comparable once the
|
||||
// type parameter API has stabilized.
|
||||
builtinAny = types.Universe.Lookup("any")
|
||||
builtinComparable = types.Universe.Lookup("comparable")
|
||||
)
|
||||
|
||||
|
|
@ -1282,7 +1283,7 @@ func (c *completer) lexical(ctx context.Context) error {
|
|||
if declScope != scope {
|
||||
continue // Name was declared in some enclosing scope, or not at all.
|
||||
}
|
||||
if obj == builtinComparable {
|
||||
if obj == builtinComparable || obj == builtinAny {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue