JVM_IR KT-45868 look for parent for delegating lambda in scope stack
This commit is contained in:
committed by
TeamCityServer
parent
c2a5b0b6e2
commit
ed88aa43a4
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user