aboutsummaryrefslogtreecommitdiff
path: root/src/go/types/predicates.go
diff options
context:
space:
mode:
authorRobert Findley <rfindley@google.com>2021-11-01 15:27:13 -0400
committerRobert Findley <rfindley@google.com>2021-11-02 20:33:56 +0000
commitb29182b54ac343bbc58a30357d9df908f1c3b727 (patch)
tree0c6b762ad2b15c6ea69d9f4e4a56fc8df87ae663 /src/go/types/predicates.go
parent7c9510ef3ec4b1008b599c9c8a0ec9adaba4b663 (diff)
downloadgo-b29182b54ac343bbc58a30357d9df908f1c3b727.tar.gz
go-b29182b54ac343bbc58a30357d9df908f1c3b727.zip
go/types: clean up asT converters (step 1 of 2)
This is a port of CL 358597 to go/types. A comment was missing in the base of applyTypeFunc, which had been there since the initial check-in of types2; somehow it was not in go/types. Change-Id: If08efd92d782dd3099b26254ae6e311c6cea8c3b Reviewed-on: https://go-review.googlesource.com/c/go/+/360477 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>
Diffstat (limited to 'src/go/types/predicates.go')
-rw-r--r--src/go/types/predicates.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/go/types/predicates.go b/src/go/types/predicates.go
index b687c151c7..d4ce97a16b 100644
--- a/src/go/types/predicates.go
+++ b/src/go/types/predicates.go
@@ -58,7 +58,7 @@ func isNumericOrString(typ Type) bool { return is(typ, IsNumeric|IsString) }
// are not fully set up.
func isTyped(typ Type) bool {
// isTyped is called with types that are not fully
- // set up. Must not call asBasic()!
+ // set up. Must not call toBasic()!
t, _ := typ.(*Basic)
return t == nil || t.info&IsUntyped == 0
}
@@ -72,13 +72,13 @@ func isOrdered(typ Type) bool { return is(typ, IsOrdered) }
func isConstType(typ Type) bool {
// Type parameters are never const types.
- t, _ := under(typ).(*Basic)
+ t := toBasic(typ)
return t != nil && t.info&IsConstType != 0
}
// IsInterface reports whether typ is an interface type.
func IsInterface(typ Type) bool {
- return asInterface(typ) != nil
+ return toInterface(typ) != nil
}
// Comparable reports whether values of type T are comparable.
@@ -341,10 +341,6 @@ func identical(x, y Type, cmpTags bool, p *ifacePair) bool {
case *TypeParam:
// nothing to do (x and y being equal is caught in the very beginning of this function)
- case *top:
- // Either both types are theTop in which case the initial x == y check
- // will have caught them. Otherwise they are not identical.
-
case nil:
// avoid a crash in case of nil type