Files
kotlin-fork/compiler/testData/codegen/boxInline/anonymousObject/sam/anonymousObjectToSam.kt
T
pyos 42f75b3247 JVM_IR: have SAM wrapper constructors accept FunctionN
Otherwise, the cached instances cannot be reused for different wrapped
types. Also, if the wrapped type is regenerated during inlining, the
inliner would produce a call to a nonexistent constructor that takes the
regenerated type as an argument.
2019-11-06 15:54:40 +01:00

16 lines
260 B
Kotlin
Vendored

// 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
}