diff options
author | Rob Findley <rfindley@google.com> | 2021-08-11 11:45:11 -0400 |
---|---|---|
committer | Robert Findley <rfindley@google.com> | 2021-08-14 15:14:43 +0000 |
commit | 50f4ebbdd30f53272b5f42ab66c50939eade0a0e (patch) | |
tree | a64d1c07cfd0450123d9ddabdb61d7fe4e518ac9 /src/cmd/compile/internal/types2/unify.go | |
parent | fc27eb50ffcada3d4f5e7e00a5c120f474cc0da4 (diff) | |
download | go-50f4ebbdd30f53272b5f42ab66c50939eade0a0e.tar.gz go-50f4ebbdd30f53272b5f42ab66c50939eade0a0e.zip |
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>
Diffstat (limited to 'src/cmd/compile/internal/types2/unify.go')
-rw-r--r-- | src/cmd/compile/internal/types2/unify.go | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/types2/unify.go b/src/cmd/compile/internal/types2/unify.go index 28f9cf751c..710fc51b53 100644 --- a/src/cmd/compile/internal/types2/unify.go +++ b/src/cmd/compile/internal/types2/unify.go @@ -426,11 +426,6 @@ func (u *unifier) nify(x, y Type, p *ifacePair) bool { } case *Named: - // Two named types are identical if their type names originate - // in the same type declaration. - // if y, ok := y.(*Named); ok { - // return x.obj == y.obj - // } if y, ok := y.(*Named); ok { x.expand(nil) y.expand(nil) |