aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/predicates.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2023-02-23 15:47:44 -0800
committerGopher Robot <gobot@golang.org>2023-02-25 20:14:38 +0000
commite7201cfa9fe638053b7c269c23bf408223600bc9 (patch)
tree9fcb3e63ec8b6d63338a7727169b3db93a383200 /src/cmd/compile/internal/types2/predicates.go
parent53a5d2541c6c071634792c1ca87622682b139499 (diff)
downloadgo-e7201cfa9fe638053b7c269c23bf408223600bc9.tar.gz
go-e7201cfa9fe638053b7c269c23bf408223600bc9.zip
go/types, types2: add isTypeLit predicate
Preparation for next CL. Change-Id: I5ef170a04577d8aea10255e304357bdbea4935a7 Reviewed-on: https://go-review.googlesource.com/c/go/+/470919 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Run-TryBot: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/predicates.go')
-rw-r--r--src/cmd/compile/internal/types2/predicates.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/types2/predicates.go b/src/cmd/compile/internal/types2/predicates.go
index 2e6067652b..c92c1dc292 100644
--- a/src/cmd/compile/internal/types2/predicates.go
+++ b/src/cmd/compile/internal/types2/predicates.go
@@ -64,6 +64,17 @@ func hasName(t Type) bool {
return false
}
+// isTypeLit reports whether t is a type literal.
+// This includes all non-defined types, but also basic types.
+// isTypeLit may be called with types that are not fully set up.
+func isTypeLit(t Type) bool {
+ switch t.(type) {
+ case *Named, *TypeParam:
+ return false
+ }
+ return true
+}
+
// isTyped reports whether t is typed; i.e., not an untyped
// constant or boolean. isTyped may be called with types that
// are not fully set up.