@@ -2615,7 +2615,6 @@ namespace {
2615
2615
bool isDistributed) {
2616
2616
ValueDecl *decl = concDeclRef.getDecl ();
2617
2617
AsyncMarkingResult result = AsyncMarkingResult::NotFound;
2618
- bool isAsyncCall = false ;
2619
2618
2620
2619
// is it an access to a property?
2621
2620
if (isPropOrSubscript (decl)) {
@@ -2660,58 +2659,6 @@ namespace {
2660
2659
result = AsyncMarkingResult::FoundAsync;
2661
2660
}
2662
2661
}
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;
2715
2662
}
2716
2663
2717
2664
if (result == AsyncMarkingResult::FoundAsync) {
@@ -2806,14 +2753,11 @@ namespace {
2806
2753
}
2807
2754
2808
2755
// Check for isolated parameters.
2809
- bool anyIsolatedParameters = false ;
2810
2756
for (unsigned paramIdx : range (fnType->getNumParams ())) {
2811
2757
// We only care about isolated parameters.
2812
2758
if (!fnType->getParams ()[paramIdx].isIsolated ())
2813
2759
continue ;
2814
2760
2815
- anyIsolatedParameters = true ;
2816
-
2817
2761
auto *args = apply->getArgs ();
2818
2762
if (paramIdx >= args->size ())
2819
2763
continue ;
@@ -2838,13 +2782,14 @@ namespace {
2838
2782
2839
2783
if (!fnType->getExtInfo ().isAsync ())
2840
2784
callOptions |= ActorReferenceResult::Flags::AsyncPromotion;
2785
+ mayExitToNonisolated = false ;
2841
2786
2842
2787
break ;
2843
2788
}
2844
2789
2845
2790
// If we're calling an async function that's nonisolated, and we're in
2846
2791
// an isolated context, then we're exiting the actor context.
2847
- if (mayExitToNonisolated && !anyIsolatedParameters && fnType->isAsync () &&
2792
+ if (mayExitToNonisolated && fnType->isAsync () &&
2848
2793
getContextIsolation ().isActorIsolated ())
2849
2794
unsatisfiedIsolation = ActorIsolation::forIndependent ();
2850
2795
0 commit comments