1
2
3
4
5 package p
6
7 func f1[P interface{ *P }]() {}
8 func f2[P interface{ func(P) }]() {}
9 func f3[P, Q interface{ func(Q) P }]() {}
10 func f4[P interface{ *Q }, Q interface{ func(P) }]() {}
11 func f5[P interface{ func(P) }]() {}
12 func f6[P interface { *Tree[P] }, Q any ]() {}
13
14 func _() {
15 f1 ()
16 f2 ()
17 f3 ()
18 f4 ()
19 f5 ()
20 f6 ()
21 }
22
23 type Tree[P any] struct {
24 left, right *Tree[P]
25 data P
26 }
27
28
29
30 func foo[Src interface { func() Src }]() Src {
31 return foo[Src]
32 }
33
34 func _() {
35 foo ()
36 }
37
View as plain text