[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.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// IGNORE_BACKEND: JS, JS_IR
|
||||
|
||||
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" })
|
||||
}
|
||||
Reference in New Issue
Block a user