@@ -53,7 +53,10 @@ std::error_code SwiftModuleScanner::findModuleFilesInDirectory(
53
53
auto ModPath = BaseName.getName (file_types::TY_SwiftModuleFile);
54
54
auto InPath = BaseName.findInterfacePath (fs, Ctx);
55
55
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) {
57
60
if (fs.exists (ModPath)) {
58
61
// The module file will be loaded directly.
59
62
auto dependencies =
@@ -271,10 +274,6 @@ ModuleDependencyVector SerializedModuleLoaderBase::getModuleDependencies(
271
274
auto modulePath = builder.get ();
272
275
auto moduleId = modulePath.front ().Item ;
273
276
274
- // Do not load interface module if it is testable import.
275
- ModuleLoadingMode MLM =
276
- isTestableDependencyLookup ? ModuleLoadingMode::OnlySerialized : LoadMode;
277
-
278
277
// Instantiate dependency scanning "loaders".
279
278
SmallVector<std::unique_ptr<SwiftModuleScanner>, 2 > scanners;
280
279
// Placeholder dependencies must be resolved first, to prevent the
@@ -283,10 +282,10 @@ ModuleDependencyVector SerializedModuleLoaderBase::getModuleDependencies(
283
282
// dependency graph of the placeholder dependency module itself.
284
283
// FIXME: submodules?
285
284
scanners.push_back (std::make_unique<PlaceholderSwiftModuleScanner>(
286
- Ctx, MLM , moduleId, Ctx.SearchPathOpts .PlaceholderDependencyModuleMap ,
285
+ Ctx, LoadMode , moduleId, Ctx.SearchPathOpts .PlaceholderDependencyModuleMap ,
287
286
delegate, moduleOutputPath));
288
287
scanners.push_back (std::make_unique<SwiftModuleScanner>(
289
- Ctx, MLM , moduleId, delegate, moduleOutputPath,
288
+ Ctx, LoadMode , moduleId, delegate, moduleOutputPath,
290
289
SwiftModuleScanner::MDS_plain));
291
290
292
291
// Check whether there is a module with this name that we can import.
0 commit comments