Files
swift-mirror/test/Concurrency/Runtime/async_let_throws.swift
Kuba (Brecka) Mracek 7853184ed6 Enable running tests from test/Concurrency/ directory in freestanding/minimal presets (#61835)
* Enable running tests from test/Concurrency/ directory in freestanding/minimal presets

* Mark failing Concurrency tests as XFAIL/SKIP on freestanding/minimal
2022-11-04 09:07:27 -07:00

34 lines
640 B
Swift

// RUN: %target-run-simple-swift( -Xfrontend -disable-availability-checking -parse-as-library) | %FileCheck %s
// REQUIRES: executable_test
// REQUIRES: concurrency
// REQUIRES: reflection
// rdar://76038845
// REQUIRES: concurrency_runtime
// UNSUPPORTED: back_deployment_runtime
struct Boom: Error {}
func boom() throws -> Int {
throw Boom()
}
@available(SwiftStdlib 5.1, *)
func test() async {
async let result = boom()
do {
_ = try await result
} catch {
print("error: \(error)") // CHECK: error: Boom()
}
}
@available(SwiftStdlib 5.1, *)
@main struct Main {
static func main() async {
await test()
}
}