File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 2525#include " swift/AST/Import.h"
2626#include " swift/AST/LookupKinds.h"
2727#include " swift/AST/Type.h"
28+ #include " swift/Basic/Assertions.h"
2829#include " swift/Basic/BasicSourceInfo.h"
2930#include " swift/Basic/Compiler.h"
3031#include " swift/Basic/Debug.h"
@@ -388,7 +389,7 @@ class ModuleDecl
388389 void setBypassResilience () { BypassResilience = true ; }
389390
390391 ArrayRef<FileUnit *> getFiles () {
391- assert (!Files.empty () || failedToLoad ());
392+ ASSERT (!Files.empty () || failedToLoad ());
392393 return Files;
393394 }
394395 ArrayRef<const FileUnit *> getFiles () const {
Original file line number Diff line number Diff line change @@ -1313,6 +1313,14 @@ ASTContext::synthesizeInvertibleProtocolDecl(InvertibleProtocolKind ip) const {
13131313 return proto;
13141314
13151315 ModuleDecl *stdlib = getStdlibModule ();
1316+ if (stdlib && stdlib->failedToLoad ()) {
1317+ stdlib = nullptr ; // Use the Builtin module instead.
1318+
1319+ // Ensure we emitted an error diagnostic!
1320+ if (!Diags.hadAnyError ())
1321+ Diags.diagnose (SourceLoc (), diag::serialization_load_failed, " Swift" );
1322+ }
1323+
13161324 FileUnit *file = nullptr ;
13171325 if (stdlib) {
13181326 file = &stdlib->getFiles ()[0 ]->getOrCreateSynthesizedFile ();
You can’t perform that action at this time.
0 commit comments