File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
test/Concurrency/attr_execution Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -4681,6 +4681,10 @@ ActorIsolation ActorIsolationChecker::determineClosureIsolation(
46814681 attr && ctx.LangOpts .hasFeature (Feature::ClosureIsolation)) {
46824682 return ActorIsolation::forNonisolated (attr->isUnsafe ());
46834683 }
4684+
4685+ if (explicitClosure->getAttrs ().hasAttribute <ConcurrentAttr>()) {
4686+ return ActorIsolation::forNonisolated (/* unsafe=*/ false );
4687+ }
46844688 }
46854689
46864690 // `nonisolated(nonsending)` inferred from the context makes
Original file line number Diff line number Diff line change @@ -456,3 +456,15 @@ func testThatClosuresAssumeIsolation(fn: inout nonisolated(nonsending) (Int) asy
456456 // CHECK: hop_to_executor [[GENERIC_EXECUTOR]]
457457 fn = { @concurrent _ in }
458458}
459+
460+ @MainActor
461+ func testNoIsolationTransfer( ) {
462+ // CHECK: // Isolation: global_actor. type: MainActor
463+ // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen23testNoIsolationTransferyyF0D7ErasureL_yyyyYaYAcF : $@convention(thin) (@guaranteed @isolated(any) @async @callee_guaranteed () -> ()) -> ()
464+ func testErasure( @_inheritActorContext _: @escaping @isolated ( any) ( ) async -> Void ) { }
465+
466+ // CHECK-LABEL: sil private [ossa] @$s21attr_execution_silgen23testNoIsolationTransferyyFyyYacfU_ : $@convention(thin) @async (@guaranteed Optional<any Actor>) -> ()
467+ // CHECK: [[GENERIC_EXECUTOR:%.*]] = enum $Optional<Builtin.Executor>, #Optional.none!enumelt
468+ // CHECK: hop_to_executor [[GENERIC_EXECUTOR]]
469+ testErasure { @concurrent in }
470+ }
You can’t perform that action at this time.
0 commit comments