Traverse multiple store-load chains for inlined lambda parameters
When a try-catch expression is passed as an argument to the inline lambda parameter, lambda variable on stack is spilled and restored in several different locations (1 for try-block, 1 for each catch-blocks). So it's possible that lambda to be invoked comes from multiple loads, all of which should have the same "root" lambda parameter.
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
fun zap(s: String) = s
|
||||
|
||||
inline fun tryZap(string: String, fn: (String) -> String) =
|
||||
fn(
|
||||
try {
|
||||
try {
|
||||
zap(string)
|
||||
}
|
||||
catch (e: Exception) { "" }
|
||||
} catch (e: Exception) { "" }
|
||||
)
|
||||
|
||||
fun box(): String = tryZap("OK") { it }
|
||||
Reference in New Issue
Block a user