aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/interface.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/types2/interface.go')
-rw-r--r--src/cmd/compile/internal/types2/interface.go33
1 files changed, 2 insertions, 31 deletions
diff --git a/src/cmd/compile/internal/types2/interface.go b/src/cmd/compile/internal/types2/interface.go
index fc1f5ffe00..aa7d0b05a0 100644
--- a/src/cmd/compile/internal/types2/interface.go
+++ b/src/cmd/compile/internal/types2/interface.go
@@ -21,20 +21,7 @@ type Interface struct {
}
// typeSet returns the type set for interface t.
-func (t *Interface) typeSet() *TypeSet { return computeTypeSet(nil, nopos, t) }
-
-// is reports whether interface t represents types that all satisfy f.
-func (t *Interface) is(f func(Type, bool) bool) bool {
- switch t := t.typeSet().types.(type) {
- case nil, *top:
- // TODO(gri) should settle on top or nil to represent this case
- return false // we must have at least one type! (was bug)
- case *Union:
- return t.is(func(t *term) bool { return f(t.typ, t.tilde) })
- default:
- return f(t, false)
- }
-}
+func (t *Interface) typeSet() *TypeSet { return computeInterfaceTypeSet(nil, nopos, t) }
// emptyInterface represents the empty interface
var emptyInterface = Interface{complete: true, tset: &topTypeSet}
@@ -113,22 +100,6 @@ 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() }
-// isSatisfiedBy reports whether interface t's type list is satisfied by the type typ.
-// If the type list is empty (absent), typ trivially satisfies the interface.
-// TODO(gri) This is not a great name. Eventually, we should have a more comprehensive
-// "implements" predicate.
-func (t *Interface) isSatisfiedBy(typ Type) bool {
- switch t := t.typeSet().types.(type) {
- case nil:
- return true // no type restrictions
- case *Union:
- r, _ := t.intersect(typ, false)
- return r != nil
- default:
- return Identical(t, typ)
- }
-}
-
// Complete computes the interface's type set. It must be called by users of
// NewInterfaceType and NewInterface after the interface's embedded types are
// fully defined and before using the interface type in any way other than to
@@ -262,7 +233,7 @@ func (check *Checker) interfaceType(ityp *Interface, iface *syntax.InterfaceType
// Compute type set with a non-nil *Checker as soon as possible
// to report any errors. Subsequent uses of type sets will use
// this computed type set and won't need to pass in a *Checker.
- check.later(func() { computeTypeSet(check, iface.Pos(), ityp) })
+ check.later(func() { computeInterfaceTypeSet(check, iface.Pos(), ityp) })
}
func flattenUnion(list []syntax.Expr, x syntax.Expr) []syntax.Expr {