4c96495eef
^KT-55171 Fixed
12 lines
400 B
Kotlin
Vendored
12 lines
400 B
Kotlin
Vendored
// LANGUAGE: +ContractSyntaxV2
|
|
import kotlin.contracts.*
|
|
|
|
fun calculateNumber(block: () -> Int): Int contract <!UNSUPPORTED!>[
|
|
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
|
]<!> = block()
|
|
|
|
fun <R> calculateResult(num: Int?, calculate: (Int?) -> R): R contract <!UNSUPPORTED!>[
|
|
callsInPlace(calculate, InvocationKind.EXACTLY_ONCE),
|
|
returns() implies (num != null)
|
|
]<!> = calculate(num)
|