mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Instead, use the `%target-swift-5.1-abi-triple` substitution to compile the tests for deployment to the minimum OS versions required for use of _Concurrency APIs.
32 lines
660 B
Swift
32 lines
660 B
Swift
// RUN: %target-run-simple-swift(-parse-as-library -target %target-swift-5.1-abi-triple) | %FileCheck %s
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: concurrency_runtime
|
|
// UNSUPPORTED: freestanding
|
|
|
|
// UNSUPPORTED: back_deployment_runtime
|
|
|
|
class C {}
|
|
|
|
@main
|
|
enum Main {
|
|
static func main() async {
|
|
weak var weakRef: C?
|
|
do {
|
|
let c = C()
|
|
let t = Task.detached { return c }
|
|
weakRef = c
|
|
}
|
|
Task.detached {
|
|
try await Task.sleep(nanoseconds: 10_000_000_000)
|
|
fatalError("Fail!")
|
|
}
|
|
|
|
while weakRef != nil {
|
|
await Task.yield()
|
|
}
|
|
// CHECK: Success
|
|
print("Success!")
|
|
}
|
|
}
|