ee8702d21e
See changes in e2606b72bdbec2fea567d4127197707869eb801e
16 lines
388 B
Kotlin
Vendored
16 lines
388 B
Kotlin
Vendored
// !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect
|
|
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
|
|
|
import kotlin.contracts.*
|
|
|
|
inline fun myRun(block: () -> Unit): Unit {
|
|
contract {
|
|
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
|
}
|
|
block()
|
|
}
|
|
|
|
fun test() {
|
|
myRun { throw java.lang.IllegalArgumentException() }
|
|
val x: Int = 42
|
|
} |