diff --git a/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/KotlinK2QuickFixRegistrar.kt b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/KotlinK2QuickFixRegistrar.kt index 83a664d9a812..48db2b545fb2 100644 --- a/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/KotlinK2QuickFixRegistrar.kt +++ b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/KotlinK2QuickFixRegistrar.kt @@ -371,6 +371,14 @@ class KotlinK2QuickFixRegistrar : KotlinQuickFixRegistrar() { registerFactory(ActualAnnotationsNotMatchExpectFixFactory.factory) } + private val removePartsFromProperty = KtQuickFixesListBuilder.registerPsiQuickFix { + registerFactory(RemovePartsFromPropertyFixFactory.abstractPropertyWithGetter) + registerFactory(RemovePartsFromPropertyFixFactory.abstractPropertyWithInitializer) + registerFactory(RemovePartsFromPropertyFixFactory.abstractPropertyWithSetter) + registerFactory(RemovePartsFromPropertyFixFactory.inapplicableLateinitModifier) + registerFactory(RemovePartsFromPropertyFixFactory.propertyInitializerInInterface) + } + private val surroundWithNullCheck = KtQuickFixesListBuilder.registerPsiQuickFix { registerFactory(SurroundWithNullCheckFixFactory.argumentTypeMismatchFactory) registerFactory(SurroundWithNullCheckFixFactory.assignmentTypeMismatchFactory) @@ -398,6 +406,7 @@ class KotlinK2QuickFixRegistrar : KotlinQuickFixRegistrar() { whenStatements, typeMismatch, needExplicitType, + removePartsFromProperty, superKeyword, surroundWithNullCheck, vararg, diff --git a/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/RemovePartsFromPropertyFixFactory.kt b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/RemovePartsFromPropertyFixFactory.kt new file mode 100644 index 000000000000..479aebfad4da --- /dev/null +++ b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/RemovePartsFromPropertyFixFactory.kt @@ -0,0 +1,132 @@ +// 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.modcommand.ActionContext +import com.intellij.modcommand.ModPsiUpdater +import com.intellij.openapi.project.Project +import org.jetbrains.kotlin.analysis.api.KaSession +import org.jetbrains.kotlin.analysis.api.fir.diagnostics.KaFirDiagnostic +import org.jetbrains.kotlin.idea.codeinsight.api.applicable.intentions.KotlinPsiUpdateModCommandAction +import org.jetbrains.kotlin.idea.codeinsight.api.applicators.fixes.KotlinQuickFixFactory +import org.jetbrains.kotlin.idea.codeinsight.utils.RemovePartsFromPropertyUtils +import org.jetbrains.kotlin.idea.codeinsights.impl.base.CallableReturnTypeUpdaterUtils +import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.psi.KtProperty +import org.jetbrains.kotlin.psi.psiUtil.getParentOfType + +internal object RemovePartsFromPropertyFixFactory { + + val abstractPropertyWithGetter = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.AbstractPropertyWithGetter -> + createQuickFix(diagnostic.psi) + } + + val abstractPropertyWithInitializer = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.AbstractPropertyWithInitializer -> + createQuickFix(diagnostic.psi) + } + + val abstractPropertyWithSetter = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.AbstractPropertyWithSetter -> + createQuickFix(diagnostic.psi) + } + + val inapplicableLateinitModifier = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.InapplicableLateinitModifier -> + createQuickFix(diagnostic.psi) + } + + val propertyInitializerInInterface = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.PropertyInitializerInInterface -> + createQuickFix(diagnostic.psi) + } + + context(KaSession) + private fun createQuickFix( + element: KtElement, + ): List { + val property = element.getParentOfType(strict = false) ?: return emptyList() + + val removeInitializer = property.hasInitializer() + val removeGetter = property.getter?.bodyExpression != null + val removeSetter = property.setter?.bodyExpression != null + + if (!removeInitializer && !removeGetter && !removeSetter) return emptyList() + + val elementContext = ElementContext( + removeInitializer, + removeGetter, + removeSetter, + getTypeInfo(property), + ) + + return listOf( + RemovePartsFromPropertyFix(property, elementContext) + ) + } + + context(KaSession) + private fun getTypeInfo(property: KtProperty): CallableReturnTypeUpdaterUtils.TypeInfo? { + if (property.hasInitializer() && property.initializer != null && property.typeReference == null) { + return CallableReturnTypeUpdaterUtils.getTypeInfo(property) + } + return null + } + + private data class ElementContext( + val removeInitializer: Boolean, + val removeGetter: Boolean, + val removeSetter: Boolean, + val typeInfo: CallableReturnTypeUpdaterUtils.TypeInfo?, + ) + + private class RemovePartsFromPropertyFix( + element: KtProperty, + elementContext: ElementContext, + ) : KotlinPsiUpdateModCommandAction.ElementBased(element, elementContext) { + + override fun getFamilyName(): String = RemovePartsFromPropertyUtils.getFamilyName() + + override fun getActionName( + actionContext: ActionContext, + element: KtProperty, + elementContext: ElementContext, + ): String { + val (removeInitializer, removeGetter, removeSetter, _) = elementContext + return RemovePartsFromPropertyUtils.getActionName(removeInitializer, removeGetter, removeSetter) + } + + override fun invoke( + actionContext: ActionContext, + element: KtProperty, + elementContext: ElementContext, + updater: ModPsiUpdater, + ) { + if (elementContext.removeInitializer) { + removeInitializer(actionContext.project, element, elementContext, updater) + } + + if (elementContext.removeGetter) { + element.getter?.delete() + } + + if (elementContext.removeSetter) { + element.setter?.delete() + } + } + + private fun removeInitializer( + project: Project, + element: KtProperty, + elementContext: ElementContext, + updater: ModPsiUpdater, + ) { + val initializer = element.initializer ?: return + element.deleteChildRange(element.equalsToken ?: initializer, initializer) + if (elementContext.typeInfo == null) return + + CallableReturnTypeUpdaterUtils.updateType( + declaration = element, + typeInfo = elementContext.typeInfo, + project = project, + editor = null, + updater = updater, + ) + } + } +} 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 d8113b45701e..208a368d05c1 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 @@ -6542,7 +6542,44 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu } } + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../../../idea/tests/testData/quickfix/typeImports") + public static class TypeImports 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("hasThisImport.kt") + public void testHasThisImport() throws Exception { + runTest("../../../idea/tests/testData/quickfix/typeImports/hasThisImport.kt"); + } + + @TestMetadata("noImportFromTheSameFile.kt") + public void testNoImportFromTheSameFile() throws Exception { + runTest("../../../idea/tests/testData/quickfix/typeImports/noImportFromTheSameFile.kt"); + } + + @TestMetadata("noImportJavaLang.kt") + public void testNoImportJavaLang() throws Exception { + runTest("../../../idea/tests/testData/quickfix/typeImports/noImportJavaLang.kt"); + } + + @TestMetadata("noImportJetStandard.kt") + public void testNoImportJetStandard() throws Exception { + runTest("../../../idea/tests/testData/quickfix/typeImports/noImportJetStandard.kt"); + } + + @TestMetadata("toImport1.kt") + public void testToImport1() throws Exception { + runTest("../../../idea/tests/testData/quickfix/typeImports/toImport1.kt"); + } + } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer2.kt b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer2.kt index afdcf48fe349..61fb1fe96e72 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer2.kt @@ -3,5 +3,5 @@ abstract class A { abstract var i = 0 } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer2.kt.after index a8969e3d1a25..af9789b083d8 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer2.kt.after @@ -3,5 +3,5 @@ abstract class A { abstract var i: Int } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer3.kt b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer3.kt index 78fd4c70cd3e..afc3774c5f6c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer3.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer3.kt @@ -3,5 +3,5 @@ abstract class A { abstract var i: Int = 0 } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer3.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer3.kt.after index 8c5371eabf6e..488795ef47d2 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer3.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWIthInitializer3.kt.after @@ -3,5 +3,5 @@ abstract class A { abstract var i: Int } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWithGetter2.kt b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWithGetter2.kt index 3c34a5fd9dfd..2ddefafe9b2e 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWithGetter2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWithGetter2.kt @@ -3,5 +3,5 @@ abstract class B { abstract val i = 0 get() = field } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWithGetter2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWithGetter2.kt.after index 099516879cae..15e5a03ec365 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWithGetter2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/abstract/abstractPropertyWithGetter2.kt.after @@ -2,5 +2,5 @@ abstract class B { abstract val i: Int } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetter.kt b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetter.kt index 11dedf9200e8..5dd8343b451b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetter.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetter.kt @@ -4,5 +4,5 @@ class A { lateinit var str: String get() = "" } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetter.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetter.kt.after index 837d06f2a3b7..2b949fbd8dee 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetter.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetter.kt.after @@ -3,5 +3,5 @@ class A { lateinit var str: String } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetterSetter.kt b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetterSetter.kt index 4b6fd3a369ec..549e8da82ddf 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetterSetter.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetterSetter.kt @@ -5,5 +5,5 @@ class A { get() = "" set(value) {} } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetterSetter.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetterSetter.kt.after index 0f8fb1bf8c0b..fc6d6e626ab9 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetterSetter.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withGetterSetter.kt.after @@ -3,5 +3,5 @@ class A { lateinit var str: String } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.fir.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.fir.kt.after new file mode 100644 index 000000000000..23ffe1b527eb --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.fir.kt.after @@ -0,0 +1,7 @@ +// "Remove initializer from property" "true" + +class A { + lateinit var str: String +} +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.kt b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.kt index a561f88308b0..ea2378e74fb8 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.kt @@ -3,5 +3,5 @@ class A { lateinit var str = "" } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.kt.after index 83c053c8dad9..276d4067a7c3 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withInitializer.kt.after @@ -3,5 +3,5 @@ class A { lateinit var str: String } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withSetter.kt b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withSetter.kt index 7841df39cce3..00798637c121 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withSetter.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withSetter.kt @@ -4,5 +4,5 @@ class A { lateinit var str: String set(value) {} } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withSetter.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withSetter.kt.after index e8ca453f2015..88685d596606 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withSetter.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/lateinit/withSetter.kt.after @@ -3,5 +3,5 @@ class A { lateinit var str: String } -/* IGNORE_K2 */ -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/hasThisImport.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/hasThisImport.kt index 930bc26984c3..dc15bb29c1e7 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/hasThisImport.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/hasThisImport.kt @@ -8,4 +8,5 @@ class M { val l = emptyList() } } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/hasThisImport.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/hasThisImport.kt.after index 8d382582f1d6..385503e951e0 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/hasThisImport.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/hasThisImport.kt.after @@ -8,4 +8,5 @@ class M { val l: List } } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportFromTheSameFile.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportFromTheSameFile.kt index e1a852f37438..6abe2edc887c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportFromTheSameFile.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportFromTheSameFile.kt @@ -5,4 +5,5 @@ class A() {} class B() { public val a = A() } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.intentions.SpecifyTypeExplicitlyIntention \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.intentions.SpecifyTypeExplicitlyIntention +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.intentions.SpecifyTypeExplicitlyIntention \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportFromTheSameFile.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportFromTheSameFile.kt.after index ec2c011cc070..352d7a3cb167 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportFromTheSameFile.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportFromTheSameFile.kt.after @@ -5,4 +5,5 @@ class A() {} class B() { public val a: A = A() } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.intentions.SpecifyTypeExplicitlyIntention \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.intentions.SpecifyTypeExplicitlyIntention +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.intentions.SpecifyTypeExplicitlyIntention \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJavaLang.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJavaLang.kt index a439f1bd7ee8..7aba31bbea78 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJavaLang.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJavaLang.kt @@ -6,4 +6,5 @@ class M { abstract val e = Thread() } } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJavaLang.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJavaLang.kt.after index 83237b104037..927fdad63676 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJavaLang.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJavaLang.kt.after @@ -6,4 +6,5 @@ class M { abstract val e: Thread } } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJetStandard.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJetStandard.kt index 933c27c7d690..b3083e79b9fa 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJetStandard.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJetStandard.kt @@ -6,4 +6,5 @@ class M { abstract val i = 10 } } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJetStandard.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJetStandard.kt.after index f89885bdfa2a..d9cfd88a6fb5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJetStandard.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/noImportJetStandard.kt.after @@ -6,4 +6,5 @@ class M { abstract val i: Int } } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/toImport1.kt b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/toImport1.kt index 9ae67fe396b5..e8252af0d5e2 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/toImport1.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/toImport1.kt @@ -8,4 +8,5 @@ class M { abstract val l = emptyList() } } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/toImport1.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/toImport1.kt.after index b5c6dfa86338..9dc9d40baa5e 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/typeImports/toImport1.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/typeImports/toImport1.kt.after @@ -8,4 +8,5 @@ class M { abstract val l: List } } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.RemovePartsFromPropertyFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.k2.codeinsight.fixes.RemovePartsFromPropertyFixFactory$RemovePartsFromPropertyFix \ No newline at end of file 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 b68c133d6607..4a28333ab6fa 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 @@ -191,7 +191,7 @@ internal fun MutableTWorkspace.generateK2FixTests() { model("$idea/quickfix/surroundWithNullCheck", pattern = pattern) model("$idea/quickfix/suspiciousCollectionReassignment", pattern = pattern, isIgnored = true) model("$idea/quickfix/tooLongCharLiteralToString", pattern = pattern) - model("$idea/quickfix/typeImports", pattern = pattern, isIgnored = true) + model("$idea/quickfix/typeImports", pattern = pattern) model("$idea/quickfix/typeInferenceExpectedTypeMismatch", pattern = pattern, isIgnored = true) model("$idea/quickfix/typeOfAnnotationMember", pattern = pattern) model("$idea/quickfix/typeParameters", pattern = pattern, isIgnored = true)