Fix protected visibility in class object.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
fun devNull(<!UNUSED_PARAMETER!>obj<!>: Any?) {}
|
||||
|
||||
open class A {
|
||||
class object {
|
||||
val internal_val = 1
|
||||
public val public_val: Int = 2
|
||||
private val private_val = 3
|
||||
protected val protected_val: Int = 5
|
||||
}
|
||||
|
||||
fun fromClass() {
|
||||
devNull(internal_val)
|
||||
devNull(public_val)
|
||||
devNull(private_val)
|
||||
devNull(protected_val)
|
||||
}
|
||||
}
|
||||
|
||||
fun fromOutside() {
|
||||
devNull(A.internal_val)
|
||||
devNull(A.public_val)
|
||||
devNull(A.<!INVISIBLE_MEMBER!>private_val<!>)
|
||||
devNull(A.<!INVISIBLE_MEMBER!>protected_val<!>)
|
||||
}
|
||||
|
||||
class B: A() {
|
||||
fun fromSubclass() {
|
||||
devNull(A.internal_val)
|
||||
devNull(A.public_val)
|
||||
devNull(A.<!INVISIBLE_MEMBER!>private_val<!>)
|
||||
devNull(A.protected_val)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package
|
||||
|
||||
internal fun devNull(/*0*/ obj: kotlin.Any?): kotlin.Unit
|
||||
internal fun fromOutside(): kotlin.Unit
|
||||
|
||||
internal open class A {
|
||||
public constructor A()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final fun fromClass(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
|
||||
internal class object <class-object-for-A> {
|
||||
private constructor <class-object-for-A>()
|
||||
internal final val internal_val: kotlin.Int = 1
|
||||
private final val private_val: kotlin.Int = 3
|
||||
protected final val protected_val: kotlin.Int = 5
|
||||
public final val public_val: kotlin.Int = 2
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
internal final class B : A {
|
||||
public constructor B()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
internal final override /*1*/ /*fake_override*/ fun fromClass(): kotlin.Unit
|
||||
internal final fun fromSubclass(): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -9396,6 +9396,12 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("VisibilityInClassObject.kt")
|
||||
public void testVisibilityInClassObject() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/VisibilityInClassObject.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("VisibilityInheritModifier.kt")
|
||||
public void testVisibilityInheritModifier() throws Exception {
|
||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/scopes/VisibilityInheritModifier.kt");
|
||||
|
||||
@@ -63,6 +63,9 @@ public class Visibilities {
|
||||
@Override
|
||||
protected boolean isVisible(@NotNull DeclarationDescriptorWithVisibility what, @NotNull DeclarationDescriptor from) {
|
||||
ClassDescriptor classDescriptor = DescriptorUtils.getParentOfType(what, ClassDescriptor.class);
|
||||
if (DescriptorUtils.isClassObject(classDescriptor)) {
|
||||
classDescriptor = DescriptorUtils.getParentOfType(classDescriptor, ClassDescriptor.class);
|
||||
}
|
||||
if (classDescriptor == null) return false;
|
||||
|
||||
ClassDescriptor fromClass = DescriptorUtils.getParentOfType(from, ClassDescriptor.class, false);
|
||||
|
||||
Reference in New Issue
Block a user