aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/predicates.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-10-25 21:43:07 -0700
committerRobert Griesemer <gri@golang.org>2021-10-27 20:24:56 +0000
commit5c4d7c50c7266bfbce3f43f04a0fb622b9e45805 (patch)
tree267f4536e80b4b3dcd1014a4ee0ed294cf77b6ef /src/cmd/compile/internal/types2/predicates.go
parenta155a307fbeda88fd44c5399d4fb7ea9e34db545 (diff)
downloadgo-5c4d7c50c7266bfbce3f43f04a0fb622b9e45805.tar.gz
go-5c4d7c50c7266bfbce3f43f04a0fb622b9e45805.zip
cmd/compile/internal/types2: rename isNamed predicate to hasName
isNamed(t) is easily confused with asNamed(t) != nil (e.g., we have isPointer(t) that is defined as asPointer(t) != nil). This rename also helped clarifying a couple of places in the assignability rules where it makes sense to simply look for types that have names. Change-Id: Ie995908613a26883ffe0562343d297a1e981e9ef Reviewed-on: https://go-review.googlesource.com/c/go/+/358621 Trust: Robert Griesemer <gri@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/predicates.go')
-rw-r--r--src/cmd/compile/internal/types2/predicates.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cmd/compile/internal/types2/predicates.go b/src/cmd/compile/internal/types2/predicates.go
index 4faa09ebd0..409715ad9d 100644
--- a/src/cmd/compile/internal/types2/predicates.go
+++ b/src/cmd/compile/internal/types2/predicates.go
@@ -6,9 +6,10 @@
package types2
-// isNamed reports whether typ has a name.
-// isNamed may be called with types that are not fully set up.
-func isNamed(typ Type) bool {
+// hasName reports whether typ has a name. This includes
+// predeclared types, defined types, and type parameters.
+// hasName may be called with types that are not fully set up.
+func hasName(typ Type) bool {
switch typ.(type) {
case *Basic, *Named, *TypeParam:
return true