mirror of
https://github.com/golang/go
synced 2024-11-26 08:27:56 -07:00
cmd/compile/internal/types2: rename IsMethodSet to IsConstraint (cleanup)
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>
This commit is contained in:
parent
4068fb6c21
commit
0ac64f6d70
@ -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) }
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user