9dd8eda1c9
Library methods such as 'listOf' are resolved to have the package fragments as their parents, but JVM expects their containing file classes as parents. This fix generates those file classes and uses them as parent replacements for such library methods.
32 lines
542 B
Kotlin
Vendored
32 lines
542 B
Kotlin
Vendored
// TARGET_BACKEND: JVM
|
|
|
|
// WITH_REFLECT
|
|
// FILE: J.java
|
|
|
|
import kotlin.jvm.functions.Function2;
|
|
import kotlin.reflect.KFunction;
|
|
|
|
public class J {
|
|
public static String go() {
|
|
KFunction<String> fun = K.Companion.getRef();
|
|
Object result = ((Function2) fun).invoke(new K(), "KO");
|
|
return (String) result;
|
|
}
|
|
}
|
|
|
|
// FILE: K.kt
|
|
|
|
class K {
|
|
fun reverse(s: String): String {
|
|
return s.reversed()
|
|
}
|
|
|
|
companion object {
|
|
fun getRef() = K::reverse
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
return J.go()
|
|
}
|