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 @@ -314,7 +314,7 @@ struct ArgumentInitHelper {
314
314
assert (type->isMaterializable ());
315
315
316
316
++ArgNo;
317
- if (PD->hasName ()) {
317
+ if (PD->hasName () || PD-> isIsolated () ) {
318
318
makeArgumentIntoBinding (type, &*f.begin (), PD);
319
319
return ;
320
320
}
Original file line number Diff line number Diff line change @@ -10,3 +10,17 @@ public actor A {
10
10
// CHECK: sil{{.*}} [ossa] @$s4test13takesIsolatedyyAA1ACYiF
11
11
@available ( SwiftStdlib 5 . 1 , * )
12
12
public 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