Files
kotlin-fork/compiler/testData/codegen/box/contracts/kt47168.kt
T
2021-09-10 16:29:16 +03:00

17 lines
383 B
Kotlin
Vendored

// !OPT_IN: kotlin.contracts.ExperimentalContracts
// IGNORE_BACKEND: NATIVE
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)
}