JVM_IR: create temporaries for complex SAM conversion arguments
To avoid bytecode sequences like
new _1Kt$sam$i$java_lang_Runnable$0
dup
new _1Kt$f$1
dup
invokespecial _1Kt$f$1.<init>()V
invokespecial _1Kt$sam$i$java_lang_Runnable$0.<init>(...)V
as the different order of `new` and `<init>` confuses the inliner.
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: 1.kt
|
||||
package test
|
||||
|
||||
inline fun f(crossinline g: () -> Unit) = Runnable(object : () -> Unit {
|
||||
override fun invoke() = g()
|
||||
})
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
var result = "FAIL"
|
||||
f { result = "OK" }.run()
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user