gopls/internal/lsp: enable min/max builtin completion test
For golang/go#59488
Change-Id: I93680138c90750454b4d94af6dc84fe942c9dd34
Reviewed-on: https://go-review.googlesource.com/c/tools/+/498516
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
diff --git a/gopls/internal/lsp/completion_test.go b/gopls/internal/lsp/completion_test.go
index bef5e11..1fc7304 100644
--- a/gopls/internal/lsp/completion_test.go
+++ b/gopls/internal/lsp/completion_test.go
@@ -25,8 +25,8 @@
opts.LiteralCompletions = strings.Contains(string(src.URI()), "literal")
opts.ExperimentalPostfixCompletions = strings.Contains(string(src.URI()), "postfix")
})
- got = filterSkipCompletionItems(tests.FilterBuiltins(src, got))
- want := filterSkipCompletionItems(expected(t, test, items))
+ got = tests.FilterBuiltins(src, got)
+ want := expected(t, test, items)
if diff := tests.DiffCompletionItems(want, got); diff != "" {
t.Errorf("mismatching completion items (-want +got):\n%s", diff)
}
@@ -175,16 +175,3 @@
}
return list.Items
}
-
-func filterSkipCompletionItems(items []protocol.CompletionItem) []protocol.CompletionItem {
- n := 0
- for _, item := range items {
- // TODO(cuonglm): remove once https://go-review.googlesource.com/c/go/+/498495 land.
- if item.Label == "max" || item.Label == "min" {
- continue
- }
- items[n] = item
- n++
- }
- return items[:n]
-}
diff --git a/gopls/internal/lsp/testdata/builtins/builtins.go b/gopls/internal/lsp/testdata/builtins/builtins.go
index 47fa682..2e3361c 100644
--- a/gopls/internal/lsp/testdata/builtins/builtins.go
+++ b/gopls/internal/lsp/testdata/builtins/builtins.go
@@ -28,8 +28,8 @@
/* int8 */ //@item(int8, "int8", "", "type")
/* iota */ //@item(iota, "iota", "", "const")
/* len(v Type) int */ //@item(len, "len", "func(v Type) int", "func")
-/* max(x Type, y ...Type) Type */ //@item(max, "max", "func(x Type, y ...Type) Type", "func")
-/* min(y Type, y ...Type) Type */ //@item(min, "min", "func(y Type, y ...Type) Type", "func")
+/* max(x T, y ...T) T */ //@item(max, "max", "func(x T, y ...T) T", "func")
+/* min(y T, y ...T) T */ //@item(min, "min", "func(x T, y ...T) T", "func")
/* make(t Type, size ...int) Type */ //@item(make, "make", "func(t Type, size ...int) Type", "func")
/* new(Type) *Type */ //@item(new, "new", "func(Type) *Type", "func")
/* nil */ //@item(_nil, "nil", "", "var")