Files
kotlin-fork/compiler/testData/diagnostics/tests/when/kt9929.kt
T
Mikhail Zarechenskiy f702417655 [NI] Relax rules for call completion: require at least one constraint
It's enough to have at least one good constraint.

 Note that the whole algorithm can be a bit more general:
 we could check also Out<T>, In<T> and verify that T has good only
 lower constraint or upper constraint, but there are questions for
 types like Inv<Out<T>>, where T should have lower and upper constraints

 #KT-31514 Fixed
2019-05-29 02:14:00 +03:00

10 lines
196 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
val test: Int = <!NI;TYPE_MISMATCH, NI;TYPE_MISMATCH!>if (true) {
when (2) {
1 -> 1
else -> <!OI;NULL_FOR_NONNULL_TYPE!>null<!>
}
}
else {
2
}<!>