JVM_IR wrap function into a proxy if indy SAM-conversion becomes valid

This commit is contained in:
Dmitry Petrov
2021-10-06 18:53:29 +03:00
committed by teamcityserver
parent 9ad62eb1fd
commit 40fe67880b
21 changed files with 583 additions and 66 deletions
@@ -0,0 +1,27 @@
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// SAM_CONVERSIONS: INDY
// WITH_RUNTIME
// FULL_JDK
// CHECK_BYTECODE_TEXT
// JVM_IR_TEMPLATES
// 1 java/lang/invoke/LambdaMetafactory
// FILE: inlineFunWithPrivateMethod.kt
private inline fun g(x: String) = println(x)
fun call(c: Consumer<String>) = c.accept("")
fun box(): String {
val obj = { call(::g) } // `g` is inaccessible in this scope
obj()
return "OK"
}
// FILE: Consumer.java
public interface Consumer<T> {
void accept(T t);
}