blob: 3057f4e64b6e73312a660da9a2b80572e4e1fe11 [file] [log] [blame]
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
// IGNORE_BACKEND: NATIVE
// WITH_RUNTIME
import kotlin.contracts.*
fun runOnce(action: () -> Unit) {
contract {
callsInPlace(action, InvocationKind.EXACTLY_ONCE)
}
action()
}
fun ok(): String {
val res: String
when (val o = "OK") {
else -> runOnce {
res = o
}
}
return res
}
fun box(): String {
return ok()
}