File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %target-run-simple-swift(-parse-as-library -Xfrontend -enable-experimental-concurrency %import-libdispatch) | %FileCheck %s
2+
3+ // REQUIRES: executable_test
4+ // REQUIRES: concurrency
5+ // REQUIRES: libdispatch
6+
7+ // FIXME: this should pass! from rdar://73266050
8+ // XFAIL: *
9+
10+ // doesn't matter that it's bool identity function or not
11+ func boolIdentityFn( _ x : Bool ) -> Bool { return x }
12+
13+ actor FirstActor {
14+ func startTest( ) { // whether startTest is async or sync doesn't matter
15+
16+ // do not remove this call or if-statement.
17+ if boolIdentityFn ( true ) { }
18+
19+ }
20+
21+ deinit ( ) {
22+ // CHECK: called deinit
23+ print ( " called deinit " )
24+ }
25+ }
26+
27+ @main struct RunIt {
28+ static func main( ) async {
29+ let actor = FirstActor ( )
30+ await actor . startTest ( ) // do not remove this call
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ // RUN: %target-run-simple-swift(-parse-as-library -Xfrontend -enable-experimental-concurrency %import-libdispatch) | %FileCheck %s
2+
3+ // REQUIRES: executable_test
4+ // REQUIRES: concurrency
5+ // REQUIRES: libdispatch
6+
7+ // this needs to match with the check count below.
8+ let NUM_TASKS : Int = 100
9+
10+ final class Capture : ConcurrentValue {
11+ func doSomething( ) { }
12+ deinit {
13+ // CHECK-COUNT-100: deinit was called!
14+ print ( " deinit was called! " )
15+ }
16+ }
17+
18+ @main
19+ struct App {
20+ static func main( ) async {
21+ var n = 0
22+ for _ in 1 ... NUM_TASKS {
23+ let c = Capture ( )
24+ let r = Task . runDetached {
25+ c. doSomething ( )
26+ }
27+ await r. get ( )
28+ n += 1
29+ }
30+ print ( " test complete " )
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments