]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/types2: rename IsMethodSet to IsConstraint (cleanup)
authorRobert Griesemer <gri@golang.org>
Wed, 25 Aug 2021 03:20:07 +0000 (20:20 -0700)
committerRobert Griesemer <gri@golang.org>
Wed, 25 Aug 2021 23:43:58 +0000 (23:43 +0000)
Invert the boolean result to match the new name.

Change-Id: Ide6c649ed8ac3a5d263640309960e61a005c886e
Reviewed-on: https://go-review.googlesource.com/c/go/+/344872
Trust: Robert Griesemer <gri@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Dan Scales <danscales@google.com>
src/cmd/compile/internal/types2/interface.go
src/cmd/compile/internal/types2/typeset.go
src/cmd/compile/internal/types2/typexpr.go

index ccd3de0a6e66bfa0fc6c3754723a11b9322bfade..e57158d2d508ea870d6054e68adb951bc96974b1 100644 (file)
@@ -98,7 +98,7 @@ func (t *Interface) Empty() bool { return t.typeSet().IsAll() }
 func (t *Interface) IsComparable() bool { return t.typeSet().IsComparable() }
 
 // IsConstraint reports whether interface t is not just a method set.
-func (t *Interface) IsConstraint() bool { return !t.typeSet().IsMethodSet() }
+func (t *Interface) IsConstraint() bool { return t.typeSet().IsConstraint() }
 
 func (t *Interface) Underlying() Type { return t }
 func (t *Interface) String() string   { return TypeString(t, nil) }
index 56f64ab40595b0f17f37d555ed0274517ed84354..1673b9b4af80cb0ce01186a8ded46828a1b9c392 100644 (file)
@@ -30,10 +30,8 @@ func (s *_TypeSet) IsAll() bool {
        return !s.comparable && len(s.methods) == 0 && s.terms.isAll()
 }
 
-// TODO(gri) IsMethodSet is not a great name for this predicate. Find a better one.
-
-// IsMethodSet reports whether the type set s is described by a single set of methods.
-func (s *_TypeSet) IsMethodSet() bool { return !s.comparable && s.terms.isAll() }
+// IsConstraint reports whether type set s is not just a set of methods.
+func (s *_TypeSet) IsConstraint() bool { return s.comparable || !s.terms.isAll() }
 
 // IsComparable reports whether each type in the set is comparable.
 func (s *_TypeSet) IsComparable() bool {
index f3e415e4c73bf505ef26643093e04961731d5d0f..6938648bbc50e63a6a08fe82c7b0256c8eef685e 100644 (file)
@@ -151,7 +151,7 @@ func (check *Checker) ordinaryType(pos syntax.Pos, typ Type) {
        check.later(func() {
                if t := asInterface(typ); t != nil {
                        tset := computeInterfaceTypeSet(check, pos, t) // TODO(gri) is this the correct position?
-                       if !tset.IsMethodSet() {
+                       if tset.IsConstraint() {
                                if tset.comparable {
                                        check.softErrorf(pos, "interface is (or embeds) comparable")
                                } else {