mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
22 lines
455 B
Kotlin
Vendored
22 lines
455 B
Kotlin
Vendored
// !LANGUAGE: +AllowContractsForCustomFunctions +ReadDeserializedContracts
|
|
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
|
@file:Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
|
|
|
package test
|
|
|
|
import kotlin.contracts.*
|
|
|
|
class A
|
|
|
|
fun simpleIsInstace(x: Any?) {
|
|
contract {
|
|
returns(true) implies (x is A)
|
|
}
|
|
}
|
|
|
|
fun Any?.receiverIsInstance() {
|
|
contract {
|
|
returns(true) implies (this@receiverIsInstance is A)
|
|
}
|
|
}
|