mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-17 15:54:03 +00:00
25 lines
485 B
Kotlin
25 lines
485 B
Kotlin
fun foo(x: Number, y: Int) {
|
|
when (x) {
|
|
is Int -> <!DEBUG_INFO_SMARTCAST!>x<!> : Int
|
|
y -> {}
|
|
else -> {}
|
|
}
|
|
<!TYPE_MISMATCH!>x<!> : Int
|
|
}
|
|
|
|
fun bar(x: Number) {
|
|
when (x) {
|
|
is Int -> <!DEBUG_INFO_SMARTCAST!>x<!> : Int
|
|
else -> {}
|
|
}
|
|
<!TYPE_MISMATCH!>x<!> : Int
|
|
}
|
|
|
|
fun whenWithoutSubject(x: Number) {
|
|
when {
|
|
(x is Int) -> <!DEBUG_INFO_SMARTCAST!>x<!> : Int
|
|
else -> {}
|
|
}
|
|
<!TYPE_MISMATCH!>x<!> : Int
|
|
}
|