Effects: add cfg-tests on inlined lambdas

==========
Introduction of Effect System: 15/18
This commit is contained in:
Dmitry Savvinov
2017-10-03 15:02:50 +03:00
parent a986999226
commit f487525a1d
48 changed files with 6677 additions and 860 deletions
@@ -0,0 +1,21 @@
// LANGUAGE_VERSION: 1.3
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)
}