mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
29 lines
670 B
Swift
29 lines
670 B
Swift
// RUN: %target-run-simple-swift(-Xfrontend -enable-experimental-concurrency %import-libdispatch -parse-as-library) | %FileCheck %s --dump-input=always
|
|
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: concurrency
|
|
|
|
// rdar://76038845
|
|
// UNSUPPORTED: use_os_stdlib
|
|
|
|
// This test is flaky on VS2017 (unknown reasons)
|
|
// UNSUPPORTED: MSVC_VER=15.0
|
|
|
|
@available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *)
|
|
@main struct Main {
|
|
static func main() async {
|
|
let handle = detach {
|
|
while (!Task.isCancelled) { // no need for await here, yay
|
|
print("waiting")
|
|
}
|
|
|
|
print("done")
|
|
}
|
|
|
|
handle.cancel()
|
|
|
|
// CHECK: done
|
|
await handle.get()
|
|
}
|
|
}
|