Files
kotlin-fork/compiler/testData/codegen/box/contracts/exactlyOnceNotInline.kt
T
Mikhail Zarechenskiy 3cf77d29b5 Unmute test for NI
It was fixed in 7f6c03c9
2020-02-17 10:29:45 +03:00

21 lines
388 B
Kotlin
Vendored

// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: NATIVE
import kotlin.contracts.*
public fun myrun(block: () -> Unit) {
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
block()
}
fun box(): String {
val x: Long
myrun {
x = 1L
}
return if (x != 1L) "FAIL" else "OK"
}