63b13027df
Except all, it's also useful to use one class of language version settings for compiler tests to configure it specially for tests
21 lines
405 B
Kotlin
Vendored
21 lines
405 B
Kotlin
Vendored
// !LANGUAGE: +CallsInPlaceEffect
|
|
|
|
import kotlin.internal.contracts.*
|
|
|
|
inline fun myRun(block: () -> Unit): Unit {
|
|
contract {
|
|
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
|
}
|
|
return block()
|
|
}
|
|
|
|
inline fun unknownRun(block: () -> Unit) { block() }
|
|
|
|
fun foo() {
|
|
val x: Int
|
|
myRun {
|
|
unknownRun { println("shouldn't change anything") }
|
|
x = 42
|
|
}
|
|
println(x)
|
|
} |