Skip to content

Commit 115af99

Browse files
committed
[CSApply] Mark call to distributed thunks as implicitly throwing
Use newly added `isDistributedThunk` check to determine whether the given call is to a remote distributed actor and if so mark it as implicitly throwing. Resolves: rdar://83610106
1 parent 3cebfdd commit 115af99

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/Sema/CSApply.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7581,6 +7581,15 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
75817581
apply->setArgs(args);
75827582
cs.setType(apply, fnType->getResult());
75837583

7584+
// If this is a call to a distributed method thunk, let's mark the
7585+
// call as implicitly throwing.
7586+
if (isDistributedThunk(callee, apply->getFn(), dc,
7587+
target && target->isAsyncLetInitializer())) {
7588+
auto *FD = cast<AbstractFunctionDecl>(callee.getDecl());
7589+
if (!FD->hasThrows())
7590+
apply->setImplicitlyThrows(true);
7591+
}
7592+
75847593
solution.setExprTypes(apply);
75857594
Expr *result = TypeChecker::substituteInputSugarTypeForResult(apply);
75867595
cs.cacheExprTypes(result);

0 commit comments

Comments
 (0)