]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/types2: generalize instanceHash to accept any type, rename to...
authorRobert Griesemer <gri@golang.org>
Sat, 28 Aug 2021 03:50:31 +0000 (20:50 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 30 Aug 2021 22:07:43 +0000 (22:07 +0000)
commit437362ccec8aeab03aaac63db188f7e8f9eed699
treeebafe27cdf5b5af404043cd2e17c730f6defa8f6
parent86fa510d2456e20ceaa518f97f0c1c89d2ebd81c
cmd/compile/internal/types2: generalize instanceHash to accept any type, rename to typeHash

Rename instanceHashing accordingly.

Eventually, this will make it possible to use typeHash to detect
multiple identical types in type switch cases and other places.

Also fix some bugs: When creating a type hash, the name of function
parameters must be ignored because they don't matter for type
identity. And when printing a type name, don't assume its type
is a *Named type; it could be a *Basic type as well.

Finally, use a correctly qualified type string when reporting
a duplicate type error in a type switch case rather than the
(debugging) type string.

Change-Id: Ida3873f6259b51847843b0e2d7e3aa2fcdc3a0c3
Reviewed-on: https://go-review.googlesource.com/c/go/+/345791
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
src/cmd/compile/internal/types2/instantiate.go
src/cmd/compile/internal/types2/named.go
src/cmd/compile/internal/types2/stmt.go
src/cmd/compile/internal/types2/subst.go
src/cmd/compile/internal/types2/typestring.go