internal/lsp/source: don't find possible interface references to types

In CL 259998 we added the ability to find calls to methods through
interfaces. That included very common interfaces like Stringer, which we
judged unfortunate but possibly acceptable. We didn't consider the
behavior when searching for references to a type. When searching for
references to a type that happens to be a Stringer, the user almost
certainly doesn't want to see all uses of the Stringer interface. Don't
consider interface references to types.

No tests; I don't think this is worth a regtest and the marker tests
can't check a negative AFAIK.

Fixes golang/go#42350.

Change-Id: I0b929d8743f7f0b4e7543e8d35921a7cf3784bf5
Reviewed-on: https://go-review.googlesource.com/c/tools/+/268462
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
diff --git a/internal/lsp/source/references.go b/internal/lsp/source/references.go
index 32db1d0..3010043 100644
--- a/internal/lsp/source/references.go
+++ b/internal/lsp/source/references.go
@@ -127,7 +127,11 @@
 		}
 	}
 
-	if includeInterfaceRefs {
+	// When searching on type name, don't include interface references -- they
+	// would be things like all references to Stringer for any type that
+	// happened to have a String method.
+	_, isType := declIdent.Declaration.obj.(*types.TypeName)
+	if includeInterfaceRefs && !isType {
 		declRange, err := declIdent.Range()
 		if err != nil {
 			return nil, err