During inlining, remove POP instructions popping inlined lambdas
In cases like KT-17384, where 'break' or 'continue' happens in an argument to an inlined lambda call, fix-stack transformation sees corresponding ALOAD for lambda, and inserts corresponding POP instruction before jump. However, this ALOAD is later removed during inlining. So, we should also remove the related POP instructions.
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
fun returnNullable(): String? = null
|
||||
|
||||
inline fun Array<String>.matchAll(fn: (String) -> Unit) {
|
||||
for (string in this) {
|
||||
fn(returnNullable() ?: continue)
|
||||
}
|
||||
}
|
||||
|
||||
fun Array<String>.matchAll2(fn: (String) -> Unit) {
|
||||
matchAll(fn)
|
||||
}
|
||||
|
||||
inline fun Array<String>.matchAll3(crossinline fn: (String) -> Unit) {
|
||||
matchAll2 { fn(it) }
|
||||
}
|
||||
|
||||
fun test(a: Array<String>) {
|
||||
a.matchAll {}
|
||||
a.matchAll2 {}
|
||||
a.matchAll3 {}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
test(arrayOf(""))
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user