mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
36 lines
940 B
Swift
36 lines
940 B
Swift
// RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library)
|
|
// RUN: %target-run-simple-swift(-target %target-swift-5.1-abi-triple -parse-as-library -swift-version 5 -strict-concurrency=complete -enable-upcoming-feature NonisolatedNonsendingByDefault)
|
|
// REQUIRES: swift_feature_NonisolatedNonsendingByDefault
|
|
|
|
// 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()
|
|
}
|
|
}
|
|
|