aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/interface.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-07-26 14:50:57 -0700
committerRobert Griesemer <gri@golang.org>2021-07-27 21:21:00 +0000
commitc751e2e6ba30fc319c93b9cfe207dc7d1b48c3fb (patch)
treed4b7355ff1fe7ed9b985d1a6f639957863d7f9c5 /src/cmd/compile/internal/types2/interface.go
parent5d8f90f90405e9faa9c5425627024d2cfa67faa3 (diff)
downloadgo-c751e2e6ba30fc319c93b9cfe207dc7d1b48c3fb.tar.gz
go-c751e2e6ba30fc319c93b9cfe207dc7d1b48c3fb.zip
[dev.typeparams] cmd/compile/internal/types2: use comparable bit rather than ==() method
This removes the special "==" methods from comparable interfaces in favor of a "comparable" flag in TypeSets indicating that the interface is or embeds comparable. Fixes various related implementation inaccuracies. While at it, fix setup of the predeclared error and comparable interface types by associating their respective type name objects with them. For #47411. Change-Id: I409f880c8c8f2fe345621401267e4aaabd17124d Reviewed-on: https://go-review.googlesource.com/c/go/+/337354 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/interface.go')
-rw-r--r--src/cmd/compile/internal/types2/interface.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types2/interface.go b/src/cmd/compile/internal/types2/interface.go
index c344f8ed01..cf8ec1a5e2 100644
--- a/src/cmd/compile/internal/types2/interface.go
+++ b/src/cmd/compile/internal/types2/interface.go
@@ -107,7 +107,7 @@ func (t *Interface) Method(i int) *Func { return t.typeSet().Method(i) }
// Empty reports whether t is the empty interface.
func (t *Interface) Empty() bool { return t.typeSet().IsTop() }
-// IsComparable reports whether interface t is or embeds the predeclared interface "comparable".
+// IsComparable reports whether each type in interface t's type set is comparable.
func (t *Interface) IsComparable() bool { return t.typeSet().IsComparable() }
// IsConstraint reports whether interface t is not just a method set.