break
}
if t := asInterface(T); t != nil {
- if t.IsConstraint() {
+ if !t.IsMethodSet() {
check.errorf(call, _Todo, "cannot use interface %s in conversion (contains type list or is comparable)", T)
break
}
return false
}
u, _ := named.under().(*Interface)
- return u != nil && u.IsConstraint()
+ return u != nil && !u.IsMethodSet()
}
func (check *Checker) typeDecl(obj *TypeName, tdecl *ast.TypeSpec, def *Named) {
// IsMethodSet reports whether the interface t is fully described by its method
// set.
-func (t *Interface) IsMethodSet() bool { return !t.typeSet().IsConstraint() }
-
-// IsConstraint reports whether interface t is not just a method set.
-//
-// TODO(rfindley): remove this method.
-func (t *Interface) IsConstraint() bool { return t.typeSet().IsConstraint() }
+func (t *Interface) IsMethodSet() bool { return t.typeSet().IsMethodSet() }
// Complete computes the interface's type set. It must be called by users of
// NewInterfaceType and NewInterface after the interface's embedded types are
// TypeParams returns the type parameters of signature s, or nil.
func (s *Signature) TypeParams() *TypeParamList { return s.tparams }
-// SetTypeParams sets the type parameters of signature s.
-func (s *Signature) SetTypeParams(tparams []*TypeParam) { s.tparams = bindTParams(tparams) }
-
// RecvTypeParams returns the receiver type parameters of signature s, or nil.
func (s *Signature) RecvTypeParams() *TypeParamList { return s.rparams }
-// SetRecvTypeParams sets the receiver type params of signature s.
-func (s *Signature) SetRecvTypeParams(rparams []*TypeParam) { s.rparams = bindTParams(rparams) }
-
// Params returns the parameters of signature s, or nil.
func (s *Signature) Params() *Tuple { return s.params }
// IsAll reports whether type set s is the set of all types (corresponding to the empty interface).
func (s *_TypeSet) IsAll() bool { return !s.comparable && len(s.methods) == 0 && 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() }
+// IsMethodSet reports whether the interface t is fully described by its method set.
+func (s *_TypeSet) IsMethodSet() bool { return !s.comparable && s.terms.isAll() }
// IsComparable reports whether each type in the set is comparable.
func (s *_TypeSet) IsComparable() bool {
check.later(func() {
if t := asInterface(typ); t != nil {
tset := computeInterfaceTypeSet(check, e.Pos(), t) // TODO(gri) is this the correct position?
- if tset.IsConstraint() {
+ if !tset.IsMethodSet() {
if tset.comparable {
check.softErrorf(e, _Todo, "interface is (or embeds) comparable")
} else {