Files
kotlin-fork/compiler/testData/codegen/boxInline/complexStack/spillConstructorArgumentsAndInlineLambdaParameter.kt
T
Andrey Zinovyev 06b23d5937 [FIR] Improve the control flow graph around try expressions
1. throw goes to catches instead of main exist block
2. return goes via finally (single level only supported atm)
3. collect non-direct return to retrieve all return expressions easier
2021-08-06 11:49:34 +03:00

23 lines
428 B
Kotlin
Vendored

// FILE: 1.kt
class A(val s: String)
inline fun inlineMe(limit: Int, c: (String) -> String): A {
var index = 0
var res: A?
while (true) {
res = A(c(try {
throw IllegalStateException("")
} catch (ignored: Throwable) {
"OK"
})
)
if (index++ == limit) break
}
return res!!
}
// FILE: 2.kt
fun box(): String {
return inlineMe(1) { "OK" }.s
}