...
1
2
3
4
5 package p
6
7 func _[P int]() {
8 type A = P
9 _ = A(0)
10 }
11
12 func _[P []int]() {
13 type A = P
14 _ = make(A, 10)
15 }
16
17 func _[P string]() {
18 var t []byte
19 type A = P
20 var s A
21 copy(t, s)
22 }
23
24 func _[P map[int]int]() {
25 type A = P
26 var m A
27 clear(m)
28 }
29
30 type S1 struct {
31 x int "S1.x"
32 }
33
34 type S2 struct {
35 x int "S2.x"
36 }
37
38 func _[P1 S1, P2 S2]() {
39 type A = P1
40 var p A
41 _ = P2(p)
42 }
43
44 func _[P1 S1, P2 S2]() {
45 var p P1
46 type A = P2
47 _ = A(p)
48 }
49
50 func _[P int | string]() {
51 var p P
52 type A = int
53
54
55
56 _ = A(p )
57 }
58
59 func _[P struct{ x int }]() {
60 var x struct{ x int }
61 type A = P
62 var _ A = x
63 }
64
65 func _[P struct{ x int }]() {
66 type A = P
67 var x A
68 var _ struct{ x int } = x
69 }
70
71 func _[P []int | struct{}]() {
72 type A = []int
73 var a A
74 var p P
75
76 a = p
77 _ = a
78 }
79
80 func _[P any]() {
81 type A = P
82 var x A
83
84 var _ int = x
85 }
86
87
88 func _() {
89 type (
90 S struct{}
91 A = *S
92 T S
93 )
94 var p A
95 _ = (*T)(p)
96 }
97
View as plain text