@@ -516,10 +516,6 @@ namespace {
516516 LookUpConformanceInModule (dc->getParentModule ()));
517517 }
518518
519- // / Determine whether the given reference is to a method on
520- // / a remote distributed actor in the given context.
521- bool isDistributedThunk (ConcreteDeclRef ref, Expr *context);
522-
523519 // / Determine whether the given reference on the given
524520 // / base has to be replaced with a distributed thunk instead.
525521 bool requiresDistributedThunk (Expr *base, SourceLoc memberLoc,
@@ -1649,6 +1645,10 @@ namespace {
16491645
16501646 ConcreteDeclRef thunkRef{thunkDecl, memberRef.getSubstitutions ()};
16511647
1648+ // Update member reference to point to the thunk.
1649+ CachedConcreteRefs[cs.getConstraintLocator (memberLocator)] =
1650+ thunkRef;
1651+
16521652 auto declRefExpr = new (context) DeclRefExpr (
16531653 thunkRef, memberLoc, Implicit, AccessSemantics::DirectToStorage);
16541654
@@ -7790,14 +7790,14 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
77907790 cs.setType (apply, fnType->getResult ());
77917791
77927792 // If this is a call to a distributed method thunk,
7793- // let's mark the call as implicitly throwing.
7794- if (isDistributedThunk (callee, apply->getFn ())) {
7795- auto *FD = cast<AbstractFunctionDecl >(callee.getDecl ());
7796- if (!FD-> hasThrows ())
7793+ // let's mark the call as implicitly throwing/async .
7794+ if (isa<SelfApplyExpr>( apply->getFn ())) {
7795+ auto *FD = dyn_cast<FuncDecl >(callee.getDecl ());
7796+ if (FD && FD-> isDistributedThunk ()) {
77977797 apply->setImplicitlyThrows (true );
7798- if (!FD->hasAsync ())
77997798 apply->setImplicitlyAsync (ImplicitActorHopTarget::forInstanceSelf ());
7800- apply->setUsesDistributedThunk (true );
7799+ apply->setUsesDistributedThunk (true );
7800+ }
78017801 }
78027802
78037803 solution.setExprTypes (apply);
@@ -7916,14 +7916,6 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
79167916 return ctorCall;
79177917}
79187918
7919- bool ExprRewriter::isDistributedThunk (ConcreteDeclRef ref, Expr *context) {
7920- if (!isa<SelfApplyExpr>(context))
7921- return false ;
7922-
7923- return requiresDistributedThunk (cast<SelfApplyExpr>(context)->getBase (),
7924- context->getLoc (), ref);
7925- }
7926-
79277919bool ExprRewriter::requiresDistributedThunk (Expr *base, SourceLoc memberLoc,
79287920 ConcreteDeclRef memberRef) {
79297921
0 commit comments