[FIR] Check is for impossibility

^KT-58203 Fixed
^KT-62646
This commit is contained in:
Nikolay Lunyak
2024-02-29 15:39:33 +02:00
committed by Space Team
parent 92d8da621e
commit 88ff93df7f
42 changed files with 110 additions and 83 deletions
@@ -0,0 +1,17 @@
sealed class Sealed(val x: Int) {
object First: Sealed(12)
open class NonFirst(x: Int, val y: Int): Sealed(x) {
object Second: NonFirst(34, 2)
object Third: NonFirst(56, 3)
}
object Last: Sealed(78)
}
fun foo(s: Sealed): Int {
return when(s) {
!is Sealed.First -> 1
<!USELESS_IS_CHECK!>!is Sealed.Last<!> -> 0
// no else required
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
sealed class Sealed(val x: Int) {
object First: Sealed(12)
open class NonFirst(x: Int, val y: Int): Sealed(x) {