]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: remove 1.18 APIs that have been replaced
authorRobert Findley <rfindley@google.com>
Fri, 1 Oct 2021 18:22:34 +0000 (14:22 -0400)
committerRobert Findley <rfindley@google.com>
Mon, 4 Oct 2021 18:15:09 +0000 (18:15 +0000)
Remove the Interface.IsConstraint, Signature.SetTypeParams, and
Signature.SetRecvTypeParams methods, as they have been replaced and
usage removed from x/tools.

Change-Id: I8786c3cf34e96ab5211cd8e7e6348e9ee792b843
Reviewed-on: https://go-review.googlesource.com/c/go/+/353570
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/call.go
src/go/types/decl.go
src/go/types/interface.go
src/go/types/signature.go
src/go/types/typeset.go
src/go/types/typexpr.go

index 2fa29dd43971fa36c0f50c0049106d1208f62089..98a8fda9d1adaf9a210ac4a3f423c91cc7e74094 100644 (file)
@@ -112,7 +112,7 @@ func (check *Checker) callExpr(x *operand, call *ast.CallExpr) exprKind {
                                        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
                                        }
index d0809f5a6ee09d83868d5210abf27fbcf702b5ef..3c68bbfb20e4b7a661fc2874ed69fc0a327cdb93 100644 (file)
@@ -586,7 +586,7 @@ func (check *Checker) isImportedConstraint(typ Type) bool {
                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) {
index ccea1f6dccf2a5a8318fd1493144159ba526f3cd..866a3427ca18c26b2e034e2919aff1dbdf0ce81d 100644 (file)
@@ -106,12 +106,7 @@ func (t *Interface) IsComparable() bool { return t.typeSet().IsComparable() }
 
 // 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
index c26437afe43d72f7b855b9dc9f34ebf0cb0e559d..9bb6ec2f4feb38352a7c21fa4f99eb813f195884 100644 (file)
@@ -82,15 +82,9 @@ func (s *Signature) Recv() *Var { return s.recv }
 // 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 }
 
index 3e59155e5c6b5acfaba58f94e8cbdf968c408ccf..b4477998628631d252486111e04e21ba31fb6d14 100644 (file)
@@ -28,8 +28,8 @@ func (s *_TypeSet) IsEmpty() bool { return s.terms.isEmpty() }
 // 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 {
index 505c6394443e250b39ceb798c359afee09fba451..c4e4bc3dfe6887c26f23d6e63c6c046f5a2ddce4 100644 (file)
@@ -139,7 +139,7 @@ func (check *Checker) varType(e ast.Expr) Type {
        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 {