JVM_IR KT-45868 look for parent for delegating lambda in scope stack

This commit is contained in:
Dmitry Petrov
2021-04-08 19:46:53 +03:00
committed by TeamCityServer
parent c2a5b0b6e2
commit ed88aa43a4
7 changed files with 82 additions and 11 deletions
@@ -0,0 +1,33 @@
// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// SAM_CONVERSIONS: INDY
// FILE: insideInitBlock.kt
class Outer {
class Nested {
class PredicateSource(val condition: Boolean)
val value: String
init {
value = Test.test(PredicateSource::condition, PredicateSource(true))
}
}
}
fun box() = Outer.Nested().value
// FILE: Test.java
public class Test {
public static <T> String test(Predicate<T> predicate, T value) {
if (predicate.getResult(value) == true)
return "OK";
else
return "Failed";
}
}
// FILE: Predicate.java
public interface Predicate<T> {
Boolean getResult(T value);
}