mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-18 08:31:38 +00:00
24 lines
595 B
Kotlin
Vendored
24 lines
595 B
Kotlin
Vendored
// !LANGUAGE: +AllowContractsForCustomFunctions +ReadDeserializedContracts
|
|
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
|
|
|
package test
|
|
|
|
import kotlin.internal.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)
|
|
}
|
|
} |