KT-4008 'Replace if with when' is available but does not work
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
fun test(n: Int) {
|
||||
val s = "test"
|
||||
<caret>if (n == 0)
|
||||
s = "zero"
|
||||
else if (n == 1)
|
||||
s = "one"
|
||||
else if (n == 2)
|
||||
s = "two"
|
||||
return s
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fun test(n: Int) {
|
||||
val s = "test"
|
||||
when (n) {
|
||||
0 -> s = "zero"
|
||||
1 -> s = "one"
|
||||
2 -> s = "two"
|
||||
}
|
||||
return s
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fun test(n: Int) {
|
||||
val s = "test"
|
||||
<caret>when (n) {
|
||||
0 -> s = "zero"
|
||||
1 -> s = "one"
|
||||
2 -> s = "two"
|
||||
}
|
||||
return s
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun test(n: Int) {
|
||||
val s = "test"
|
||||
if (n == 0) s = "zero"
|
||||
else if (n == 1) s = "one"
|
||||
else if (n == 2) s = "two"
|
||||
return s
|
||||
}
|
||||
@@ -4,8 +4,11 @@
|
||||
// ERROR: Unreachable code
|
||||
// ERROR: Unreachable code
|
||||
// ACTION: Disable 'Eliminate Argument of 'when''
|
||||
// ACTION: Disable 'Replace 'when' with 'if''
|
||||
// ACTION: Edit intention settings
|
||||
// ACTION: Edit intention settings
|
||||
// ACTION: Eliminate argument of 'when'
|
||||
// ACTION: Replace 'when' with 'if'
|
||||
package foo
|
||||
|
||||
fun foo() {
|
||||
|
||||
Reference in New Issue
Block a user