mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[Serialization] Differentiate module loading behavior for non-public imports
Differentiate `internal` and `fileprivate` imports from implementation-only imports at the module-wide level to offer a different module loading strategy. The main difference is for non-public imports from a module with testing enabled to be loaded by transitive clients. Ideally, we would only load transitive non-public dependencies on testable imports of the middle module. The current module loading logic doesn't allow for this behavior easily as a module may be first loaded for a normal import and extra dependencies would have to be loaded on later imports. We may want to refactor the module loading logic to allow this if needed. rdar://106514965
This commit is contained in:
@@ -468,6 +468,10 @@ void ModuleFile::getImportedModules(SmallVectorImpl<ImportedModule> &results,
|
||||
continue;
|
||||
}
|
||||
|
||||
} else if (dep.isInternalOrBelow()) {
|
||||
if (!filter.contains(ModuleDecl::ImportFilterKind::InternalOrBelow))
|
||||
continue;
|
||||
|
||||
} else if (dep.isPackageOnly()) {
|
||||
if (!filter.contains(ModuleDecl::ImportFilterKind::PackageOnly))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user