Skip to content

Commit 66a994b

Browse files
committed
[Sema] Insert missing imports from any non-API modules
We can insert imports to any module from a source file that's part of a non-API module without risking breaking the public swiftinterface.
1 parent fefbbb6 commit 66a994b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/AST/Module.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2547,7 +2547,8 @@ RestrictedImportKind SourceFile::getRestrictedImportKind(const ModuleDecl *modul
25472547
return RestrictedImportKind::None;
25482548

25492549
if (importKind == RestrictedImportKind::Implicit &&
2550-
module->getLibraryLevel() == LibraryLevel::API) {
2550+
(module->getLibraryLevel() == LibraryLevel::API ||
2551+
getParentModule()->getLibraryLevel() != LibraryLevel::API)) {
25512552
// Hack to fix swiftinterfaces in case of missing imports.
25522553
// We can get rid of this logic when we don't leak the use of non-locally
25532554
// imported things in API.

0 commit comments

Comments
 (0)