[Analysis API] add method for implicit companion object reference detection

Add a new method `isImplicitReferenceToCompanion` to determine
if the given reference is an implicit reference to a companion object.

The method is needed for the rename refactoring in IJ.

^KTIJ-25863
This commit is contained in:
Ilya Kirillov
2023-06-22 11:13:14 +02:00
committed by Space Team
parent f5bbf2b4fe
commit 8b0eb0488f
26 changed files with 553 additions and 1 deletions
@@ -0,0 +1,9 @@
class AA {
companion object {
fun x() = 10
}
}
fun main() {
A<caret>A.Companion.x()
}
@@ -0,0 +1,9 @@
class AA {
companion object BB {
fun x() = 10
}
}
fun main() {
A<caret>A.BB.x()
}
@@ -0,0 +1,9 @@
class AA {
companion object {
fun x() = 10
}
}
fun main() {
A<caret>A()
}
@@ -0,0 +1 @@
isImplicitCompanionReference: false
@@ -0,0 +1,10 @@
class AA {
companion object {
operator fun invoke() {}
}
}
fun main() {
A<caret>A()
}
@@ -0,0 +1,9 @@
class AA {
companion object {
fun x() = 10
}
}
fun main() {
AA.Com<caret>panion.x()
}
@@ -0,0 +1,9 @@
class AA {
companion object BB {
fun x() = 10
}
}
fun main() {
AA.B<caret>B.x()
}
@@ -0,0 +1,8 @@
class AA {
companion object {
fun x() = 10
}
}
fun main() {
A<caret>A.x()
}
@@ -0,0 +1,8 @@
class AA {
companion object {
fun x() = 10
}
}
fun main() {
A<caret>A
}