Compare the package names of the accessing module and the decl's defining module.

Update tests.
This commit is contained in:
Ellie Shin
2024-02-08 20:08:46 -08:00
parent f5150e7265
commit 7d4e5678c7
7 changed files with 52 additions and 43 deletions

View File

@@ -762,7 +762,7 @@ void UnboundImport::validateInterfaceWithPackageName(ModuleDecl *topLevelModule,
// If source file is .swift or non-interface, show diags when importing an interface file
ASTContext &ctx = topLevelModule->getASTContext();
if (topLevelModule->inPackage(ctx.LangOpts.PackageName) &&
if (topLevelModule->inSamePackage(ctx.MainModule) &&
topLevelModule->isBuiltFromInterface() &&
!topLevelModule->getModuleSourceFilename().endswith(".package.swiftinterface")) {
ctx.Diags.diagnose(import.module.getModulePath().front().Loc,