Invert if condition intention: don't add unnecessary 'continue'

#KT-12329 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-02-21 10:30:21 +01:00
committed by Vladimir Dolzhenko
parent 62e335ac88
commit e406669190
8 changed files with 75 additions and 1 deletions
@@ -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")
}
}
}