Normalize local returns before other inlining transformations
Local returns normalization can generate POP instructions. These POP instructions can drop functional parameters, as in KT-17590, and should be processed in markPlacesForInlineAndRemoveInlinable just as other POP instructions. KT-17590 conditional return in inline function parameter argument causes compilation exception
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
fun zap(s: String): String? = s
|
||||
|
||||
inline fun tryZap(s: String, fn: (String) -> String): String {
|
||||
return fn(zap(s) ?: return "null")
|
||||
}
|
||||
|
||||
fun box() = tryZap("OK") { it }
|
||||
@@ -0,0 +1,10 @@
|
||||
fun foo(x: Any?, y: Any?) = 0L
|
||||
|
||||
inline fun test(value: Any?): Long {
|
||||
return foo(null, value ?: return 1L)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val t = test(null)
|
||||
return if (t == 1L) "OK" else "fail: t=$t"
|
||||
}
|
||||
Reference in New Issue
Block a user