4c96495eef
^KT-55171 Fixed
24 lines
533 B
Kotlin
Vendored
24 lines
533 B
Kotlin
Vendored
// LANGUAGE: +ContractSyntaxV2
|
|
import kotlin.contracts.*
|
|
|
|
fun printStr(str: String?) contract <!UNSUPPORTED!>[
|
|
returns() implies (str != null)
|
|
]<!> {
|
|
require(str != null)
|
|
println(str)
|
|
}
|
|
|
|
fun callExactlyOnce(block: () -> Int) contract <!UNSUPPORTED!>[
|
|
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
|
]<!> {
|
|
val num = block()
|
|
println(num)
|
|
}
|
|
|
|
fun calculateNumber(block: () -> Int): Int contract <!UNSUPPORTED!>[
|
|
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
|
]<!> {
|
|
val num = block()
|
|
return num
|
|
}
|