[FIR] Report NON_EXHAUSTIVE_WHEN_STATEMENT/NO_ELSE_IN_WHEN for when's on logical types

^KT-47709 In Progress
This commit is contained in:
Dmitriy Novozhilov
2021-07-13 13:15:49 +03:00
committed by teamcityserver
parent ef635f6a96
commit a6edd852ff
38 changed files with 120 additions and 431 deletions
@@ -60,11 +60,11 @@ fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) {
false -> "2"
null -> "3"
}
value_1 == 5 -> when (value_3) {
value_1 == 5 -> <!NON_EXHAUSTIVE_WHEN_STATEMENT!>when<!> (value_3) {
true -> "1"
false -> "2"
}
value_1 == 6 -> when (value_3) {}
value_1 == 6 -> <!NON_EXHAUSTIVE_WHEN_STATEMENT!>when<!> (value_3) {}
}
}
@@ -51,21 +51,21 @@ fun case_5(value_1: Int, value_2: Int, value_3: Boolean?) {
value_2 > 100 -> "2"
else -> "3"
}
2 -> when (value_3) {
2 -> <!NON_EXHAUSTIVE_WHEN_STATEMENT!>when<!> (value_3) {
value_2 > 1000 -> "1"
value_2 > 100 -> "2"
}
3 -> when (value_3) {}
3 -> <!NON_EXHAUSTIVE_WHEN_STATEMENT!>when<!> (value_3) {}
4 -> when (value_3) {
true -> "1"
false -> "2"
null -> "3"
}
5 -> when (value_3) {
5 -> <!NON_EXHAUSTIVE_WHEN_STATEMENT!>when<!> (value_3) {
true -> "1"
false -> "2"
}
6 -> when (value_3) {}
6 -> <!NON_EXHAUSTIVE_WHEN_STATEMENT!>when<!> (value_3) {}
}
}
@@ -24,7 +24,7 @@ fun case_2(value_1: Number, value_2: Int) {
// TESTCASE NUMBER: 3
fun case_3(value_1: Boolean, value_2: Boolean, value_3: Long) {
when (value_1) {
<!NON_EXHAUSTIVE_WHEN_STATEMENT!>when<!> (value_1) {
value_2 -> {}
!value_2 -> {}
getBoolean() && value_2 -> {}
@@ -18,7 +18,7 @@ fun case_2(value_1: Number, value_2: Int) {
// TESTCASE NUMBER: 3
fun case_3(value_1: Boolean, value_2: Boolean, value_3: Long) {
when (value_1) {
<!NON_EXHAUSTIVE_WHEN_STATEMENT!>when<!> (value_1) {
value_2, !value_2, getBoolean() && value_2, getChar() != 'a' -> {}
getList() === getAny(), value_3 <= 11 -> {}
}