JVM_IR KT-45581 generate H_INVOKEINTERFACE for interface method handles

This commit is contained in:
Dmitry Petrov
2021-03-19 17:20:48 +03:00
parent 73d4fa65ea
commit 9e30ddd12e
7 changed files with 87 additions and 1 deletions
@@ -0,0 +1,18 @@
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// SAM_CONVERSIONS: INDY
// FILE: interfaceMemberRef.kt
interface IFoo {
fun foo(): String
}
class C(val v: String) : IFoo {
override fun foo(): String = v
}
fun box() = Sam(IFoo::foo).get(C("OK"))
// FILE: Sam.java
public interface Sam {
String get(IFoo c);
}
@@ -0,0 +1,20 @@
// TARGET_BACKEND: JVM
// WITH_RUNTIME
// JVM_TARGET: 1.8
// SAM_CONVERSIONS: INDY
// FULL_JDK
// IGNORE_DEXING
// ^ D8 fails with AssertionError, possible reason: only Kotlin output files are passed to D8
// FILE: kt45581.kt
fun box(): String = J.bar(emptySet<String>()::contains)
// FILE: J.java
import java.util.function.Predicate;
public class J {
public static String bar(Predicate<String> predicate) {
return "OK";
}
}