cb505d1101
tailrec f(x: () -> T = { y }, y: T = ...) = f()
-- at the call we know that in `x` the observed value of `y` is `null`,
but the constructor should still have a single parameter.
10 lines
224 B
Kotlin
Vendored
10 lines
224 B
Kotlin
Vendored
// IGNORE_BACKEND: JVM
|
|
// IGNORE_BACKEND_FIR: JVM_IR
|
|
tailrec fun foo(x: () -> String? = { y }, y: String = "fail"): String? {
|
|
if (y == "start")
|
|
return foo()
|
|
return x()
|
|
}
|
|
|
|
fun box() = foo(y = "start") ?: "OK"
|