ReplaceGuardClause inspection: do not remove 'else' branch
#KT-32797 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
a3a3c52c24
commit
a6690e4e35
+4
@@ -0,0 +1,4 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(flag: Boolean) {
|
||||
<caret>if (!flag) throw IllegalArgumentException() else println(1)
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(flag: Boolean) {
|
||||
<caret>require(flag)
|
||||
println(1)
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(flag: Boolean) {
|
||||
<caret>if (!flag) throw IllegalArgumentException()
|
||||
else {
|
||||
println(1)
|
||||
println(2)
|
||||
}
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(flag: Boolean) {
|
||||
<caret>require(flag)
|
||||
println(1)
|
||||
println(2)
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(flag: Boolean, i: Int) {
|
||||
<caret>if (!flag) {
|
||||
throw IllegalArgumentException()
|
||||
} else if (i == 0) {
|
||||
println(0)
|
||||
} else {
|
||||
println(1)
|
||||
println(2)
|
||||
}
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// WITH_RUNTIME
|
||||
fun test(flag: Boolean, i: Int) {
|
||||
<caret>require(flag)
|
||||
if (i == 0) {
|
||||
println(0)
|
||||
} else {
|
||||
println(1)
|
||||
println(2)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user