Track lookups for nested/inner Java classes

This commit is contained in:
Zalim Bashorov
2015-11-02 20:21:18 +03:00
parent 87f32ef07b
commit a6855116b8
6 changed files with 33 additions and 2 deletions
@@ -615,7 +615,10 @@ public class LazyJavaClassMemberScope(
override fun getDispatchReceiverParameter(): ReceiverParameterDescriptor? =
DescriptorUtils.getDispatchReceiverParameterIfNeeded(getContainingDeclaration())
override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? = nestedClasses(name)
override fun getClassifier(name: Name, location: LookupLocation): ClassifierDescriptor? {
recordLookup(name, location)
return nestedClasses(name)
}
override fun getClassNames(kindFilter: DescriptorKindFilter, nameFilter: (Name) -> Boolean): Collection<Name>
= nestedClassIndex().keySet() + enumEntryIndex().keySet()
@@ -31,6 +31,8 @@ import bar.*
}
}
inner class C
companion object {
val a = 1
fun baz() {}
@@ -44,6 +46,8 @@ import bar.*
/*p:foo*/interface I {
var a: /*c:foo.I p:foo*/Int
fun foo()
class NI
}
/*p:foo*/object Obj : /*p:foo*/I {
@@ -31,3 +31,16 @@ import bar.*
/*p:foo p:bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io*/E./*c:foo.E*/X./*c:foo.E*/a
/*p:foo p:bar p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io*/E./*c:foo.E*/Y./*c:foo.E*/foo()
}
/*p:foo*/fun classifiers(
a: /*p:foo*/A,
ab: /*p:foo*/A./*c:foo.A*/B,
ac: /*p:foo*/A./*c:foo.A*/C,
abCo: /*p:foo*/A./*c:foo.A*/B./*c:foo.A.B*/CO,
aCompanion: /*p:foo*/A./*c:foo.A*/Companion,
aO: /*p:foo*/A./*c:foo.A*/O,
i: /*p:foo*/I,
ni: /*p:foo*/I./*c:foo.I*/NI,
obj: /*p:foo*/Obj,
e: /*p:foo*/E
) {}
@@ -3,3 +3,4 @@ src/usages.kt
End of files
COMPILATION FAILED
Unresolved reference: IS
Unresolved reference: IS
@@ -33,3 +33,13 @@ import baz.*
/*p:foo p:baz p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io*/E./*c:baz.E*/F./*c:baz.E*/field
/*p:foo p:baz p:java.lang p:kotlin p:kotlin.annotation p:kotlin.jvm p:kotlin.io*/E./*c:baz.E*/S./*c:baz.E*/func()
}
/*p:foo*/fun classifiers(
c: C,
b: C./*c:bar.C*/B,
s: C./*c:bar.C*/S,
cis: C./*c:bar.C*/IS,
i: /*p:foo*/I,
iis: /*p:foo*/I./*c:foo.I*/IS,
e: /*p:foo p:baz*/E
) {}
@@ -4,5 +4,5 @@ import /*p:<root>*/JavaClass
/*p:foo*/class KotlinClass : JavaClass() {
override fun getFoo() = 2
fun setFoo(i: /*c:foo.KotlinClass p:foo*/Int) {}
fun setFoo(i: /*c:foo.KotlinClass c:JavaClass p:foo*/Int) {}
}