IR: keep capture sets the same when copying objects for tailrec funs

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.
This commit is contained in:
pyos
2021-09-21 12:16:51 +02:00
committed by Mikhael Bogdanov
parent a4d1358e57
commit cb505d1101
10 changed files with 67 additions and 17 deletions
@@ -0,0 +1,9 @@
// 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"