KTIJ-25530 [Analysis API] Correctly collect references to implicitly dispatched callables in Import Optimizer

N.B. There is a case which is not covered ATM due to the bug in the
compiler, see KT-58980

^KTIJ-25530 Fixed
This commit is contained in:
Roman Golyshev
2023-05-17 16:10:49 +02:00
committed by teamcity
parent 060f3fa7c4
commit adab552928
7 changed files with 155 additions and 18 deletions
@@ -0,0 +1,6 @@
test.Foo.callableReference
test.Foo.extFuncFromBase
test.Foo.extPropFromBase
test.Foo.funcFromBase
test.Foo.invoke
test.Foo.propFromBase
@@ -0,0 +1,36 @@
package test
import test.Foo.funcFromBase
import test.Foo.extFuncFromBase
import test.Foo.propFromBase
import test.Foo.extPropFromBase
import test.Foo.invoke
import test.Foo.callableReference
open class Base {
fun funcFromBase() {}
fun Int.extFuncFromBase() {}
val propFromBase: Int = 0
val Int.extPropFromBase: Int get() = 0
operator fun String.invoke() {}
fun callableReference() {}
}
object Foo : Base()
fun usage() {
with(Foo) {
funcFromBase()
10.extFuncFromBase()
propFromBase
10.extPropFromBase
"hello"()
::callableReference
}
}
@@ -0,0 +1,34 @@
package test
import test.Foo.funcFromBase
import test.Foo.extFuncFromBase
import test.Foo.propFromBase
import test.Foo.extPropFromBase
import test.Foo.invoke
import test.Foo.callableReference
open class Base {
fun funcFromBase() {}
fun Int.extFuncFromBase() {}
val propFromBase: Int = 0
val Int.extPropFromBase: Int get() = 0
operator fun String.invoke() {}
fun callableReference() {}
}
object Foo : Base()
fun usage() {
funcFromBase()
10.extFuncFromBase()
propFromBase
10.extPropFromBase
"hello"()
::callableReference
}