KT-9839 related, secondary constructor to primary: inspection for the single constructor

(cherry picked from commit aec0090)
This commit is contained in:
Mikhail Glukhikh
2016-09-30 14:03:56 +03:00
committed by Mikhail Glukhikh
parent 3508bea391
commit 0a4542c6c0
7 changed files with 69 additions and 11 deletions
@@ -0,0 +1,10 @@
<problems>
<problem>
<file>test.kt</file>
<line>5</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="temp:///src/test.kt" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Convert to primary constructor</problem_class>
<description>Convert to primary constructor</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.intentions.ConvertSecondaryConstructorToPrimaryInspection
@@ -0,0 +1,19 @@
class Single {
val x: Int
constructor(x: Int) {
this.x = x
}
}
class NotSingle {
val x: Int
constructor(): this(42)
constructor(x: Int) {
this.x = x
}
}