[Distributed] Improve erroring out when distributed types not found

also return early when type hasError
This commit is contained in:
Konrad `ktoso` Malawski
2024-06-11 18:21:15 +09:00
parent 12f402f715
commit 4bae14a5c4
2 changed files with 6 additions and 3 deletions

View File

@@ -81,15 +81,15 @@ static VarDecl*
// what already has a witness.
static VarDecl *addImplicitDistributedActorIDProperty(
ClassDecl *nominal) {
if (!nominal)
return nullptr;
if (!nominal->isDistributedActor())
if (!nominal || !nominal->isDistributedActor())
return nullptr;
auto &C = nominal->getASTContext();
// ==== Synthesize and add 'id' property to the actor decl
Type propertyType = getDistributedActorIDType(nominal);
if (!propertyType || propertyType->hasError())
return nullptr;
auto *propDecl = new (C)
VarDecl(/*IsStatic*/false, VarDecl::Introducer::Let,