gopls/internal/lsp/source: fix renaming instantiated fields

Correctly associate instantiated functions and fields with their origin
during renaming.

Fixes golang/go#61640

Change-Id: I819ffe303a2b1c35810d5b3c2d71fa5f4231a0c4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/518897
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
diff --git a/gopls/internal/lsp/source/rename.go b/gopls/internal/lsp/source/rename.go
index c1db0e5..eb1fdce 100644
--- a/gopls/internal/lsp/source/rename.go
+++ b/gopls/internal/lsp/source/rename.go
@@ -1054,13 +1054,7 @@
 	// shouldUpdate reports whether obj is one of (or an
 	// instantiation of one of) the target objects.
 	shouldUpdate := func(obj types.Object) bool {
-		if r.objsToUpdate[obj] {
-			return true
-		}
-		if fn, ok := obj.(*types.Func); ok && r.objsToUpdate[funcOrigin(fn)] {
-			return true
-		}
-		return false
+		return containsOrigin(r.objsToUpdate, obj)
 	}
 
 	// Find all identifiers in the package that define or use a