aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/types2/testdata
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2021-07-15 16:42:25 -0700
committerRobert Griesemer <gri@golang.org>2021-07-16 04:41:47 +0000
commit3d8453e00e3d0a6f23cec06bcad08cf740ec5940 (patch)
tree5ae4ea8833b913919931fcc3d83bda1ee99aa2a2 /src/cmd/compile/internal/types2/testdata
parent334f2fc045b7d9d846cccba01b3a0dbf70ddb0db (diff)
downloadgo-3d8453e00e3d0a6f23cec06bcad08cf740ec5940.tar.gz
go-3d8453e00e3d0a6f23cec06bcad08cf740ec5940.zip
[dev.typeparams] cmd/compile/internal/types2: more consistent handling of predeclared "any"
Rather than removing "any" from the universe scope, keep it predeclared but provide a better error message. While at it, remove some unnecessary type assertions. Change-Id: I10603274282ea6afc107f703ab194f32bd334dd1 Reviewed-on: https://go-review.googlesource.com/c/go/+/334911 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
Diffstat (limited to 'src/cmd/compile/internal/types2/testdata')
-rw-r--r--src/cmd/compile/internal/types2/testdata/check/typeparams.go28
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/compile/internal/types2/testdata/check/typeparams.go2 b/src/cmd/compile/internal/types2/testdata/check/typeparams.go2
index 8a7f6eb2c2..2755a539e5 100644
--- a/src/cmd/compile/internal/types2/testdata/check/typeparams.go2
+++ b/src/cmd/compile/internal/types2/testdata/check/typeparams.go2
@@ -6,11 +6,11 @@ package p
// import "io" // for type assertion tests
-// The predeclared identifier "any" is only visible as a constraint
+// The predeclared identifier "any" can only be used as a constraint
// in a type parameter list.
-var _ any // ERROR undeclared
-func _[_ any /* ok here */ , _ interface{any /* ERROR undeclared */ }](any /* ERROR undeclared */ ) {
- var _ any /* ERROR undeclared */
+var _ any // ERROR cannot use any outside constraint position
+func _[_ any /* ok here */ , _ interface{any /* ERROR constraint */ }](any /* ERROR constraint */ ) {
+ var _ any /* ERROR constraint */
}
func identity[T any](x T) T { return x }