Files
swift-mirror/test/Concurrency/optional_isolated_parameters.swift
Alexis Laferrière 841740e7ab Tests: XFAIL a few tests on freestanding
rdar://121121793
2024-03-11 13:29:49 -07:00

31 lines
734 B
Swift

// RUN: %empty-directory(%t)
// RUN: %target-build-swift -Xfrontend -disable-availability-checking %s -o %t/main
// RUN: %target-codesign %t/main
// RUN: %target-run %t/main | %FileCheck %s
// REQUIRES: executable_test
// REQUIRES: concurrency
// rdar://124277662
// XFAIL: freestanding
actor MyActor: CustomStringConvertible {
let description = "MyActor"
}
func optionalIsolated(to actor: isolated (any Actor)?) {
actor?.assertIsolated()
if let actor {
print("isolated to \(actor)")
} else {
print("nonisolated")
}
}
// CHECK: nonisolated
// CHECK: isolated to Swift.MainActor
// CHECK: isolated to MyActor
optionalIsolated(to: nil)
optionalIsolated(to: MainActor.shared)
await optionalIsolated(to: MyActor())