mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Sema: Only add implicit imports to module interface during resilience typechecking.
Previously, implicit imports were also being added to the module interface during override checking (without any diagnostic). Additionally, correct the structure of the import which contained an extra, duplicated path component. It would be diagnosed as a scoped import and written into the interface like this: ``` import UIKit/*.UIKit*/ ``` Resolves rdar://104935794
This commit is contained in:
@@ -3115,21 +3115,6 @@ RestrictedImportKind SourceFile::getRestrictedImportKind(const ModuleDecl *modul
|
||||
if (imports.isImportedBy(module, getParentModule()))
|
||||
return RestrictedImportKind::None;
|
||||
|
||||
if (importKind == RestrictedImportKind::MissingImport &&
|
||||
(module->getLibraryLevel() == LibraryLevel::API ||
|
||||
getParentModule()->getLibraryLevel() != LibraryLevel::API)) {
|
||||
// Hack to fix swiftinterfaces in case of missing imports.
|
||||
// We can get rid of this logic when we don't leak the use of non-locally
|
||||
// imported things in API.
|
||||
ImportPath::Element pathElement = {module->getName(), SourceLoc()};
|
||||
auto pathArray = getASTContext().AllocateCopy(
|
||||
llvm::makeArrayRef(pathElement));
|
||||
auto missingImport = ImportedModule(
|
||||
ImportPath::Access(pathArray),
|
||||
const_cast<ModuleDecl *>(module));
|
||||
addMissingImportedModule(missingImport);
|
||||
}
|
||||
|
||||
return importKind;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user