Invert if condition intention: don't add unnecessary 'continue'
#KT-12329 Fixed
This commit is contained in:
committed by
Vladimir Dolzhenko
parent
62e335ac88
commit
e406669190
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
for (x in "abc") {
|
||||
<caret>if (x == 'a') continue
|
||||
println("else")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
for (x in "abc") {
|
||||
if (x != 'a') {
|
||||
println("else")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
for (x in "abc") {
|
||||
if (x != 'a') {
|
||||
<caret>if (x == 'b') continue
|
||||
println("else")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
for (x in "abc") {
|
||||
if (x != 'a') {
|
||||
if (x != 'b') {
|
||||
println("else")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
for (x in "abc") {
|
||||
if (x != 'a') {
|
||||
<caret>if (x == 'b') {
|
||||
println("foo")
|
||||
continue
|
||||
}
|
||||
println("else")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
for (x in "abc") {
|
||||
if (x != 'a') {
|
||||
if (x != 'b') {
|
||||
println("else")
|
||||
continue
|
||||
}
|
||||
println("foo")
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user