Files
kotlin-fork/compiler/testData/diagnostics/tests/when/whenOnNothing.kt
T
2021-08-06 22:57:12 +03:00

12 lines
293 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNREACHABLE_CODE
// exhaustive
fun test1(n: Nothing) = when (n) { }
fun test2(n: Nothing?) = <!NO_ELSE_IN_WHEN!>when<!> (<!DEBUG_INFO_CONSTANT!>n<!>) {
null -> {}
}
// not exhaustive
fun test3(n: Nothing?) = <!NO_ELSE_IN_WHEN!>when<!> (<!DEBUG_INFO_CONSTANT!>n<!>) {
}