aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types/identity.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/types/identity.go')
-rw-r--r--src/cmd/compile/internal/types/identity.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/compile/internal/types/identity.go b/src/cmd/compile/internal/types/identity.go
index dc39acced8..2e9e2f4fd8 100644
--- a/src/cmd/compile/internal/types/identity.go
+++ b/src/cmd/compile/internal/types/identity.go
@@ -4,8 +4,11 @@
package types
-// Identical reports whether t1 and t2 are identical types, following
-// the spec rules. Receiver parameter types are ignored.
+// Identical reports whether t1 and t2 are identical types, following the spec rules.
+// Receiver parameter types are ignored. Named (defined) types are only equal if they
+// are pointer-equal - i.e. there must be a unique types.Type for each specific named
+// type. Also, a type containing a shape type is considered identical to another type
+// (shape or not) if their underlying types are the same, or they are both pointers.
func Identical(t1, t2 *Type) bool {
return identical(t1, t2, true, nil)
}