Skip to content

Commit 1032da2

Browse files
committed
[CSApply] Fix distributed thunk requirement check to handle non-parameter/capture base
If distributed memeber is referenced on a base that represents a result of some expression which is not a variable, parameter, or a capture it should always be dispatched via a thunk.
1 parent 4fa74c2 commit 1032da2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/Sema/CSApply.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7930,12 +7930,16 @@ bool ExprRewriter::requiresDistributedThunk(Expr *base, SourceLoc memberLoc,
79307930
auto *memberDecl = memberRef.getDecl();
79317931
assert(memberDecl);
79327932

7933-
if (auto *FD = dyn_cast<AbstractFunctionDecl>(memberDecl)) {
7933+
if (auto *FD = dyn_cast<FuncDecl>(memberDecl)) {
79347934
if (!(FD->isInstanceMember() && FD->isDistributed()))
79357935
return false;
79367936
} else if (auto *VD = dyn_cast<VarDecl>(memberDecl)) {
79377937
if (!VD->isDistributed())
79387938
return false;
7939+
} else {
7940+
// On 'distributed' methods and computed properties could ever
7941+
// require access via a distributed thunk.
7942+
return false;
79397943
}
79407944

79417945
auto *actor = getReferencedParamOrCapture(
@@ -7947,8 +7951,12 @@ bool ExprRewriter::requiresDistributedThunk(Expr *base, SourceLoc memberLoc,
79477951
return nullptr;
79487952
});
79497953

7954+
// If the base is not a parameter/variable reference or a capture
7955+
// it means that it's a result of some expression which cannot
7956+
// possibly be isolated, so referencing a distributed member on
7957+
// such base always requires a thunk.
79507958
if (!actor)
7951-
return false;
7959+
return true;
79527960

79537961
// If this is a method reference on an potentially isolated
79547962
// actor then it cannot be a remote thunk.

0 commit comments

Comments
 (0)