Condition of 'if' expression is constant: remove else keyword if needed

#KT-34713 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-11-23 16:22:48 +09:00
committed by Vladimir Dolzhenko
parent 1b0fac4a67
commit 37277d71de
6 changed files with 67 additions and 0 deletions
@@ -0,0 +1,13 @@
// WITH_RUNTIME
fun main() {
foo(true);
}
fun foo(someBool:Boolean) {
if (someBool) {
println("test1");
} else if (<caret>false) {
println("test2");
}
println("test3");
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
fun main() {
foo(true);
}
fun foo(someBool:Boolean) {
if (someBool) {
println("test1");
}
println("test3");
}
@@ -0,0 +1,16 @@
// WITH_RUNTIME
fun foo(x: Int) {}
fun bar(s: String?) {
if (s == null) {
1
}
else if (<caret>false) {
foo(1)
2
}
else {
3
}
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
fun foo(x: Int) {}
fun bar(s: String?) {
if (s == null) {
1
}
else {
3
}
}