e7b4927b6c
This case (value is always null) contradicts the error message which says "Expression under 'when' is never equal to null".
12 lines
246 B
Kotlin
Vendored
12 lines
246 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNREACHABLE_CODE
|
|
|
|
// exhaustive
|
|
fun test1(n: Nothing) = when (n) { }
|
|
fun test2(n: Nothing?) = when (n) {
|
|
<!SENSELESS_COMPARISON!>null<!> -> {}
|
|
}
|
|
|
|
// not exhaustive
|
|
fun test3(n: Nothing?) = <!NO_ELSE_IN_WHEN!>when<!> (n) {
|
|
}
|