[FIR] Implement checker for exhaustive when's in expression position
This commit is contained in:
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
FILE: missingBooleanBranch.kt
|
||||
public final fun test_1(cond: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/cond|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
lval y: R|kotlin/Unit| = when (R|<local>/cond|) {
|
||||
==($subj$, Boolean(false)) -> {
|
||||
Int(2)
|
||||
}
|
||||
}
|
||||
|
||||
lval z: R|kotlin/Int| = when (R|<local>/cond|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
==($subj$, Boolean(false)) -> {
|
||||
Int(2)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_2(cond: R|kotlin/Boolean?|): R|kotlin/Unit| {
|
||||
lval x: R|kotlin/Unit| = when (R|<local>/cond|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
==($subj$, Boolean(false)) -> {
|
||||
Int(2)
|
||||
}
|
||||
}
|
||||
|
||||
lval x: R|kotlin/Int| = when (R|<local>/cond|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
==($subj$, Boolean(false)) -> {
|
||||
Int(2)
|
||||
}
|
||||
==($subj$, Null(null)) -> {
|
||||
Int(3)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test_3(cond: R|kotlin/Boolean|): R|kotlin/Unit| {
|
||||
when (R|<local>/cond|) {
|
||||
==($subj$, Boolean(true)) -> {
|
||||
Int(1)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user