Files
kotlin-fork/compiler/testData/diagnostics/tests/when/kt9972.kt
T
2019-03-04 11:29:38 +03:00

18 lines
494 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
fun test1(): Int {
val x: String = <!NI;TYPE_MISMATCH!>if (true) {
when {
true -> <!OI;TYPE_MISMATCH!>Any()<!>
else -> <!OI;NULL_FOR_NONNULL_TYPE!>null<!>
}
} else ""<!>
return x.hashCode()
}
fun test2(): Int {
val x: String = <!NI;TYPE_MISMATCH!>when {
true -> <!OI;TYPE_MISMATCH!>Any()<!>
else -> null
} ?: return 0<!>
return x.hashCode()
}