|
| 1 | +// REQUIRES: objc_interop |
| 2 | +// REQUIRES: concurrency |
| 3 | + |
| 4 | +// RUN: %empty-directory(%t) |
| 5 | +// RUN: %empty-directory(%t/out) |
| 6 | +// RUN: split-file %s %t |
| 7 | +// RUN: %target-swift-ide-test(mock-sdk: %clang-importer-sdk) -swift-version 5.6 -batch-code-completion -source-filename %t/test.swift -filecheck %raw-FileCheck -completion-output-dir %t/out -import-objc-header %t/ObjC.h -enable-objc-interop |
| 8 | + |
| 9 | + |
| 10 | +//--- ObjC.h |
| 11 | + |
| 12 | + |
| 13 | +@import Foundation; |
| 14 | +
|
| 15 | +_Pragma("clang assume_nonnull begin") |
| 16 | + |
| 17 | +@interface MyObjCClass: NSObject |
| 18 | +
|
| 19 | +- (void)method1WithCompletionHandler:(void (^)(NSError * _Nullable err))completionHandler; |
| 20 | +- (void)method2WithCompletionHandler:(void (^)(NSError * _Nullable err))completionHandler __attribute__((swift_private)); |
| 21 | +- (void)method3WithCompletionHandler:(void (^)(NSError * _Nullable err))completionHandler __attribute__((swift_private)) __attribute__((swift_async_name("named3()"))); |
| 22 | +- (void)method4WithCompletionHandler:(void (^)(NSError * _Nullable err))completionHandler __attribute__((swift_async(swift_private, 1))); |
| 23 | +- (void)method5WithCompletionHandler:(void (^)(NSError * _Nullable err))completionHandler __attribute__((swift_async(swift_private, 1))) __attribute__((swift_async_name("named5()"))); |
| 24 | +- (void)method6WithCompletionHandler:(void (^)(NSError * _Nullable err))completionHandler __attribute__((swift_async(not_swift_private, 1))); |
| 25 | +- (void)method7WithCompletionHandler:(void (^)(NSError * _Nullable err))completionHandler __attribute__((swift_async(not_swift_private, 1))) __attribute__((swift_async_name("named7()"))); |
| 26 | + |
| 27 | +@end |
| 28 | + |
| 29 | +_Pragma("clang assume_nonnull end") |
| 30 | + |
| 31 | +//--- test.swift |
| 32 | + |
| 33 | +func test(obj: MyObjCClass) async throws { |
| 34 | + obj.#^COMPLETE^# |
| 35 | +// COMPLETE: Begin completions |
| 36 | +// COMPLETE-NOT: method2( |
| 37 | +// COMPLETE-NOT: method4() |
| 38 | +// COMPLETE-NOT: method5() |
| 39 | +// COMPLETE-DAG: Keyword[self]/CurrNominal: self[#MyObjCClass#]; name=self |
| 40 | +// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method1({#completionHandler: (Error?) -> Void##(Error?) -> Void#})[#Void#]; |
| 41 | +// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method1()[' async'][' throws'][#Void#]; |
| 42 | +// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: named3()[' async'][' throws'][#Void#]; |
| 43 | +// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method4({#completionHandler: (Error?) -> Void##(Error?) -> Void#})[#Void#]; |
| 44 | +// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method5({#completionHandler: (Error?) -> Void##(Error?) -> Void#})[#Void#]; |
| 45 | +// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method6({#completionHandler: (Error?) -> Void##(Error?) -> Void#})[#Void#]; |
| 46 | +// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method6()[' async'][' throws'][#Void#]; |
| 47 | +// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: method7({#completionHandler: (Error?) -> Void##(Error?) -> Void#})[#Void#]; |
| 48 | +// COMPLETE-DAG: Decl[InstanceMethod]/CurrNominal: named7()[' async'][' throws'][#Void#]; |
| 49 | +// COMPLETE: End completions |
| 50 | +} |
0 commit comments