Files
kotlin-fork/compiler/testData/codegen/box/contracts/kt47168.kt
T
2023-12-26 10:18:19 +00:00

19 lines
391 B
Kotlin
Vendored

// !OPT_IN: kotlin.contracts.ExperimentalContracts
// JVM_ABI_K1_K2_DIFF: KT-62464
import kotlin.contracts.*
inline fun foo(x: () -> String, y: () -> String): String {
contract {
callsInPlace(x, InvocationKind.EXACTLY_ONCE)
callsInPlace(y, InvocationKind.EXACTLY_ONCE)
}
return x() + y()
}
fun box(): String {
val y = { "K" }
return foo({ "O" }, y)
}