From 0961a7aeabcd999b322a744bc952f82ac1fd524d Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Wed, 3 Jan 2024 13:54:20 +0100 Subject: [PATCH] [kotlin] Improve message to reflect type of element to be safe deleted #KTIJ-27923 Fixed GitOrigin-RevId: 3cd7b6f90a693b5aa8c1082aa82a4e9e5d4e8719 --- .../daemon/quickFix/ActionHint.java | 28 +++- .../quickfix/AbstractHighLevelQuickFixTest.kt | 11 +- .../HighLevelQuickFixTestGenerated.java | 146 ++++++++++++++++++ .../KotlinUnusedHighlightingVisitor.kt | 10 +- .../KotlinBaseHighlightingBundle.properties | 5 +- .../idea/quickfix/AbstractK1QuickFixTest.kt | 2 + .../idea/quickfix/AbstractQuickFixTest.kt | 19 ++- .../quickfix/removeUnused/.k2Inspection | 1 + .../removeUnused/companionViaImport3.kt | 3 +- .../removeUnused/companionViaImport3.kt.after | 3 +- .../quickfix/removeUnused/notTriangle.kt | 3 +- .../removeUnused/notTriangle.kt.after | 3 +- .../secondaryLocalClassConstructor.kt | 6 +- .../secondaryLocalClassConstructor.kt.after | 6 +- .../removeUnused/simpleUnusedEnumEntry.kt | 3 +- .../simpleUnusedEnumEntry.kt.after | 3 +- .../quickfix/removeUnused/typeAlias2.kt | 3 +- .../quickfix/removeUnused/typeAlias2.kt.after | 3 +- .../quickfix/removeUnused/unusedClass.kt | 3 +- .../removeUnused/unusedClass.kt.after | 3 +- .../removeUnused/unusedConstructor.kt | 6 +- .../removeUnused/unusedConstructor.kt.after | 6 +- .../quickfix/removeUnused/unusedEnumEntry.kt | 3 +- .../removeUnused/unusedEnumEntry.kt.after | 3 +- .../quickfix/removeUnused/unusedEnumEntry2.kt | 3 +- .../removeUnused/unusedEnumEntry2.kt.after | 3 +- .../quickfix/removeUnused/unusedEnumEntry3.kt | 3 +- .../removeUnused/unusedEnumEntry3.kt.after | 3 +- .../quickfix/removeUnused/unusedEnumEntry4.kt | 3 +- .../removeUnused/unusedEnumEntry4.kt.after | 3 +- .../quickfix/removeUnused/unusedEnumEntry5.kt | 3 +- .../removeUnused/unusedEnumEntry5.kt.after | 3 +- .../quickfix/removeUnused/unusedFunction.kt | 3 +- .../removeUnused/unusedFunction.kt.after | 3 +- .../quickfix/removeUnused/unusedProperty.kt | 3 +- .../removeUnused/unusedProperty.kt.after | 3 +- .../unusedPropertyAsConstructorParameter.kt | 7 +- ...sedPropertyAsConstructorParameter.kt.after | 7 +- .../unusedPropertyAsConstructorParameter2.kt | 6 +- ...edPropertyAsConstructorParameter2.kt.after | 6 +- .../removeUnused/unusedTypeParameter.kt | 3 +- .../removeUnused/unusedTypeParameter.kt.after | 3 +- .../fir/testGenerator/FirGenerateTests.kt | 2 +- 43 files changed, 296 insertions(+), 56 deletions(-) create mode 100644 plugins/kotlin/idea/tests/testData/quickfix/removeUnused/.k2Inspection diff --git a/platform/testFramework/src/com/intellij/codeInsight/daemon/quickFix/ActionHint.java b/platform/testFramework/src/com/intellij/codeInsight/daemon/quickFix/ActionHint.java index 2bd126ef4a44..25ab41d9db0f 100644 --- a/platform/testFramework/src/com/intellij/codeInsight/daemon/quickFix/ActionHint.java +++ b/platform/testFramework/src/com/intellij/codeInsight/daemon/quickFix/ActionHint.java @@ -218,8 +218,32 @@ public final class ActionHint { } assert comment != null : commenter; - // "quick fix action text to perform" "should be available" - Pattern pattern = Pattern.compile("^" + Pattern.quote(comment) + " \"(.*)\" \"(\\w+)(?:-(\\w+))?\".*", Pattern.DOTALL); + return parse(file, contents, Pattern.quote(comment), exactMatch); + } + + /** + * Parse given file with given contents extracting ActionHint of it. + *

