- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathcircularity.swift
283 lines (247 loc) · 7.81 KB
/
circularity.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
// Please keep this file in alphabetical order!
// REQUIRES: objc_interop
// RUN: %empty-directory(%t)
// FIXME: BEGIN -enable-source-import hackaround
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/ObjectiveC.swift -disable-objc-attr-requires-foundation-module
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/CoreGraphics.swift
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -emit-module -o %t %S/../Inputs/clang-importer-sdk/swift-modules/Foundation.swift
// FIXME: END -enable-source-import hackaround
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/circularity.h -emit-module -o %t %s
// RUN: %target-swift-frontend(mock-sdk: -sdk %S/../Inputs/clang-importer-sdk -I %t) -import-objc-header %S/Inputs/circularity.h -parse-as-library %t/circularity.swiftmodule -typecheck -verify -emit-objc-header-path %t/circularity.h
// RUN: %FileCheck %s < %t/circularity.h
// RUN: %check-in-clang %t/circularity.h
// RUN: %check-in-clang -fno-modules -Qunused-arguments %t/circularity.h
import Foundation
// CHECK-LABEL: @interface A1 : ProtoImpl
classA1:ProtoImpl{
// CHECK: // 'test(_:)' below
@objcfunc test(_:NeedsProto<A2>){}
} // CHECK: @end
// CHECK-LABEL: @interface A2 : ProtoImpl
classA2:ProtoImpl{
// CHECK: - (void)test:
@objcfunc test(_:NeedsProto<A1>){}
} // CHECK: @end
// CHECK-LABEL: @interface B1 : ProtoImpl
classB1:ProtoImpl{
// CHECK: // 'test(_:)' below
@objcfunc test(_:NeedsProto<B2>){}
} // CHECK: @end
// CHECK-LABEL: @interface B2 : ProtoImpl
classB2:ProtoImpl{
} // CHECK: @end
// CHECK-LABEL: @interface C1 : ProtoImpl
classC1:ProtoImpl{
// CHECK: // 'test(_:)' below
@objcfunc test(_:NeedsProto<C2>){}
} // CHECK: @end
// CHECK-LABEL: @protocol C2 <Proto>
@objcprotocolC2:Proto{
} // CHECK: @end
// CHECK-LABEL: @interface D1 : ProtoImpl
classD1:ProtoImpl{
// CHECK: // 'test(_:)' below
@objcfunc test(_:NeedsProto<D2>){}
} // CHECK: @end
// CHECK-LABEL: @protocol D2 <Proto>
@objcprotocolD2:Proto{
// CHECK: - (void)test:
func test(_:NeedsProto<D1>)
} // CHECK: @end
// CHECK-LABEL: @interface D4 : ProtoImpl
// CHECK: // 'test(_:)' below
// CHECK: @end
// CHECK-LABEL: @protocol D3 <Proto>
@objcprotocolD3:Proto{
// CHECK: - (void)test:
func test(_:NeedsProto<D4>)
} // CHECK: @end
// Moved ahead.
classD4:ProtoImpl{
@objcfunc test(_:NeedsProto<D3>){}
}
// CHECK-LABEL: @interface E2 : ProtoImpl
// CHECK: @end
// CHECK-LABEL: @protocol E1 <Proto>
@objcprotocolE1:Proto{
// CHECK: - (void)test:
func test(_:NeedsProto<E2>)
} // CHECK: @end
// Moved ahead.
classE2:ProtoImpl{}
// CHECK-LABEL: @interface F1 : ProtoImpl
classF1:ProtoImpl{
} // CHECK: @end
// CHECK-LABEL: @interface F2 : ProtoImpl
// CHECK: @end
// CHECK-LABEL: @interface F1 (SWIFT_EXTENSION(circularity))
extensionF1{
// CHECK: - (void)test:
@objcfunc test(_:NeedsProto<F2>){}
} // CHECK: @end
// Moved ahead.
classF2:ProtoImpl{}
// CHECK-LABEL: @interface G1 : ProtoImpl
classG1:ProtoImpl{
} // CHECK: @end
// CHECK-LABEL: @protocol G2 <Proto>
// CHECK: @end
// CHECK-LABEL: @interface G1 (SWIFT_EXTENSION(circularity))
extensionG1{
// CHECK: - (void)test:
@objcfunc test(_:NeedsProto<G2>){}
} // CHECK: @end
// Moved ahead.
@objcprotocolG2:Proto{}
// CHECK-LABEL: @interface H1 : ProtoImpl
classH1:ProtoImpl{
// CHECK: 'test(_:)' below
@objcfunc test(_:NeedsProto<H2>){}
// CHECK: 'anotherTest(_:)' below
@objcfunc anotherTest(_:NeedsProto<H3>){}
} // CHECK: @end
// CHECK-LABEL: @interface H2 : ProtoImpl
classH2:ProtoImpl{
// CHECK: // 'test(_:)' below
@objcfunc test(_:NeedsProto<H3>){}
// CHECK: - (void)anotherTest:
@objcfunc anotherTest(_:NeedsProto<H1>){}
} // CHECK: @end
// CHECK-LABEL: @interface H3 : ProtoImpl
classH3:ProtoImpl{
// CHECK: - (void)test:
@objcfunc test(_:NeedsProto<H1>){}
// CHECK: - (void)anotherTest:
@objcfunc anotherTest(_:NeedsProto<H2>){}
} // CHECK: @end
// CHECK-LABEL: @interface I1 : Parent
classI1:Parent{
// CHECK: // 'test(_:)' below
@objcfunc test(_:NeedsParent<I2>){}
} // CHECK: @end
// CHECK-LABEL: @interface I2 : Parent
classI2:Parent{
// CHECK: - (void)test:
@objcfunc test(_:NeedsParent<I1>){}
} // CHECK: @end
// CHECK-LABEL: @interface J1 : Parent
classJ1:Parent{
// CHECK: - (void)test:
@objcfunc test(_:Unconstrained<J2>){}
} // CHECK: @end
// CHECK-LABEL: @interface J2 : Parent
classJ2:Parent{
// CHECK: - (void)test:
@objcfunc test(_:Unconstrained<J1>){}
} // CHECK: @end
// CHECK-LABEL: @protocol K1 <Proto>
@objcprotocolK1:Proto{
// CHECK: - (void)test:
@objcfunc test(_:Unconstrained<K2>)
} // CHECK: @end
// CHECK-LABEL: @protocol K2 <Proto>
@objcprotocolK2:Proto{
// CHECK: - (void)test:
@objcfunc test(_:Unconstrained<K1>)
} // CHECK: @end
// CHECK-LABEL: @interface NA2 : ProtoImpl
// CHECK: @end
// CHECK-LABEL: @protocol NA1
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface NA3 : NSObject <NA1>
// CHECK: @end
@objcprotocolNA1{
@objcoptionalfunc test(_:NeedsProto<NA2>)
}
classNA2:ProtoImpl{}
classNA3:NSObject,NA1{}
// CHECK-LABEL: @interface NB1 : ProtoImpl
// CHECK: @end
// CHECK-LABEL: @protocol NB2
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface NB3 : NSObject <NB2>
// CHECK: @end
classNB1:ProtoImpl{}
@objcprotocolNB2{
@objcoptionalfunc test(_:NeedsProto<NB1>)
}
classNB3:NSObject,NB2{}
// CHECK-LABEL: @interface NC2 : ProtoImpl
// CHECK: @end
// CHECK-LABEL: @protocol NC3
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface NC1 : NSObject <NC3>
// CHECK: @end
classNC1:NSObject,NC3{}
classNC2:ProtoImpl{}
@objcprotocolNC3{
@objcoptionalfunc test(_:NeedsProto<NC2>)
}
// CHECK-LABEL: @interface ND3 : ProtoImpl
// CHECK: @end
// CHECK-LABEL: @protocol ND2
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface ND1 : NSObject <ND2>
// CHECK: @end
classND1:NSObject,ND2{}
@objcprotocolND2{
@objcoptionalfunc test(_:NeedsProto<ND3>)
}
classND3:ProtoImpl{}
// CHECK-LABEL: @interface NE3 : ProtoImpl
// CHECK: @end
// CHECK-LABEL: @protocol NE1
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface NE2 : NSObject <NE1>
// CHECK: @end
@objcprotocolNE1{
@objcoptionalfunc test(_:NeedsProto<NE3>)
}
classNE2:NSObject,NE1{}
classNE3:ProtoImpl{}
// CHECK-LABEL: @interface NF2 : ProtoImpl
// CHECK: @end
// CHECK-LABEL: @protocol NF1
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface NF3 : NSObject <NF1>
// CHECK: @end
@objcprotocolNF1{
@objcoptionalfunc test(_:NeedsProto<NF2>)
}
classNF2:ProtoImpl{}
classNF3:NSObject,NF1{}
// CHECK-LABEL: @interface ZZZ_EOF : NSObject
classZZZ_EOF:NSObject{
} // CHECK: @end
// CHECK-LABEL: @interface A1 (SWIFT_EXTENSION(circularity))
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface B1 (SWIFT_EXTENSION(circularity))
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface C1 (SWIFT_EXTENSION(circularity))
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface D1 (SWIFT_EXTENSION(circularity))
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface D4 (SWIFT_EXTENSION(circularity))
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface H1 (SWIFT_EXTENSION(circularity))
// CHECK: - (void)test:
// CHECK-NOT: @end
// CHECK: - (void)anotherTest:
// CHECK: @end
// CHECK-LABEL: @interface H2 (SWIFT_EXTENSION(circularity))
// CHECK: - (void)test:
// CHECK: @end
// CHECK-LABEL: @interface I1 (SWIFT_EXTENSION(circularity))
// CHECK: - (void)test:
// CHECK: @end