mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add a check for an empty package interface path
Update diags
This commit is contained in:
@@ -1110,7 +1110,7 @@ ERROR(in_package_module_not_compiled_from_source_or_package_interface,none,
|
||||
|
||||
WARNING(in_package_module_not_compiled_locally,none,
|
||||
"module %0 is in package %1 but was loaded from SDK; "
|
||||
"modules of the same package should be built locally: %2",
|
||||
"modules of the same package should be built locally from source only: %2",
|
||||
(Identifier, Identifier, StringRef))
|
||||
|
||||
ERROR(import_restriction_conflict,none,
|
||||
|
||||
@@ -70,7 +70,7 @@ std::error_code SwiftModuleScanner::findModuleFilesInDirectory(
|
||||
// Use package.swiftinterface if it exists and its package-name applies to
|
||||
// the importer module.
|
||||
auto PkgInPath = BaseName.getPackageInterfacePathIfInSamePackage(fs, Ctx).value_or("");
|
||||
if (fs.exists(PkgInPath)) {
|
||||
if (!PkgInPath.empty() && fs.exists(PkgInPath)) {
|
||||
InPath = PkgInPath;
|
||||
} else {
|
||||
// If not in package, use the private interface file if exits.
|
||||
|
||||
@@ -641,7 +641,7 @@ SerializedModuleBaseName::findInterfacePath(llvm::vfs::FileSystem &fs, ASTContex
|
||||
// Check if a package interface exists and if the package name applies to
|
||||
// the importer module.
|
||||
auto pkgPath = getPackageInterfacePathIfInSamePackage(fs, ctx).value_or("");
|
||||
if (fs.exists(pkgPath))
|
||||
if (!pkgPath.empty() && fs.exists(pkgPath))
|
||||
return pkgPath;
|
||||
|
||||
// If above fails, use the existing logic as fallback.
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
package func log(level: Int) {}
|
||||
|
||||
//--- Client1.swift
|
||||
import LibInSDK // expected-warning {{module 'LibInSDK' is in package 'libPkg' but was loaded from SDK; modules of the same package should be built locally}}
|
||||
import LibInSDK // expected-warning {{module 'LibInSDK' is in package 'libPkg' but was loaded from SDK; modules of the same package should be built locally from source only}}
|
||||
|
||||
func someFunc() {
|
||||
log(level: 1)
|
||||
|
||||
Reference in New Issue
Block a user