mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ScanDependency] Allow continue searching for testable module
When swift dependency scanner first finds a binary module for a testable import, verify if the module is built for enable-testing or not. If not, keeps searching in case there is a second testable binary module in the search path. Previously, the first binary module will always be accepted by scanner and rely on the importer to provide a good diagnostics. Now the scanner will emit a warning before continue searching, so user understands why the binary in the search path is not taken.
This commit is contained in:
@@ -454,6 +454,12 @@ SerializedModuleLoaderBase::scanModuleFile(Twine modulePath, bool isFramework,
|
||||
modulePath.str());
|
||||
return std::make_error_code(std::errc::no_such_file_or_directory);
|
||||
}
|
||||
|
||||
if (isTestableImport && !loadedModuleFile->isTestable()) {
|
||||
Ctx.Diags.diagnose(SourceLoc(), diag::skip_module_not_testable,
|
||||
modulePath.str());
|
||||
return std::make_error_code(std::errc::no_such_file_or_directory);
|
||||
}
|
||||
}
|
||||
|
||||
// Some transitive dependencies of binary modules are not required to be
|
||||
|
||||
Reference in New Issue
Block a user