[TypeChecker] Distributed: Verify properties before attempting to synthesize a thunk

This commit is contained in:
Pavel Yaskevich
2022-06-15 17:12:43 -07:00
parent d68961d407
commit a016fae223
2 changed files with 15 additions and 7 deletions

View File

@@ -822,6 +822,9 @@ FuncDecl *GetDistributedThunkRequest::evaluate(Evaluator &evaluator,
if (!var->isDistributed())
return nullptr;
if (checkDistributedActorProperty(var, /*diagnose=*/false))
return nullptr;
distributedTarget = var->getAccessor(AccessorKind::Get);
} else {
distributedTarget = originator.get<AbstractFunctionDecl *>();
@@ -846,7 +849,8 @@ FuncDecl *GetDistributedThunkRequest::evaluate(Evaluator &evaluator,
// we must avoid synthesis of the thunk because it'd also have errors,
// giving an ugly user experience (errors in implicit code).
if (distributedTarget->getInterfaceType()->hasError() ||
checkDistributedFunction(distributedTarget)) {
(!isa<AccessorDecl>(distributedTarget) &&
checkDistributedFunction(distributedTarget))) {
return nullptr;
}