@@ -325,6 +325,7 @@ func testGlobalActorFuncValue(_ fn: @RedActor () -> Void) async {
325325
326326func acceptAsyncSendableClosureInheriting< T> ( @_inheritActorContext _: @Sendable ( ) async -> T ) { }
327327func acceptAsyncSendableClosureAlwaysInheriting< T> ( @_inheritActorContext ( always) _: @Sendable ( ) async -> T ) { }
328+ func acceptAsyncSendableClosureAlwaysInheritingErased< T> ( @_inheritActorContext ( always) _: sending @isolated ( any) ( ) async -> T ) { }
328329
329330extension MyActor {
330331 func synchronous( ) { }
@@ -385,6 +386,22 @@ func testIsolatedParameterWithInheritActorContext(_ isolation: isolated (any Act
385386 }
386387}
387388
389+ // CHECK-LABEL: sil hidden [ossa] @$s4test0a17IsolatedParamWithB3AnyyyScA_pYiF
390+ // CHECK: [[CLOSURE_REF:%.*]] = function_ref @$s4test0a17IsolatedParamWithB3AnyyyScA_pYiFyyYaXEfU_
391+ // CHECK-NEXT: [[ISOLATION_COPY_1:%.*]] = copy_value %0 : $any Actor
392+ // CHECK-NEXT: [[ISOLATION_COPY_2:%.*]] = copy_value [[ISOLATION_COPY_1]] : $any Actor
393+ // CHECK-NEXT: [[DYNAMIC_ISOLATION:%.*]] = enum $Optional<any Actor>, #Optional.some!enumelt, [[ISOLATION_COPY_2]] : $any Actor
394+ // CHECK-NEXT: [[CLOSURE_WITH_APPLIED_ISOLATION:%.*]] = partial_apply [callee_guaranteed] [isolated_any] [[CLOSURE_REF]]([[DYNAMIC_ISOLATION]], [[ISOLATION_COPY_1]])
395+ func testIsolatedParamWithIsolatedAny( _ isolation: isolated any Actor ) {
396+ // CHECK-LABEL: sil private [ossa] @$s4test0a17IsolatedParamWithB3AnyyyScA_pYiFyyYaXEfU_
397+ // CHECK: bb0(%0 : $*(), [[DYNAMIC_ISOLATION:%[0-9]+]] : @guaranteed $Optional<any Actor>, [[CAPTURED_ISOLATION:%[0-9]+]] : @closureCapture @guaranteed $any Actor):
398+ // CHECK: [[COPY:%[0-9]+]] = copy_value [[CAPTURED_ISOLATION]] : $any Actor
399+ // CHECK-NEXT: [[BORROW:%[0-9]+]] = begin_borrow [[COPY]] : $any Actor
400+ // CHECK-NEXT: hop_to_executor [[BORROW]] : $any Actor
401+ acceptAsyncSendableClosureAlwaysInheritingErased {
402+ }
403+ }
404+
388405func acceptAsyncClosure( _: ( ) async -> Void ) { }
389406func acceptAsyncClosure2< T> ( _: ( T ) async -> T ) { }
390407
0 commit comments