mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
23 lines
516 B
Kotlin
Vendored
23 lines
516 B
Kotlin
Vendored
// !LANGUAGE: +AllowContractsForCustomFunctions +ReadDeserializedContracts
|
|
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
|
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
|
|
|
package test
|
|
|
|
import kotlin.contracts.*
|
|
|
|
|
|
fun orSequence(x: Any?, y: Any?, b: Boolean) {
|
|
contract {
|
|
returns() implies (x is String || y is Int || !b)
|
|
}
|
|
}
|
|
|
|
class A
|
|
class B
|
|
|
|
fun andSequence(x: Any?, y: Any?, b:Boolean) {
|
|
contract {
|
|
returns() implies (x is A && x is B && ((y is A) && b))
|
|
}
|
|
} |