]> Cypherpunks.ru repositories - gostls13.git/commit
go/types: implement deduplication of instances using the Environment
authorRobert Findley <rfindley@google.com>
Thu, 2 Sep 2021 22:39:58 +0000 (18:39 -0400)
committerRobert Findley <rfindley@google.com>
Wed, 8 Sep 2021 16:31:21 +0000 (16:31 +0000)
commita1a6540bf1c38c2c8ad7fced983d2e3206ab1d2b
tree9c805423a049f2e2f4fac6af56f33fbc2564fbd3
parent409434d62364cb362f0f17d0c7769dc680b2da99
go/types: implement deduplication of instances using the Environment

Implement deduplication of type instances via the Environment by
recording a map of unique IDs for *Named types. This avoids an issue
with the existing type hash, where qualified names alone were not
sufficient to differentiate two *Named types that have the same fully
qualified name but which are distinct pointers. It also allows us to
drop the scope accounting for local types.

A subtle bug is also fixed in subst.go, where the instance t was passed
to typeHash rather than t.orig.

Change-Id: I85639ccc1c9bfee470babd2fc85375484c8ed0b9
Reviewed-on: https://go-review.googlesource.com/c/go/+/344390
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/check.go
src/go/types/decl.go
src/go/types/environment.go [new file with mode: 0644]
src/go/types/instantiate.go
src/go/types/instantiate_test.go [new file with mode: 0644]
src/go/types/named.go
src/go/types/subst.go
src/go/types/typestring.go