FIR IDE: handle reference to package and outer classes

For a qualified name like `foo.bar.Outer.Inner`, FIR represents it as
one atomic FIR element. Hence, to properly resolve these names to the
corresponding package and class, we need some additional work.
This commit is contained in:
Tianyu Geng
2021-06-23 18:29:39 -07:00
committed by Ilya Kirillov
parent a537074e1e
commit 84f8d4d315
23 changed files with 332 additions and 58 deletions
@@ -1,3 +1,4 @@
// FIR_COMPARISON
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtObjectDeclaration
// OPTIONS: usages
class Foo {
@@ -1,3 +1,4 @@
// FIR_COMPARISON
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtObjectDeclaration
// OPTIONS: usages
class Foo {
@@ -1,3 +1,4 @@
// FIR_COMPARISON
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtObjectDeclaration
// OPTIONS: usages
fun foo(): Any {
@@ -1 +1 @@
Value read 6 return Bar
Value read 7 return Bar
@@ -1,3 +1,4 @@
// FIR_COMPARISON
// PSI_ELEMENT: org.jetbrains.kotlin.psi.KtObjectDeclaration
// OPTIONS: usages
fun foo(): Any {
@@ -1 +1 @@
Value read 7 return Bar
Value read 8 return Bar
@@ -1,5 +1,3 @@
// IGNORE_FIR
package test
class Conflict
@@ -1,3 +1,4 @@
// IGNORE_FIR
package test
object Conflict
@@ -0,0 +1,13 @@
package foo.bar.baz
class AA {
class BB {
companion object
}
}
fun test() {
val b = f<caret>oo.bar.baz.AA.BB
}
// REF: foo
@@ -0,0 +1,14 @@
// IGNORE_FIR
package foo.bar.baz
class AA {
class BB {
companion object
}
}
fun test() {
val b = foo.bar.baz.AA.B<caret>B
}
// REF: companion object of (in foo.bar.baz.AA).BB
@@ -0,0 +1,13 @@
package foo.bar.baz
class AA {
class BB {
companion object
}
}
fun test() {
val b = foo.bar.baz.A<caret>A.BB
}
// REF: (foo.bar.baz).AA
@@ -0,0 +1,13 @@
package foo.bar.baz
class AA {
class BB {
companion object
}
}
fun test() {
val b = foo.bar.b<caret>az.AA.BB
}
// REF: baz
@@ -0,0 +1,11 @@
package foo.bar.baz
class AA {
fun foo() {}
}
fun test() {
A<caret>A::foo
}
// REF: (foo.bar.baz).AA
@@ -0,0 +1,14 @@
// IGNORE_FE10
package foo.bar.baz
class AA {
companion object {
fun foo() {}
}
}
fun test() {
A<caret>A::foo // FE1.0 won't resolve this
}
// REF: companion object of (foo.bar.baz).AA
@@ -0,0 +1,14 @@
// IGNORE_FE10
package foo.bar.baz
class AA {
companion object
}
fun AA.Companion.foo() {}
fun test() {
A<caret>A::foo // FE1.0 won't resolve this
}
// REF: companion object of (foo.bar.baz).AA