diff options
author | Robert Griesemer <gri@golang.org> | 2023-02-23 15:47:44 -0800 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-02-25 20:14:38 +0000 |
commit | e7201cfa9fe638053b7c269c23bf408223600bc9 (patch) | |
tree | 9fcb3e63ec8b6d63338a7727169b3db93a383200 /src/go/types/predicates.go | |
parent | 53a5d2541c6c071634792c1ca87622682b139499 (diff) | |
download | go-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/go/types/predicates.go')
-rw-r--r-- | src/go/types/predicates.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/go/types/predicates.go b/src/go/types/predicates.go index 903b1445e9..cf02a8cab5 100644 --- a/src/go/types/predicates.go +++ b/src/go/types/predicates.go @@ -66,6 +66,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. |