diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 0a2b122d693b4..8e5cf912970d9 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -1383,6 +1383,9 @@ FuncDecl *ASTContext::getMakeInvocationEncoderOnDistributedActorSystem( FuncDecl * ASTContext::getRecordGenericSubstitutionOnDistributedInvocationEncoder( NominalTypeDecl *nominal) const { + if (!nominal) + return nullptr; + for (auto result : nominal->lookupDirect(Id_recordGenericSubstitution)) { auto *func = dyn_cast(result); if (func && @@ -1396,6 +1399,9 @@ ASTContext::getRecordGenericSubstitutionOnDistributedInvocationEncoder( AbstractFunctionDecl *ASTContext::getRecordArgumentOnDistributedInvocationEncoder( NominalTypeDecl *nominal) const { + if (!nominal) + return nullptr; + return evaluateOrDefault( nominal->getASTContext().evaluator, GetDistributedTargetInvocationEncoderRecordArgumentFunctionRequest{nominal}, @@ -1404,6 +1410,9 @@ AbstractFunctionDecl *ASTContext::getRecordArgumentOnDistributedInvocationEncode AbstractFunctionDecl *ASTContext::getRecordReturnTypeOnDistributedInvocationEncoder( NominalTypeDecl *nominal) const { + if (!nominal) + return nullptr; + return evaluateOrDefault( nominal->getASTContext().evaluator, GetDistributedTargetInvocationEncoderRecordReturnTypeFunctionRequest{nominal}, @@ -1412,6 +1421,9 @@ AbstractFunctionDecl *ASTContext::getRecordReturnTypeOnDistributedInvocationEnco AbstractFunctionDecl *ASTContext::getRecordErrorTypeOnDistributedInvocationEncoder( NominalTypeDecl *nominal) const { + if (!nominal) + return nullptr; + return evaluateOrDefault( nominal->getASTContext().evaluator, GetDistributedTargetInvocationEncoderRecordErrorTypeFunctionRequest{nominal}, @@ -1420,6 +1432,9 @@ AbstractFunctionDecl *ASTContext::getRecordErrorTypeOnDistributedInvocationEncod AbstractFunctionDecl *ASTContext::getDecodeNextArgumentOnDistributedInvocationDecoder( NominalTypeDecl *nominal) const { + if (!nominal) + return nullptr; + return evaluateOrDefault( nominal->getASTContext().evaluator, GetDistributedTargetInvocationDecoderDecodeNextArgumentFunctionRequest{nominal}, @@ -1428,6 +1443,9 @@ AbstractFunctionDecl *ASTContext::getDecodeNextArgumentOnDistributedInvocationDe AbstractFunctionDecl *ASTContext::getOnReturnOnDistributedTargetInvocationResultHandler( NominalTypeDecl *nominal) const { + if (!nominal) + return nullptr; + return evaluateOrDefault( nominal->getASTContext().evaluator, GetDistributedTargetInvocationResultHandlerOnReturnFunctionRequest{nominal}, diff --git a/test/Distributed/distributed_imcomplete_system_dont_crash.swift b/test/Distributed/distributed_imcomplete_system_dont_crash.swift index a2cc7d2ca3772..e4f5d3e7f9dce 100644 --- a/test/Distributed/distributed_imcomplete_system_dont_crash.swift +++ b/test/Distributed/distributed_imcomplete_system_dont_crash.swift @@ -36,4 +36,12 @@ public final class CompletelyHollowActorSystem: DistributedActorSystem { // expected-error@-1{{type 'CompletelyHollowActorSystem.ResultHandler' does not conform to protocol 'DistributedTargetInvocationResultHandler'}} } +} + +public final class CompletelyHollowActorSystem_NotEvenTypes: DistributedActorSystem { + // expected-error@-1{{type 'CompletelyHollowActorSystem_NotEvenTypes' does not conform to protocol 'DistributedActorSystem'}} + // expected-error@-2{{class 'CompletelyHollowActorSystem_NotEvenTypes' is missing witness for protocol requirement 'remoteCallVoid'}} + // expected-error@-3{{class 'CompletelyHollowActorSystem_NotEvenTypes' is missing witness for protocol requirement 'remoteCall'}} + // expected-note@-4{{protocol 'DistributedActorSystem' requires function 'remoteCall' with signature:}} + // expected-note@-5{{protocol 'DistributedActorSystem' requires function 'remoteCallVoid' with signature:}} } \ No newline at end of file