1
- // RUN: %target-swift-emit-silgen %s -enable-experimental-feature ExecutionAttribute | %FileCheck %s
2
- // RUN: %target-swift-emit-silgen %s -enable-experimental-feature ExecutionAttribute -enable-experimental-feature AsyncCallerExecution | %FileCheck %s
1
+ // RUN: %target-swift-emit-silgen %s -enable-experimental-feature ExecutionAttribute | %FileCheck -check-prefix CHECK -check-prefix DISABLED %s
2
+ // RUN: %target-swift-emit-silgen %s -enable-experimental-feature ExecutionAttribute -enable-experimental-feature AsyncCallerExecution | %FileCheck -check-prefix CHECK -check-prefix ENABLED %s
3
3
4
4
// REQUIRES: concurrency
5
5
// REQUIRES: asserts
@@ -20,3 +20,47 @@ func executionCaller() async {}
20
20
// CHECK: sil hidden [ossa] @$s14execution_attr0A10ConcurrentyyYaF : $@convention(thin) @async () -> () {
21
21
@execution ( concurrent)
22
22
func executionConcurrent( ) async { }
23
+
24
+ // DISABLED: sil hidden [ossa] @$s14execution_attr0A15CallerParameteryyyyYaYCXEYaF : $@convention(thin) @async (@guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional<any Actor>) -> ()) -> () {
25
+ // ENABLED: sil hidden [ossa] @$s14execution_attr0A15CallerParameteryyyyYaYCXEYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional<any Actor>, @guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional<any Actor>) -> ()) -> () {
26
+ // CHECK: } // end sil function '$s14execution_attr0A15CallerParameteryyyyYaYCXEYaF'
27
+ func executionCallerParameter( _ x: @execution ( caller) ( ) async -> ( ) ) async {
28
+ await x ( )
29
+ }
30
+
31
+ // DISABLED-LABEL: sil hidden [ossa] @$s14execution_attr0A19ConcurrentParameteryyyyYaXEYaF : $@convention(thin) @async (@guaranteed @noescape @async @callee_guaranteed () -> ()) -> () {
32
+ // ENABLED-LABEL: sil hidden [ossa] @$s14execution_attr0A19ConcurrentParameteryyyyYaXEYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional<any Actor>, @guaranteed @noescape @async @callee_guaranteed () -> ()) -> () {
33
+ func executionConcurrentParameter( _ x: @execution ( concurrent) ( ) async -> ( ) ) async {
34
+ await x ( )
35
+ }
36
+
37
+ struct S {
38
+ let field : @execution ( caller) ( ) async -> ( )
39
+ }
40
+
41
+ // DISABLED: sil hidden [ossa] @$s14execution_attr0A11CallerFieldyyAA1SVYaF : $@convention(thin) @async (@guaranteed S) -> () {
42
+ // DISABLED: bb0([[ARG:%.*]] : @guaranteed $S):
43
+ // DISABLED: [[FIELD:%.*]] = struct_extract [[ARG]]
44
+ // DISABLED: [[FIELD_COPY:%.*]] = copy_value [[FIELD]]
45
+ // DISABLED: [[ACTOR_NONE:%.*]] = enum $Optional<any Actor>, #Optional.none!enumelt
46
+ // DISABLED: [[BORROWED_FIELD:%.*]] = begin_borrow [[FIELD_COPY]]
47
+ // DISABLED: apply [[BORROWED_FIELD]]([[ACTOR_NONE]])
48
+ // DISABLED: } // end sil function '$s14execution_attr0A11CallerFieldyyAA1SVYaF'
49
+
50
+ // ENABLED: sil hidden [ossa] @$s14execution_attr0A11CallerFieldyyAA1SVYaF : $@convention(thin) @async (@sil_isolated @sil_implicit_leading_param @guaranteed Optional<any Actor>, @guaranteed S) -> () {
51
+ // ENABLED: bb0([[ACTOR:%.*]] : @guaranteed $Optional<any Actor>, [[ARG:%.*]] : @guaranteed $S):
52
+ // ENABLED: [[FIELD:%.*]] = struct_extract [[ARG]]
53
+ // ENABLED: [[FIELD_COPY:%.*]] = copy_value [[FIELD]]
54
+ // ENABLED: [[BORROWED_FIELD:%.*]] = begin_borrow [[FIELD_COPY]]
55
+ // ENABLED: apply [[BORROWED_FIELD]]([[ACTOR]])
56
+ // ENABLED: } // end sil function '$s14execution_attr0A11CallerFieldyyAA1SVYaF'
57
+ func executionCallerField( _ s: S ) async {
58
+ await s. field ( )
59
+ }
60
+
61
+ extension S {
62
+ // CHECK-LABEL: // S.executionCallerFieldMethod(_:)
63
+ // CHECK: // Isolation: unspecified
64
+ // CHECK: sil hidden [ossa] @$s14execution_attr1SV0A17CallerFieldMethodyyyyYaYCXEF : $@convention(method) (@guaranteed @noescape @async @callee_guaranteed (@sil_isolated @sil_implicit_leading_param @guaranteed Optional<any Actor>) -> (), @guaranteed S) -> () {
65
+ func executionCallerFieldMethod( _ x: @execution ( caller) ( ) async -> ( ) ) { }
66
+ }
0 commit comments