aboutsummaryrefslogtreecommitdiff
path: root/src/go/types/predicates.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/go/types/predicates.go')
-rw-r--r--src/go/types/predicates.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/go/types/predicates.go b/src/go/types/predicates.go
index 73d240241e9..a5d4be9bcc4 100644
--- a/src/go/types/predicates.go
+++ b/src/go/types/predicates.go
@@ -6,6 +6,8 @@
package types
+import "go/token"
+
// isNamed reports whether typ has a name.
// isNamed may be called with types that are not fully set up.
func isNamed(typ Type) bool {
@@ -225,6 +227,13 @@ func identical(x, y Type, cmpTags bool, p *ifacePair) bool {
identical(x.results, y.results, cmpTags, p)
}
+ case *Union:
+ if y, _ := y.(*Union); y != nil {
+ xset := computeUnionTypeSet(nil, token.NoPos, x)
+ yset := computeUnionTypeSet(nil, token.NoPos, y)
+ return xset.terms.equal(yset.terms)
+ }
+
case *Interface:
// Two interface types are identical if they describe the same type sets.
// With the existing implementation restriction, this simplifies to:
@@ -302,9 +311,6 @@ func identical(x, y Type, cmpTags bool, p *ifacePair) bool {
// Two named types are identical if their type names originate
// in the same type declaration.
if y, ok := y.(*Named); ok {
- x.expand(nil)
- y.expand(nil)
-
xargs := x.TypeArgs().list()
yargs := y.TypeArgs().list()