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:
+6
@@ -0,0 +1,6 @@
|
||||
test.Foo.callableReference
|
||||
test.Foo.extFuncFromBase
|
||||
test.Foo.extPropFromBase
|
||||
test.Foo.funcFromBase
|
||||
test.Foo.invoke
|
||||
test.Foo.propFromBase
|
||||
+36
@@ -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
|
||||
}
|
||||
}
|
||||
+34
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user