Skip to content

Commit 11dd80a

Browse files
committed
[Concurrency] Eliminate unused so for dealing with calls via a separate path
Remove the "old" path that diagnosed actor isolation and sendability issues with some calls. It is now unused.
1 parent 740cd7b commit 11dd80a

File tree

1 file changed

+2
-57
lines changed

1 file changed

+2
-57
lines changed

lib/Sema/TypeCheckConcurrency.cpp

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,7 +2615,6 @@ namespace {
26152615
bool isDistributed) {
26162616
ValueDecl *decl = concDeclRef.getDecl();
26172617
AsyncMarkingResult result = AsyncMarkingResult::NotFound;
2618-
bool isAsyncCall = false;
26192618

26202619
// is it an access to a property?
26212620
if (isPropOrSubscript(decl)) {
@@ -2660,58 +2659,6 @@ namespace {
26602659
result = AsyncMarkingResult::FoundAsync;
26612660
}
26622661
}
2663-
2664-
} else if (isa_and_nonnull<SelfApplyExpr>(context) &&
2665-
isa<AbstractFunctionDecl>(decl)) {
2666-
// actor-isolated non-isolated-self calls are implicitly async
2667-
// and thus OK.
2668-
2669-
if (!getDeclContext()->isAsyncContext())
2670-
return AsyncMarkingResult::SyncContext;
2671-
2672-
isAsyncCall = true;
2673-
} else if (!applyStack.empty()) {
2674-
// Check our applyStack metadata from the traversal.
2675-
// Our goal is to identify whether the actor reference appears
2676-
// as the called value of the enclosing ApplyExpr. We cannot simply
2677-
// inspect Parent here because of expressions like (callee)()
2678-
// and the fact that the reference may be just an argument to an apply
2679-
ApplyExpr *apply = applyStack.back();
2680-
Expr *fn = apply->getFn()->getValueProvidingExpr();
2681-
if (auto fnConv = dyn_cast<FunctionConversionExpr>(fn))
2682-
fn = fnConv->getSubExpr()->getValueProvidingExpr();
2683-
if (auto memberRef = findReference(fn)) {
2684-
auto concDecl = memberRef->first;
2685-
if (decl == concDecl.getDecl() && !apply->isImplicitlyAsync()) {
2686-
2687-
if (!getDeclContext()->isAsyncContext())
2688-
return AsyncMarkingResult::SyncContext;
2689-
2690-
// then this ValueDecl appears as the called value of the ApplyExpr.
2691-
isAsyncCall = true;
2692-
}
2693-
}
2694-
}
2695-
2696-
// Set up an implicit async call.
2697-
if (isAsyncCall) {
2698-
// If we're calling to a distributed actor, make sure the function
2699-
// is actually 'distributed'.
2700-
bool setThrows = false;
2701-
bool usesDistributedThunk = false;
2702-
if (isDistributed) {
2703-
if (auto access = checkDistributedAccess(declLoc, decl, context)) {
2704-
std::tie(setThrows, usesDistributedThunk) = *access;
2705-
} else {
2706-
return AsyncMarkingResult::NotDistributed;
2707-
}
2708-
}
2709-
2710-
// Mark call as implicitly 'async', and also potentially as
2711-
// throwing and using a distributed thunk.
2712-
markNearestCallAsImplicitly(
2713-
/*setAsync=*/target, setThrows, usesDistributedThunk);
2714-
result = AsyncMarkingResult::FoundAsync;
27152662
}
27162663

27172664
if (result == AsyncMarkingResult::FoundAsync) {
@@ -2806,14 +2753,11 @@ namespace {
28062753
}
28072754

28082755
// Check for isolated parameters.
2809-
bool anyIsolatedParameters = false;
28102756
for (unsigned paramIdx : range(fnType->getNumParams())) {
28112757
// We only care about isolated parameters.
28122758
if (!fnType->getParams()[paramIdx].isIsolated())
28132759
continue;
28142760

2815-
anyIsolatedParameters = true;
2816-
28172761
auto *args = apply->getArgs();
28182762
if (paramIdx >= args->size())
28192763
continue;
@@ -2838,13 +2782,14 @@ namespace {
28382782

28392783
if (!fnType->getExtInfo().isAsync())
28402784
callOptions |= ActorReferenceResult::Flags::AsyncPromotion;
2785+
mayExitToNonisolated = false;
28412786

28422787
break;
28432788
}
28442789

28452790
// If we're calling an async function that's nonisolated, and we're in
28462791
// an isolated context, then we're exiting the actor context.
2847-
if (mayExitToNonisolated && !anyIsolatedParameters && fnType->isAsync() &&
2792+
if (mayExitToNonisolated && fnType->isAsync() &&
28482793
getContextIsolation().isActorIsolated())
28492794
unsatisfiedIsolation = ActorIsolation::forIndependent();
28502795

0 commit comments

Comments
 (0)