Fix "make constructor parameter a property" for vararg case
Same should work for annotated parameters #KT-29312 Fixed
This commit is contained in:
@@ -46,7 +46,7 @@ class MakeConstructorParameterPropertyFix(
|
||||
|
||||
override fun invoke(project: Project, editor: Editor?, file: KtFile) {
|
||||
val element = element ?: return
|
||||
element.addBefore(kotlinValVar.createKeyword(KtPsiFactory(project))!!, element.firstChild)
|
||||
element.addBefore(kotlinValVar.createKeyword(KtPsiFactory(project))!!, element.nameIdentifier)
|
||||
element.addModifier(KtTokens.PRIVATE_KEYWORD)
|
||||
element.visibilityModifier()?.let { private ->
|
||||
editor?.apply {
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Make constructor parameter a property" "true"
|
||||
|
||||
class SomeClass(vararg dismissibleViewTypes: Int) {
|
||||
fun someFun() {
|
||||
<caret>dismissibleViewTypes
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Make constructor parameter a property" "true"
|
||||
|
||||
class SomeClass(private vararg val dismissibleViewTypes: Int) {
|
||||
fun someFun() {
|
||||
dismissibleViewTypes
|
||||
}
|
||||
}
|
||||
@@ -7709,6 +7709,11 @@ public class QuickFixTestGenerated extends AbstractQuickFixTest {
|
||||
public void testVar() throws Exception {
|
||||
runTest("idea/testData/quickfix/makeConstructorParameterProperty/var.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("vararg.kt")
|
||||
public void testVararg() throws Exception {
|
||||
runTest("idea/testData/quickfix/makeConstructorParameterProperty/vararg.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("idea/testData/quickfix/makeTypeParameterReified")
|
||||
|
||||
Reference in New Issue
Block a user