@@ -53,7 +53,10 @@ std::error_code SwiftModuleScanner::findModuleFilesInDirectory(
5353 auto ModPath = BaseName.getName (file_types::TY_SwiftModuleFile);
5454 auto InPath = BaseName.findInterfacePath (fs, Ctx);
5555
56- if (LoadMode == ModuleLoadingMode::OnlySerialized || !InPath) {
56+ // Lookup binary module if it is a testable lookup, or only binary module
57+ // lookup, or interface file does not exist.
58+ if (LoadMode == ModuleLoadingMode::OnlySerialized ||
59+ isTestableDependencyLookup || !InPath) {
5760 if (fs.exists (ModPath)) {
5861 // The module file will be loaded directly.
5962 auto dependencies =
@@ -271,10 +274,6 @@ ModuleDependencyVector SerializedModuleLoaderBase::getModuleDependencies(
271274 auto modulePath = builder.get ();
272275 auto moduleId = modulePath.front ().Item ;
273276
274- // Do not load interface module if it is testable import.
275- ModuleLoadingMode MLM =
276- isTestableDependencyLookup ? ModuleLoadingMode::OnlySerialized : LoadMode;
277-
278277 // Instantiate dependency scanning "loaders".
279278 SmallVector<std::unique_ptr<SwiftModuleScanner>, 2 > scanners;
280279 // Placeholder dependencies must be resolved first, to prevent the
@@ -283,10 +282,10 @@ ModuleDependencyVector SerializedModuleLoaderBase::getModuleDependencies(
283282 // dependency graph of the placeholder dependency module itself.
284283 // FIXME: submodules?
285284 scanners.push_back (std::make_unique<PlaceholderSwiftModuleScanner>(
286- Ctx, MLM , moduleId, Ctx.SearchPathOpts .PlaceholderDependencyModuleMap ,
285+ Ctx, LoadMode , moduleId, Ctx.SearchPathOpts .PlaceholderDependencyModuleMap ,
287286 delegate, moduleOutputPath));
288287 scanners.push_back (std::make_unique<SwiftModuleScanner>(
289- Ctx, MLM , moduleId, delegate, moduleOutputPath,
288+ Ctx, LoadMode , moduleId, delegate, moduleOutputPath,
290289 SwiftModuleScanner::MDS_plain));
291290
292291 // Check whether there is a module with this name that we can import.
0 commit comments