mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Concurrency] Implicitly strip optionals for return type of translated "async throws".
Review over a large number of APIs has found that most of the time, the result type of an Objective-C completion handler method that becomes "async throws" should be optional. Change the default behavior to match this, and replace _Nullable_on_error with _Nullable_result to capture the case where the result should be optional.
This commit is contained in:
@@ -10,13 +10,13 @@
|
||||
// CHECK-DAG: func doSomethingSlow(_ operation: String, completionHandler handler: @escaping (Int) -> Void)
|
||||
// CHECK-DAG: func doSomethingSlow(_ operation: String) async -> Int
|
||||
// CHECK-DAG: func doSomethingDangerous(_ operation: String, completionHandler handler: ((String?, Error?) -> Void)? = nil)
|
||||
// CHECK-DAG: func doSomethingDangerous(_ operation: String) async throws -> String?
|
||||
// CHECK-DAG: func doSomethingDangerous(_ operation: String) async throws -> String
|
||||
// CHECK-DAG: func checkAvailability(completionHandler: @escaping (Bool) -> Void)
|
||||
// CHECK-DAG: func checkAvailability() async -> Bool
|
||||
// CHECK-DAG: func findAnswer(completionHandler handler: @escaping (String?, Error?) -> Void)
|
||||
// CHECK-DAG: func findAnswer() async throws -> String?
|
||||
// CHECK-DAG: func findAnswer() async throws -> String
|
||||
// CHECK-DAG: func findAnswerFailingly(completionHandler handler: @escaping (String?, Error?) -> Void) throws
|
||||
// CHECK-DAG: func findAnswerFailingly() async throws -> String?
|
||||
// CHECK-DAG: func findAnswerFailingly() async throws -> String
|
||||
// CHECK-DAG: func doSomethingFun(_ operation: String) async
|
||||
// CHECK: {{^[}]$}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user