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