diff --git a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt index 3d4c30ae31f..20ac76b76fa 100644 --- a/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt +++ b/idea/src/org/jetbrains/kotlin/idea/intentions/ConvertPrimaryConstructorToSecondaryIntention.kt @@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor import org.jetbrains.kotlin.descriptors.ConstructorDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.idea.caches.resolve.analyze +import org.jetbrains.kotlin.idea.util.CommentSaver import org.jetbrains.kotlin.lexer.KtTokens.THIS_KEYWORD import org.jetbrains.kotlin.lexer.KtTokens.VARARG_KEYWORD import org.jetbrains.kotlin.psi.* @@ -58,6 +59,7 @@ class ConvertPrimaryConstructorToSecondaryIntention : SelfTargetingIntention() for (property in klass.getProperties()) { if (property.typeReference == null) { @@ -116,7 +118,9 @@ class ConvertPrimaryConstructorToSecondaryIntention : SelfTargetingIntentionconstructor( + /* First parameter */ + val first: Int, + /* Second Parameter */ + val second: Double) \ No newline at end of file diff --git a/idea/testData/intentions/convertPrimaryConstructorToSecondary/withComments.kt.after b/idea/testData/intentions/convertPrimaryConstructorToSecondary/withComments.kt.after new file mode 100644 index 00000000000..785842e1413 --- /dev/null +++ b/idea/testData/intentions/convertPrimaryConstructorToSecondary/withComments.kt.after @@ -0,0 +1,17 @@ +/** + * An important class + */ +class WithComments +/** + * Some nasty constructor + */ +{/* First parameter */ + /* Second Parameter */ + val first: Int + val second: Double + + constructor(first: Int, second: Double) { + this.first = first + this.second = second + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index 5392bdae553..f0eb97e981e 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -4462,6 +4462,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } + @TestMetadata("withComments.kt") + public void testWithComments() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertPrimaryConstructorToSecondary/withComments.kt"); + doTest(fileName); + } + @TestMetadata("withMultipleInheritance.kt") public void testWithMultipleInheritance() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/convertPrimaryConstructorToSecondary/withMultipleInheritance.kt");