Files
kotlin-fork/compiler/testData/ir/irText/declarations/parameters/useNextParamInLambda.kt
T
Mads Ager 92cf521e11 [IR] Deal with forward references in default argument lambdas.
Rely on the frontend weeding out cases that are not supported.

In psi2ir, introduce all the parameters before processing default
values.

Change the DefaultArgumentStubGenerator to generate code that
matches the behavior of the current backend.
2019-10-10 09:00:51 +02:00

15 lines
263 B
Kotlin
Vendored

fun f(
f1: () -> String = { f2() },
f2: () -> String = { "FAIL" }
): String = f1()
fun box(): String {
var result = "fail"
try {
f()
} catch (e : Exception) {
result = "OK"
}
return f(f2 = { "O" }) + f(f1 = { "K" })
}