Skip to content

Commit 0919917

Browse files
committed
internal/lsp/source: filter out comparable from completion results
The comparable interface is introduced on the dev.typeparams branch. Filter it out from gopls completion results so that it doesn't break tests on the dev.typeparams branch. Change-Id: Iba22c0980c09e99b454ce9e22813cc3a1f94a90c Reviewed-on: https://go-review.googlesource.com/c/tools/+/293931 Trust: Robert Findley <[email protected]> Run-TryBot: Robert Findley <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Go Bot <[email protected]> (cherry picked from commit f3748ed) Reviewed-on: https://go-review.googlesource.com/c/tools/+/294911
1 parent 2965cf7 commit 0919917

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/lsp/source/completion/completion.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,11 @@ func (c *completer) lexical(ctx context.Context) error {
12641264
var (
12651265
builtinIota = types.Universe.Lookup("iota")
12661266
builtinNil = types.Universe.Lookup("nil")
1267+
// comparable is an interface that exists on the dev.typeparams Go branch.
1268+
// Filter it out from completion results to stabilize tests.
1269+
// TODO(rFindley) update (or remove) our handling for comparable once the
1270+
// type parameter API has stabilized.
1271+
builtinComparable = types.Universe.Lookup("comparable")
12671272
)
12681273

12691274
// Track seen variables to avoid showing completions for shadowed variables.
@@ -1282,6 +1287,9 @@ func (c *completer) lexical(ctx context.Context) error {
12821287
if declScope != scope {
12831288
continue // Name was declared in some enclosing scope, or not at all.
12841289
}
1290+
if obj == builtinComparable {
1291+
continue
1292+
}
12851293

12861294
// If obj's type is invalid, find the AST node that defines the lexical block
12871295
// containing the declaration of obj. Don't resolve types for packages.

0 commit comments

Comments
 (0)