[Serialization] Do not accept packages without a name

Realign the module loading behavior with the one of the package
access-level. If the package name is an empty string, don't accept other
modules with an empty package name as being part of the same module and
don't load package dependencies in such a case.
This commit is contained in:
Alexis Laferrière
2023-03-20 12:52:18 -07:00
parent fa58280587
commit 8aadcf464f

View File

@@ -1712,7 +1712,7 @@ ModuleFileSharedCore::getTransitiveLoadingBehavior(
if (dependency.isPackageOnly()) {
// Package dependencies are usually loaded only for import from the same
// package.
if (packageName == getModulePackageName()) {
if (!packageName.empty() && packageName == getModulePackageName()) {
return ModuleLoadingBehavior::Required;
} else if (debuggerMode) {
return ModuleLoadingBehavior::Optional;