2
2
// REQUIRES: concurrency
3
3
4
4
// RUN: %empty-directory(%t)
5
-
6
- // This test somehow depends on the Foundation overlay present in the build
7
- // directory, even though it uses the mock SDK. Unfortunately we can't
8
- // continue building overlays in-tree, so this will need further investigation.
9
- // (The hidden dependency seems like a problem -- the mock SDK ought to use mock
10
- // overlays, not the real ones.)
11
- // REQUIRES: rdar78879483
5
+ // RUN: %build-clang-importer-objc-overlays
12
6
13
7
import Foundation
14
8
import ConvertBoolObjC
@@ -19,47 +13,47 @@ func optionalBoolWithErr(completion: (String?, Bool?, Bool, Error?) -> Void) {}
19
13
20
14
// All 7 of the below should generate the same refactoring.
21
15
22
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR %s
16
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR %s
23
17
boolWithErr { b, err in
24
18
if !b {
25
19
fatalError ( " oh no \( err!) " )
26
20
}
27
21
print ( " not err " )
28
22
}
29
23
30
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR %s
24
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR %s
31
25
boolWithErr { b, err in
32
26
if b {
33
27
fatalError ( " oh no \( err!) " )
34
28
}
35
29
print ( " not err " )
36
30
}
37
31
38
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR %s
32
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR %s
39
33
boolWithErr { b, err in
40
34
if !b && err != nil {
41
35
fatalError ( " oh no \( err!) " )
42
36
}
43
37
print ( " not err " )
44
38
}
45
39
46
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR %s
40
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR %s
47
41
boolWithErr { b, err in
48
42
if b && err != nil {
49
43
fatalError ( " oh no \( err!) " )
50
44
}
51
45
print ( " not err " )
52
46
}
53
47
54
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR %s
48
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR %s
55
49
boolWithErr { b, err in
56
50
if err != nil && b == false {
57
51
fatalError ( " oh no \( err!) " )
58
52
}
59
53
print ( " not err " )
60
54
}
61
55
62
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR %s
56
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR %s
63
57
boolWithErr { b, err in
64
58
if b == true && err == nil {
65
59
} else {
@@ -68,7 +62,7 @@ boolWithErr { b, err in
68
62
print ( " not err " )
69
63
}
70
64
71
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR %s
65
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR %s
72
66
boolWithErr { b, err in
73
67
if !b && err == nil {
74
68
} else {
@@ -86,7 +80,7 @@ boolWithErr { b, err in
86
80
87
81
// These 3 should both generate the same refactoring.
88
82
89
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR2 %s
83
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR2 %s
90
84
boolWithErr { success, err in
91
85
if success == true && err == nil {
92
86
print ( " hi " )
@@ -96,7 +90,7 @@ boolWithErr { success, err in
96
90
print ( " not err " )
97
91
}
98
92
99
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR2 %s
93
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR2 %s
100
94
boolWithErr { success, err in
101
95
if success && err == nil {
102
96
print ( " hi " )
@@ -106,7 +100,7 @@ boolWithErr { success, err in
106
100
print ( " not err " )
107
101
}
108
102
109
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR2 %s
103
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR2 %s
110
104
boolWithErr { success, err in
111
105
if err == nil {
112
106
print ( " hi " )
@@ -124,7 +118,7 @@ boolWithErr { success, err in
124
118
// BOOL-WITH-ERR2-NEXT: fatalError("oh no \(err)")
125
119
// BOOL-WITH-ERR2-NEXT: }
126
120
127
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR3 %s
121
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR3 %s
128
122
boolWithErr { failure, err in
129
123
if failure {
130
124
print ( " a \( err!) " )
@@ -147,7 +141,7 @@ boolWithErr { failure, err in
147
141
// BOOL-WITH-ERR3-NEXT: }
148
142
149
143
// Don't handle the below example as the force unwrap of err takes place under a different condition.
150
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-DONT-HANDLE %s
144
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-DONT-HANDLE %s
151
145
boolWithErr { success, err in
152
146
if !success {
153
147
if err != nil {
@@ -171,7 +165,7 @@ boolWithErr { success, err in
171
165
// BOOL-DONT-HANDLE-NEXT: }
172
166
// BOOL-DONT-HANDLE-NEXT: print("not err")
173
167
174
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-DONT-HANDLE2 %s
168
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-DONT-HANDLE2 %s
175
169
boolWithErr { success, err in
176
170
if !success {
177
171
func doThings( ) {
@@ -224,7 +218,7 @@ boolWithErr { success, err in
224
218
// BOOL-DONT-HANDLE2-NEXT: }
225
219
// BOOL-DONT-HANDLE2-NEXT: print("not err")
226
220
227
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-DONT-HANDLE3 %s
221
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-DONT-HANDLE3 %s
228
222
boolWithErr { success, err in
229
223
if !success {
230
224
fatalError ( " oh no maybe \( err) " )
@@ -240,7 +234,7 @@ boolWithErr { success, err in
240
234
// BOOL-DONT-HANDLE3-NEXT: }
241
235
// BOOL-DONT-HANDLE3-NEXT: print("not err")
242
236
243
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-DONT-HANDLE4 %s
237
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-DONT-HANDLE4 %s
244
238
boolWithErr { failure, err in
245
239
if failure {
246
240
print ( " a " )
@@ -263,7 +257,7 @@ boolWithErr { failure, err in
263
257
// BOOL-DONT-HANDLE4-NEXT: print("c")
264
258
// BOOL-DONT-HANDLE4-NEXT: }
265
259
266
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR-SILLY %s
260
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR-SILLY %s
267
261
boolWithErr { success, err in
268
262
if success == false && err == nil {
269
263
print ( " ummm wat \( err!) " )
@@ -279,7 +273,7 @@ boolWithErr { success, err in
279
273
// BOOL-WITH-ERR-SILLY-NEXT: }
280
274
// BOOL-WITH-ERR-SILLY-NEXT: print("not err")
281
275
282
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=BOOL-WITH-ERR-SILLY2 %s
276
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=BOOL-WITH-ERR-SILLY2 %s
283
277
boolWithErr { success, err in
284
278
if success {
285
279
print ( " ummm wat \( err!) " )
@@ -297,7 +291,7 @@ boolWithErr { success, err in
297
291
// BOOL-WITH-ERR-SILLY2-NEXT: print("ummm wat \(<#err#>!)")
298
292
// BOOL-WITH-ERR-SILLY2-NEXT: }
299
293
300
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=MULTI-BOOL-WITH-ERR %s
294
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=MULTI-BOOL-WITH-ERR %s
301
295
multipleBoolWithErr { str, b1, b2, err in
302
296
if !b1 && !b2 {
303
297
print ( " a \( err!) " )
@@ -333,7 +327,7 @@ multipleBoolWithErr { str, b1, b2, err in
333
327
// MULTI-BOOL-WITH-ERR-NEXT: print("d \(err)")
334
328
// MULTI-BOOL-WITH-ERR-NEXT: }
335
329
336
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=OPT-BOOL-WITH-ERR %s
330
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=OPT-BOOL-WITH-ERR %s
337
331
optionalBoolWithErr { str, optBool, b, err in
338
332
if optBool != nil {
339
333
print ( " a \( err!) " )
@@ -378,7 +372,7 @@ optionalBoolWithErr { str, optBool, b, err in
378
372
// OPT-BOOL-WITH-ERR-NEXT: print("g \(err)")
379
373
// OPT-BOOL-WITH-ERR-NEXT: }
380
374
381
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=OBJC-BOOL-WITH-ERR %s
375
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=OBJC-BOOL-WITH-ERR %s
382
376
ClassWithHandlerMethods . firstBoolFlagSuccess ( " " ) { str, success, unrelated, err in
383
377
if !unrelated {
384
378
print ( err!)
@@ -409,7 +403,7 @@ ClassWithHandlerMethods.firstBoolFlagSuccess("") { str, success, unrelated, err
409
403
// OBJC-BOOL-WITH-ERR-NEXT: print(err)
410
404
// OBJC-BOOL-WITH-ERR-NEXT: }
411
405
412
- // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -sdk % clang-importer-sdk-path | %FileCheck -check-prefix=OBJC-BOOL-WITH-ERR2 %s
406
+ // RUN: %refactor -convert-call-to-async-alternative -dump-text -source-filename %s -pos=%(line+1):1 -I %S/Inputs -I %t % clang-importer-sdk-nosource | %FileCheck -check-prefix=OBJC-BOOL-WITH-ERR2 %s
413
407
ClassWithHandlerMethods . secondBoolFlagFailure ( " " ) { str, unrelated, failure, err in
414
408
if unrelated {
415
409
print ( err!)
0 commit comments