Add braces: don't move EOL comment when if statement is single statement

#KT-28619 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-04-08 06:04:24 +03:00
committed by Mikhail Glukhikh
parent a92cf19641
commit 401d8c2d70
8 changed files with 77 additions and 2 deletions
@@ -0,0 +1,10 @@
fun test(b: Boolean) {
if (b) foo(0)
else<caret>
while (true) {
foo(1)
}
// comment about call below
}
fun foo(i: Int) {}
@@ -0,0 +1,11 @@
fun test(b: Boolean) {
if (b) foo(0)
else {
while (true) {
foo(1)
}
}
// comment about call below
}
fun foo(i: Int) {}
@@ -0,0 +1,10 @@
fun test() {
if (false)<caret>
while (true) {
foo(1)
}
//comment about foo(2)
foo(2)
}
fun foo(i: Int) {}
@@ -0,0 +1,11 @@
fun test() {
if (false) {
while (true) {
foo(1)
}
}
//comment about foo(2)
foo(2)
}
fun foo(i: Int) {}
@@ -0,0 +1,9 @@
fun test() {
if (false)<caret>
while (true)
foo(1)
//comment about foo(2)
foo(2)
}
fun foo(i: Int) {}
@@ -0,0 +1,10 @@
fun test() {
if (false) {
while (true)
foo(1)
}
//comment about foo(2)
foo(2)
}
fun foo(i: Int) {}