[AA] Fix processing of member invoke functions from objects in reference shortening and import optimization

Correctly handle `KtDotQualifedExpression`s with function calls as
selectors (like `foo.Bar()`). Without such handling, processing of
member invoke calls on objects was broken both
for reference shortener (causing KTIJ-26695)
and import optimizer (causing KTIJ-23407)

Also, to fix KTIJ-23407, do not ignore qualifiers with
`ImplicitInvokeCall` fake source

^KTIJ-26695 Fixed
^KTIJ-23407 Fixed
This commit is contained in:
Roman Golyshev
2023-08-17 21:26:52 +02:00
committed by teamcity
parent 4958196c51
commit 52d6ac5ed0
13 changed files with 108 additions and 4 deletions
@@ -0,0 +1,15 @@
// FILE: main.kt
package test
import dependency.MyObject
fun usage() {
dependency.MyObject()
}
// FILE: dependency.kt
package dependency
object MyObject {
operator fun invoke() {}
}
@@ -0,0 +1,15 @@
// FILE: main.kt
package test
import dependency.MyObject
fun usage() {
MyObject()
}
// FILE: dependency.kt
package dependency
object MyObject {
operator fun invoke() {}
}
@@ -0,0 +1,14 @@
// FILE: main.kt
package test
fun test() {
<expr>dependency.Foo()</expr>
}
// FILE: dependency.kt
package dependency
object Foo {
operator fun invoke() {}
}
@@ -0,0 +1,7 @@
Before shortening: dependency.Foo()
with DO_NOT_SHORTEN:
with SHORTEN_IF_ALREADY_IMPORTED:
with SHORTEN_AND_IMPORT:
[qualifier] dependency.Foo()
with SHORTEN_AND_STAR_IMPORT:
[qualifier] dependency.Foo()