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
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) {
}
type T1 interface{
- type int
+ ~int
}
type T2 interface{
// 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 */ ]()
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 {
// Test case from issue.
type Nat interface {
- type Zero, Succ
+ Zero|Succ
}
type Zero struct{}
}
type I2 interface {
- type int
+ ~int
}
type I3 interface {
}
type constraint interface {
- type int
+ ~int
}
func _[T constraint](x interface{}){
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)
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) {
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)
}