Remove check in visibilities that allowed access to privates of outer packages

It doesn't work for a while now in imports and is planned to be dropped with upcoming changes to private
This commit is contained in:
Pavel V. Talanov
2015-05-13 17:15:57 +03:00
parent be66ee7015
commit 7585cbfe22
7 changed files with 51 additions and 17 deletions
@@ -1,3 +0,0 @@
package a.b
fun box() = a.x
@@ -1,3 +0,0 @@
package a
private val x: String = "OK"
@@ -0,0 +1,25 @@
// FILE: a.kt
package outer
private fun a() {}
private class B
// FILE: b.kt
package outer.p1
import outer.<!INVISIBLE_REFERENCE!>a<!>
fun use() {
<!INVISIBLE_MEMBER!>a<!>()
outer.<!INVISIBLE_MEMBER!>B<!>()
}
// FILE: c.kt
package outer.p1.p2
import outer.<!INVISIBLE_REFERENCE!>a<!>
fun use() {
<!INVISIBLE_MEMBER!>a<!>()
outer.<!INVISIBLE_MEMBER!>B<!>()
}
@@ -0,0 +1,20 @@
package
package outer {
private fun a(): kotlin.Unit
private final class B {
public constructor B()
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
package outer.p1 {
internal fun use(): kotlin.Unit
package outer.p1.p2 {
internal fun use(): kotlin.Unit
}
}
}
@@ -379,6 +379,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("PrivateFromOuterPackage.kt")
public void testPrivateFromOuterPackage() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/PrivateFromOuterPackage.kt");
doTest(fileName);
}
@TestMetadata("ProcessingEmptyImport.kt")
public void testProcessingEmptyImport() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/ProcessingEmptyImport.kt");
@@ -77,12 +77,6 @@ public class BlackBoxMultiFileCodegenTestGenerated extends AbstractBlackBoxCodeg
doTestMultiFile(fileName);
}
@TestMetadata("nestedPackages")
public void testNestedPackages() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/nestedPackages/");
doTestMultiFile(fileName);
}
@TestMetadata("packageLocalClassNotImportedWithDefaultImport")
public void testPackageLocalClassNotImportedWithDefaultImport() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/codegen/boxMultiFile/packageLocalClassNotImportedWithDefaultImport/");
@@ -53,11 +53,6 @@ public class Visibilities {
if (parent == fromParent) {
return true;
}
if (fromParent instanceof PackageFragmentDescriptor) {
return parent instanceof PackageFragmentDescriptor
&& ((PackageFragmentDescriptor) parent).getFqName().isAncestorOf(((PackageFragmentDescriptor) fromParent).getFqName())
&& DescriptorUtils.areInSameModule(fromParent, parent);
}
fromParent = fromParent.getContainingDeclaration();
}
return false;