mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
33 lines
832 B
Swift
33 lines
832 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift -O -Xfrontend -disable-availability-checking %s -plugin-path %swift-plugin-dir -parse-as-library -module-name main -o %t/main
|
|
// RUN: %target-codesign %t/main
|
|
// RUN: %target-run %t/main | %FileCheck %s
|
|
|
|
// REQUIRES: objc_interop
|
|
// REQUIRES: concurrency
|
|
// REQUIRES: executable_test
|
|
// REQUIRES: concurrency_runtime
|
|
// UNSUPPORTED: back_deployment_runtime || use_os_stdlib
|
|
|
|
// rdar://108260399
|
|
// REQUIRES: optimized_stdlib
|
|
|
|
import Foundation
|
|
|
|
@main struct M {
|
|
@TaskLocal static var v: UUID = UUID()
|
|
static func test(_ t: UUID) async {
|
|
await Self.$v.withValue(t) {
|
|
await Task.sleep(1)
|
|
print(Self.$v.get())
|
|
}
|
|
}
|
|
static func main() async {
|
|
// CHECK: before
|
|
print("before")
|
|
await test(UUID())
|
|
// CHECK: after
|
|
print("after")
|
|
}
|
|
}
|