Add braces to 'if' statement: save/restore comments correctly
So #KT-16332 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
b436ee6e19
commit
4726b44371
@@ -0,0 +1,6 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test() {
|
||||
<caret>do /* aaa */ foo() // comment
|
||||
while(true)
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test() {
|
||||
do {
|
||||
/* aaa */ foo() // comment
|
||||
} while(true)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
if (b) foo() <caret>else
|
||||
/* aaa */ foo() // bbb
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
if (b) foo() else {
|
||||
/* aaa */ foo() // bbb
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test() {
|
||||
<caret>for (i in 1..4) /* aaa */ foo() // bbb
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test() {
|
||||
for (i in 1..4) {
|
||||
/* aaa */ foo() // bbb
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
<caret>if (b) foo() /* if comment */ else foo() // else comment
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
if (b) {
|
||||
foo() /* if comment */
|
||||
} else foo() // else comment
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
<caret>if (b) /* aaa */ /* bbb */ foo() // ccc
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
if (b) {
|
||||
/* aaa */ /* bbb */ foo() // ccc
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test(a: Int) {
|
||||
when (a) {
|
||||
<caret>1 -> /* aaa */ foo() // bbb
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test(a: Int) {
|
||||
when (a) {
|
||||
1 -> {
|
||||
/* aaa */ foo() // bbb
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
<caret>while (b) /* aaa */ foo() // bbb
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
fun foo() {}
|
||||
|
||||
fun test(b: Boolean) {
|
||||
while (b) {
|
||||
/* aaa */ foo() // bbb
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user