Skip to content

Commit 4479e49

Browse files
committed
Revert "[Concurrency] Fix @_inheritActorContext(always) to use forActorInstanceCapture for parameters"
This reverts commit 9104744.
1 parent 16501c1 commit 4479e49

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4781,18 +4781,13 @@ ActorIsolation ActorIsolationChecker::determineClosureIsolation(
47814781

47824782
case ActorIsolation::ActorInstance: {
47834783
if (checkIsolatedCapture) {
4784-
if (auto param = closure->getCaptureInfo().getIsolatedParamCapture())
4785-
return ActorIsolation::forActorInstanceCapture(param);
4786-
47874784
auto *explicitClosure = dyn_cast<ClosureExpr>(closure);
47884785
// @_inheritActorContext(always) forces the isolation capture.
4789-
if (explicitClosure && explicitClosure->alwaysInheritsActorContext()) {
4790-
if (parentIsolation.isActorInstanceIsolated()) {
4791-
if (auto *param = parentIsolation.getActorInstance())
4792-
return ActorIsolation::forActorInstanceCapture(param);
4793-
}
4786+
if (explicitClosure && explicitClosure->alwaysInheritsActorContext())
47944787
return parentIsolation;
4795-
}
4788+
4789+
if (auto param = closure->getCaptureInfo().getIsolatedParamCapture())
4790+
return ActorIsolation::forActorInstanceCapture(param);
47964791
} else {
47974792
// If we don't have capture information during code completion, assume
47984793
// that the closure captures the `isolated` parameter from the parent

test/SILGen/hop_to_executor.swift

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ func testGlobalActorFuncValue(_ fn: @RedActor () -> Void) async {
325325

326326
func acceptAsyncSendableClosureInheriting<T>(@_inheritActorContext _: @Sendable () async -> T) { }
327327
func acceptAsyncSendableClosureAlwaysInheriting<T>(@_inheritActorContext(always) _: @Sendable () async -> T) { }
328-
func acceptAsyncSendableClosureAlwaysInheritingErased<T>(@_inheritActorContext(always) _: sending @isolated(any) () async -> T) { }
329328

330329
extension MyActor {
331330
func synchronous() { }
@@ -386,22 +385,6 @@ func testIsolatedParameterWithInheritActorContext(_ isolation: isolated (any Act
386385
}
387386
}
388387

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-
405388
func acceptAsyncClosure(_: () async -> Void) { }
406389
func acceptAsyncClosure2<T>(_: (T) async -> T) { }
407390

0 commit comments

Comments
 (0)