57bafcf9e9
It is safe to treat DefaultValueArgument as UNKNOWN_COMPUTATION, because default arguments can't break smartcasts. Possibly, they can add new ones, but it can be supported later. ^KT-25278 Fixed
16 lines
432 B
Kotlin
Vendored
16 lines
432 B
Kotlin
Vendored
// !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect
|
|
// !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER
|
|
|
|
import kotlin.internal.contracts.*
|
|
|
|
fun myAssert(condition: Boolean, message: String = "") {
|
|
contract {
|
|
returns() implies (condition)
|
|
}
|
|
if (!condition) throw kotlin.IllegalArgumentException(message)
|
|
}
|
|
|
|
fun test(x: Any?) {
|
|
myAssert(x is String)
|
|
<!DEBUG_INFO_SMARTCAST!>x<!>.length
|
|
} |