Source file
test/codegen/ifaces.go
1
2
3
4
5
6
7 package codegen
8
9 type I interface{ M() }
10
11 func NopConvertIface(x I) I {
12
13 return I(x)
14 }
15
16 func NopConvertGeneric[T any](x T) T {
17
18 return T(x)
19 }
20
21 var NopConvertGenericIface = NopConvertGeneric[I]
22
23 func ConvToM(x any) I {
24
25
26 return x.(I)
27 }
28
29 func e1(x any, y *int) bool {
30
31
32 return x == y
33 }
34
35 func e2(x any, y *int) bool {
36
37
38 return y == x
39 }
40
41 type E *int
42
43 func e3(x any, y E) bool {
44
45
46 return x == y
47 }
48
49 type T int
50
51 func (t *T) M() {}
52
53 func i1(x I, y *T) bool {
54
55
56 return x == y
57 }
58
59 func i2(x I, y *T) bool {
60
61
62 return y == x
63 }
64
View as plain text