|
4 | 4 | // REQUIRES: executable_test
|
5 | 5 |
|
6 | 6 | @main struct App { static func main() {
|
7 |
| - test1((1,2,3,4)) |
| 7 | + test1() |
8 | 8 | }}
|
9 | 9 |
|
10 | 10 | func barrier() { print("barrier") }
|
11 | 11 |
|
12 |
| -struct Ur<T> : ~Copyable { |
13 |
| - var t: T |
| 12 | +struct Ur : ~Copyable { |
14 | 13 | var name: String
|
15 |
| - init(_ t: T, named name: String) { |
16 |
| - self.t = t |
| 14 | + init(named name: String) { |
17 | 15 | self.name = name
|
18 | 16 | print("hi", name)
|
19 | 17 | }
|
20 | 18 | deinit {
|
21 | 19 | print("bye", name)
|
22 | 20 | }
|
23 | 21 | }
|
24 |
| -func take<T>(_ u: consuming Ur<T>) {} |
| 22 | +func take(_ u: consuming Ur) {} |
25 | 23 |
|
26 |
| -struct Pair<T> : ~Copyable { |
27 |
| - var u1: Ur<T> |
28 |
| - var u2: Ur<T> |
29 |
| - init(_ t1: T, _ t2: T, named name: String) { |
30 |
| - u1 = .init(t1, named: "\(name).u1") |
31 |
| - u2 = .init(t2, named: "\(name).u2") |
| 24 | +struct Pair : ~Copyable { |
| 25 | + var u1: Ur |
| 26 | + var u2: Ur |
| 27 | + init(named name: String) { |
| 28 | + u1 = .init(named: "\(name).u1") |
| 29 | + u2 = .init(named: "\(name).u2") |
32 | 30 | }
|
33 | 31 | }
|
34 |
| -func take<T>(_ u: consuming Pair<T>) {} |
| 32 | +func take(_ u: consuming Pair) {} |
35 | 33 |
|
36 |
| -struct Quad<T> : ~Copyable { |
37 |
| - var p1: Pair<T> |
38 |
| - var p2: Pair<T> |
39 |
| - init(_ t1: T, _ t2: T, _ t3: T, _ t4: T, named name: String) { |
40 |
| - p1 = .init(t1, t2, named: "\(name).p1") |
41 |
| - p2 = .init(t3, t4, named: "\(name).p2") |
| 34 | +struct Quad : ~Copyable { |
| 35 | + var p1: Pair |
| 36 | + var p2: Pair |
| 37 | + init(named name: String) { |
| 38 | + p1 = .init(named: "\(name).p1") |
| 39 | + p2 = .init(named: "\(name).p2") |
42 | 40 | }
|
43 | 41 | }
|
44 |
| -func take<T>(_ u: consuming Quad<T>) {} |
| 42 | +func take(_ u: consuming Quad) {} |
45 | 43 |
|
46 |
| -func test1<T>(_ ts: (T, T, T, T)) { |
| 44 | +func test1() { |
47 | 45 | do {
|
48 |
| - let q1 = Quad<T>(ts.0, ts.1, ts.2, ts.3, named: "\(#function).q1") |
| 46 | + let q1 = Quad(named: "\(#function).q1") |
49 | 47 | barrier()
|
50 | 48 | // CHECK: barrier
|
51 |
| - // CHECK: bye test1(_:).q1.p1.u1 |
52 |
| - // CHECK: bye test1(_:).q1.p1.u2 |
53 |
| - // CHECK: bye test1(_:).q1.p2.u1 |
54 |
| - // CHECK: bye test1(_:).q1.p2.u2 |
| 49 | + // CHECK: bye test1().q1.p1.u1 |
| 50 | + // CHECK: bye test1().q1.p1.u2 |
| 51 | + // CHECK: bye test1().q1.p2.u1 |
| 52 | + // CHECK: bye test1().q1.p2.u2 |
55 | 53 | }
|
56 | 54 |
|
57 |
| - let q2 = Quad<T>(ts.0, ts.1, ts.2, ts.3, named: "\(#function).q2") |
| 55 | + let q2 = Quad(named: "\(#function).q2") |
58 | 56 | take(q2.p2.u2)
|
59 | 57 | take(q2.p2.u1)
|
60 | 58 | barrier()
|
61 | 59 | take(q2.p1.u2)
|
62 | 60 | take(q2.p1.u1)
|
63 |
| - // CHECK: bye test1(_:).q2.p2.u2 |
64 |
| - // CHECK: bye test1(_:).q2.p2.u1 |
| 61 | + // CHECK: bye test1().q2.p2.u2 |
| 62 | + // CHECK: bye test1().q2.p2.u1 |
65 | 63 | // CHECK: barrier
|
66 |
| - // CHECK: bye test1(_:).q2.p1.u2 |
67 |
| - // CHECK: bye test1(_:).q2.p1.u1 |
| 64 | + // CHECK: bye test1().q2.p1.u2 |
| 65 | + // CHECK: bye test1().q2.p1.u1 |
68 | 66 |
|
69 |
| - let q3 = Quad<T>(ts.0, ts.1, ts.2, ts.3, named: "\(#function).q3") |
| 67 | + let q3 = Quad(named: "\(#function).q3") |
70 | 68 | _ = consume q3.p2.u2
|
71 | 69 | _ = consume q3.p2.u1
|
72 | 70 | _ = consume q3.p1.u2
|
73 | 71 | barrier()
|
74 | 72 | _ = consume q3.p1.u1
|
75 |
| - // CHECK: bye test1(_:).q3.p2.u2 |
76 |
| - // CHECK: bye test1(_:).q3.p2.u1 |
77 |
| - // CHECK: bye test1(_:).q3.p1.u2 |
| 73 | + // CHECK: bye test1().q3.p2.u2 |
| 74 | + // CHECK: bye test1().q3.p2.u1 |
| 75 | + // CHECK: bye test1().q3.p1.u2 |
78 | 76 | // CHECK: barrier
|
79 |
| - // CHECK: bye test1(_:).q3.p1.u1 |
| 77 | + // CHECK: bye test1().q3.p1.u1 |
80 | 78 |
|
81 |
| - let q4 = Quad<T>(ts.0, ts.1, ts.2, ts.3, named: "\(#function).q4") |
| 79 | + let q4 = Quad(named: "\(#function).q4") |
82 | 80 | _ = consume q4.p1.u1
|
83 | 81 | barrier()
|
84 | 82 | _ = consume q4.p2.u1
|
85 | 83 | _ = consume q4.p1.u2
|
86 | 84 | _ = consume q4.p2.u2
|
87 |
| - // CHECK: bye test1(_:).q4.p1.u1 |
| 85 | + // CHECK: bye test1().q4.p1.u1 |
88 | 86 | // CHECK: barrier
|
89 |
| - // CHECK: bye test1(_:).q4.p2.u1 |
90 |
| - // CHECK: bye test1(_:).q4.p1.u2 |
91 |
| - // CHECK: bye test1(_:).q4.p2.u2 |
| 87 | + // CHECK: bye test1().q4.p2.u1 |
| 88 | + // CHECK: bye test1().q4.p1.u2 |
| 89 | + // CHECK: bye test1().q4.p2.u2 |
92 | 90 |
|
93 | 91 | do {
|
94 |
| - let q5 = Quad<T>(ts.0, ts.1, ts.2, ts.3, named: "\(#function).q5") |
| 92 | + let q5 = Quad(named: "\(#function).q5") |
95 | 93 | take(q5.p1.u1)
|
96 | 94 | _ = consume q5.p2.u1
|
97 | 95 | _ = consume q5.p1.u2
|
98 | 96 | take(q5.p2.u2)
|
99 |
| - // CHECK: bye test1(_:).q5.p1.u1 |
100 |
| - // CHECK: bye test1(_:).q5.p2.u1 |
101 |
| - // CHECK: bye test1(_:).q5.p1.u2 |
102 |
| - // CHECK: bye test1(_:).q5.p2.u2 |
| 97 | + // CHECK: bye test1().q5.p1.u1 |
| 98 | + // CHECK: bye test1().q5.p2.u1 |
| 99 | + // CHECK: bye test1().q5.p1.u2 |
| 100 | + // CHECK: bye test1().q5.p2.u2 |
103 | 101 | }
|
104 | 102 | do {
|
105 |
| - let q6 = Quad<T>(ts.0, ts.1, ts.2, ts.3, named: "\(#function).q6") |
| 103 | + let q6 = Quad(named: "\(#function).q6") |
106 | 104 | if Bool.random() {
|
107 | 105 | take(q6.p1.u1)
|
108 | 106 | _ = consume q6.p2.u1
|
|
0 commit comments