JVM_IR: do not use invokedynamic for inline fun references

This commit is contained in:
pyos
2021-06-01 11:52:30 +02:00
committed by Dmitry Petrov
parent 5d53d34d85
commit 4128d27510
2 changed files with 18 additions and 8 deletions
@@ -10,11 +10,17 @@
import java.util.function.Consumer
fun call(c: Consumer<String>) {
}
inline fun <reified T> f(x: T) =
println("${T::class.simpleName}($x)")
private inline fun g(x: String) = println(x)
fun call(c: Consumer<String>) = c.accept("")
fun box(): String {
// println is inline only and therefore we cannot use invoke-dynamic to target it.
call(::println)
call(::println) // `println` is `@InlineOnly`
call(::f) // `f` has a reified type parameter and thus isn't callable directly
val obj = { call(::g) } // `g` is inaccessible in this scope
obj()
return "OK"
}