mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #78005 from xymus/access-level-import-reexports
Sema: Prioritize @_exported imports over local non-public imports
This commit is contained in:
@@ -2957,6 +2957,16 @@ SourceFile::getImportAccessLevel(const ModuleDecl *targetModule) const {
|
||||
restrictiveImport = import;
|
||||
}
|
||||
}
|
||||
|
||||
// Reexports from the local module take precedence over non-public imports
|
||||
// and lift all access-level restrictions. We still prioritize file local
|
||||
// public imports as diagnostics will have an import to point to and
|
||||
// they are recommended over indirect imports.
|
||||
if ((!restrictiveImport.has_value() ||
|
||||
restrictiveImport->accessLevel < AccessLevel::Public) &&
|
||||
imports.isImportedBy(targetModule, getParentModule()))
|
||||
return std::nullopt;
|
||||
|
||||
return restrictiveImport;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user