+ * Currently the following syntax is supported: + *

+ * {@code $commentPrefix "quick-fix name or intention text[|->next step]" "true|false|[-preview]"} + *

+ * If {@link ProblemHighlightType} enum value is specified instead of true/false + * (e.g. {@code "INFORMATION"}), then + * it's expected that the action is present and it's a quick-fix with given highlight type. + *

+ * + * @param file PsiFile associated with contents (used to determine the language) + * @param contents file contents + * @param commentPrefix any custom specific prefix, could be a regexp + * @param exactMatch if false then action hint matches prefix like in {@link CodeInsightTestFixture#filterAvailableIntentions(String)} + * @return ActionHint object + * @throws AssertionError if action hint is absent or has invalid format + */ + @NotNull + public static ActionHint parse(@NotNull PsiFile file, @NotNull String contents, @NotNull String commentPrefix, boolean exactMatch) { + // $commentPrefix "quick fix action text to perform" "should be available" + Pattern pattern = Pattern.compile("^" + commentPrefix + " \"([^\n]*)\" \"(\\w+)(?:-(\\w+))?\".*", Pattern.DOTALL); Matcher matcher = pattern.matcher(contents); TestCase.assertTrue("No comment found in " + file.getVirtualFile(), matcher.matches()); final String text = matcher.group(1); diff --git a/plugins/kotlin/fir/tests/test/org/jetbrains/kotlin/idea/fir/quickfix/AbstractHighLevelQuickFixTest.kt b/plugins/kotlin/fir/tests/test/org/jetbrains/kotlin/idea/fir/quickfix/AbstractHighLevelQuickFixTest.kt index f158b07d62b4..0d4fde0cb012 100644 --- a/plugins/kotlin/fir/tests/test/org/jetbrains/kotlin/idea/fir/quickfix/AbstractHighLevelQuickFixTest.kt +++ b/plugins/kotlin/fir/tests/test/org/jetbrains/kotlin/idea/fir/quickfix/AbstractHighLevelQuickFixTest.kt @@ -3,7 +3,6 @@ package org.jetbrains.kotlin.idea.fir.quickfix import com.intellij.codeInsight.intention.IntentionAction -import com.intellij.codeInspection.InspectionProfileEntry import com.intellij.testFramework.runInEdtAndWait import org.jetbrains.kotlin.idea.fir.invalidateCaches import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest @@ -19,6 +18,7 @@ abstract class AbstractHighLevelQuickFixTest : AbstractQuickFixTest() { } override fun isFirPlugin(): Boolean = true + override fun tearDown() { runAll( { runInEdtAndWait { project.invalidateCaches() } }, @@ -59,8 +59,11 @@ abstract class AbstractHighLevelQuickFixTest : AbstractQuickFixTest() { // TODO: Enable these as more actions/inspections are enabled, and/or add more FIR-specific directives override fun checkForUnexpectedErrors() {} + + override val inspectionFileName: String + get() = ".k2Inspection" + + override val actionPrefix: String? = "K2_ACTION:" + override fun checkAvailableActionsAreExpected(actions: List) {} - override fun parseInspectionsToEnable(beforeFileName: String, beforeFileText: String): List { - return emptyList() - } } diff --git a/plugins/kotlin/fir/tests/test/org/jetbrains/kotlin/idea/fir/quickfix/HighLevelQuickFixTestGenerated.java b/plugins/kotlin/fir/tests/test/org/jetbrains/kotlin/idea/fir/quickfix/HighLevelQuickFixTestGenerated.java index 6e2b02b2650c..ec6d2d170b9f 100644 --- a/plugins/kotlin/fir/tests/test/org/jetbrains/kotlin/idea/fir/quickfix/HighLevelQuickFixTestGenerated.java +++ b/plugins/kotlin/fir/tests/test/org/jetbrains/kotlin/idea/fir/quickfix/HighLevelQuickFixTestGenerated.java @@ -4695,7 +4695,153 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../../idea/tests/testData/quickfix/removeUnused") + public static class RemoveUnused extends AbstractHighLevelQuickFixTest { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + @TestMetadata("companionViaImport3.kt") + public void testCompanionViaImport3() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/companionViaImport3.kt"); + } + + @TestMetadata("deledage.kt") + public void testDeledage() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/deledage.kt"); + } + + @TestMetadata("importEnumValues.kt") + public void testImportEnumValues() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/importEnumValues.kt"); + } + + @TestMetadata("importObjectFun.kt") + public void testImportObjectFun() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/importObjectFun.kt"); + } + + @TestMetadata("notTriangle.kt") + public void testNotTriangle() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/notTriangle.kt"); + } + + @TestMetadata("secondaryLocalClassConstructor.kt") + public void testSecondaryLocalClassConstructor() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/secondaryLocalClassConstructor.kt"); + } + + @TestMetadata("simpleUnusedEnumEntry.kt") + public void testSimpleUnusedEnumEntry() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/simpleUnusedEnumEntry.kt"); + } + + @TestMetadata("triangle.kt") + public void testTriangle() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/triangle.kt"); + } + + @TestMetadata("triangle2.kt") + public void testTriangle2() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/triangle2.kt"); + } + + @TestMetadata("typeAlias2.kt") + public void testTypeAlias2() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/typeAlias2.kt"); + } + + @TestMetadata("unusedClass.kt") + public void testUnusedClass() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedClass.kt"); + } + + @TestMetadata("unusedConstructor.kt") + public void testUnusedConstructor() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedConstructor.kt"); + } + + @TestMetadata("unusedDelegatedConstructor.kt") + public void testUnusedDelegatedConstructor() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedDelegatedConstructor.kt"); + } + + @TestMetadata("unusedDelegatedConstructorSuper.kt") + public void testUnusedDelegatedConstructorSuper() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedDelegatedConstructorSuper.kt"); + } + + @TestMetadata("unusedEnumEntry.kt") + public void testUnusedEnumEntry() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedEnumEntry.kt"); + } + + @TestMetadata("unusedEnumEntry2.kt") + public void testUnusedEnumEntry2() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedEnumEntry2.kt"); + } + + @TestMetadata("unusedEnumEntry3.kt") + public void testUnusedEnumEntry3() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedEnumEntry3.kt"); + } + + @TestMetadata("unusedEnumEntry4.kt") + public void testUnusedEnumEntry4() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedEnumEntry4.kt"); + } + + @TestMetadata("unusedEnumEntry5.kt") + public void testUnusedEnumEntry5() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedEnumEntry5.kt"); + } + + @TestMetadata("unusedFunction.kt") + public void testUnusedFunction() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedFunction.kt"); + } + + @TestMetadata("unusedProperty.kt") + public void testUnusedProperty() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedProperty.kt"); + } + + @TestMetadata("unusedPropertyAsConstructorParameter.kt") + public void testUnusedPropertyAsConstructorParameter() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter.kt"); + } + + @TestMetadata("unusedPropertyAsConstructorParameter2.kt") + public void testUnusedPropertyAsConstructorParameter2() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter2.kt"); + } + + @TestMetadata("unusedTypeParameter.kt") + public void testUnusedTypeParameter() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/unusedTypeParameter.kt"); + } + + @TestMetadata("usedClassAsAlias.kt") + public void testUsedClassAsAlias() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/usedClassAsAlias.kt"); + } + + @TestMetadata("usedFunAsAlias.kt") + public void testUsedFunAsAlias() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/usedFunAsAlias.kt"); + } + + @TestMetadata("usedObjectAsAlias.kt") + public void testUsedObjectAsAlias() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/usedObjectAsAlias.kt"); + } + + @TestMetadata("usedVarAsAlias.kt") + public void testUsedVarAsAlias() throws Exception { + runTest("../../idea/tests/testData/quickfix/removeUnused/usedVarAsAlias.kt"); + } + } diff --git a/plugins/kotlin/highlighting/highlighting-k2/src/org/jetbrains/kotlin/idea/highlighting/KotlinUnusedHighlightingVisitor.kt b/plugins/kotlin/highlighting/highlighting-k2/src/org/jetbrains/kotlin/idea/highlighting/KotlinUnusedHighlightingVisitor.kt index f609b35a38ab..4e2ff9025904 100644 --- a/plugins/kotlin/highlighting/highlighting-k2/src/org/jetbrains/kotlin/idea/highlighting/KotlinUnusedHighlightingVisitor.kt +++ b/plugins/kotlin/highlighting/highlighting-k2/src/org/jetbrains/kotlin/idea/highlighting/KotlinUnusedHighlightingVisitor.kt @@ -199,7 +199,15 @@ class KotlinRefsHolder { class SafeDeleteFix(declaration: KtNamedDeclaration) : LocalQuickFixAndIntentionActionOnPsiElement(declaration) { @Nls private val name: String = - KotlinBaseHighlightingBundle.message("safe.delete.text", declaration.name ?: declaration.text) + KotlinBaseHighlightingBundle.message(declaration.toNameKey(), declaration.name ?: declaration.text) + + private fun KtNamedDeclaration.toNameKey(): String = + when (this) { + is KtPrimaryConstructor -> "safe.delete.primary.ctor.text.0" + is KtSecondaryConstructor -> "safe.delete.secondary.ctor.text.0" + is KtParameter -> "safe.delete.parameter.text.0" + else -> "safe.delete.text.0" + } override fun getText(): @IntentionName String { return name diff --git a/plugins/kotlin/highlighting/highlighting-shared/resources/messages/KotlinBaseHighlightingBundle.properties b/plugins/kotlin/highlighting/highlighting-shared/resources/messages/KotlinBaseHighlightingBundle.properties index e374d009b766..5d3a74e7ebc6 100644 --- a/plugins/kotlin/highlighting/highlighting-shared/resources/messages/KotlinBaseHighlightingBundle.properties +++ b/plugins/kotlin/highlighting/highlighting-shared/resources/messages/KotlinBaseHighlightingBundle.properties @@ -9,4 +9,7 @@ smart.cast.to.0=Smart cast to {0} inspection.message.never.used={0} is never used safe.delete.family=Safe delete -safe.delete.text=Safe delete ''{0}'' +safe.delete.text.0=Safe delete ''{0}'' +safe.delete.secondary.ctor.text.0=Safe delete secondary constructor ''{0}'' +safe.delete.primary.ctor.text.0=Safe delete primary constructor ''{0}'' +safe.delete.parameter.text.0=Safe delete parameter ''{0}'' diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractK1QuickFixTest.kt b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractK1QuickFixTest.kt index ea0eb7e12a13..493020a2e12a 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractK1QuickFixTest.kt +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractK1QuickFixTest.kt @@ -17,4 +17,6 @@ abstract class AbstractK1QuickFixTest : AbstractQuickFixTest() { """.trimIndent() ) } + + override val actionPrefix: String? = "K1_ACTION:" } \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixTest.kt b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixTest.kt index 67f6b2dfbac2..0032510d7406 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixTest.kt +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/quickfix/AbstractQuickFixTest.kt @@ -8,6 +8,7 @@ import com.intellij.codeInsight.intention.IntentionActionDelegate import com.intellij.codeInsight.intention.PriorityAction import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler import com.intellij.codeInsight.intention.impl.config.IntentionManagerSettings +import com.intellij.codeInspection.LocalQuickFixOnPsiElement import com.intellij.codeInspection.SuppressableProblemGroup import com.intellij.codeInspection.ex.QuickFixWrapper import com.intellij.internal.statistic.eventLog.StatisticsEventLoggerProvider @@ -21,8 +22,9 @@ import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.io.FileUtil import com.intellij.openapi.util.text.StringUtil import com.intellij.openapi.vfs.CharsetToolkit -import com.intellij.psi.util.PsiUtilBase import com.intellij.platform.testFramework.core.FileComparisonFailedError +import com.intellij.psi.PsiFile +import com.intellij.psi.util.PsiUtilBase import com.intellij.testFramework.* import com.intellij.util.ui.UIUtil import junit.framework.TestCase @@ -240,13 +242,13 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q configExtra(fileText) - val hint = ActionHint.parse(myFixture.file, contents.replace("\${file}", fileName, ignoreCase = true)) + val hint = myFixture.file.actionHint(contents.replace("\${file}", fileName, ignoreCase = true)) actionHint = hint val intention = runInEdtAndGet { findActionWithText(hint.expectedText) } if (hint.shouldPresent()) { if (intention == null) { fail( - "Action with text '" + hint.expectedText + "' not found\nAvailable actions:\n" + + "Action with text '" + hint.expectedText + "' not found\n${myFixture.availableIntentions.size} available actions:\n" + myFixture.availableIntentions.joinToString(separator = "\n") { "// \"${it.text}\" \"true\"" }) return } @@ -290,13 +292,18 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q ConfigLibraryUtil.unconfigureLibrariesByDirective(myFixture.module, fileText) } } + } + private fun PsiFile.actionHint(contents: String): ActionHint { + return ActionHint.parse(this, contents, + actionPrefix?.let { ".*//(?: $it)?" } ?: "//", + true) } private fun applyAction(contents: String, hint: ActionHint, intention: IntentionAction, fileName: String) { val unwrappedIntention = unwrapIntention(intention) if (shouldCheckIntentionActionType) { - if (intention.asModCommandAction() == null) { + if (intention.asModCommandAction() == null && unwrappedIntention !is LocalQuickFixOnPsiElement) { assertInstanceOf(unwrappedIntention, QuickFixActionBase::class.java) } } @@ -365,7 +372,7 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q private fun checkForUnexpectedActions() { val text = myFixture.editor.document.text - val actionHint = ActionHint.parse(myFixture.file, text) + val actionHint = myFixture.file.actionHint(text) if (actionHint.shouldPresent() && !InTextDirectivesUtils.isDirectiveDefined(text, DirectiveBasedActionUtils.ACTION_DIRECTIVE)) { return } @@ -438,4 +445,6 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q override val additionalToolDirectives: Array get() = arrayOf(if (isFirPlugin) K2_TOOL_DIRECTIVE else K1_TOOL_DIRECTIVE) + + protected open val actionPrefix: String? = null } diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/.k2Inspection b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/.k2Inspection new file mode 100644 index 000000000000..5ea8faaa4cd9 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/.k2Inspection @@ -0,0 +1 @@ +org.jetbrains.kotlin.idea.k2.codeinsight.inspections.UnusedSymbolInspection \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/companionViaImport3.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/companionViaImport3.kt index 602488d315cc..8b6e223e0314 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/companionViaImport3.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/companionViaImport3.kt @@ -6,4 +6,5 @@ class TestClass{ const val CONST = "abc" } } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +/* IGNORE_K2 */ \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/companionViaImport3.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/companionViaImport3.kt.after index e54e102f026e..65d4eb2c692a 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/companionViaImport3.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/companionViaImport3.kt.after @@ -2,4 +2,5 @@ class TestClass{ } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +/* IGNORE_K2 */ \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/notTriangle.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/notTriangle.kt index db2433502a6d..974c13c3980f 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/notTriangle.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/notTriangle.kt @@ -7,4 +7,5 @@ abstract class Abstract { class Test: Abstract() { } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/notTriangle.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/notTriangle.kt.after index da73271f36ac..9f8b99303b03 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/notTriangle.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/notTriangle.kt.after @@ -6,4 +6,5 @@ abstract class Abstract { class Test: Abstract() { } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/secondaryLocalClassConstructor.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/secondaryLocalClassConstructor.kt index 1e25090e1c88..79ac81900ba8 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/secondaryLocalClassConstructor.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/secondaryLocalClassConstructor.kt @@ -1,4 +1,5 @@ -// "Safe delete constructor" "true" +// K1_ACTION: "Safe delete constructor" "true" +// K2_ACTION: "Safe delete secondary constructor 'LocalClass'" "true" fun main() { class LocalClass(val number: Int) { constructor(s: String) : this(s.toInt()) @@ -6,4 +7,5 @@ fun main() { val l = LocalClass(42) } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/secondaryLocalClassConstructor.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/secondaryLocalClassConstructor.kt.after index 05846f8e57c9..11fdd7f9b599 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/secondaryLocalClassConstructor.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/secondaryLocalClassConstructor.kt.after @@ -1,8 +1,10 @@ -// "Safe delete constructor" "true" +// K1_ACTION: "Safe delete constructor" "true" +// K2_ACTION: "Safe delete secondary constructor 'LocalClass'" "true" fun main() { class LocalClass(val number: Int) { } val l = LocalClass(42) } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/simpleUnusedEnumEntry.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/simpleUnusedEnumEntry.kt index bd86bfe76ad7..1314f41d870b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/simpleUnusedEnumEntry.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/simpleUnusedEnumEntry.kt @@ -7,4 +7,5 @@ enum class MyEnum { fun main() { MyEnum.HELLO } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/simpleUnusedEnumEntry.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/simpleUnusedEnumEntry.kt.after index 75b0698bac27..110f532fc6d5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/simpleUnusedEnumEntry.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/simpleUnusedEnumEntry.kt.after @@ -6,4 +6,5 @@ enum class MyEnum { fun main() { MyEnum.HELLO } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/typeAlias2.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/typeAlias2.kt index 09c6705bf765..963dad8fad65 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/typeAlias2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/typeAlias2.kt @@ -8,4 +8,5 @@ enum class MyEnum { typealias Other = MyEnum -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +/* IGNORE_K2 */ \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/typeAlias2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/typeAlias2.kt.after index 46b955c1f838..4764c0b1413b 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/typeAlias2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/typeAlias2.kt.after @@ -5,4 +5,5 @@ enum class MyEnum { WORLD } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +/* IGNORE_K2 */ \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedClass.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedClass.kt index 99af241c7c53..6e11230aa001 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedClass.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedClass.kt @@ -3,4 +3,5 @@ class DummyClass class UnusedClass -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedClass.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedClass.kt.after index f67b1a1d2eea..cd0d5499c2d7 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedClass.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedClass.kt.after @@ -1,4 +1,5 @@ // "Safe delete 'UnusedClass'" "true" class DummyClass -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedConstructor.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedConstructor.kt index 419c2d2026ec..cf824ef93e1f 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedConstructor.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedConstructor.kt @@ -1,5 +1,7 @@ -// "Safe delete constructor" "true" +// K1_ACTION: "Safe delete constructor" "true" +// K2_ACTION: "Safe delete secondary constructor 'Owner'" "true" class Owner(val x: Int) { constructor(): this(42) } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedConstructor.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedConstructor.kt.after index 5f6786d342ac..279cb941ed30 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedConstructor.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedConstructor.kt.after @@ -1,4 +1,6 @@ -// "Safe delete constructor" "true" +// K1_ACTION: "Safe delete constructor" "true" +// K2_ACTION: "Safe delete secondary constructor 'Owner'" "true" class Owner(val x: Int) { } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry.kt index 3899e4a6971e..ea0f0fe5acd4 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry.kt @@ -11,4 +11,5 @@ enum class MyEnum(val i: Int) { fun test() { MyEnum.HELLO } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry.kt.after index 21135f4584f0..b435420a8c5c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry.kt.after @@ -10,4 +10,5 @@ enum class MyEnum(val i: Int) { fun test() { MyEnum.HELLO } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry2.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry2.kt index c41b76b4b64c..ac3a07e19a33 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry2.kt @@ -10,4 +10,5 @@ enum class MyEnum(val i: Int) { fun test() { MyEnum.HELLO } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry2.kt.after index 4e72d467bb06..9ffea3cf8749 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry2.kt.after @@ -9,4 +9,5 @@ enum class MyEnum(val i: Int) { fun test() { MyEnum.HELLO } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry3.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry3.kt index e340a3090e3c..8c046aa5e219 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry3.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry3.kt @@ -3,4 +3,5 @@ enum class MyEnum { HELLO } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry3.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry3.kt.after index 2a7f6bc5e2c7..625e7e241dec 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry3.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry3.kt.after @@ -2,4 +2,5 @@ enum class MyEnum { } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry4.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry4.kt index 40def2213fbd..73de4a724d87 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry4.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry4.kt @@ -3,4 +3,5 @@ enum class MyEnum { HELLO, } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry4.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry4.kt.after index 2a7f6bc5e2c7..625e7e241dec 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry4.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry4.kt.after @@ -2,4 +2,5 @@ enum class MyEnum { } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry5.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry5.kt index fcfd9c23a29e..1930d3909b84 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry5.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry5.kt @@ -5,4 +5,5 @@ enum class MyEnum { HELLO, } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry5.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry5.kt.after index 14a8a6db65a1..4132f111aff6 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry5.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedEnumEntry5.kt.after @@ -3,4 +3,5 @@ enum class MyEnum { } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedFunction.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedFunction.kt index 0a9e4a4b4556..46de8aa4deed 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedFunction.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedFunction.kt @@ -6,4 +6,5 @@ fun unusedFun() { } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedFunction.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedFunction.kt.after index fa33d53e436a..2e19e6dd1ec2 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedFunction.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedFunction.kt.after @@ -2,4 +2,5 @@ fun dummy() { } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedProperty.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedProperty.kt index 601a265958a1..52cc8e621ae5 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedProperty.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedProperty.kt @@ -3,4 +3,5 @@ class UnusedProperty() { val property: String = ":)" } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedProperty.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedProperty.kt.after index 806ae5a8774d..b8e93e1657fa 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedProperty.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedProperty.kt.after @@ -2,4 +2,5 @@ class UnusedProperty() { } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter.kt index 0571f1557224..9a72fafbeb93 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter.kt @@ -1,4 +1,7 @@ -// "Safe delete 'property'" "true" +// K1_ACTION: "Safe delete 'property'" "true" +// K2_ACTION: "Safe delete parameter 'property'" "true" class UnusedPropertyAsConstructorParameter(val property: String) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix +/* IGNORE_K2 */ \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter.kt.after index d91e9b5806e4..99dfd881ac33 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter.kt.after @@ -1,4 +1,7 @@ -// "Safe delete 'property'" "true" +// K1_ACTION: "Safe delete 'property'" "true" +// K2_ACTION: "Safe delete parameter 'property'" "true" class UnusedPropertyAsConstructorParameter -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix +/* IGNORE_K2 */ \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter2.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter2.kt index 9dfa7f895788..9d3dfeec8f78 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter2.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter2.kt @@ -1,4 +1,6 @@ -// "Safe delete 'property'" "true" +// K1_ACTION: "Safe delete 'property'" "true" +// K2_ACTION: "Safe delete parameter 'property'" "true" class UnusedPropertyAsConstructorParameter(val property: String, val foo: String) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter2.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter2.kt.after index 95746783d195..897b6f9d3c2d 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter2.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedPropertyAsConstructorParameter2.kt.after @@ -1,4 +1,6 @@ -// "Safe delete 'property'" "true" +// K1_ACTION: "Safe delete 'property'" "true" +// K2_ACTION: "Safe delete parameter 'property'" "true" class UnusedPropertyAsConstructorParameter(val foo: String) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedTypeParameter.kt b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedTypeParameter.kt index 75015f43dc0d..9d59f0992277 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedTypeParameter.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedTypeParameter.kt @@ -1,4 +1,5 @@ // "Safe delete 'T'" "true" class UnusedTypeParameter<T, P>(val p: P) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedTypeParameter.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedTypeParameter.kt.after index 95287639de33..3f958abdc05e 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedTypeParameter.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/removeUnused/unusedTypeParameter.kt.after @@ -1,4 +1,5 @@ // "Safe delete 'T'" "true" class UnusedTypeParameter

(val p: P) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.inspections.SafeDeleteFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.highlighting.SafeDeleteFix \ No newline at end of file diff --git a/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/FirGenerateTests.kt b/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/FirGenerateTests.kt index 0de0e5d867c1..cc456516c806 100644 --- a/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/FirGenerateTests.kt +++ b/plugins/kotlin/util/test-generator-fir/test/org/jetbrains/kotlin/fir/testGenerator/FirGenerateTests.kt @@ -311,7 +311,7 @@ private fun assembleWorkspace(): TWorkspace = workspace { model("quickfix/removeSuspend", pattern = pattern, isIgnored = true) model("quickfix/removeToStringInStringTemplate", pattern = pattern, isIgnored = true) model("quickfix/removeTypeVariance", pattern = pattern, isIgnored = true) - model("quickfix/removeUnused", pattern = pattern, isIgnored = true) + model("quickfix/removeUnused", pattern = pattern) model("quickfix/removeUnusedParameter", pattern = pattern, isIgnored = true) model("quickfix/removeUnusedReceiver", pattern = pattern, isIgnored = true) model("quickfix/removeUseSiteTarget", pattern = pattern, isIgnored = true)