Files
swift-mirror/test/Concurrency/Runtime/executor_deinit1.swift
Kavon Farvardin 354d061946 re-enable executor_deinit1.swift
I put this test in originally XFAIL'd because the deinit for the actor was not being run before program exit. It was expected to run because it's not top-level code so there is a release of the object before returning from RunIt.main.

My guess is that the root cause of the original
bug of it not running the deinit was because of
the "executor stickiness" that was present in
Swift concurrency prior to SE-338. Today it
seems that this isn't an issue so we may as well
have this test back.

resolves rdar://77397981
resolves https://github.com/apple/swift/issues/56817
2023-08-11 10:09:08 -07:00

32 lines
825 B
Swift

// RUN: %target-run-simple-swift(-parse-as-library -Xfrontend -disable-availability-checking %import-libdispatch) | %FileCheck %s
// REQUIRES: executable_test
// REQUIRES: concurrency
// REQUIRES: libdispatch
// REQUIRES: concurrency_runtime
// UNSUPPORTED: back_deployment_runtime
// doesn't matter that it's bool identity function or not
func boolIdentityFn(_ x : Bool) -> Bool { return x }
actor FirstActor {
func startTest() { // whether startTest is async or sync doesn't matter
// do not remove this call or if-statement.
if boolIdentityFn(true) {}
}
deinit {
// CHECK: called deinit
print("called deinit")
}
}
@main struct RunIt {
static func main() async {
let actor = FirstActor()
await actor.startTest() // do not remove this call
}
}