]> Cypherpunks.ru repositories - gostls13.git/commit
go/types: deduplicate signatures with the context
authorRobert Findley <rfindley@google.com>
Wed, 10 Nov 2021 03:31:59 +0000 (22:31 -0500)
committerRobert Findley <rfindley@google.com>
Sat, 13 Nov 2021 00:34:41 +0000 (00:34 +0000)
commitbfbe5ac9ce58fb59aa38ef69dee4933f20aac039
treeac328f38fca0236b55b5aa7a76cca44ee1acc574
parent787708a6ff66092678cd4312358e90a5085eac89
go/types: deduplicate signatures with the context

Extend the type checking context to allow de-duplicating *Signature
instances, in addition to *Named instances.

Naively we would deduplicate instances of different-but-identical origin
*Signature types. That may be OK, but it seems a bit strange to get the
same signature when instantiating two different functions. For now,
differentiate *Signature types by prepending a unique identifier for the
origin pointer, thus guaranteeing that instances de-duplicated if they
come from the exact same (pointer identical) origin type.

Updates #47103

Change-Id: I93cc3cacad195267fe0a5801f9c5a3b1e61eb907
Reviewed-on: https://go-review.googlesource.com/c/go/+/362801
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/api_test.go
src/go/types/context.go
src/go/types/instantiate.go
src/go/types/instantiate_test.go
src/go/types/named.go
src/go/types/subst.go
src/go/types/typestring.go
src/go/types/typexpr.go