Files
kotlin-fork/compiler/testData/codegen/box/invokedynamic/sam/inline/inlineLambda1.kt
T
Dmitry Petrov f0abd8bc68 JVM_IR indy-SAM conversions: prohibit in crossinline lambdas
KT-44278 KT-26060 KT-42621
2021-01-29 12:59:47 +03:00

27 lines
393 B
Kotlin
Vendored

// TARGET_BACKEND: JVM
// JVM_TARGET: 1.8
// SAM_CONVERSIONS: INDY
// WITH_RUNTIME
// FILE: 1.kt
fun interface IFoo {
fun foo()
}
fun foo(iFoo: IFoo) = iFoo.foo()
inline fun twice(fn: () -> Unit) {
fn()
fn()
}
// FILE: 2.kt
fun box(): String {
var test = 0
twice {
foo { test += 1 }
}
if (test != 2)
return "Failed: test=$test"
return "OK"
}