Assert that an added file loaded without error

This commit is contained in:
Hamish Knight
2020-05-28 15:06:55 -07:00
parent 046f17f519
commit 439c1481be
4 changed files with 13 additions and 0 deletions

View File

@@ -498,6 +498,10 @@ bool ModuleDecl::isClangModule() const {
}
void ModuleDecl::addFile(FileUnit &newFile) {
// If this is a LoadedFile, make sure it loaded without error.
assert(!(isa<LoadedFile>(newFile) &&
cast<LoadedFile>(newFile).hadLoadError()));
// Require Main and REPL files to be the first file added.
assert(Files.empty() ||
!isa<SourceFile>(newFile) ||