diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml
index 614837d5651..f390cd5c569 100644
--- a/idea/src/META-INF/plugin.xml
+++ b/idea/src/META-INF/plugin.xml
@@ -432,6 +432,7 @@
order="before jetExpression" />
+
if (a) {
+ bar() // do bar
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/CommentAfterStatement.kt.after b/idea/testData/joinLines/removeBraces/CommentAfterStatement.kt.after
new file mode 100644
index 00000000000..a689f516c65
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/CommentAfterStatement.kt.after
@@ -0,0 +1,4 @@
+fun foo() {
+ if (a) { bar() // do bar
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/CommentAfterStatement2.kt b/idea/testData/joinLines/removeBraces/CommentAfterStatement2.kt
new file mode 100644
index 00000000000..b937407c817
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/CommentAfterStatement2.kt
@@ -0,0 +1,6 @@
+fun foo() {
+ if (a) {
+ bar()
+ // do something else here
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/CommentAfterStatement2.kt.after b/idea/testData/joinLines/removeBraces/CommentAfterStatement2.kt.after
new file mode 100644
index 00000000000..7916bcc68df
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/CommentAfterStatement2.kt.after
@@ -0,0 +1,5 @@
+fun foo() {
+ if (a) { bar()
+ // do something else here
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/CommentBeforeStatement.kt b/idea/testData/joinLines/removeBraces/CommentBeforeStatement.kt
new file mode 100644
index 00000000000..1e03b6ae233
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/CommentBeforeStatement.kt
@@ -0,0 +1,6 @@
+fun foo() {
+ if (a) {
+ // do bar
+ bar()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/CommentBeforeStatement.kt.after b/idea/testData/joinLines/removeBraces/CommentBeforeStatement.kt.after
new file mode 100644
index 00000000000..5e08b4f334b
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/CommentBeforeStatement.kt.after
@@ -0,0 +1,5 @@
+fun foo() {
+ if (a) { // do bar
+ bar()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/CommentBeforeStatement2.kt b/idea/testData/joinLines/removeBraces/CommentBeforeStatement2.kt
new file mode 100644
index 00000000000..9d66568985c
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/CommentBeforeStatement2.kt
@@ -0,0 +1,6 @@
+fun foo() {
+ if (a) {
+ /* do bar */
+ bar()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/CommentBeforeStatement2.kt.after b/idea/testData/joinLines/removeBraces/CommentBeforeStatement2.kt.after
new file mode 100644
index 00000000000..44885b564b7
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/CommentBeforeStatement2.kt.after
@@ -0,0 +1,5 @@
+fun foo() {
+ if (a) { /* do bar */
+ bar()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/DoWhile.kt b/idea/testData/joinLines/removeBraces/DoWhile.kt
new file mode 100644
index 00000000000..37f8f159774
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/DoWhile.kt
@@ -0,0 +1,5 @@
+fun foo() {
+ do {
+ if (bar()) break
+ } while (true)
+}
diff --git a/idea/testData/joinLines/removeBraces/DoWhile.kt.after b/idea/testData/joinLines/removeBraces/DoWhile.kt.after
new file mode 100644
index 00000000000..208246ac3c5
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/DoWhile.kt.after
@@ -0,0 +1,3 @@
+fun foo() {
+ do if (bar()) break while (true)
+}
diff --git a/idea/testData/joinLines/removeBraces/Else.kt b/idea/testData/joinLines/removeBraces/Else.kt
new file mode 100644
index 00000000000..897da31ab2b
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/Else.kt
@@ -0,0 +1,5 @@
+fun foo() {
+ if (a) bar1() else {
+ bar2()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/Else.kt.after b/idea/testData/joinLines/removeBraces/Else.kt.after
new file mode 100644
index 00000000000..f347395d4da
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/Else.kt.after
@@ -0,0 +1,3 @@
+fun foo() {
+ if (a) bar1() else bar2()
+}
diff --git a/idea/testData/joinLines/removeBraces/For.kt b/idea/testData/joinLines/removeBraces/For.kt
new file mode 100644
index 00000000000..19c871c1457
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/For.kt
@@ -0,0 +1,5 @@
+fun foo() {
+ for (element in collection) {
+ println(element)
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/For.kt.after b/idea/testData/joinLines/removeBraces/For.kt.after
new file mode 100644
index 00000000000..409a7a9467c
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/For.kt.after
@@ -0,0 +1,3 @@
+fun foo() {
+ for (element in collection) println(element)
+}
diff --git a/idea/testData/joinLines/removeBraces/FunctionBody.kt b/idea/testData/joinLines/removeBraces/FunctionBody.kt
new file mode 100644
index 00000000000..c16200b023d
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/FunctionBody.kt
@@ -0,0 +1,3 @@
+fun foo() {
+ bar()
+}
diff --git a/idea/testData/joinLines/removeBraces/FunctionBody.kt.after b/idea/testData/joinLines/removeBraces/FunctionBody.kt.after
new file mode 100644
index 00000000000..086210c64ec
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/FunctionBody.kt.after
@@ -0,0 +1,2 @@
+fun foo() { bar()
+}
diff --git a/idea/testData/joinLines/removeBraces/If.kt b/idea/testData/joinLines/removeBraces/If.kt
new file mode 100644
index 00000000000..40b24eb2a4f
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/If.kt
@@ -0,0 +1,5 @@
+fun foo() {
+ if (a) {
+ bar()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/If.kt.after b/idea/testData/joinLines/removeBraces/If.kt.after
new file mode 100644
index 00000000000..76f6ca2866c
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/If.kt.after
@@ -0,0 +1,3 @@
+fun foo() {
+ if (a) bar()
+}
diff --git a/idea/testData/joinLines/removeBraces/IfWithElse.kt b/idea/testData/joinLines/removeBraces/IfWithElse.kt
new file mode 100644
index 00000000000..1305d67b393
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/IfWithElse.kt
@@ -0,0 +1,7 @@
+fun foo() {
+ if (a) {
+ bar1()
+ } else {
+ bar2()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/IfWithElse.kt.after b/idea/testData/joinLines/removeBraces/IfWithElse.kt.after
new file mode 100644
index 00000000000..4898804a27f
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/IfWithElse.kt.after
@@ -0,0 +1,5 @@
+fun foo() {
+ if (a) bar1() else {
+ bar2()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/LambdaBody.kt b/idea/testData/joinLines/removeBraces/LambdaBody.kt
new file mode 100644
index 00000000000..6814e36dd83
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/LambdaBody.kt
@@ -0,0 +1,5 @@
+fun foo() {
+ run {
+ bar()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/LambdaBody.kt.after b/idea/testData/joinLines/removeBraces/LambdaBody.kt.after
new file mode 100644
index 00000000000..0f6b26dfa6f
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/LambdaBody.kt.after
@@ -0,0 +1,4 @@
+fun foo() {
+ run { bar()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/NotSingleLineStatement.kt b/idea/testData/joinLines/removeBraces/NotSingleLineStatement.kt
new file mode 100644
index 00000000000..fc67781b2de
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/NotSingleLineStatement.kt
@@ -0,0 +1,6 @@
+fun foo() {
+ if (a) {
+ println("a" +
+ "b")
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/NotSingleLineStatement.kt.after b/idea/testData/joinLines/removeBraces/NotSingleLineStatement.kt.after
new file mode 100644
index 00000000000..109573bb444
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/NotSingleLineStatement.kt.after
@@ -0,0 +1,4 @@
+fun foo() {
+ if (a) println("a" +
+ "b")
+}
diff --git a/idea/testData/joinLines/removeBraces/TwoStatements.kt b/idea/testData/joinLines/removeBraces/TwoStatements.kt
new file mode 100644
index 00000000000..26e2b05087f
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/TwoStatements.kt
@@ -0,0 +1,5 @@
+fun foo() {
+ if (a) {
+ bar1(); bar2()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/TwoStatements.kt.after b/idea/testData/joinLines/removeBraces/TwoStatements.kt.after
new file mode 100644
index 00000000000..86beb05ee3e
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/TwoStatements.kt.after
@@ -0,0 +1,4 @@
+fun foo() {
+ if (a) { bar1(); bar2()
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/While.kt b/idea/testData/joinLines/removeBraces/While.kt
new file mode 100644
index 00000000000..ae3d45b95cb
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/While.kt
@@ -0,0 +1,5 @@
+fun foo() {
+ while (true) {
+ if (bar()) break
+ }
+}
diff --git a/idea/testData/joinLines/removeBraces/While.kt.after b/idea/testData/joinLines/removeBraces/While.kt.after
new file mode 100644
index 00000000000..e6a42a7a1cd
--- /dev/null
+++ b/idea/testData/joinLines/removeBraces/While.kt.after
@@ -0,0 +1,3 @@
+fun foo() {
+ while (true) if (bar()) break
+}
diff --git a/idea/tests/org/jetbrains/jet/plugin/intentions/declarations/JoinLinesTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/intentions/declarations/JoinLinesTestGenerated.java
index 126e01d2ecd..422ef65e4bd 100644
--- a/idea/tests/org/jetbrains/jet/plugin/intentions/declarations/JoinLinesTestGenerated.java
+++ b/idea/tests/org/jetbrains/jet/plugin/intentions/declarations/JoinLinesTestGenerated.java
@@ -32,7 +32,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("idea/testData/joinLines")
@TestDataPath("$PROJECT_ROOT")
-@InnerTestClasses({JoinLinesTestGenerated.DeclarationAndAssignment.class})
+@InnerTestClasses({JoinLinesTestGenerated.DeclarationAndAssignment.class, JoinLinesTestGenerated.RemoveBraces.class})
@RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class)
public class JoinLinesTestGenerated extends AbstractJoinLinesTest {
public void testAllFilesPresentInJoinLines() throws Exception {
@@ -139,4 +139,98 @@ public class JoinLinesTestGenerated extends AbstractJoinLinesTest {
}
+ @TestMetadata("idea/testData/joinLines/removeBraces")
+ @TestDataPath("$PROJECT_ROOT")
+ @RunWith(org.jetbrains.jet.JUnit3RunnerWithInners.class)
+ public static class RemoveBraces extends AbstractJoinLinesTest {
+ public void testAllFilesPresentInRemoveBraces() throws Exception {
+ JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/joinLines/removeBraces"), Pattern.compile("^(.+)\\.kt$"), true);
+ }
+
+ @TestMetadata("CommentAfterStatement.kt")
+ public void testCommentAfterStatement() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/CommentAfterStatement.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("CommentAfterStatement2.kt")
+ public void testCommentAfterStatement2() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/CommentAfterStatement2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("CommentBeforeStatement.kt")
+ public void testCommentBeforeStatement() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/CommentBeforeStatement.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("CommentBeforeStatement2.kt")
+ public void testCommentBeforeStatement2() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/CommentBeforeStatement2.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("DoWhile.kt")
+ public void testDoWhile() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/DoWhile.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("Else.kt")
+ public void testElse() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/Else.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("For.kt")
+ public void testFor() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/For.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("FunctionBody.kt")
+ public void testFunctionBody() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/FunctionBody.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("If.kt")
+ public void testIf() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/If.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("IfWithElse.kt")
+ public void testIfWithElse() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/IfWithElse.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("LambdaBody.kt")
+ public void testLambdaBody() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/LambdaBody.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("NotSingleLineStatement.kt")
+ public void testNotSingleLineStatement() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/NotSingleLineStatement.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("TwoStatements.kt")
+ public void testTwoStatements() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/TwoStatements.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("While.kt")
+ public void testWhile() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/removeBraces/While.kt");
+ doTest(fileName);
+ }
+
+ }
+
}