Convert 'simplify when' from intention to inspection

Related to KT-20492
This commit is contained in:
Mikhail Glukhikh
2017-11-09 16:30:34 +03:00
parent df86ff7115
commit 7b2a66c006
36 changed files with 150 additions and 133 deletions
@@ -1 +0,0 @@
org.jetbrains.kotlin.idea.intentions.SimplifyWhenWithBooleanConstantConditionIntention
@@ -1,6 +0,0 @@
fun test() {
val x = <caret>when {
false -> 1
else -> 2
}
}
@@ -1,3 +0,0 @@
fun test() {
val x = 2
}
@@ -1,13 +0,0 @@
// WITH_RUNTIME
fun test() {
val x = <caret>when {
false -> {
println(1)
1
}
else -> {
println(2)
2
}
}
}
@@ -1,7 +0,0 @@
// WITH_RUNTIME
fun test() {
val x = run {
println(2)
2
}
}
@@ -1,11 +0,0 @@
// WITH_RUNTIME
fun test() {
<caret>when {
false -> {
println(1)
}
else -> {
println(2)
}
}
}
@@ -1,4 +0,0 @@
// WITH_RUNTIME
fun test() {
println(2)
}
@@ -1,6 +0,0 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'else' branch
fun test() {
val x = <caret>when {
false -> 1
}
}
@@ -1,5 +0,0 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'else' branch
fun test() {
val x = when {
}
}
@@ -1,10 +0,0 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'else' branch
// WITH_RUNTIME
fun test() {
val x = <caret>when {
false -> {
println(1)
1
}
}
}
@@ -1,6 +0,0 @@
// ERROR: 'when' expression must be exhaustive, add necessary 'else' branch
// WITH_RUNTIME
fun test() {
val x = when {
}
}
@@ -1,8 +0,0 @@
// WITH_RUNTIME
fun test() {
<caret>when {
false -> {
println(1)
}
}
}
@@ -1,3 +0,0 @@
// WITH_RUNTIME
fun test() {
}
@@ -1,8 +0,0 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test(b: Boolean) {
<caret>when(b) {
true -> println(1)
false -> println(2)
}
}
@@ -1,8 +0,0 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun test(i: Int) {
<caret>when {
i == 1 -> println(1)
else -> println(2)
}
}
@@ -1,8 +0,0 @@
fun test(i: Int) {
val x = <caret>when {
i == 1 -> 1
false -> 2
true -> 3
else -> 4
}
}
@@ -1,6 +0,0 @@
fun test(i: Int) {
val x = when {
i == 1 -> 1
else -> 3
}
}
@@ -1,21 +0,0 @@
// WITH_RUNTIME
fun test(i: Int) {
val x = <caret>when {
i == 1 -> {
println(1)
1
}
false -> {
println(2)
2
}
true -> {
println(3)
3
}
else -> {
println(4)
4
}
}
}
@@ -1,13 +0,0 @@
// WITH_RUNTIME
fun test(i: Int) {
val x = when {
i == 1 -> {
println(1)
1
}
else -> {
println(3)
3
}
}
}
@@ -1,17 +0,0 @@
// WITH_RUNTIME
fun test(i: Int) {
<caret>when {
i == 1 -> {
println(1)
}
false -> {
println(2)
}
true -> {
println(3)
}
else -> {
println(4)
}
}
}
@@ -1,11 +0,0 @@
// WITH_RUNTIME
fun test(i: Int) {
when {
i == 1 -> {
println(1)
}
else -> {
println(3)
}
}
}
@@ -1,6 +0,0 @@
fun test() {
val x = <caret>when {
true -> 1
else -> 2
}
}
@@ -1,3 +0,0 @@
fun test() {
val x = 1
}
@@ -1,13 +0,0 @@
// WITH_RUNTIME
fun test() {
val x = <caret>when {
true -> {
println(1)
1
}
else -> {
println(2)
2
}
}
}
@@ -1,7 +0,0 @@
// WITH_RUNTIME
fun test() {
val x = run {
println(1)
1
}
}
@@ -1,11 +0,0 @@
// WITH_RUNTIME
fun test() {
when<caret> {
true -> {
println(1)
}
else -> {
println(2)
}
}
}
@@ -1,4 +0,0 @@
// WITH_RUNTIME
fun test() {
println(1)
}