]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typeparams] go/types: convert testdata/fixedbugs tests to type set sytax
authorRob Findley <rfindley@google.com>
Wed, 9 Jun 2021 22:51:24 +0000 (18:51 -0400)
committerRobert Findley <rfindley@google.com>
Thu, 17 Jun 2021 02:10:00 +0000 (02:10 +0000)
This is a port of CL 324530 to go/types. One error position in
issue39634.go2 was adjusted by a character, to account for go/types'
positioning.

Change-Id: Ie06974ea9ee81d3ae66ef58dba522936ab4ce2d1
Reviewed-on: https://go-review.googlesource.com/c/go/+/326681
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/testdata/fixedbugs/issue39634.go2
src/go/types/testdata/fixedbugs/issue39680.go2
src/go/types/testdata/fixedbugs/issue39699.go2
src/go/types/testdata/fixedbugs/issue39723.go2
src/go/types/testdata/fixedbugs/issue39755.go2
src/go/types/testdata/fixedbugs/issue41124.go2
src/go/types/testdata/fixedbugs/issue42758.go2
src/go/types/testdata/fixedbugs/issue45548.go2
src/go/types/testdata/fixedbugs/issue45635.go2
src/go/types/testdata/fixedbugs/issue45985.go2

index c759be0d93fbd0afc26c6116e211f36d0594e6d2..8decff5291e03b01c0ff0beb57f879656ee47b73 100644 (file)
@@ -31,12 +31,12 @@ type x7[A any] struct{ foo7 }
 func main7() { var _ foo7 = x7[int]{} }
 
 // crash 8
-type foo8[A any] interface { type A }
+type foo8[A any] interface { ~A }
 func bar8[A foo8[A]](a A) {}
 func main8() {}
 
 // crash 9
-type foo9[A any] interface { type foo9 /* ERROR cannot use interface */ [A] }
+type foo9[A any] interface { ~ /* ERROR cannot use interface */ foo9 [A] }
 func _() { var _ = new(foo9 /* ERROR interface contains type constraints */ [int]) }
 
 // crash 12
index 9bc26f35461345eb2f0d5728ba39fe793774723d..01eadd2dbf9c5b8a769974ec6fe1212d4e2550ef 100644 (file)
@@ -7,13 +7,13 @@ package p
 import "fmt"
 
 // Minimal test case.
-func _[T interface{type T}](x T) T{
+func _[T interface{~T}](x T) T{
        return x
 }
 
 // Test case from issue.
 type constr[T any] interface {
-       type T
+       ~T
 }
 
 func Print[T constr[T]](s []T) {
index 75491e7e26f00cd5b1d0ce771d471724ae7cdf9e..72f83997c2460a5496556cb1d294b9e260550c5d 100644 (file)
@@ -8,7 +8,7 @@ type T0 interface{
 }
 
 type T1 interface{
-       type int
+       ~int
 }
 
 type T2 interface{
index 61bc60678923428c6a51193510d32c9baae61885..367b3f1360f3cfdb82736edd00a7ac1cd7f27025 100644 (file)
@@ -6,4 +6,4 @@ package p
 
 // A constraint must be an interface; it cannot
 // be a type parameter, for instance.
-func _[A interface{ type int }, B A /* ERROR not an interface */ ]()
+func _[A interface{ ~int }, B A /* ERROR not an interface */ ]()
index b7ab68818e9587897e7f916730644a3dc1f0af8b..257b73a2fbeff15a934f4daf4798952578bad9d5 100644 (file)
@@ -4,14 +4,14 @@
 
 package p
 
-func _[T interface{type map[string]int}](x T) {
+func _[T interface{~map[string]int}](x T) {
        _ = x == nil
 }
 
 // simplified test case from issue
 
 type PathParamsConstraint interface {
-        type map[string]string, []struct{key, value string}
+        ~map[string]string | ~[]struct{key, value string}
 }
 
 type PathParams[T PathParamsConstraint] struct {
index 61f766bcbd7891ef16f8ca6396349e1ff43159f6..ab535049dd7e58485e118e62a7ffbe336b6d8318 100644 (file)
@@ -7,7 +7,7 @@ package p
 // Test case from issue.
 
 type Nat interface {
-       type Zero, Succ
+       Zero|Succ
 }
 
 type Zero struct{}
@@ -22,7 +22,7 @@ type I1 interface {
 }
 
 type I2 interface {
-       type int
+       ~int
 }
 
 type I3 interface {
index 698cb8a16bad26194a40f5893e7a1d493b30083c..bf0031f5d244305720afb8c8d2f2710c5b8bbaf9 100644 (file)
@@ -17,7 +17,7 @@ func _[T any](x interface{}){
 }
 
 type constraint interface {
-       type int
+       ~int
 }
 
 func _[T constraint](x interface{}){
index b1e42497e8586c500d11985f0df6c70249927949..b8ba0ad4a70915b4edaca42bb24ca60f1088a2bd 100644 (file)
@@ -4,7 +4,7 @@
 
 package p
 
-func f[F interface{type *Q}, G interface{type *R}, Q, R any](q Q, r R) {}
+func f[F interface{~*Q}, G interface{~*R}, Q, R any](q Q, r R) {}
 
 func _() {
        f[*float64, *int](1, 2)
index 3e2cceca2d43b007e9f11bda908ab50ba588b281..0f6298034340528f332b60dd1ee01584d7b04a97 100644 (file)
@@ -13,7 +13,7 @@ type N[T any] struct{}
 var _ N /* ERROR "0 arguments but 1 type parameters" */ []
 
 type I interface {
-       type map[int]int, []int
+       ~map[int]int | ~[]int
 }
 
 func _[T I](i, j int) {
index 550b9c6712768cb9950fd398a366ab1b3677a7d4..6e42dbb633969bf92e3df7e0ce084c4de103b7b3 100644 (file)
@@ -5,7 +5,7 @@
 package issue45985
 
 // TODO(rFindley): this error should be on app[int] below.
-func app[S /* ERROR "type S = S does not match" */ interface{ type []T }, T any](s S, e T) S {
+func app[S /* ERROR "type S = S does not match" */ interface{ ~[]T }, T any](s S, e T) S {
     return append(s, e)
 }