File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %empty-directory(%t)
2+ // RUN: %target-build-swift -Xfrontend -enable-experimental-concurrency %s -module-name main -o %t/main
3+ // RUN: %target-codesign %t/main
4+ // RUN: %target-run %t/main | %FileCheck %s
5+
6+ // REQUIRES: concurrency
7+ // UNSUPPORTED: use_os_stdlib
8+ // UNSUPPORTED: CPU=arm64e
9+
10+
11+ func sayHello( ) async {
12+ print ( " hello " )
13+ }
14+
15+ func sayGeneric< T> ( _ msg: T ) async {
16+ await sayHello ( )
17+ print ( msg)
18+ }
19+
20+ func sayWithClosure( _ action: ( ) async -> ( ) ) async {
21+ await action ( )
22+ print ( " hallo welt " )
23+ }
24+
25+ runAsync {
26+ // CHECK: hello
27+ await sayHello ( )
28+
29+ // CHECK: hello
30+ // CHECK: world
31+ await sayGeneric ( " world " )
32+
33+
34+ // CHECK: hello
35+ // CHECK: and now in german
36+ // CHECK: hallo welt
37+ await sayWithClosure {
38+ await sayHello ( )
39+ print ( " and now in german " )
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments