mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Adapt the `ThrowingEntityAnalyzer` to pick up any `await` keywords and add an `async` to the extracted function if necessary along with an `await` for its call. rdar://72199949
16 lines
462 B
Plaintext
16 lines
462 B
Plaintext
func longLongLongJourney() async -> Int { 0 }
|
|
func longLongLongAwryJourney() async throws -> Int { 0 }
|
|
func consumesAsync(_ fn: () async throws -> Void) rethrows {}
|
|
|
|
fileprivate func new_name() async throws -> Int {
|
|
return try await longLongLongAwryJourney() + 1
|
|
}
|
|
|
|
func testThrowingClosure() async throws -> Int {
|
|
let x = await longLongLongJourney()
|
|
let y = try await new_name()
|
|
try consumesAsync { try await longLongLongAwryJourney() }
|
|
return x + y
|
|
}
|
|
|