...
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
7package typeparams
8
9type T[P any] struct{}
10type T[P1, P2, P3 any] struct{}
11
12type T[P C] struct{}
13type T[P1, P2, P3 C] struct{}
14
15type T[P C[P]] struct{}
16type T[P1, P2, P3 C[P1, P2, P3]] struct{}
17
18func f[P any](x P)
19func f[P1, P2, P3 any](x1 P1, x2 P2, x3 P3) struct{}
20
21func f[P interface{}](x P)
22func f[P1, P2, P3 interface {
23 m1(P1)
24 ~P2 | ~P3
25}](x1 P1, x2 P2, x3 P3) struct{}
26func f[P any](T1[P], T2[P]) T3[P]
27
28func (x T[P]) m()
29func (T[P]) m(x T[P]) P
30
31func _() {
32 type _ []T[P]
33 var _ []T[P]
34 _ = []T[P]{}
35}
View as plain text