From e33ddaaa4364b6c5e3e42a7766e63bc0530351f1 Mon Sep 17 00:00:00 2001 From: Konrad `ktoso` Malawski Date: Thu, 22 Jun 2023 10:59:47 +0900 Subject: [PATCH] [Distributed] Don't diagnose declared dist member properties when importing module rdar://111080052 --- lib/Sema/TypeCheckDistributed.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Sema/TypeCheckDistributed.cpp b/lib/Sema/TypeCheckDistributed.cpp index 9afdb38c4f184..75f7ce7dc2b5c 100644 --- a/lib/Sema/TypeCheckDistributed.cpp +++ b/lib/Sema/TypeCheckDistributed.cpp @@ -657,9 +657,13 @@ bool swift::checkDistributedActorProperty(VarDecl *var, bool diagnose) { void swift::checkDistributedActorProperties(const NominalTypeDecl *decl) { auto &C = decl->getASTContext(); - auto sourceFile = decl->getDeclContext()->getParentSourceFile(); - if (sourceFile && sourceFile->Kind == SourceFileKind::Interface) { - // Don't diagnose properties in swiftinterfaces. + if (auto sourceFile = decl->getDeclContext()->getParentSourceFile()) { + if (sourceFile->Kind == SourceFileKind::Interface) { + // Don't diagnose properties in swiftinterfaces. + return; + } + } else { + // Don't diagnose when checking without source file (e.g. from module, importer etc). return; }