Internal visibility works the same as public
Fix test data This change is needed to preserve old behaviour for M9 isFriend() utilities become unused after this change
This commit is contained in:
@@ -22,14 +22,14 @@ class B
|
||||
import p.*
|
||||
|
||||
fun test() {
|
||||
val _a = <!INVISIBLE_MEMBER!>a<!>
|
||||
val _v = <!INVISIBLE_MEMBER!>v<!>
|
||||
<!INVISIBLE_MEMBER!>a<!>()
|
||||
<!INVISIBLE_MEMBER!>B<!>()
|
||||
val _a = a
|
||||
val _v = v
|
||||
a()
|
||||
B()
|
||||
|
||||
val inst = A()
|
||||
val ia = inst.<!INVISIBLE_MEMBER!>a<!>
|
||||
val iv = inst.<!INVISIBLE_MEMBER!>v<!>
|
||||
inst.<!INVISIBLE_MEMBER!>a<!>()
|
||||
inst.<!INVISIBLE_MEMBER!>B<!>()
|
||||
val ia = inst.a
|
||||
val iv = inst.v
|
||||
inst.a()
|
||||
inst.B()
|
||||
}
|
||||
@@ -75,8 +75,8 @@ public class Visibilities {
|
||||
public static final Visibility INTERNAL = new Visibility("internal", false) {
|
||||
@Override
|
||||
protected boolean isVisible(@NotNull DeclarationDescriptorWithVisibility what, @NotNull DeclarationDescriptor from) {
|
||||
DeclarationDescriptor fromOrModule = from instanceof PackageViewDescriptor ? ((PackageViewDescriptor) from).getModule() : from;
|
||||
return isInFriendModule(what, fromOrModule);
|
||||
//NOTE: supposedly temporarily
|
||||
return PUBLIC.isVisible(what, from);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -119,6 +119,7 @@ public class Visibilities {
|
||||
return findInvisibleMember(what, from) == null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
private static boolean isInFriendModule(@NotNull DeclarationDescriptor what, @NotNull DeclarationDescriptor from) {
|
||||
return DescriptorUtils.getContainingModule(what).isFriend(DescriptorUtils.getContainingModule(from));
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ public fun publicInM2() {
|
||||
|
||||
fun access() {
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'privateInM1': it is 'private' in 'shared'">privateInM1</error>()
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'internalInM1': it is 'internal' in 'shared'">internalInM1</error>()
|
||||
internalInM1()
|
||||
publicInM1()
|
||||
|
||||
|
||||
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: privateInM1Test">privateInM1Test</error>()
|
||||
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: internalInM1Test">internalInM1Test</error>()
|
||||
<error descr="[UNRESOLVED_REFERENCE] Unresolved reference: publicInM1Test">publicInM1Test</error>()
|
||||
|
||||
@@ -11,11 +11,11 @@ public fun publicInM2Test() {
|
||||
|
||||
fun access() {
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'privateInM1': it is 'private' in 'shared'">privateInM1</error>()
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'internalInM1': it is 'internal' in 'shared'">internalInM1</error>()
|
||||
internalInM1()
|
||||
publicInM1()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'privateInM1Test': it is 'private' in 'test'">privateInM1Test</error>()
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'internalInM1Test': it is 'internal' in 'test'">internalInM1Test</error>()
|
||||
internalInM1Test()
|
||||
publicInM1Test()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'privateInM2': it is 'private' in 'shared'">privateInM2</error>()
|
||||
|
||||
@@ -11,19 +11,19 @@ public fun publicInM3Test() {
|
||||
|
||||
fun access() {
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'privateInM1': it is 'private' in 'shared'">privateInM1</error>()
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'internalInM1': it is 'internal' in 'shared'">internalInM1</error>()
|
||||
internalInM1()
|
||||
publicInM1()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'privateInM1Test': it is 'private' in 'test'">privateInM1Test</error>()
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'internalInM1Test': it is 'internal' in 'test'">internalInM1Test</error>()
|
||||
internalInM1Test()
|
||||
publicInM1Test()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'privateInM2': it is 'private' in 'shared'">privateInM2</error>()
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'internalInM2': it is 'internal' in 'shared'">internalInM2</error>()
|
||||
internalInM2()
|
||||
publicInM2()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'privateInM2Test': it is 'private' in 'test'">privateInM2Test</error>()
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'internalInM2Test': it is 'internal' in 'test'">internalInM2Test</error>()
|
||||
internalInM2Test()
|
||||
publicInM2Test()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'privateInM3': it is 'private' in 'shared'">privateInM3</error>()
|
||||
|
||||
@@ -5,20 +5,20 @@ import m1.*
|
||||
fun testVisibility() {
|
||||
PublicClassInM1()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'InternalClassInM1': it is 'internal' in 'm1'">InternalClassInM1</error>()
|
||||
InternalClassInM1()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'PrivateClassInM1': it is 'private' in 'm1'">PrivateClassInM1</error>()
|
||||
|
||||
publicFunInM1()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'internalFunInM1': it is 'internal' in 'm1'">internalFunInM1</error>()
|
||||
internalFunInM1()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'privateFunInM1': it is 'private' in 'm1'">privateFunInM1</error>()
|
||||
}
|
||||
|
||||
public class ClassInM2
|
||||
|
||||
public class B: <error descr="[INVISIBLE_MEMBER] Cannot access '<init>': it is 'internal' in 'A'">A</error>() {
|
||||
public class B: A() {
|
||||
|
||||
fun accessA(<warning>a</warning>: A) {}
|
||||
|
||||
@@ -29,6 +29,6 @@ public class B: <error descr="[INVISIBLE_MEMBER] Cannot access '<init>': it is '
|
||||
|
||||
pub()
|
||||
|
||||
<error descr="[INVISIBLE_MEMBER] Cannot access 'int': it is 'invisible_fake' in 'B'">int</error>()
|
||||
int()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user