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