From c0db84331e9eaf9f2aae0b8e8f10d10848dbce8f Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Wed, 1 Oct 2014 14:48:06 +0400 Subject: [PATCH] Fixed bug in join lines --- .../jetbrains/jet/lang/psi/JetProperty.java | 29 ++++++++++++++++++- .../JetDeclarationJoinLinesHandler.kt | 10 +++---- .../joinLines/propertyWithAnnotation.kt | 4 +++ .../joinLines/propertyWithAnnotation.kt.after | 3 ++ .../joinLines/simpleInitWithComments.kt.after | 2 +- .../simpleInitWithComments2.kt.after | 2 +- .../declarations/JoinLinesTestGenerated.java | 12 ++++---- 7 files changed, 49 insertions(+), 13 deletions(-) create mode 100644 idea/testData/joinLines/propertyWithAnnotation.kt create mode 100644 idea/testData/joinLines/propertyWithAnnotation.kt.after diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetProperty.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetProperty.java index e60220b5050..440d5353241 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetProperty.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/JetProperty.java @@ -33,7 +33,6 @@ import org.jetbrains.jet.lexer.JetTokens; import java.util.List; -import static org.jetbrains.jet.JetNodeTypes.PROPERTY_ACCESSOR; import static org.jetbrains.jet.JetNodeTypes.PROPERTY_DELEGATE; import static org.jetbrains.jet.lexer.JetTokens.*; @@ -233,6 +232,34 @@ public class JetProperty extends JetTypeParameterListOwnerStub[volatile] var v: Int + v = 1 +} \ No newline at end of file diff --git a/idea/testData/joinLines/propertyWithAnnotation.kt.after b/idea/testData/joinLines/propertyWithAnnotation.kt.after new file mode 100644 index 00000000000..d7babee1489 --- /dev/null +++ b/idea/testData/joinLines/propertyWithAnnotation.kt.after @@ -0,0 +1,3 @@ +fun foo() { + [volatile] var v: Int = 1 +} \ No newline at end of file diff --git a/idea/testData/joinLines/simpleInitWithComments.kt.after b/idea/testData/joinLines/simpleInitWithComments.kt.after index 5548a74c627..cbb494ec529 100644 --- a/idea/testData/joinLines/simpleInitWithComments.kt.after +++ b/idea/testData/joinLines/simpleInitWithComments.kt.after @@ -1,5 +1,5 @@ fun foo(n: Int) { // foo3 - val x: String = "" // bar3 + val /* foo */ x: String = "" // bar3 /* baz */ } \ No newline at end of file diff --git a/idea/testData/joinLines/simpleInitWithComments2.kt.after b/idea/testData/joinLines/simpleInitWithComments2.kt.after index 5548a74c627..cbb494ec529 100644 --- a/idea/testData/joinLines/simpleInitWithComments2.kt.after +++ b/idea/testData/joinLines/simpleInitWithComments2.kt.after @@ -1,5 +1,5 @@ fun foo(n: Int) { // foo3 - val x: String = "" // bar3 + val /* foo */ x: String = "" // bar3 /* baz */ } \ No newline at end of file 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 b2001980622..3236e8d7fe8 100644 --- a/idea/tests/org/jetbrains/jet/plugin/intentions/declarations/JoinLinesTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/intentions/declarations/JoinLinesTestGenerated.java @@ -17,13 +17,9 @@ package org.jetbrains.jet.plugin.intentions.declarations; import com.intellij.testFramework.TestDataPath; -import junit.framework.Test; -import junit.framework.TestSuite; -import org.junit.runner.RunWith; import org.jetbrains.jet.JetTestUtils; -import org.jetbrains.jet.test.InnerTestClasses; import org.jetbrains.jet.test.TestMetadata; -import org.jetbrains.jet.JUnit3RunnerWithInners; +import org.junit.runner.RunWith; import java.io.File; import java.util.regex.Pattern; @@ -50,6 +46,12 @@ public class JoinLinesTestGenerated extends AbstractJoinLinesTest { doTest(fileName); } + @TestMetadata("propertyWithAnnotation.kt") + public void testPropertyWithAnnotation() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/propertyWithAnnotation.kt"); + doTest(fileName); + } + @TestMetadata("simpleInit.kt") public void testSimpleInit() throws Exception { String fileName = JetTestUtils.navigationMetadata("idea/testData/joinLines/simpleInit.kt");