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