mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
17 lines
352 B
Kotlin
Vendored
17 lines
352 B
Kotlin
Vendored
// !CHECK_TYPE
|
|
|
|
fun foo(x: Int?): Int = x!!
|
|
|
|
fun elvis(x: Number?): Int {
|
|
val result = (x as Int?) ?: foo(<!DEBUG_INFO_SMARTCAST!>x<!>)
|
|
checkSubtype<Int?>(<!DEBUG_INFO_SMARTCAST!>x<!>)
|
|
return result
|
|
}
|
|
|
|
|
|
fun elvisWithRHSTypeInfo(x: Number?): Any? {
|
|
val result = x ?: x!!
|
|
checkSubtype<Int?>(<!TYPE_MISMATCH!>x<!>)
|
|
return result
|
|
}
|