mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 15:53:46 +00:00
25 lines
647 B
Kotlin
Vendored
25 lines
647 B
Kotlin
Vendored
// !LANGUAGE: +AllowContractsForCustomFunctions +ReadDeserializedContracts
|
|
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
|
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
|
|
|
package test
|
|
|
|
import kotlin.contracts.*
|
|
|
|
fun <X, Y, Z, R> callsEffectWithKind(block: (X, Y, Z) -> R) {
|
|
contract {
|
|
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
|
|
}
|
|
}
|
|
|
|
inline fun callsEffectImplicitUnknown(x: Int, y: Int, block: () -> Unit) {
|
|
contract {
|
|
callsInPlace(block)
|
|
}
|
|
}
|
|
|
|
inline fun callsEffectExplicitUnknown(x: Int, block: () -> Unit) {
|
|
contract {
|
|
callsInPlace(block, InvocationKind.UNKNOWN)
|
|
}
|
|
} |