summaryrefslogtreecommitdiff
path: root/libgo/go/go/types/testdata/check/typeinst.go2
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2022-02-11 14:53:56 -0800
committerIan Lance Taylor <iant@golang.org>2022-02-11 15:01:19 -0800
commit8dc2499aa62f768c6395c9754b8cabc1ce25c494 (patch)
tree43d7fd2bbfd7ad8c9625a718a5e8718889351994 /libgo/go/go/types/testdata/check/typeinst.go2
parent9a56779dbc4e2d9c15be8d31e36f2f59be7331a8 (diff)
downloadgcc-8dc2499aa62f768c6395c9754b8cabc1ce25c494.tar.gz
libgo: update to Go1.18beta2
gotools/ * Makefile.am (go_cmd_cgo_files): Add ast_go118.go (check-go-tool): Copy golang.org/x/tools directories. * Makefile.in: Regenerate. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/384695
Diffstat (limited to 'libgo/go/go/types/testdata/check/typeinst.go2')
-rw-r--r--libgo/go/go/types/testdata/check/typeinst.go221
1 files changed, 12 insertions, 9 deletions
diff --git a/libgo/go/go/types/testdata/check/typeinst.go2 b/libgo/go/go/types/testdata/check/typeinst.go2
index 3184a4b5b1c..6423cb801f9 100644
--- a/libgo/go/go/types/testdata/check/typeinst.go2
+++ b/libgo/go/go/types/testdata/check/typeinst.go2
@@ -8,7 +8,8 @@ type myInt int
// Parameterized type declarations
-type T1[P any] P
+// For now, a lone type parameter is not permitted as RHS in a type declaration (issue #45639).
+type T1[P any] P // ERROR cannot use a type parameter as RHS in type declaration
type T2[P any] struct {
f P
@@ -17,13 +18,15 @@ type T2[P any] struct {
type List[P any] []P
-// Alias type declarations cannot have type parameters. Syntax error.
-type A1[P any] = /* ERROR cannot be alias */ P
+// Alias type declarations cannot have type parameters.
+// Issue #46477 proposses to change that.
+type A1[P any] = /* ERROR cannot be alias */ struct{}
-// But an alias may refer to a generic, uninstantiated type.
-type A2 = List
+// Pending clarification of #46477 we disallow aliases
+// of generic types.
+type A2 = List // ERROR cannot use generic type
var _ A2[int]
-var _ A2 /* ERROR without instantiation */
+var _ A2
type A3 = List[int]
var _ A3
@@ -33,11 +36,11 @@ var _ A3
var x int
type _ x /* ERROR not a type */ [int]
-type _ int /* ERROR not a generic type */ []
-type _ myInt /* ERROR not a generic type */ []
+type _ int /* ERROR not a generic type */ [] // ERROR expected type argument list
+type _ myInt /* ERROR not a generic type */ [] // ERROR expected type argument list
// TODO(gri) better error messages
-type _ T1 /* ERROR got 0 arguments but 1 type parameters */ []
+type _ T1[] // ERROR expected type argument list
type _ T1[x /* ERROR not a type */ ]
type _ T1 /* ERROR got 2 arguments but 1 type parameters */ [int, float32]