diff options
author | Robert Griesemer <gri@golang.org> | 2022-06-29 18:21:32 -0700 |
---|---|---|
committer | Robert Griesemer <gri@google.com> | 2022-06-30 23:25:23 +0000 |
commit | 405c269b858941c46e35fb9a92b45aa75c61561c (patch) | |
tree | 4f6d9809aa6b8502212deec49d6828266d06b969 | |
parent | aad9382e590265efb5e5fa3591c30486dcf215e0 (diff) | |
download | go-405c269b858941c46e35fb9a92b45aa75c61561c.tar.gz go-405c269b858941c46e35fb9a92b45aa75c61561c.zip |
go/types, types2: re-enable a couple of commented out tests
Change-Id: Ibb27012b18fc0f0f9f9ef74cc120e7ef981e6d43
Reviewed-on: https://go-review.googlesource.com/c/go/+/415156
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
-rw-r--r-- | src/cmd/compile/internal/types2/testdata/fixedbugs/issue39634.go | 13 | ||||
-rw-r--r-- | src/go/types/testdata/fixedbugs/issue39634.go | 13 |
2 files changed, 10 insertions, 16 deletions
diff --git a/src/cmd/compile/internal/types2/testdata/fixedbugs/issue39634.go b/src/cmd/compile/internal/types2/testdata/fixedbugs/issue39634.go index b408dd7003..b7d99f96c2 100644 --- a/src/cmd/compile/internal/types2/testdata/fixedbugs/issue39634.go +++ b/src/cmd/compile/internal/types2/testdata/fixedbugs/issue39634.go @@ -31,10 +31,8 @@ type x7[A any] struct{ foo7 } func main7() { var _ foo7 = x7[int]{} } // crash 8 -// Embedding stand-alone type parameters is not permitted for now. Disabled. -// type foo8[A any] interface { ~A } -// func bar8[A foo8[A]](a A) {} -// func main8() {} +type foo8[A any] interface { ~A /* ERROR cannot be a type parameter */ } +func bar8[A foo8[A]](a A) {} // crash 9 type foo9[A any] interface { foo9 /* ERROR illegal cycle */ [A] } @@ -74,10 +72,9 @@ func F20[t Z20]() { F20(t /* ERROR invalid composite literal type */ {}) } type Z21 /* ERROR illegal cycle */ interface{ Z21 } func F21[T Z21]() { ( /* ERROR not used */ F21[Z21]) } -// For now, a lone type parameter is not permitted as RHS in a type declaration (issue #45639). -// // crash 24 -// type T24[P any] P -// func (r T24[P]) m() { T24 /* ERROR without instantiation */ .m() } +// crash 24 +type T24[P any] P // ERROR cannot use a type parameter as RHS in type declaration +func (r T24[P]) m() { T24 /* ERROR without instantiation */ .m() } // crash 25 type T25[A any] int diff --git a/src/go/types/testdata/fixedbugs/issue39634.go b/src/go/types/testdata/fixedbugs/issue39634.go index 8cba2e735a..ce84299a61 100644 --- a/src/go/types/testdata/fixedbugs/issue39634.go +++ b/src/go/types/testdata/fixedbugs/issue39634.go @@ -31,10 +31,8 @@ type x7[A any] struct{ foo7 } func main7() { var _ foo7 = x7[int]{} } // crash 8 -// Embedding stand-alone type parameters is not permitted for now. Disabled. -// type foo8[A any] interface { ~A } -// func bar8[A foo8[A]](a A) {} -// func main8() {} +type foo8[A any] interface { ~A /* ERROR cannot be a type parameter */ } +func bar8[A foo8[A]](a A) {} // crash 9 type foo9[A any] interface { foo9 /* ERROR illegal cycle */ [A] } @@ -74,10 +72,9 @@ func F20[t Z20]() { F20(t /* ERROR invalid composite literal type */ {}) } type Z21 /* ERROR illegal cycle */ interface{ Z21 } func F21[T Z21]() { ( /* ERROR not used */ F21[Z21]) } -// For now, a lone type parameter is not permitted as RHS in a type declaration (issue #45639). -// // crash 24 -// type T24[P any] P -// func (r T24[P]) m() { T24 /* ERROR without instantiation */ .m() } +// crash 24 +type T24[P any] P // ERROR cannot use a type parameter as RHS in type declaration +func (r T24[P]) m() { T24 /* ERROR without instantiation */ .m() } // crash 25 type T25[A any] int |