mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Correct discrepancies in the package interface file lookup.
Add a check for the client side flag which explcitly opts in to loading the package interface, besides whether package-name is empty or in the same package. rdar://131393508
This commit is contained in:
@@ -618,9 +618,6 @@ std::string SerializedModuleBaseName::getName(file_types::ID fileTy) const {
|
||||
std::optional<std::string>
|
||||
SerializedModuleBaseName::getPackageInterfacePathIfInSamePackage(
|
||||
llvm::vfs::FileSystem &fs, ASTContext &ctx) const {
|
||||
if (!ctx.LangOpts.EnablePackageInterfaceLoad)
|
||||
return std::nullopt;
|
||||
|
||||
std::string packagePath{
|
||||
getName(file_types::TY_PackageSwiftModuleInterfaceFile)};
|
||||
|
||||
@@ -667,8 +664,12 @@ SerializedModuleBaseName::findInterfacePath(llvm::vfs::FileSystem &fs,
|
||||
if (!fs.exists(interfacePath))
|
||||
return std::nullopt;
|
||||
|
||||
// If there is a package name, try look for the package interface.
|
||||
if (!ctx.LangOpts.PackageName.empty()) {
|
||||
// If there is a package name, try to look for the package interface,
|
||||
// which can only be loaded if -experimental-package-interface-load
|
||||
// is passed to the client, so fall back to private/public interface
|
||||
// if not.
|
||||
if (!ctx.LangOpts.PackageName.empty() &&
|
||||
ctx.LangOpts.EnablePackageInterfaceLoad) {
|
||||
if (auto maybePackageInterface =
|
||||
getPackageInterfacePathIfInSamePackage(fs, ctx))
|
||||
return *maybePackageInterface;
|
||||
|
||||
Reference in New Issue
Block a user