Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gopls/internal/cache/methodsets: support generics
This CL adds support to gopls' index of methodsets to enable matching of generic types and their methods. Previously, the index was based on the notion of "fingerprints", strings that encode the type of a method such that fingerprints are equal if and only if types are equal. Of course this does not work for generic types, which can match multiple distinct types. This change redesigns the fingerprint encoding so that it preserves the tree structure of the type, allowing it to be parsed again later, supporting tree-based matching such as unification. (The encoding is about 30% bigger.) The actual tree matching in this CL is very simple: each type parameter is treated as a wildcard that can match any subtree at all, without regard to consistency of substitution (as in true unification), nor to type parameter constraint satisfaction. Full unification would reduce false positives, but is not urgently needed. This CL addresses only the global algorithm using the methodsets index. See CL 634596 for the local (type-based) algorithm. + Test, relnote, doc Updates golang/go#59224 Change-Id: I670511a8e5ce02ab23ff7b7bd60e7bd7b43c1cca Reviewed-on: https://go-review.googlesource.com/c/tools/+/634197 Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Robert Findley <rfindley@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
- Loading branch information