Prohibit accessing nested classes/objects of class object using class literal

The fqname of class should be clear from code
Example: can't shorten A.Default.B.Default.C to A.B.C
Also fixes problem when nested class of enum class could be accessed via enum entry
This commit is contained in:
Pavel V. Talanov
2015-02-18 19:22:25 +03:00
parent 86bbb117ef
commit ffabe19229
25 changed files with 480 additions and 44 deletions
@@ -43,22 +43,27 @@ private val FUNCTIONS_COLLECTOR = FunctionCollector.withDefaultFilter()
private val VARIABLES_COLLECTOR = VariableCollector.withDefaultFilter()
private val PROPERTIES_COLLECTOR = PropertyCollector.withDefaultFilter()
public class CallableDescriptorCollectors<D : CallableDescriptor>(vararg collectors: CallableDescriptorCollector<D>) : Iterable<CallableDescriptorCollector<D>> {
private val collectors = collectors.toList()
public class CallableDescriptorCollectors<D : CallableDescriptor>(val collectors: List<CallableDescriptorCollector<D>>) :
Iterable<CallableDescriptorCollector<D>> {
override fun iterator(): Iterator<CallableDescriptorCollector<D>> = collectors.iterator()
[suppress("UNCHECKED_CAST")]
class object {
public val FUNCTIONS_AND_VARIABLES: CallableDescriptorCollectors<CallableDescriptor> =
CallableDescriptorCollectors(FUNCTIONS_COLLECTOR as CallableDescriptorCollector<CallableDescriptor>,
VARIABLES_COLLECTOR as CallableDescriptorCollector<CallableDescriptor>)
CallableDescriptorCollectors(listOf(
FUNCTIONS_COLLECTOR as CallableDescriptorCollector<CallableDescriptor>,
VARIABLES_COLLECTOR as CallableDescriptorCollector<CallableDescriptor>
))
public val FUNCTIONS: CallableDescriptorCollectors<CallableDescriptor> =
CallableDescriptorCollectors(FUNCTIONS_COLLECTOR as CallableDescriptorCollector<CallableDescriptor>)
public val VARIABLES: CallableDescriptorCollectors<VariableDescriptor> = CallableDescriptorCollectors(VARIABLES_COLLECTOR)
public val PROPERTIES: CallableDescriptorCollectors<VariableDescriptor> = CallableDescriptorCollectors(PROPERTIES_COLLECTOR)
CallableDescriptorCollectors(listOf(FUNCTIONS_COLLECTOR as CallableDescriptorCollector<CallableDescriptor>))
public val VARIABLES: CallableDescriptorCollectors<VariableDescriptor> = CallableDescriptorCollectors(listOf(VARIABLES_COLLECTOR))
public val PROPERTIES: CallableDescriptorCollectors<VariableDescriptor> = CallableDescriptorCollectors(listOf(PROPERTIES_COLLECTOR))
}
}
public fun <D : CallableDescriptor> CallableDescriptorCollectors<D>.filtered(filter: (D) -> Boolean): CallableDescriptorCollectors<D> =
CallableDescriptorCollectors(this.collectors.map { it.filtered(filter) })
private object FunctionCollector : CallableDescriptorCollector<FunctionDescriptor> {
override fun getNonExtensionsByName(scope: JetScope, name: Name, bindingTrace: BindingTrace): Collection<FunctionDescriptor> {
@@ -23,8 +23,6 @@ import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.psi.Call
import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext
import org.jetbrains.kotlin.resolve.calls.smartcasts.SmartCastUtils
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollector
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.CallableDescriptorCollectors
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.scopes.JetScope
import org.jetbrains.kotlin.resolve.scopes.JetScopeUtils
@@ -39,6 +37,9 @@ import org.jetbrains.kotlin.resolve.calls.context.ResolutionContext
import org.jetbrains.kotlin.resolve.calls.CallResolverUtil.isOrOverridesSynthesized
import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind.*
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue.NO_RECEIVER
import org.jetbrains.kotlin.resolve.*
import org.jetbrains.kotlin.resolve.calls.util.*
import org.jetbrains.kotlin.resolve.calls.tasks.collectors.*
public class TaskPrioritizer(private val storageManager: StorageManager) {
@@ -71,10 +72,7 @@ public class TaskPrioritizer(private val storageManager: StorageManager) {
if (explicitReceiver is QualifierReceiver) {
val qualifierReceiver = explicitReceiver : QualifierReceiver
doComputeTasks(NO_RECEIVER, taskPrioritizerContext.replaceScope(qualifierReceiver.getNestedClassesAndPackageMembersScope()))
val classObjectReceiver = qualifierReceiver.getClassObjectReceiver()
if (classObjectReceiver.exists()) {
doComputeTasks(classObjectReceiver, taskPrioritizerContext)
}
computeTasksForClassObjectReceiver(qualifierReceiver, taskPrioritizerContext)
}
else {
doComputeTasks(explicitReceiver, taskPrioritizerContext)
@@ -83,6 +81,30 @@ public class TaskPrioritizer(private val storageManager: StorageManager) {
return result.getTasks()
}
private fun <D : CallableDescriptor, F : D> computeTasksForClassObjectReceiver(
qualifierReceiver: QualifierReceiver,
taskPrioritizerContext: TaskPrioritizerContext<D, F>
) {
val classObjectReceiver = qualifierReceiver.getClassObjectReceiver()
if (!classObjectReceiver.exists()) {
return
}
val classifierDescriptor = qualifierReceiver.classifier
doComputeTasks(classObjectReceiver, taskPrioritizerContext.filterCollectors {
when {
classifierDescriptor is ClassDescriptor && classifierDescriptor.getDefaultObjectDescriptor() != null -> {
// nested classes and objects should not be accessible via short reference to default object
it !is ConstructorDescriptor && it !is FakeCallableDescriptorForObject
}
classifierDescriptor != null && DescriptorUtils.isEnumEntry(classifierDescriptor) -> {
// objects nested in enum should not be accessible via enum entries reference
it !is FakeCallableDescriptorForObject
}
else -> true
}
})
}
private fun <D : CallableDescriptor, F : D> doComputeTasks(receiver: ReceiverValue, c: TaskPrioritizerContext<D, F>) {
ProgressIndicatorProvider.checkCanceled()
@@ -428,5 +450,9 @@ public class TaskPrioritizer(private val storageManager: StorageManager) {
fun replaceCollectors(newCollectors: CallableDescriptorCollectors<D>): TaskPrioritizerContext<D, F> {
return TaskPrioritizerContext(name, result, context, scope, newCollectors)
}
fun filterCollectors(filter: (D) -> Boolean): TaskPrioritizerContext<D, F> {
return TaskPrioritizerContext(name, result, context, scope, callableDescriptorCollectors.filtered(filter))
}
}
}
@@ -252,6 +252,6 @@ class CollectorForDynamicReceivers<D: CallableDescriptor>(val delegate: Callable
}
}
fun <D: CallableDescriptor> CallableDescriptorCollectors<D>.onlyDynamicReceivers(): CallableDescriptorCollectors<D> {
return CallableDescriptorCollectors(* this.map { CollectorForDynamicReceivers(it) }.copyToArray())
fun <D : CallableDescriptor> CallableDescriptorCollectors<D>.onlyDynamicReceivers(): CallableDescriptorCollectors<D> {
return CallableDescriptorCollectors(this.map { CollectorForDynamicReceivers(it) })
}
@@ -18,12 +18,10 @@ package org.jetbrains.kotlin.resolve.scopes.receivers
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.resolve.scopes.JetScope
import org.jetbrains.kotlin.psi.JetSimpleNameExpression
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.DescriptorUtils.getFqName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.scopes.ChainedScope
import java.util.ArrayList
import org.jetbrains.kotlin.utils.addIfNotNull
import org.jetbrains.kotlin.resolve.BindingContext.*
@@ -35,6 +33,7 @@ import org.jetbrains.kotlin.psi.JetExpression
import org.jetbrains.kotlin.resolve.bindingContextUtil.recordScopeAndDataFlowInfo
import kotlin.properties.Delegates
import org.jetbrains.kotlin.resolve.descriptorUtil.classObjectDescriptor
import org.jetbrains.kotlin.resolve.scopes.*
public trait Qualifier: ReceiverValue {
@@ -67,7 +66,10 @@ class QualifierReceiver (
override var resultingDescriptor: DeclarationDescriptor by Delegates.notNull()
override val scope: JetScope get() {
val scopes = listOf(classifier?.getClassObjectType()?.getMemberScope(), getNestedClassesAndPackageMembersScope()).filterNotNull().copyToArray()
val classObjectTypeScope = classifier?.getClassObjectType()?.getMemberScope()?.let {
FilteringScope(it) { it !is ClassDescriptor }
}
val scopes = listOf(classObjectTypeScope, getNestedClassesAndPackageMembersScope()).filterNotNull().copyToArray()
return ChainedScope(descriptor, "Member scope for " + name + " as package or class or object", *scopes)
}
@@ -82,12 +84,6 @@ class QualifierReceiver (
if (classifier is ClassDescriptor) {
scopes.add(classifier.getStaticScope())
val classObjectDescriptor = classifier.getDefaultObjectDescriptor()
if (classObjectDescriptor != null) {
// non-static members are resolved through class object receiver
scopes.add(DescriptorUtils.getStaticNestedClassesScope(classObjectDescriptor))
}
if (classifier.getKind() != ClassKind.ENUM_ENTRY) {
scopes.add(DescriptorUtils.getStaticNestedClassesScope(classifier))
}
@@ -8,6 +8,6 @@ class Outer() {
}
fun box (): String {
val inner = Outer.Inner()
val inner = Outer.Default.Inner()
return "OK"
}
@@ -1,4 +1,4 @@
fun box() = if(Context.operatingSystemType == Context.OsType.OTHER) "OK" else "fail"
fun box() = if(Context.operatingSystemType == Context.Default.OsType.OTHER) "OK" else "fail"
public class Context
{
@@ -13,17 +13,17 @@ class A {
fun foo(x : A.Default.Season) : String {
return when (x) {
A.Season.WINTER -> "winter"
A.Season.SPRING -> "spring"
A.Season.SUMMER -> "summer"
A.Default.Season.WINTER -> "winter"
A.Default.Season.SPRING -> "spring"
A.Default.Season.SUMMER -> "summer"
else -> "other"
}
}
fun box() : String {
assertEquals("winter", foo(A.Season.WINTER))
assertEquals("spring", foo(A.Season.SPRING))
assertEquals("summer", foo(A.Season.SUMMER))
assertEquals("other", foo(A.Season.AUTUMN))
assertEquals("winter", foo(A.Default.Season.WINTER))
assertEquals("spring", foo(A.Default.Season.SPRING))
assertEquals("summer", foo(A.Default.Season.SUMMER))
assertEquals("other", foo(A.Default.Season.AUTUMN))
return "OK"
}
@@ -2,7 +2,7 @@ package foo
fun test() {
A.d
A.<!INVISIBLE_MEMBER!>f<!>
A.Default.<!INVISIBLE_MEMBER!>f<!>
B.<!INVISIBLE_MEMBER!>D<!>
<!INVISIBLE_MEMBER!>CCC<!>
CCC.<!INVISIBLE_MEMBER!>classObjectVar<!>
@@ -0,0 +1,51 @@
package a
class A {
class Nested
inner class Inner
class object {
class Nested2
val c: Int = 1
object Obj2 {
val c: Int = 1
}
}
object Obj
}
object O {
class A
object O
}
fun f() {
A.c
A.hashCode()
A().<!NO_CLASS_OBJECT, NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>Nested<!>
A.Nested()
A().Inner()
A.Default.<!UNRESOLVED_REFERENCE!>Nested<!>
A.Default.<!UNRESOLVED_REFERENCE!>Inner<!>
A.<!UNRESOLVED_REFERENCE!>Inner<!>
A.Default.c
A.Default.Obj2
A.Default.Obj2.c
A.Default.Nested2()
A.Default.c
A.Obj
A.Default.Obj2
A.<!UNRESOLVED_REFERENCE!>Obj2<!>
A.<!UNRESOLVED_REFERENCE!>Obj2<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>c<!>
A.<!UNRESOLVED_REFERENCE!>Nested2<!>
O.O
O.A()
}
@@ -0,0 +1,77 @@
package
package a {
internal fun f(): kotlin.Unit
internal final class A {
public constructor A()
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 class object Default {
private constructor Default()
internal final val c: kotlin.Int = 1
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 Nested2 {
public constructor Nested2()
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 object Obj2 {
private constructor Obj2()
internal final val c: kotlin.Int = 1
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 inner class Inner {
public constructor Inner()
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 Nested {
public constructor Nested()
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 object Obj {
private constructor Obj()
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 object O {
private constructor O()
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 A {
public constructor A()
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 object O {
private constructor O()
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
}
}
}
@@ -0,0 +1,49 @@
package a
enum class C {
E1 E2 E3 {
object O_O
fun b() {
O_O
}
class G
}
E4 {
fun c() {
//TODO: this is a bug
this.<!UNRESOLVED_REFERENCE!>B<!>()
C.A()
A()
//TODO: this is a bug
this.<!UNRESOLVED_REFERENCE!>A<!>()
}
}
class A
inner class B
object O {
object InO
}
}
fun f() {
C.E1.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE, FUNCTION_CALL_EXPECTED!>A<!>
C.E1.<!NESTED_CLASS_ACCESSED_VIA_INSTANCE_REFERENCE!>A<!>()
C.E2.B()
C.E2.<!UNRESOLVED_REFERENCE!>O<!>
C.E3.<!UNRESOLVED_REFERENCE!>O<!>.<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>InO<!>
C.O
C.O.InO
C.A()
C.<!UNRESOLVED_REFERENCE!>B<!>()
C.E3.<!UNRESOLVED_REFERENCE!>O_O<!>
C.E3.<!UNRESOLVED_REFERENCE!>G<!>()
}
@@ -0,0 +1,103 @@
package
package a {
internal fun f(): kotlin.Unit
internal final enum class C : kotlin.Enum<a.C> {
public enum entry E1 : a.C {
private constructor E1()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: a.C): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public enum entry E2 : a.C {
private constructor E2()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: a.C): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public enum entry E3 : a.C {
private constructor E3()
internal final fun b(): kotlin.Unit
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: a.C): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
internal final class G {
public constructor G()
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 object O_O {
private constructor O_O()
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
}
}
public enum entry E4 : a.C {
private constructor E4()
internal final fun c(): kotlin.Unit
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: a.C): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
private constructor C()
public final override /*1*/ /*fake_override*/ fun compareTo(/*0*/ other: a.C): kotlin.Int
public final override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public final override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public final override /*1*/ /*fake_override*/ fun name(): kotlin.String
public final override /*1*/ /*fake_override*/ fun ordinal(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
internal final class A {
public constructor A()
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 inner 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
}
internal object O {
private constructor O()
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 object InO {
private constructor InO()
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
}
}
// Static members
public final /*synthesized*/ fun valueOf(/*0*/ value: kotlin.String): a.C
public final /*synthesized*/ fun values(): kotlin.Array<a.C>
}
}
@@ -10,6 +10,6 @@ class A {
}
}
fun f1() = A.B.<!INVISIBLE_MEMBER!>C<!>
fun f1() = A.Default.B.<!INVISIBLE_MEMBER!>C<!>
fun f2() = A.B.C.<!INVISIBLE_MEMBER!>foo<!>()
fun f2() = A.Default.B.C.<!INVISIBLE_MEMBER!>foo<!>()
@@ -21,10 +21,10 @@ public class M1 {
public val a: A = A()
public val b: A.B = A.B()
public val c: A.C = A.C
public val d: A.Default.D = A.D()
public val e: A.Default.D.E = A.D.E
public val d: A.Default.D = A.Default.D()
public val e: A.Default.D.E = A.Default.D.E
public val f: A.F = A().F()
public val g: A.Default.G = A.G()
public val g: A.Default.G = A.Default.G()
}
// MODULE: m2
@@ -1,6 +1,6 @@
//no nested class access via instance reference error
fun test() {
A.f(<!TYPE_MISMATCH!>""<!>)
A.Default.f(<!TYPE_MISMATCH!>""<!>)
}
class A() {
@@ -1540,6 +1540,18 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("InnerClassAccessThroughClassObject.kt")
public void testInnerClassAccessThroughClassObject() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughClassObject.kt");
doTest(fileName);
}
@TestMetadata("InnerClassAccessThroughEnum.kt")
public void testInnerClassAccessThroughEnum() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/classObjects/InnerClassAccessThroughEnum.kt");
doTest(fileName);
}
@TestMetadata("InnerClassClassObject.kt")
public void testInnerClassClassObject() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/classObjects/InnerClassClassObject.kt");
@@ -0,0 +1,27 @@
class A {
class Nested
inner class Inner
class object {
class Nested2
val c: Int = 1
object Obj2
fun foo() {
}
}
object Obj
}
fun some() {
A.<caret>
}
// EXIST: Nested
// EXIST: Default
// EXIST: c
// EXIST: foo
// EXIST: Obj
// ABSENT: Nested2
// ABSENT: Obj2
@@ -0,0 +1,27 @@
class A {
class Nested
inner class Inner
class object Named {
class Nested2
val c: Int = 1
object Obj2
fun foo() {
}
}
object Obj
}
fun some() {
A.<caret>
}
// EXIST: Nested
// EXIST: Named
// EXIST: c
// EXIST: foo
// EXIST: Obj
// ABSENT: Nested2
// ABSENT: Obj2
@@ -0,0 +1,27 @@
class A {
class Nested
inner class Inner
class object Named {
class Nested2
val c: Int = 1
object Obj2
fun foo() {
}
}
object Obj
}
fun some() {
A.Named.<caret>
}
// EXIST: Nested2
// EXIST: c
// EXIST: foo
// EXIST: Obj2
// ABSENT: Nested
// ABSENT: Named
// ABSENT: Obj
@@ -5,5 +5,5 @@ class Test {
}
fun test() {
Test.S<caret>
Test.Default.S<caret>
}
@@ -5,5 +5,5 @@ class Test {
}
fun test() {
Test.Some<caret>
Test.Default.Some
}
@@ -7,5 +7,5 @@ class Test {
}
fun test() {
a.Test.S<caret>
a.Test.Default.S<caret>
}
@@ -7,5 +7,5 @@ class Test {
}
fun test() {
a.Test.Some<caret>
a.Test.Default.Some<caret>
}
@@ -613,6 +613,24 @@ public class JSBasicCompletionTestGenerated extends AbstractJSBasicCompletionTes
doTest(fileName);
}
@TestMetadata("NestedClassesOnClassWithDefaultObject.kt")
public void testNestedClassesOnClassWithDefaultObject() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/NestedClassesOnClassWithDefaultObject.kt");
doTest(fileName);
}
@TestMetadata("NestedClassesOnClassWithNamedDefaultObject.kt")
public void testNestedClassesOnClassWithNamedDefaultObject() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/NestedClassesOnClassWithNamedDefaultObject.kt");
doTest(fileName);
}
@TestMetadata("NestedClassesOnDefaultObjectLiteral.kt")
public void testNestedClassesOnDefaultObjectLiteral() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/NestedClassesOnDefaultObjectLiteral.kt");
doTest(fileName);
}
@TestMetadata("NoAutoInsertionOfNotImported.kt")
public void testNoAutoInsertionOfNotImported() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/NoAutoInsertionOfNotImported.kt");
@@ -613,6 +613,24 @@ public class JvmBasicCompletionTestGenerated extends AbstractJvmBasicCompletionT
doTest(fileName);
}
@TestMetadata("NestedClassesOnClassWithDefaultObject.kt")
public void testNestedClassesOnClassWithDefaultObject() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/NestedClassesOnClassWithDefaultObject.kt");
doTest(fileName);
}
@TestMetadata("NestedClassesOnClassWithNamedDefaultObject.kt")
public void testNestedClassesOnClassWithNamedDefaultObject() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/NestedClassesOnClassWithNamedDefaultObject.kt");
doTest(fileName);
}
@TestMetadata("NestedClassesOnDefaultObjectLiteral.kt")
public void testNestedClassesOnDefaultObjectLiteral() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/NestedClassesOnDefaultObjectLiteral.kt");
doTest(fileName);
}
@TestMetadata("NoAutoInsertionOfNotImported.kt")
public void testNoAutoInsertionOfNotImported() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/completion/basic/common/NoAutoInsertionOfNotImported.kt");