4a76ea6ecb
This is a hack to work around the fact that type mappings should not be inherited by inlining contexts for lambdas called from anonymous objects. As the lambda can call the inline function again, this could produce a reference to the original object, which is remapped to a new type in the parent context. Unfortunately, there are many redundant `MethodRemapper`s between the lambda and the class file, so simply editing `TypeRemapper` does not work. Hence, this hack. For now. (Issue found by compiling IntelliJ IDEA BTW.)
16 lines
480 B
Kotlin
Vendored
16 lines
480 B
Kotlin
Vendored
// FILE: 1.kt
|
|
// Intentionally in the same package, as objects in other packages are always regenerated.
|
|
|
|
fun f(x: () -> String) = x()
|
|
|
|
inline fun g(crossinline x: () -> String) = f { x() }
|
|
|
|
// FILE: 2.kt
|
|
// _1Kt$g$1 not regenerated because the original already does the same thing (invoking a functional object)
|
|
// \-v
|
|
fun h(x: () -> String) = g { g(x) }
|
|
// /-^
|
|
// _1Kt$g$1 regenerated to inline the lambda
|
|
|
|
fun box() = h { "OK" }
|