Files
kotlin-fork/compiler/testData/diagnostics/tests/sealed/NonExhaustiveWhenWithAnyCase.kt
T
Dmitry Neverov cd24adac32 Detect redundant 'is' check
#KT-14187 Fixed
2017-05-15 11:24:35 +03:00

16 lines
312 B
Kotlin
Vendored

sealed class Sealed {
object First: Sealed()
open class NonFirst: Sealed() {
object Second: NonFirst()
object Third: NonFirst()
}
}
fun foo(s: Sealed): Int {
return <!NO_ELSE_IN_WHEN!>when<!>(s) {
is Sealed.First -> 1
<!USELESS_IS_CHECK!>!is Any<!> -> 0
}
}