Private inside a package should be visible only inside this package in the same module
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// MODULE: m1
|
||||
// FILE: a.kt
|
||||
|
||||
package p
|
||||
|
||||
private val a = 1
|
||||
|
||||
// FILE: b.kt
|
||||
|
||||
package p
|
||||
|
||||
val b = a // same package, same module
|
||||
|
||||
// MODULE: m2(m1)
|
||||
// FILE: c.kt
|
||||
|
||||
package p
|
||||
|
||||
val c = <!INVISIBLE_MEMBER!>a<!> // same package, another module
|
||||
@@ -4872,6 +4872,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest("compiler/testData/diagnostics/tests/multimodule/internal.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("packagePrivate.kt")
|
||||
public void testPackagePrivate() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/multimodule/packagePrivate.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/diagnostics/tests/namedArguments")
|
||||
|
||||
@@ -46,8 +46,9 @@ public class Visibilities {
|
||||
return true;
|
||||
}
|
||||
if (fromParent instanceof PackageFragmentDescriptor) {
|
||||
return parent instanceof PackageFragmentDescriptor && ((PackageFragmentDescriptor) parent).getFqName()
|
||||
.isAncestorOf(((PackageFragmentDescriptor) fromParent).getFqName());
|
||||
return parent instanceof PackageFragmentDescriptor
|
||||
&& ((PackageFragmentDescriptor) parent).getFqName().isAncestorOf(((PackageFragmentDescriptor) fromParent).getFqName())
|
||||
&& DescriptorUtils.areInSameModule(fromParent, parent);
|
||||
}
|
||||
fromParent = fromParent.getContainingDeclaration();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user