File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ struct ArgumentInitHelper {
316316 assert (type->isMaterializable ());
317317
318318 ++ArgNo;
319- if (PD->hasName ()) {
319+ if (PD->hasName () || PD-> isIsolated () ) {
320320 makeArgumentIntoBinding (type, &*f.begin (), PD);
321321 return ;
322322 }
Original file line number Diff line number Diff line change @@ -10,3 +10,17 @@ public actor A {
1010// CHECK: sil{{.*}} [ossa] @$s4test13takesIsolatedyyAA1ACYiF
1111@available ( SwiftStdlib 5 . 1 , * )
1212public func takesIsolated( _: isolated A) { }
13+
14+ @available ( SwiftStdlib 5 . 1 , * )
15+ public func takeClosureWithIsolatedParam( body: ( isolated A) async -> Void ) { }
16+
17+ // Emit the unnamed parameter when it's isolated, so that we can hop to it.
18+ // CHECK-LABEL: sil private [ossa] @$s4test0A24ClosureWithIsolatedParamyyFyAA1ACYiYaXEfU_ : $@convention(thin) @async (@guaranteed A)
19+ // CHECK: bb0(%0 : @guaranteed $A):
20+ // CHECK: [[COPY:%.*]] = copy_value %0 : $A
21+ // CHECK-NEXT: [[BORROW:%.*]] = begin_borrow [[COPY]] : $A
22+ // CHECK-NEXT: hop_to_executor [[BORROW]] : $A
23+ @available ( SwiftStdlib 5 . 1 , * )
24+ public func testClosureWithIsolatedParam( ) {
25+ takeClosureWithIsolatedParam { _ in }
26+ }
You can’t perform that action at this time.
0 commit comments