1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 //gofmt
6
7 package typeparams
8
9 type T[P any] struct{}
10 type T[P1, P2, P3 any] struct{}
11
12 type T[P C] struct{}
13 type T[P1, P2, P3 C] struct{}
14
15 type T[P C[P]] struct{}
16 type T[P1, P2, P3 C[P1, P2, P3]] struct{}
17
18 func f[P any](x P)
19 func f[P1, P2, P3 any](x1 P1, x2 P2, x3 P3) struct{}
20
21 func f[P interface{}](x P)
22 func f[P1, P2, P3 interface {
23 m1(P1)
24 ~P2 | ~P3
25 }](x1 P1, x2 P2, x3 P3) struct{}
26 func f[P any](T1[P], T2[P]) T3[P]
27
28 func (x T[P]) m()
29 func (T[P]) m(x T[P]) P
30
31 func _() {
32 type _ []T[P]
33 var _ []T[P]
34 _ = []T[P]{}
35 }
36
View as plain text