blob: 8c6ce6d6700cabdc148e501b645c8d9aa55a6857 [file]
// LANGUAGE: +NameBasedDestructuring +DeprecateNameMismatchInShortDestructuringWithParentheses +EnableNameBasedDestructuringShortForm
// OPT_IN: kotlin.contracts.ExperimentalContracts
// WITH_STDLIB
import kotlin.contracts.*
fun runOnce(action: () -> Unit) {
contract {
callsInPlace(action, InvocationKind.EXACTLY_ONCE)
}
action()
}
fun ok(): String {
val res: String
val [o, _] = "OK" to "FAIL"
runOnce {
res = o
}
return res
}
fun box(): String {
return ok()
}