Replace 'if' with 'when': don't swallow comments if there is no synthetic else branch

#KT-34640 Fixed
This commit is contained in:
Toshiaki Kameyama
2020-01-17 19:34:47 +09:00
committed by Vladimir Dolzhenko
parent f487118be5
commit 699ea0aa2b
4 changed files with 36 additions and 1 deletions
@@ -0,0 +1,12 @@
fun test(foo: String) {
<caret>if (foo == "1") {
println("1")
}
if (foo == "a") {
// some comments for "a"
println("a");
}
}
fun println(s: String) {}
@@ -0,0 +1,14 @@
fun test(foo: String) {
when (foo) {
"1" -> {
println("1")
}
}
if (foo == "a") {
// some comments for "a"
println("a");
}
}
fun println(s: String) {}