diff --git a/plugins/kotlin/base/psi/src/org/jetbrains/kotlin/idea/base/psi/KotlinPsiModificationUtils.kt b/plugins/kotlin/base/psi/src/org/jetbrains/kotlin/idea/base/psi/KotlinPsiModificationUtils.kt
index 45200a6619ba..a1fb78caff0c 100644
--- a/plugins/kotlin/base/psi/src/org/jetbrains/kotlin/idea/base/psi/KotlinPsiModificationUtils.kt
+++ b/plugins/kotlin/base/psi/src/org/jetbrains/kotlin/idea/base/psi/KotlinPsiModificationUtils.kt
@@ -184,4 +184,13 @@ fun KtExpression.prependDotQualifiedReceiver(receiver: KtExpression, factory: Kt
fun KtExpression.appendDotQualifiedSelector(selector: KtExpression, factory: KtPsiFactory): KtExpression {
val dotQualified = factory.createExpressionByPattern("$0.$1", this, selector)
return this.replaced(dotQualified)
+}
+
+fun KtSecondaryConstructor.getOrCreateBody(): KtBlockExpression {
+ bodyExpression?.let { return it }
+
+ val delegationCall = getDelegationCall()
+ val anchor = if (delegationCall.isImplicit) valueParameterList else delegationCall
+ val newBody = KtPsiFactory(project).createEmptyBody()
+ return addAfter(newBody, anchor) as KtBlockExpression
}
\ No newline at end of file
diff --git a/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties b/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties
index f878a351a9c6..32d37168aa90 100644
--- a/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties
+++ b/plugins/kotlin/base/resources/resources-en/messages/KotlinBundle.properties
@@ -1119,6 +1119,7 @@ replace.annotation.with.0=Replace annotation with {0}
add.initializer=Add initializer
move.to.constructor.parameters=Move to constructor parameters
initialize.with.constructor.parameter=Initialize with constructor parameter
+initialize.with.constructor.parameter.analyzing.existing.variables=Analyzing Existing Variables\u2026
inline.type.parameter=Inline type parameter
insert.explicit.delegation.call=Insert explicit delegation call
the.anonymous.object=the anonymous object
diff --git a/plugins/kotlin/code-insight/fixes-k2/kotlin.code-insight.fixes.k2.iml b/plugins/kotlin/code-insight/fixes-k2/kotlin.code-insight.fixes.k2.iml
index 15d5b9aa9cbd..fb9d8a4ed6bc 100644
--- a/plugins/kotlin/code-insight/fixes-k2/kotlin.code-insight.fixes.k2.iml
+++ b/plugins/kotlin/code-insight/fixes-k2/kotlin.code-insight.fixes.k2.iml
@@ -37,6 +37,7 @@
+
diff --git a/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/InitializePropertyQuickFixFactories.kt b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/InitializePropertyQuickFixFactories.kt
index a4dd1d9625ff..587c65aa942f 100644
--- a/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/InitializePropertyQuickFixFactories.kt
+++ b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/InitializePropertyQuickFixFactories.kt
@@ -1,106 +1,353 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.kotlin.idea.k2.codeinsight.fixes
+import com.intellij.codeInsight.intention.CommonIntentionAction
+import com.intellij.codeInspection.util.IntentionFamilyName
+import com.intellij.codeInspection.util.IntentionName
import com.intellij.modcommand.ActionContext
import com.intellij.modcommand.ModPsiUpdater
+import com.intellij.openapi.editor.Editor
+import com.intellij.openapi.project.Project
import com.intellij.openapi.util.TextRange
+import com.intellij.psi.PsiElement
+import com.intellij.psi.createSmartPointer
+import com.intellij.usageView.UsageInfo
+import com.intellij.util.application
+import com.intellij.util.containers.MultiMap
+import com.intellij.util.containers.addIfNotNull
import org.jetbrains.kotlin.analysis.api.KaExperimentalApi
import org.jetbrains.kotlin.analysis.api.KaSession
import org.jetbrains.kotlin.analysis.api.fir.diagnostics.KaFirDiagnostic
+import org.jetbrains.kotlin.idea.base.analysis.api.utils.analyzeInModalWindow
+import org.jetbrains.kotlin.idea.base.codeInsight.KotlinDeclarationNameValidator
+import org.jetbrains.kotlin.idea.base.codeInsight.KotlinNameSuggestionProvider
+import org.jetbrains.kotlin.idea.base.psi.getOrCreateBody
import org.jetbrains.kotlin.idea.base.resources.KotlinBundle
import org.jetbrains.kotlin.idea.codeinsight.api.applicable.intentions.KotlinPsiUpdateModCommandAction
import org.jetbrains.kotlin.idea.codeinsight.api.applicators.fixes.KotlinQuickFixFactory
-import org.jetbrains.kotlin.psi.KtClass
-import org.jetbrains.kotlin.psi.KtProperty
-import org.jetbrains.kotlin.psi.KtPsiFactory
+import org.jetbrains.kotlin.idea.codeinsight.api.classic.quickfixes.KotlinQuickFixAction
+import org.jetbrains.kotlin.idea.k2.refactoring.changeSignature.*
+import org.jetbrains.kotlin.idea.k2.refactoring.changeSignature.KotlinChangeSignatureProcessor
+import org.jetbrains.kotlin.idea.k2.refactoring.introduce.extractionEngine.KotlinNameSuggester
+import org.jetbrains.kotlin.idea.refactoring.addElement
+import org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinValVar
+import org.jetbrains.kotlin.idea.refactoring.changeSignature.toValVar
+import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject
import org.jetbrains.kotlin.psi.psiUtil.endOffset
+import org.jetbrains.kotlin.psi.psiUtil.hasActualModifier
import org.jetbrains.kotlin.psi.psiUtil.startOffset
+import org.jetbrains.kotlin.types.Variance
+import org.jetbrains.kotlin.utils.exceptions.errorWithAttachment
+import org.jetbrains.kotlin.utils.exceptions.withPsiEntry
object InitializePropertyQuickFixFactories {
- private data class ElementContext(
- val initializerText: String,
+ private data class PropertyContext(
+ val defaultInitializer: String,
+ )
+
+ private data class PropertyContextForNewParameter(
+ val defaultInitializer: String,
+ val propertyName: String,
+ val propertyType: String,
)
private class InitializePropertyModCommandAction(
- element: KtProperty,
- elementContext: ElementContext,
- ) : KotlinPsiUpdateModCommandAction.ElementBased(element, elementContext) {
+ property: KtProperty,
+ propertyContext: PropertyContext,
+ ) : KotlinPsiUpdateModCommandAction.ElementBased(property, propertyContext) {
override fun getFamilyName(): String = KotlinBundle.message("add.initializer")
override fun invoke(
actionContext: ActionContext,
element: KtProperty,
- elementContext: ElementContext,
+ elementContext: PropertyContext,
updater: ModPsiUpdater,
) {
val expression = KtPsiFactory(actionContext.project)
- .createExpression(elementContext.initializerText)
+ .createExpression(elementContext.defaultInitializer)
val initializer = element.setInitializer(expression)!!
updater.select(TextRange(initializer.startOffset, initializer.endOffset))
updater.moveCaretTo(initializer.endOffset)
}
}
+ private class InitializeWithConstructorParameterFix(
+ property: KtProperty,
+ private val propertyContext: PropertyContextForNewParameter,
+ ) : KotlinQuickFixAction(property) {
+
+ override fun getText(): @IntentionName String = KotlinBundle.message("initialize.with.constructor.parameter")
+ override fun getFamilyName(): @IntentionFamilyName String = text
+
+ override fun startInWriteAction(): Boolean = false
+
+ override fun invoke(
+ project: Project,
+ editor: Editor?,
+ file: KtFile
+ ) {
+ val property = element ?: return
+
+ val containingClass = property.containingClassOrObject as? KtClass ?: return
+
+ val constructors = buildList {
+ addIfNotNull(containingClass.primaryConstructor)
+ addAll(containingClass.secondaryConstructors)
+
+ // add `null` to change signature of the implicit primary constructor
+ if (isEmpty()) add(null)
+ }
+
+ // the constructor with a changed signature might conflict with an existing one, which is not updated at the moment;
+ // to avoid such conflicts, we need to update constructors in order defined by their parameter count
+ val sortedConstructors = constructors.sortedByDescending { it?.valueParameters?.size ?: 0 }
+ val updatedConstructors = sortedConstructors.map { constructor ->
+ changeConstructorSignature(project, property, constructor, containingClass)
+ }
+
+ application.runWriteAction {
+ for (updatedConstructor in updatedConstructors) {
+ initializeProperty(project, property, updatedConstructor, containingClass)
+ }
+ }
+ }
+
+ private fun initializeProperty(
+ project: Project,
+ property: KtProperty,
+ constructor: KtConstructor<*>,
+ containingClass: KtClass,
+ ) {
+ val newParameterName = constructor.valueParameters.last().name
+ ?: errorWithAttachment(property, constructor, containingClass)
+
+ val psiFactory = org.jetbrains.kotlin.psi.KtPsiFactory(project)
+ when (constructor) {
+ is KtPrimaryConstructor -> property.setInitializer(psiFactory.createExpression(newParameterName))
+ is KtSecondaryConstructor -> {
+ val callToThis = constructor.getDelegationCall().takeIf { it.isCallToThis }
+ if (callToThis != null) {
+ callToThis.valueArguments.last().getArgumentExpression()?.replace(psiFactory.createExpression(newParameterName))
+ } else {
+ val initialization = psiFactory.createExpression("this.${propertyContext.propertyName} = $newParameterName")
+ constructor.getOrCreateBody().addElement(initialization)
+ }
+ }
+ }
+ }
+
+ private fun changeConstructorSignature(
+ project: Project,
+ property: KtProperty,
+ constructor: KtConstructor<*>?,
+ containingClass: KtClass,
+ ): KtConstructor<*> {
+ val constructorPointer = constructor?.createSmartPointer()
+ val containingClassPointer = containingClass.createSmartPointer()
+
+ val validator = KotlinDeclarationNameValidator(
+ visibleDeclarationsContext = containingClass.parent as KtElement,
+ checkVisibleDeclarationsContext = false,
+ target = KotlinNameSuggestionProvider.ValidatorTarget.PARAMETER,
+ )
+
+ val existingNames = constructor?.valueParameters?.mapNotNull { it.name }?.toSet() ?: emptySet()
+
+ val parameterName = analyzeInModalWindow(
+ containingClass,
+ KotlinBundle.message("initialize.with.constructor.parameter.analyzing.existing.variables")
+ ) {
+ KotlinNameSuggester.suggestNameByName(propertyContext.propertyName) { it !in existingNames && validator.validate(it) }
+ }
+
+ val changeInfo = buildChangeInfoForAddingParameter(
+ constructor,
+ containingClass,
+ parameterName,
+ propertyContext.propertyType,
+ propertyContext.defaultInitializer
+ )
+
+ KotlinChangeSignatureProcessor(project, changeInfo).run()
+
+ val updatedConstructor = if (constructorPointer != null) {
+ constructorPointer.element
+ } else {
+ containingClassPointer.element?.primaryConstructor
+ } ?: errorWithAttachment(property, constructor, containingClass)
+
+ return updatedConstructor
+ }
+ }
+
+ private class MoveToConstructorParametersFix(
+ property: KtProperty,
+ private val propertyContext: PropertyContextForNewParameter,
+ ) : KotlinQuickFixAction(property) {
+
+ override fun getText(): @IntentionName String = KotlinBundle.message("move.to.constructor.parameters")
+ override fun getFamilyName(): @IntentionFamilyName String = text
+
+ override fun startInWriteAction(): Boolean = false
+
+ override fun invoke(
+ project: Project,
+ editor: Editor?,
+ file: KtFile
+ ) {
+ val property = element ?: return
+ val containingClass = property.containingClassOrObject as? KtClass ?: return
+ val primaryConstructor = containingClass.primaryConstructor
+
+ val changeInfo = buildChangeInfoForAddingParameter(
+ primaryConstructor,
+ containingClass,
+ propertyContext.propertyName,
+ propertyContext.propertyType,
+ propertyContext.defaultInitializer,
+ valOrVar = property.valOrVarKeyword.toValVar(),
+ )
+
+ val changeSignatureProcessor = object : KotlinChangeSignatureProcessor(project, changeInfo) {
+ override fun performRefactoring(usages: Array) {
+ super.performRefactoring(usages)
+
+ val newParameter = containingClass.primaryConstructor?.valueParameters?.lastOrNull()
+ ?: errorWithAttachment(property, primaryConstructor, containingClass)
+
+ // replace a new parameter with the property text to preserve the property's modifiers and comments
+ val parameterToReplaceWith = KtPsiFactory(project).createParameter(property.text)
+
+ newParameter.replace(parameterToReplaceWith)
+ property.delete()
+ }
+
+ override fun showConflicts(conflicts: MultiMap, usages: Array?): Boolean {
+ // don't show a conflict with the property as it will be removed after the refactoring is performed
+ conflicts.remove(property)
+ return super.showConflicts(conflicts, usages)
+ }
+ }
+
+ changeSignatureProcessor.setPrepareSuccessfulSwingThreadCallback {}
+ changeSignatureProcessor.run()
+ }
+ }
+
// todo refactor
- val mustBeInitialized = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.MustBeInitialized ->
+ val mustBeInitialized = KotlinQuickFixFactory { diagnostic: KaFirDiagnostic.MustBeInitialized ->
createFixes(diagnostic.psi)
}
- val mustBeInitializedWarning = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.MustBeInitializedWarning ->
+ val mustBeInitializedWarning = KotlinQuickFixFactory { diagnostic: KaFirDiagnostic.MustBeInitializedWarning ->
createFixes(diagnostic.psi)
}
- val mustBeInitializedOrBeFinal = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.MustBeInitializedOrBeFinal ->
+ val mustBeInitializedOrBeFinal = KotlinQuickFixFactory { diagnostic: KaFirDiagnostic.MustBeInitializedOrBeFinal ->
createFixes(diagnostic.psi)
}
val mustBeInitializedOrBeFinalWarning =
- KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.MustBeInitializedOrBeFinalWarning ->
+ KotlinQuickFixFactory { diagnostic: KaFirDiagnostic.MustBeInitializedOrBeFinalWarning ->
createFixes(diagnostic.psi)
}
- val mustBeInitializedOrBeAbstract = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.MustBeInitializedOrBeAbstract ->
+ val mustBeInitializedOrBeAbstract = KotlinQuickFixFactory { diagnostic: KaFirDiagnostic.MustBeInitializedOrBeAbstract ->
createFixes(diagnostic.psi)
}
val mustBeInitializedOrBeAbstractWarning =
- KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.MustBeInitializedOrBeAbstractWarning ->
+ KotlinQuickFixFactory { diagnostic: KaFirDiagnostic.MustBeInitializedOrBeAbstractWarning ->
createFixes(diagnostic.psi)
}
val mustBeInitializedOrFinalOrAbstract =
- KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.MustBeInitializedOrFinalOrAbstract ->
+ KotlinQuickFixFactory { diagnostic: KaFirDiagnostic.MustBeInitializedOrFinalOrAbstract ->
createFixes(diagnostic.psi)
}
val mustBeInitializedOrFinalOrAbstractWarning =
- KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.MustBeInitializedOrFinalOrAbstractWarning ->
+ KotlinQuickFixFactory { diagnostic: KaFirDiagnostic.MustBeInitializedOrFinalOrAbstractWarning ->
createFixes(diagnostic.psi)
}
context(KaSession)
@OptIn(KaExperimentalApi::class)
private fun createFixes(
- element: KtProperty,
- ): List> {
+ property: KtProperty,
+ ): List {
// An extension property cannot be initialized because it has no backing field
- if (element.receiverTypeReference != null) return emptyList()
+ if (property.receiverTypeReference != null) return emptyList()
return buildList {
- val elementContext = ElementContext(
- initializerText = element.returnType.defaultInitializer ?: "TODO()",
- )
- add(InitializePropertyModCommandAction(element, elementContext))
+ val propertyType = property.returnType
+ val initializerText = propertyType.defaultInitializer ?: "TODO()"
+ val propertyContext = PropertyContext(initializerText)
- (element.containingClassOrObject as? KtClass)?.let { ktClass ->
+ add(InitializePropertyModCommandAction(property, propertyContext))
+
+ val propertyName = property.name ?: return@buildList
+
+ (property.containingClassOrObject as? KtClass)?.let { ktClass ->
if (ktClass.isAnnotation() || ktClass.isInterface()) return@let
+ if (ktClass.primaryConstructor?.hasActualModifier() == true) return@let
- // TODO: Add quickfixes MoveToConstructorParameters and InitializeWithConstructorParameter after change signature
- // refactoring is available. See org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory
+ val propertyContextForNewParameter = PropertyContextForNewParameter(
+ initializerText,
+ propertyName,
+ propertyType.render(position = Variance.INVARIANT)
+ )
+
+ val secondaryConstructors = ktClass.secondaryConstructors.filterNot(::hasExplicitDelegationCallToThis)
+ if (property.accessors.isEmpty() && secondaryConstructors.isEmpty()) {
+ add(MoveToConstructorParametersFix(property, propertyContextForNewParameter))
+ } else {
+ if (secondaryConstructors.none { it.hasActualModifier() }) {
+ add(InitializeWithConstructorParameterFix(property, propertyContextForNewParameter))
+ }
+ }
}
}
}
+
+ private fun buildChangeInfoForAddingParameter(
+ constructor: KtConstructor<*>?,
+ containingClass: KtClass,
+ name: String,
+ type: String,
+ defaultValueForCall: String,
+ valOrVar: KotlinValVar = KotlinValVar.None,
+ ): KotlinChangeInfo {
+ val constructorOrClass = constructor ?: containingClass
+
+ val methodDescriptor = KotlinMethodDescriptor(constructorOrClass)
+ val changeInfo = KotlinChangeInfo(methodDescriptor)
+
+ val parameterInfo = KotlinParameterInfo(
+ originalType = KotlinTypeInfo(type, constructorOrClass),
+ name = name,
+ valOrVar = valOrVar,
+ defaultValueForCall = KtPsiFactory.contextual(constructorOrClass).createExpression(defaultValueForCall),
+ defaultValueAsDefaultParameter = false,
+ defaultValue = null,
+ context = constructorOrClass,
+ )
+
+ changeInfo.addParameter(parameterInfo)
+
+ return changeInfo
+ }
+
+ private fun hasExplicitDelegationCallToThis(constructor: KtSecondaryConstructor): Boolean = constructor.getDelegationCall().isCallToThis
+
+ private fun errorWithAttachment(property: KtProperty, constructor: KtConstructor<*>?, containingClass: KtClass): Nothing {
+ errorWithAttachment("Failed to perform fix") {
+ withPsiEntry("property", property)
+ withPsiEntry("constructor", constructor)
+ withPsiEntry("containingClass", containingClass)
+ }
+ }
}
diff --git a/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java b/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java
index d8ebca505612..e597a79dfaac 100644
--- a/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java
+++ b/plugins/kotlin/code-insight/fixes-k2/tests/test/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/HighLevelQuickFixTestGenerated.java
@@ -9029,7 +9029,124 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu
}
}
+ @RunWith(JUnit3RunnerWithInners.class)
+ @TestMetadata("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter")
+ public static class InitializeWithConstructorParameter extends AbstractHighLevelQuickFixTest {
+ @java.lang.Override
+ @org.jetbrains.annotations.NotNull
+ public final KotlinPluginMode getPluginMode() {
+ return KotlinPluginMode.K2;
+ }
+ private void runTest(String testDataFilePath) throws Exception {
+ KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
+ }
+
+ @TestMetadata("constructorWithThisDelegation.kt")
+ public void testConstructorWithThisDelegation() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.kt");
+ }
+
+ @TestMetadata("genericParameterInScope.kt")
+ public void testGenericParameterInScope() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/genericParameterInScope.kt");
+ }
+
+ @TestMetadata("localVar.kt")
+ public void testLocalVar() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/localVar.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassNameClashInPrimaryConstructor.kt")
+ public void testMemberPropertyInClassNameClashInPrimaryConstructor() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassNameClashInPrimaryConstructor2.kt")
+ public void testMemberPropertyInClassNameClashInPrimaryConstructor2() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor2.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassNameClashInSecondaryConstructor.kt")
+ public void testMemberPropertyInClassNameClashInSecondaryConstructor() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInSecondaryConstructor.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassNoConstructors.kt")
+ public void testMemberPropertyInClassNoConstructors() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNoConstructors.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassPrimaryAndSecondaryConstructors.kt")
+ public void testMemberPropertyInClassPrimaryAndSecondaryConstructors() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassPrimaryConstructorOnly.kt")
+ public void testMemberPropertyInClassPrimaryConstructorOnly() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryConstructorOnly.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassSecondaryConstructorsOnly.kt")
+ public void testMemberPropertyInClassSecondaryConstructorsOnly() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassSecondaryConstructorsOnly.kt");
+ }
+
+ @TestMetadata("memberPropertyInInterface.kt")
+ public void testMemberPropertyInInterface() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInInterface.kt");
+ }
+
+ @TestMetadata("memberPropertyInObject.kt")
+ public void testMemberPropertyInObject() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInObject.kt");
+ }
+
+ @TestMetadata("memberPropertyNoAccessorsInClassNoConstructors.kt")
+ public void testMemberPropertyNoAccessorsInClassNoConstructors() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassNoConstructors.kt");
+ }
+
+ @TestMetadata("memberPropertyNoAccessorsInClassPrimaryAndSecondaryConstructors.kt")
+ public void testMemberPropertyNoAccessorsInClassPrimaryAndSecondaryConstructors() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryAndSecondaryConstructors.kt");
+ }
+
+ @TestMetadata("memberPropertyNoAccessorsInClassPrimaryConstructorOnly.kt")
+ public void testMemberPropertyNoAccessorsInClassPrimaryConstructorOnly() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryConstructorOnly.kt");
+ }
+
+ @TestMetadata("memberPropertyWithDelegateRuntime.kt")
+ public void testMemberPropertyWithDelegateRuntime() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyWithDelegateRuntime.kt");
+ }
+
+ @TestMetadata("multipleConstructors.kt")
+ public void testMultipleConstructors() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructors.kt");
+ }
+
+ @TestMetadata("multipleConstructorsClash.kt")
+ public void testMultipleConstructorsClash() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash.kt");
+ }
+
+ @TestMetadata("multipleConstructorsClash2.kt")
+ public void testMultipleConstructorsClash2() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash2.kt");
+ }
+
+ @TestMetadata("namelessProperty.kt")
+ public void testNamelessProperty() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/namelessProperty.kt");
+ }
+
+ @TestMetadata("topLevelProperty.kt")
+ public void testTopLevelProperty() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/initializeWithConstructorParameter/topLevelProperty.kt");
+ }
+ }
@RunWith(JUnit3RunnerWithInners.class)
@TestMetadata("../../../idea/tests/testData/quickfix/inlineClass")
@@ -9289,7 +9406,79 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu
}
}
+ @RunWith(JUnit3RunnerWithInners.class)
+ @TestMetadata("../../../idea/tests/testData/quickfix/moveToConstructorParameters")
+ public static class MoveToConstructorParameters extends AbstractHighLevelQuickFixTest {
+ @java.lang.Override
+ @org.jetbrains.annotations.NotNull
+ public final KotlinPluginMode getPluginMode() {
+ return KotlinPluginMode.K2;
+ }
+ private void runTest(String testDataFilePath) throws Exception {
+ KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
+ }
+
+ @TestMetadata("localVar.kt")
+ public void testLocalVar() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/localVar.kt");
+ }
+
+ @TestMetadata("memberExtensionProperty.kt")
+ public void testMemberExtensionProperty() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/memberExtensionProperty.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassNameClash.kt")
+ public void testMemberPropertyInClassNameClash() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNameClash.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassNoPrimaryConstructor.kt")
+ public void testMemberPropertyInClassNoPrimaryConstructor() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNoPrimaryConstructor.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassWithConstructorDelegatingToSuper.kt")
+ public void testMemberPropertyInClassWithConstructorDelegatingToSuper() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithConstructorDelegatingToSuper.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassWithImplicitlyDelegatingConstructor.kt")
+ public void testMemberPropertyInClassWithImplicitlyDelegatingConstructor() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithImplicitlyDelegatingConstructor.kt");
+ }
+
+ @TestMetadata("memberPropertyInClassWithPrimaryConstructor.kt")
+ public void testMemberPropertyInClassWithPrimaryConstructor() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithPrimaryConstructor.kt");
+ }
+
+ @TestMetadata("memberPropertyInInterface.kt")
+ public void testMemberPropertyInInterface() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInInterface.kt");
+ }
+
+ @TestMetadata("memberPropertyInObject.kt")
+ public void testMemberPropertyInObject() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInObject.kt");
+ }
+
+ @TestMetadata("memberPropertyWithDelegateRuntime.kt")
+ public void testMemberPropertyWithDelegateRuntime() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyWithDelegateRuntime.kt");
+ }
+
+ @TestMetadata("propertyWithModifiersAndComments.kt")
+ public void testPropertyWithModifiersAndComments() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/propertyWithModifiersAndComments.kt");
+ }
+
+ @TestMetadata("topLevelProperty.kt")
+ public void testTopLevelProperty() throws Exception {
+ runTest("../../../idea/tests/testData/quickfix/moveToConstructorParameters/topLevelProperty.kt");
+ }
+ }
diff --git a/plugins/kotlin/core/src/org/jetbrains/kotlin/idea/core/psiModificationUtils.kt b/plugins/kotlin/core/src/org/jetbrains/kotlin/idea/core/psiModificationUtils.kt
index 8e64fa24e111..4516ed4a0171 100644
--- a/plugins/kotlin/core/src/org/jetbrains/kotlin/idea/core/psiModificationUtils.kt
+++ b/plugins/kotlin/core/src/org/jetbrains/kotlin/idea/core/psiModificationUtils.kt
@@ -468,15 +468,6 @@ private fun KtDeclaration.predictImplicitModality(): KtModifierKeywordToken {
return KtTokens.FINAL_KEYWORD
}
-fun KtSecondaryConstructor.getOrCreateBody(): KtBlockExpression {
- bodyExpression?.let { return it }
-
- val delegationCall = getDelegationCall()
- val anchor = if (delegationCall.isImplicit) valueParameterList else delegationCall
- val newBody = KtPsiFactory(project).createEmptyBody()
- return addAfter(newBody, anchor) as KtBlockExpression
-}
-
fun KtParameter.dropDefaultValue() {
val from = equalsToken ?: return
val to = defaultValue ?: from
diff --git a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/InitializePropertyQuickFixFactory.kt b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/InitializePropertyQuickFixFactory.kt
index 25d3ee7b0cc6..1058842f9009 100644
--- a/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/InitializePropertyQuickFixFactory.kt
+++ b/plugins/kotlin/idea/src/org/jetbrains/kotlin/idea/quickfix/InitializePropertyQuickFixFactory.kt
@@ -19,12 +19,12 @@ import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import org.jetbrains.kotlin.descriptors.VariableDescriptor
import org.jetbrains.kotlin.diagnostics.Diagnostic
import org.jetbrains.kotlin.idea.base.codeInsight.KotlinNameSuggester
+import org.jetbrains.kotlin.idea.base.psi.getOrCreateBody
import org.jetbrains.kotlin.idea.base.resources.KotlinBundle
-import org.jetbrains.kotlin.idea.core.CollectingNameValidator
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
import org.jetbrains.kotlin.idea.codeInsight.shorten.runRefactoringAndKeepDelayedRequests
import org.jetbrains.kotlin.idea.codeinsight.api.classic.quickfixes.KotlinQuickFixAction
-import org.jetbrains.kotlin.idea.core.getOrCreateBody
+import org.jetbrains.kotlin.idea.core.CollectingNameValidator
import org.jetbrains.kotlin.idea.refactoring.CompositeRefactoringRunner
import org.jetbrains.kotlin.idea.refactoring.addElement
import org.jetbrains.kotlin.idea.refactoring.changeSignature.*
diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/K1QuickFixTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/K1QuickFixTestGenerated.java
index 9864d409dffe..e5fe0ae3a4a1 100644
--- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/K1QuickFixTestGenerated.java
+++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/K1QuickFixTestGenerated.java
@@ -10117,6 +10117,11 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest {
runTest("testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor.kt");
}
+ @TestMetadata("memberPropertyInClassNameClashInPrimaryConstructor2.kt")
+ public void testMemberPropertyInClassNameClashInPrimaryConstructor2() throws Exception {
+ runTest("testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor2.kt");
+ }
+
@TestMetadata("memberPropertyInClassNameClashInSecondaryConstructor.kt")
public void testMemberPropertyInClassNameClashInSecondaryConstructor() throws Exception {
runTest("testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInSecondaryConstructor.kt");
@@ -10177,6 +10182,21 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest {
runTest("testData/quickfix/initializeWithConstructorParameter/multipleConstructors.kt");
}
+ @TestMetadata("multipleConstructorsClash.kt")
+ public void testMultipleConstructorsClash() throws Exception {
+ runTest("testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash.kt");
+ }
+
+ @TestMetadata("multipleConstructorsClash2.kt")
+ public void testMultipleConstructorsClash2() throws Exception {
+ runTest("testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash2.kt");
+ }
+
+ @TestMetadata("namelessProperty.kt")
+ public void testNamelessProperty() throws Exception {
+ runTest("testData/quickfix/initializeWithConstructorParameter/namelessProperty.kt");
+ }
+
@TestMetadata("topLevelProperty.kt")
public void testTopLevelProperty() throws Exception {
runTest("testData/quickfix/initializeWithConstructorParameter/topLevelProperty.kt");
diff --git a/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notInitializeNonActualParameterWithConstructorParameter/jvm/jvm.kt b/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notInitializeNonActualParameterWithConstructorParameter/jvm/jvm.kt
index 2f0c2449a804..348175263c74 100644
--- a/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notInitializeNonActualParameterWithConstructorParameter/jvm/jvm.kt
+++ b/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notInitializeNonActualParameterWithConstructorParameter/jvm/jvm.kt
@@ -1,14 +1,6 @@
// "Initialize with constructor parameter" "false"
-// ACTION: Add getter
-// ACTION: Add initializer
-// ACTION: Apply all 'Add modifier' fixes in file
-// ACTION: Convert member to extension
-// ACTION: Convert property to function
-// ACTION: Introduce backing property
-// ACTION: Make 'b' 'abstract'
-// ACTION: Move to companion object
+// IGNORE_IRRELEVANT_ACTIONS
// ERROR: Property must be initialized or be abstract
-// IGNORE_K2
actual class SimpleWConstructor {
val b: String
diff --git a/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notInitializeWithConstructorParameter/jvm/jvm.kt b/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notInitializeWithConstructorParameter/jvm/jvm.kt
index 4c8781474cdb..20b9dd8edbcf 100644
--- a/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notInitializeWithConstructorParameter/jvm/jvm.kt
+++ b/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notInitializeWithConstructorParameter/jvm/jvm.kt
@@ -1,14 +1,6 @@
// "Initialize with constructor parameter" "false"
-// ACTION: Add getter
-// ACTION: Add initializer
-// ACTION: Apply all 'Add modifier' fixes in file
-// ACTION: Convert member to extension
-// ACTION: Convert property to function
-// ACTION: Introduce backing property
-// ACTION: Make 'b' 'abstract'
-// ACTION: Move to companion object
+// IGNORE_IRRELEVANT_ACTIONS
// ERROR: Property must be initialized or be abstract
-// IGNORE_K2
actual class SimpleWConstructor {
actual val b: String
diff --git a/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notMoveNonActualParamterToActualConstructor/jvm/jvm.kt b/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notMoveNonActualParamterToActualConstructor/jvm/jvm.kt
index b7cd51b69b0e..6bd089237e5a 100644
--- a/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notMoveNonActualParamterToActualConstructor/jvm/jvm.kt
+++ b/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notMoveNonActualParamterToActualConstructor/jvm/jvm.kt
@@ -1,14 +1,6 @@
// "Move to constructor parameters" "false"
-// ACTION: Add getter
-// ACTION: Add initializer
-// ACTION: Apply all 'Add modifier' fixes in file
-// ACTION: Convert member to extension
-// ACTION: Convert property to function
-// ACTION: Introduce backing property
-// ACTION: Make 'b' 'abstract'
-// ACTION: Move to companion object
+// IGNORE_IRRELEVANT_ACTIONS
// ERROR: Property must be initialized or be abstract
-// IGNORE_K2
actual class SimpleWConstructor actual constructor(i: Int) {
val b: String
diff --git a/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notMoveToActualConstructor/jvm/jvm.kt b/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notMoveToActualConstructor/jvm/jvm.kt
index d5f57bb4c688..4ea8da3e08a4 100644
--- a/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notMoveToActualConstructor/jvm/jvm.kt
+++ b/plugins/kotlin/idea/tests/testData/multiModuleQuickFix/initializeProperty/notMoveToActualConstructor/jvm/jvm.kt
@@ -1,14 +1,6 @@
// "Move to constructor parameters" "false"
-// ACTION: Add getter
-// ACTION: Add initializer
-// ACTION: Apply all 'Add modifier' fixes in file
-// ACTION: Convert member to extension
-// ACTION: Convert property to function
-// ACTION: Introduce backing property
-// ACTION: Make 'b' 'abstract'
-// ACTION: Move to companion object
+// IGNORE_IRRELEVANT_ACTIONS
// ERROR: Property must be initialized or be abstract
-// IGNORE_K2
actual class SimpleWConstructor actual constructor(i: Int) {
actual val b: String
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.k2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.k2.kt.after
new file mode 100644
index 000000000000..188cb4edf693
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.k2.kt.after
@@ -0,0 +1,13 @@
+// "Initialize with constructor parameter" "true"
+open class RGrandAccessor(x: Int) {}
+
+open class RAccessor : RGrandAccessor {
+ val f: Int
+ constructor(p: Boolean, f: Int) : super(1) {
+ this.f = f
+ }
+
+ constructor(p: String, f: Int) : this(true, f)
+}
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.kt
index 5671a5358bcd..8d43bc403139 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.kt
@@ -6,4 +6,5 @@ open class RAccessor : RGrandAccessor {
constructor(p: Boolean) : super(1)
constructor(p: String) : this(true)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.kt.after
index c9baa24891c5..9e246626b900 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/constructorWithThisDelegation.kt.after
@@ -9,4 +9,5 @@ open class RAccessor : RGrandAccessor {
constructor(p: String) : this(true, 0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/genericParameterInScope.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/genericParameterInScope.kt
index 7451e48291ed..d03e5688b0ad 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/genericParameterInScope.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/genericParameterInScope.kt
@@ -9,4 +9,5 @@ abstract class Form(val name: String){
abstract protected fun processData(data: T)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/genericParameterInScope.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/genericParameterInScope.kt.after
index 92ebb969e763..6705f637e67a 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/genericParameterInScope.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/genericParameterInScope.kt.after
@@ -9,4 +9,5 @@ abstract class Form(val name: String, data: T?){
abstract protected fun processData(data: T)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/localVar.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/localVar.kt
index 817bcb29206a..7bf13d9f32e4 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/localVar.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/localVar.kt
@@ -1,4 +1,4 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
+// "Initialize with constructor parameter" "false"
fun test() {
val n: Int
}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor.kt
index 91cc61da2100..1d0f6e3b09e3 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor.kt
@@ -9,4 +9,5 @@ class B : A(0)
fun test() {
val a = A(0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor.kt.after
index 28dcae292a45..7e1db956424e 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor.kt.after
@@ -9,4 +9,5 @@ class B : A(0, 0)
fun test() {
val a = A(0, 0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor2.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor2.kt
new file mode 100644
index 000000000000..051984957468
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor2.kt
@@ -0,0 +1,10 @@
+// IGNORE_K1
+// "Initialize with constructor parameter" "true"
+val n: Int = 1
+
+class A(m: Int = n) {
+ var n: Int
+ get() = 1
+}
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor2.kt.after
new file mode 100644
index 000000000000..b7c0a717892e
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInPrimaryConstructor2.kt.after
@@ -0,0 +1,10 @@
+// IGNORE_K1
+// "Initialize with constructor parameter" "true"
+val n: Int = 1
+
+class A(m: Int = n, n1: Int) {
+ var n: Int = n1
+ get() = 1
+}
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInSecondaryConstructor.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInSecondaryConstructor.kt
index 89fbea0616a5..ee0b38b820e3 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInSecondaryConstructor.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInSecondaryConstructor.kt
@@ -10,4 +10,5 @@ class B : A(1)
fun test() {
val a = A(1)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInSecondaryConstructor.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInSecondaryConstructor.kt.after
index 2e4498c200ec..55e724c08a7d 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInSecondaryConstructor.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNameClashInSecondaryConstructor.kt.after
@@ -12,4 +12,5 @@ class B : A(1, 0)
fun test() {
val a = A(1, 0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNoConstructors.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNoConstructors.kt
index e48d6e467a7e..2f8de0c4eb18 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNoConstructors.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNoConstructors.kt
@@ -9,4 +9,5 @@ class B : A()
fun test() {
val a = A()
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNoConstructors.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNoConstructors.kt.after
index fa342cdcf09b..318555bdd6d2 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNoConstructors.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassNoConstructors.kt.after
@@ -9,4 +9,5 @@ class B : A(0)
fun test() {
val a = A(0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.k2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.k2.kt.after
new file mode 100644
index 000000000000..116663e0fe6e
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.k2.kt.after
@@ -0,0 +1,16 @@
+// "Initialize with constructor parameter" "true"
+open class A(s: String, n: Int) {
+ var n: Int = n
+ get() = 1
+
+ constructor(n: Int) : this("", n)
+ constructor(a: Int, n: Int): this("" + a, n)
+}
+
+class B : A("", 0)
+
+fun test() {
+ val a = A("", 0)
+}
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.kt
index 8ce9ae631ea7..b3479051cc31 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.kt
@@ -12,4 +12,5 @@ class B : A("")
fun test() {
val a = A("")
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.kt.after
index 295bb6069f6d..f6dacbfb7321 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryAndSecondaryConstructors.kt.after
@@ -12,4 +12,5 @@ class B : A("", 0)
fun test() {
val a = A("", 0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryConstructorOnly.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryConstructorOnly.kt
index bca4afb83b59..47efe17e8e86 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryConstructorOnly.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryConstructorOnly.kt
@@ -9,4 +9,5 @@ class B : A("")
fun test() {
val a = A("")
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryConstructorOnly.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryConstructorOnly.kt.after
index 78dccf9e748b..43bac9861fb9 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryConstructorOnly.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassPrimaryConstructorOnly.kt.after
@@ -9,4 +9,5 @@ class B : A("", 0)
fun test() {
val a = A("", 0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassSecondaryConstructorsOnly.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassSecondaryConstructorsOnly.kt
index d647c7907829..56ca48565558 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassSecondaryConstructorsOnly.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassSecondaryConstructorsOnly.kt
@@ -17,4 +17,5 @@ fun test() {
val a = A("")
val aa = A(1)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassSecondaryConstructorsOnly.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassSecondaryConstructorsOnly.kt.after
index 731954504032..05c588057c65 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassSecondaryConstructorsOnly.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInClassSecondaryConstructorsOnly.kt.after
@@ -20,4 +20,5 @@ fun test() {
val a = A("", 0)
val aa = A(1, 0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInInterface.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInInterface.kt
index b6e3e508db09..11d581581d46 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInInterface.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInInterface.kt
@@ -1,7 +1,4 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
-// ACTION: Make internal
-// ACTION: Make private
-// ACTION: Make protected
+// "Initialize with constructor parameter" "false"
interface A {
val n: Int
}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInObject.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInObject.kt
index 209deda6b88e..7a93c8711075 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInObject.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyInObject.kt
@@ -1,6 +1,6 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
-// ACTION: Initialize property 'n'
-// ACTION: Make 'n' abstract
+// "Initialize with constructor parameter" "false"
+// ACTION: Add getter
+// ACTION: Add initializer
// ACTION: Make internal
// ACTION: Make private
// ERROR: Property must be initialized or be abstract
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassNoConstructors.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassNoConstructors.kt
index 0c9c892c734e..3c1760c42972 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassNoConstructors.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassNoConstructors.kt
@@ -1,4 +1,4 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
+// "Initialize with constructor parameter" "false"
// ERROR: Property must be initialized or be abstract
open class A {
val n: Int
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryAndSecondaryConstructors.k2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryAndSecondaryConstructors.k2.kt.after
new file mode 100644
index 000000000000..45de145a0c47
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryAndSecondaryConstructors.k2.kt.after
@@ -0,0 +1,15 @@
+// "Initialize with constructor parameter" "true"
+open class A(s: String, n: Int) {
+ val n: Int = n
+
+ constructor(n: Int) : this("", n)
+ constructor(a: Int, n: Int): this("" + a, n)
+}
+
+class B : A("", 0)
+
+fun test() {
+ val a = A("", 0)
+}
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryAndSecondaryConstructors.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryAndSecondaryConstructors.kt
index 4eb56f80da13..fd0d56c34884 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryAndSecondaryConstructors.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryAndSecondaryConstructors.kt
@@ -1,4 +1,4 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
+// "Initialize with constructor parameter" "false"
// ERROR: Property must be initialized or be abstract
open class A(s: String) {
val n: Int
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryConstructorOnly.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryConstructorOnly.kt
index d9d6c9379899..2c0d17d8178f 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryConstructorOnly.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyNoAccessorsInClassPrimaryConstructorOnly.kt
@@ -1,4 +1,4 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
+// "Initialize with constructor parameter" "false"
// ERROR: Property must be initialized or be abstract
open class A(s: String) {
val n: Int
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyWithDelegateRuntime.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyWithDelegateRuntime.kt
index f268df39d2ad..b49d735e845b 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyWithDelegateRuntime.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/memberPropertyWithDelegateRuntime.kt
@@ -1,4 +1,5 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
+// "Initialize with constructor parameter" "false"
+// ACTION: Convert to ordinary property
// ACTION: Make internal
// ACTION: Make private
// ACTION: Make protected
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructors.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructors.kt
index e0044d5b048a..4298391f6b1a 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructors.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructors.kt
@@ -6,4 +6,5 @@ class User {
val userName: String
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructors.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructors.kt.after
index 2f194bab4d67..2a2484317fb2 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructors.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructors.kt.after
@@ -11,4 +11,5 @@ class User {
val userName: String
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash.kt
new file mode 100644
index 000000000000..fc8be4ccb056
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash.kt
@@ -0,0 +1,13 @@
+// IGNORE_K1
+// "Initialize with constructor parameter" "true"
+class User {
+ constructor()
+ constructor(blah: String): this()
+ constructor(blah: String, n: Int, default: Int = 2)
+ constructor(d: Double): this("", 1)
+ constructor(n: Int)
+
+ val userName: String
+}
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash.kt.after
new file mode 100644
index 000000000000..03bcba3dc217
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash.kt.after
@@ -0,0 +1,21 @@
+// IGNORE_K1
+// "Initialize with constructor parameter" "true"
+class User {
+ constructor(userName: String) {
+ this.userName = userName
+ }
+
+ constructor(blah: String, userName: String): this(userName)
+ constructor(blah: String, n: Int, default: Int = 2, userName: String) {
+ this.userName = userName
+ }
+
+ constructor(d: Double, userName: String): this("", 1, userName = userName)
+ constructor(n: Int, userName: String) {
+ this.userName = userName
+ }
+
+ val userName: String
+}
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash2.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash2.kt
new file mode 100644
index 000000000000..cfcbdd5f32f2
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash2.kt
@@ -0,0 +1,9 @@
+// IGNORE_K1
+// "Initialize with constructor parameter" "true"
+class User(n: Int) {
+ constructor(n: Int, s: String) : this(n)
+
+ val userName: String
+}
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash2.kt.after
new file mode 100644
index 000000000000..3c3035a849c5
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/multipleConstructorsClash2.kt.after
@@ -0,0 +1,9 @@
+// IGNORE_K1
+// "Initialize with constructor parameter" "true"
+class User(n: Int, userName: String) {
+ constructor(n: Int, s: String, userName: String) : this(n, userName)
+
+ val userName: String = userName
+}
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$InitializeWithConstructorParameterFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/namelessProperty.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/namelessProperty.kt
new file mode 100644
index 000000000000..f309be484a19
--- /dev/null
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/namelessProperty.kt
@@ -0,0 +1,6 @@
+// "Initialize with constructor parameter" "false"
+// ERROR: Property must be initialized
+class A {
+ var : Int
+ get() = 1
+}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/topLevelProperty.kt b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/topLevelProperty.kt
index ffd16f875d70..8756ec4db71e 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/topLevelProperty.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/initializeWithConstructorParameter/topLevelProperty.kt
@@ -1,5 +1,6 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$InitializeWithConstructorParameter" "false"
-// ACTION: Initialize property 'n'
+// "Initialize with constructor parameter" "false"
+// ACTION: Add getter
+// ACTION: Add initializer
// ACTION: Make internal
// ACTION: Make private
// ERROR: Property must be initialized
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/noLateinitOnNullable.kt b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/noLateinitOnNullable.kt
index d576d3f410b3..b52b1963b740 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/noLateinitOnNullable.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/noLateinitOnNullable.kt
@@ -1,6 +1,7 @@
// "Add 'lateinit' modifier" "false"
// ACTION: Add initializer
// ACTION: Make 'a' 'abstract'
+// ACTION: Initialize with constructor parameter
// ACTION: Move to constructor parameters
// ACTION: Move to constructor
// ACTION: Add getter
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/noLateinitOnPrimitive.kt b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/noLateinitOnPrimitive.kt
index 6330611ae9c1..4ca10d66b739 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/modifiers/noLateinitOnPrimitive.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/modifiers/noLateinitOnPrimitive.kt
@@ -4,6 +4,7 @@
// ACTION: Add full qualifier
// ACTION: Introduce import alias
// ACTION: Make 'a' 'abstract'
+// ACTION: Initialize with constructor parameter
// ACTION: Move to constructor parameters
// ACTION: Move to constructor
// ACTION: Add getter
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/localVar.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/localVar.kt
index aa94b9cc52dd..18af911ca729 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/localVar.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/localVar.kt
@@ -1,4 +1,4 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
+// "Move to constructor parameters" "false"
fun test() {
val n: Int
}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberExtensionProperty.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberExtensionProperty.kt
index b047ccb67073..2a9ea66d5182 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberExtensionProperty.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberExtensionProperty.kt
@@ -1,8 +1,9 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
-// ACTION: Make 'n' abstract
+// "Move to constructor parameters" "false"
+// ACTION: Add getter
// ACTION: Make internal
// ACTION: Make private
// ACTION: Make protected
+// ACTION: Move to constructor
// ERROR: Extension property must have accessors or be abstract
class A {
val Int.n: Int
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNameClash.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNameClash.kt
index 5d0e1290aea9..d5a3065e73e8 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNameClash.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNameClash.kt
@@ -7,4 +7,5 @@ open class A(n: Int) {
fun test() {
val a = A(0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$MoveToConstructorParametersFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNoPrimaryConstructor.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNoPrimaryConstructor.kt
index 5c17a07c9abf..44bab809d056 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNoPrimaryConstructor.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNoPrimaryConstructor.kt
@@ -8,4 +8,5 @@ class B : A()
fun test() {
val a = A()
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$MoveToConstructorParametersFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNoPrimaryConstructor.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNoPrimaryConstructor.kt.after
index 749eae92b3dd..c3c0487290eb 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNoPrimaryConstructor.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassNoPrimaryConstructor.kt.after
@@ -7,4 +7,5 @@ class B : A(0)
fun test() {
val a = A(0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$MoveToConstructorParametersFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithConstructorDelegatingToSuper.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithConstructorDelegatingToSuper.kt
index 0dc0e413840e..3d09a82426df 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithConstructorDelegatingToSuper.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithConstructorDelegatingToSuper.kt
@@ -1,10 +1,11 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
-// ACTION: Initialize property 'n'
-// ACTION: Make 'n' abstract
+// "Move to constructor parameters" "false"
+// ACTION: Add getter
+// ACTION: Add initializer
+// ACTION: Initialize with constructor parameter
+// ACTION: Make 'n' 'abstract'
// ACTION: Make internal
// ACTION: Make private
// ACTION: Make protected
-// ACTION: Initialize with constructor parameter
// ERROR: Property must be initialized or be abstract
open class A(x: Int)
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithImplicitlyDelegatingConstructor.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithImplicitlyDelegatingConstructor.kt
index c2f08773798f..2e44adab115b 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithImplicitlyDelegatingConstructor.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithImplicitlyDelegatingConstructor.kt
@@ -1,10 +1,11 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
-// ACTION: Initialize property 'n'
-// ACTION: Make 'n' abstract
+// "Move to constructor parameters" "false"
+// ACTION: Add getter
+// ACTION: Add initializer
+// ACTION: Initialize with constructor parameter
+// ACTION: Make 'n' 'abstract'
// ACTION: Make internal
// ACTION: Make private
// ACTION: Make protected
-// ACTION: Initialize with constructor parameter
// ERROR: Property must be initialized or be abstract
open class A
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithPrimaryConstructor.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithPrimaryConstructor.kt
index 5aefb70d8112..cce695558294 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithPrimaryConstructor.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithPrimaryConstructor.kt
@@ -10,4 +10,5 @@ class B : A("")
fun test() {
val a = A("")
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$MoveToConstructorParametersFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithPrimaryConstructor.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithPrimaryConstructor.kt.after
index a80d1e5e942b..e444502644d1 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithPrimaryConstructor.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInClassWithPrimaryConstructor.kt.after
@@ -9,4 +9,5 @@ class B : A("", 0)
fun test() {
val a = A("", 0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$MoveToConstructorParametersFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInInterface.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInInterface.kt
index 38756c5d1f0d..54b14f3e3cb8 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInInterface.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInInterface.kt
@@ -1,7 +1,4 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
-// ACTION: Make internal
-// ACTION: Make private
-// ACTION: Make protected
+// "Move to constructor parameters" "false"
interface A {
val n: Int
}
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInObject.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInObject.kt
index 911f4692dd2e..452e7d822150 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInObject.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyInObject.kt
@@ -1,6 +1,6 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
-// ACTION: Initialize property 'n'
-// ACTION: Make 'n' abstract
+// "Move to constructor parameters" "false"
+// ACTION: Add getter
+// ACTION: Add initializer
// ACTION: Make internal
// ACTION: Make private
// ERROR: Property must be initialized or be abstract
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyWithDelegateRuntime.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyWithDelegateRuntime.kt
index 31f74e3142d1..2da46fef0d5d 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyWithDelegateRuntime.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/memberPropertyWithDelegateRuntime.kt
@@ -1,4 +1,5 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
+// "Move to constructor parameters" "false"
+// ACTION: Convert to ordinary property
// ACTION: Make internal
// ACTION: Make private
// ACTION: Make protected
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/propertyWithModifiersAndComments.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/propertyWithModifiersAndComments.kt
index 3130048caada..9babd701d297 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/propertyWithModifiersAndComments.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/propertyWithModifiersAndComments.kt
@@ -10,4 +10,5 @@ class B : A("")
fun test() {
val a = A("")
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$MoveToConstructorParametersFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/propertyWithModifiersAndComments.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/propertyWithModifiersAndComments.kt.after
index 7aae6e38eac7..65fb71c3e38c 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/propertyWithModifiersAndComments.kt.after
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/propertyWithModifiersAndComments.kt.after
@@ -9,4 +9,5 @@ class B : A("", 0)
fun test() {
val a = A("", 0)
}
-// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
\ No newline at end of file
+// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters
+// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.InitializePropertyQuickFixFactories$MoveToConstructorParametersFix
\ No newline at end of file
diff --git a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/topLevelProperty.kt b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/topLevelProperty.kt
index ff8c9ed8cdc5..ed6341e8393c 100644
--- a/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/topLevelProperty.kt
+++ b/plugins/kotlin/idea/tests/testData/quickfix/moveToConstructorParameters/topLevelProperty.kt
@@ -1,5 +1,6 @@
-// "class org.jetbrains.kotlin.idea.quickfix.InitializePropertyQuickFixFactory$MoveToConstructorParameters" "false"
-// ACTION: Initialize property 'n'
+// "Move to constructor parameters" "false"
+// ACTION: Add getter
+// ACTION: Add initializer
// ACTION: Make internal
// ACTION: Make private
// ERROR: Property must be initialized
diff --git a/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2QuickFixTests.kt b/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2QuickFixTests.kt
index 96a4cb5d6ced..6b9a075c4891 100644
--- a/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2QuickFixTests.kt
+++ b/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/codeinsight/GenerateK2QuickFixTests.kt
@@ -123,7 +123,7 @@ internal fun MutableTWorkspace.generateK2FixTests() {
model("$idea/quickfix/implement", pattern = pattern)
model("$idea/quickfix/importAlias", pattern = pattern, isIgnored = true)
model("$idea/quickfix/increaseVisibility", pattern = pattern)
- model("$idea/quickfix/initializeWithConstructorParameter", pattern = pattern, isIgnored = true)
+ model("$idea/quickfix/initializeWithConstructorParameter", pattern = pattern)
model("$idea/quickfix/inlineClass", pattern = pattern)
model("$idea/quickfix/inlineTypeParameterFix", pattern = pattern, isIgnored = true)
model("$idea/quickfix/insertDelegationCall", pattern = pattern)
@@ -141,7 +141,7 @@ internal fun MutableTWorkspace.generateK2FixTests() {
model("$idea/quickfix/missingConstructorBrackets", pattern = pattern)
model("$idea/quickfix/moveMemberToCompanionObject", pattern = pattern, isIgnored = true)
model("$idea/quickfix/moveReceiverAnnotation", pattern = pattern)
- model("$idea/quickfix/moveToConstructorParameters", pattern = pattern, isIgnored = true)
+ model("$idea/quickfix/moveToConstructorParameters", pattern = pattern)
model("$idea/quickfix/moveToSealedParent", pattern = pattern, isIgnored = true)
model("$idea/quickfix/moveTypeAliasToTopLevel", pattern = pattern)
model("$idea/quickfix/obsoleteKotlinJsPackages", pattern = pattern, isIgnored = true)