ee8702d21e
See changes in e2606b72bdbec2fea567d4127197707869eb801e
21 lines
432 B
Kotlin
Vendored
21 lines
432 B
Kotlin
Vendored
// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect
|
|
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
|
|
// !USE_EXPERIMENTAL: kotlin.contracts.ExperimentalContracts
|
|
|
|
import kotlin.contracts.*
|
|
|
|
fun test(x: Any?) {
|
|
if (isString(x)) {
|
|
<!DEBUG_INFO_SMARTCAST!>x<!>.length
|
|
}
|
|
}
|
|
|
|
fun isString(x: Any?): Boolean {
|
|
contract {
|
|
returns(true) implies (x is String)
|
|
}
|
|
return x is String
|
|
}
|
|
|
|
|