Files
swift-mirror/test/Concurrency/Runtime/actor_dynamic_subclass.swift
Allan Shortlidge c02fc4724d Tests: Remove -disable-availability-checking from many Concurrency tests.
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.
2024-10-18 16:21:51 -07:00

34 lines
691 B
Swift

// RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library)
// REQUIRES: executable_test
// REQUIRES: concurrency
// REQUIRES: objc_interop
// UNSUPPORTED: back_deployment_runtime
// UNSUPPORTED: use_os_stdlib
// Make sure the concurrency runtime tolerates dynamically-subclassed actors.
import ObjectiveC
actor Foo: NSObject {
var x = 0
func doit() async {
x += 1
try! await Task.sleep(nanoseconds: 1000)
x += 1
}
}
@main
enum Main {
static func main() async {
let FooSub = objc_allocateClassPair(Foo.self, "FooSub", 0) as! Foo.Type
objc_registerClassPair(FooSub)
let foosub = FooSub.init()
await foosub.doit()
}
}