Files
kotlin-fork/compiler/testData/diagnostics/tests/when/kt9972.kt
T
Ilya Chernikov 70c89a28e1 Stop subtyping constraint search if equality constraints for...
all not fixed type vars are found
#KT-35626 fixed
2020-03-12 08:02:45 +01:00

18 lines
512 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, NI;TYPE_MISMATCH!>when {
true -> <!OI;TYPE_MISMATCH!>Any()<!>
else -> null
} ?: return 0<!>
return x.hashCode()
}