Skip to content

Commit d71790b

Browse files
authored
Ignore unresolved imports in @_implementationOnly consistency checking (swiftlang#26255)
Unresolved imports all have the "same" ModuleDecl: nullptr. But that's not really an inconsistency, and even if there *is* a true inconsistency among unresolved imports, it can be dealt with when the developer fixes their search paths. (Or the imports. Whichever is wrong.) rdar://problem/52943397
1 parent 6da591c commit d71790b

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

lib/Sema/TypeChecker.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ void swift::checkInconsistentImplementationOnlyImports(ModuleDecl *MainModule) {
564564
continue;
565565

566566
ModuleDecl *module = nextImport->getModule();
567+
if (!module)
568+
continue;
569+
567570
if (nextImport->getAttrs().hasAttribute<ImplementationOnlyAttr>()) {
568571
// We saw an implementation-only import.
569572
bool isNew =
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Just check that we don't crash (rdar://problem/52943397)
2+
3+
// RUN: not %target-swift-frontend -typecheck %s
4+
// RUN: not %target-swift-frontend -typecheck -show-diagnostics-after-fatal %s
5+
6+
@_implementationOnly import Swift
7+
import ThisModuleDoesNotExist
8+
@_implementationOnly import ThisModuleDoesNotExist
9+
@_implementationOnly import NeitherDoesThisOne

0 commit comments

Comments
 (0)