]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile/internal/types2: define Identical for instances
authorRob Findley <rfindley@google.com>
Wed, 11 Aug 2021 15:45:11 +0000 (11:45 -0400)
committerRobert Findley <rfindley@google.com>
Sat, 14 Aug 2021 15:14:43 +0000 (15:14 +0000)
commit50f4ebbdd30f53272b5f42ab66c50939eade0a0e
treea64d1c07cfd0450123d9ddabdb61d7fe4e518ac9
parentfc27eb50ffcada3d4f5e7e00a5c120f474cc0da4
cmd/compile/internal/types2: define Identical for instances

Instantiation of parameterized types may occur in other packages, so we
need an intrinsic notion of type identity for instances.

Add the natural definition: two instances are identical if their bases
and type arguments are identical.

Type unification was already considering type arguments, but has some
inaccurate logic with respect to objects. This will be addressed in a
follow-up CL.

Change-Id: Ib2ce67c05de65eb302ee588cc40c89c60018da50
Reviewed-on: https://go-review.googlesource.com/c/go/+/341856
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/cmd/compile/internal/types2/api_test.go
src/cmd/compile/internal/types2/predicates.go
src/cmd/compile/internal/types2/unify.go