22// REQUIRES: concurrency
33
44// 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
126
137import Foundation
148import ConvertBoolObjC
@@ -19,47 +13,47 @@ func optionalBoolWithErr(completion: (String?, Bool?, Bool, Error?) -> Void) {}
1913
2014// All 7 of the below should generate the same refactoring.
2115
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
2317boolWithErr { b, err in
2418 if !b {
2519 fatalError ( " oh no \( err!) " )
2620 }
2721 print ( " not err " )
2822}
2923
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
3125boolWithErr { b, err in
3226 if b {
3327 fatalError ( " oh no \( err!) " )
3428 }
3529 print ( " not err " )
3630}
3731
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
3933boolWithErr { b, err in
4034 if !b && err != nil {
4135 fatalError ( " oh no \( err!) " )
4236 }
4337 print ( " not err " )
4438}
4539
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
4741boolWithErr { b, err in
4842 if b && err != nil {
4943 fatalError ( " oh no \( err!) " )
5044 }
5145 print ( " not err " )
5246}
5347
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
5549boolWithErr { b, err in
5650 if err != nil && b == false {
5751 fatalError ( " oh no \( err!) " )
5852 }
5953 print ( " not err " )
6054}
6155
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
6357boolWithErr { b, err in
6458 if b == true && err == nil {
6559 } else {
@@ -68,7 +62,7 @@ boolWithErr { b, err in
6862 print ( " not err " )
6963}
7064
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
7266boolWithErr { b, err in
7367 if !b && err == nil {
7468 } else {
@@ -86,7 +80,7 @@ boolWithErr { b, err in
8680
8781// These 3 should both generate the same refactoring.
8882
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
9084boolWithErr { success, err in
9185 if success == true && err == nil {
9286 print ( " hi " )
@@ -96,7 +90,7 @@ boolWithErr { success, err in
9690 print ( " not err " )
9791}
9892
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
10094boolWithErr { success, err in
10195 if success && err == nil {
10296 print ( " hi " )
@@ -106,7 +100,7 @@ boolWithErr { success, err in
106100 print ( " not err " )
107101}
108102
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
110104boolWithErr { success, err in
111105 if err == nil {
112106 print ( " hi " )
@@ -124,7 +118,7 @@ boolWithErr { success, err in
124118// BOOL-WITH-ERR2-NEXT: fatalError("oh no \(err)")
125119// BOOL-WITH-ERR2-NEXT: }
126120
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
128122boolWithErr { failure, err in
129123 if failure {
130124 print ( " a \( err!) " )
@@ -147,7 +141,7 @@ boolWithErr { failure, err in
147141// BOOL-WITH-ERR3-NEXT: }
148142
149143// 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
151145boolWithErr { success, err in
152146 if !success {
153147 if err != nil {
@@ -171,7 +165,7 @@ boolWithErr { success, err in
171165// BOOL-DONT-HANDLE-NEXT: }
172166// BOOL-DONT-HANDLE-NEXT: print("not err")
173167
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
175169boolWithErr { success, err in
176170 if !success {
177171 func doThings( ) {
@@ -224,7 +218,7 @@ boolWithErr { success, err in
224218// BOOL-DONT-HANDLE2-NEXT: }
225219// BOOL-DONT-HANDLE2-NEXT: print("not err")
226220
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
228222boolWithErr { success, err in
229223 if !success {
230224 fatalError ( " oh no maybe \( err) " )
@@ -240,7 +234,7 @@ boolWithErr { success, err in
240234// BOOL-DONT-HANDLE3-NEXT: }
241235// BOOL-DONT-HANDLE3-NEXT: print("not err")
242236
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
244238boolWithErr { failure, err in
245239 if failure {
246240 print ( " a " )
@@ -263,7 +257,7 @@ boolWithErr { failure, err in
263257// BOOL-DONT-HANDLE4-NEXT: print("c")
264258// BOOL-DONT-HANDLE4-NEXT: }
265259
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
267261boolWithErr { success, err in
268262 if success == false && err == nil {
269263 print ( " ummm wat \( err!) " )
@@ -279,7 +273,7 @@ boolWithErr { success, err in
279273// BOOL-WITH-ERR-SILLY-NEXT: }
280274// BOOL-WITH-ERR-SILLY-NEXT: print("not err")
281275
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
283277boolWithErr { success, err in
284278 if success {
285279 print ( " ummm wat \( err!) " )
@@ -297,7 +291,7 @@ boolWithErr { success, err in
297291// BOOL-WITH-ERR-SILLY2-NEXT: print("ummm wat \(<#err#>!)")
298292// BOOL-WITH-ERR-SILLY2-NEXT: }
299293
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
301295multipleBoolWithErr { str, b1, b2, err in
302296 if !b1 && !b2 {
303297 print ( " a \( err!) " )
@@ -333,7 +327,7 @@ multipleBoolWithErr { str, b1, b2, err in
333327// MULTI-BOOL-WITH-ERR-NEXT: print("d \(err)")
334328// MULTI-BOOL-WITH-ERR-NEXT: }
335329
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
337331optionalBoolWithErr { str, optBool, b, err in
338332 if optBool != nil {
339333 print ( " a \( err!) " )
@@ -378,7 +372,7 @@ optionalBoolWithErr { str, optBool, b, err in
378372// OPT-BOOL-WITH-ERR-NEXT: print("g \(err)")
379373// OPT-BOOL-WITH-ERR-NEXT: }
380374
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
382376ClassWithHandlerMethods . firstBoolFlagSuccess ( " " ) { str, success, unrelated, err in
383377 if !unrelated {
384378 print ( err!)
@@ -409,7 +403,7 @@ ClassWithHandlerMethods.firstBoolFlagSuccess("") { str, success, unrelated, err
409403// OBJC-BOOL-WITH-ERR-NEXT: print(err)
410404// OBJC-BOOL-WITH-ERR-NEXT: }
411405
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
413407ClassWithHandlerMethods . secondBoolFlagFailure ( " " ) { str, unrelated, failure, err in
414408 if unrelated {
415409 print ( err!)
0 commit comments