[FIR] Reimplement when exhaustiveness checker to fir it's logic with FE 1.0
This commit is contained in:
@@ -18,6 +18,6 @@ fun test2(x: Stmt): String =
|
||||
}
|
||||
|
||||
fun test3(x: Expr): String =
|
||||
<!NO_ELSE_IN_WHEN!>when<!> (x) {
|
||||
when (x) {
|
||||
is Stmt -> "stmt"
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
sealed class Base {
|
||||
sealed class A : Base() {
|
||||
object A1 : A()
|
||||
sealed class A2 : A()
|
||||
}
|
||||
sealed class B : Base() {
|
||||
sealed class B1 : B()
|
||||
object B2 : B()
|
||||
}
|
||||
|
||||
fun foo() = when (this) {
|
||||
is A -> 1
|
||||
is B.B1 -> 2
|
||||
B.B2 -> 3
|
||||
// No else required
|
||||
}
|
||||
|
||||
fun bar() = <!NO_ELSE_IN_WHEN!>when<!> (this) {
|
||||
is A -> 1
|
||||
is B.B1 -> 2
|
||||
}
|
||||
|
||||
fun baz() = when (this) {
|
||||
is A -> 1
|
||||
B.B2 -> 3
|
||||
// No else required (no possible B1 instances)
|
||||
}
|
||||
|
||||
fun negated() = when (this) {
|
||||
!is A -> 1
|
||||
A.A1 -> 2
|
||||
is A.A2 -> 3
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
sealed class Base {
|
||||
sealed class A : Base() {
|
||||
object A1 : A()
|
||||
|
||||
Reference in New Issue
Block a user