From a8adbe84e9a4e1edf30fc8abe1376da65aed0c38 Mon Sep 17 00:00:00 2001 From: Andrey Cherkasov Date: Thu, 13 Jun 2024 02:19:16 +0400 Subject: [PATCH] [kotlin] Port ChangeToUseSpreadOperatorFix to K2 ^KTIJ-29614 GitOrigin-RevId: 12491bc9442c1df1cead4fe2f5932eaf7b310729 --- .../ChangeToUseSpreadOperatorFixFactory.kt | 72 +++++++++++++++++++ .../fixes/KotlinK2QuickFixRegistrar.kt | 1 + .../fixes/HighLevelQuickFixTestGenerated.java | 62 ++++++++++++++++ .../quickfix/K1QuickFixTestGenerated.java | 10 +++ .../differentTypeParameterGeneric.kt | 8 +++ .../changeToUseSpreadOperator/mapOf.kt | 3 +- .../changeToUseSpreadOperator/mapOf.kt.after | 3 +- .../multipleParams.kt | 3 +- .../multipleParams.kt.after | 3 +- .../nestedGeneric.kt | 9 +++ .../nestedGeneric.kt.after | 9 +++ .../changeToUseSpreadOperator/normal.kt | 3 +- .../changeToUseSpreadOperator/normal.kt.after | 3 +- .../changeToUseSpreadOperator/stdlibMapOf.kt | 3 +- .../stdlibMapOf.kt.after | 3 +- .../changeToUseSpreadOperator/vararg.kt | 3 +- .../changeToUseSpreadOperator/vararg.kt.after | 3 +- .../codeinsight/GenerateK2QuickFixTests.kt | 2 +- 18 files changed, 192 insertions(+), 11 deletions(-) create mode 100644 plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/ChangeToUseSpreadOperatorFixFactory.kt create mode 100644 plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/differentTypeParameterGeneric.kt create mode 100644 plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/nestedGeneric.kt create mode 100644 plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/nestedGeneric.kt.after diff --git a/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/ChangeToUseSpreadOperatorFixFactory.kt b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/ChangeToUseSpreadOperatorFixFactory.kt new file mode 100644 index 000000000000..9b755a0d13f6 --- /dev/null +++ b/plugins/kotlin/code-insight/fixes-k2/src/org/jetbrains/kotlin/idea/k2/codeinsight/fixes/ChangeToUseSpreadOperatorFixFactory.kt @@ -0,0 +1,72 @@ +// 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 org.jetbrains.kotlin.analysis.api.KaSession +import org.jetbrains.kotlin.analysis.api.KaStarTypeProjection +import org.jetbrains.kotlin.analysis.api.calls.KaErrorCallInfo +import org.jetbrains.kotlin.analysis.api.calls.KaFunctionCall +import org.jetbrains.kotlin.analysis.api.calls.symbol +import org.jetbrains.kotlin.analysis.api.components.buildClassType +import org.jetbrains.kotlin.analysis.api.fir.diagnostics.KaFirDiagnostic +import org.jetbrains.kotlin.analysis.api.types.KaCapturedType +import org.jetbrains.kotlin.analysis.api.types.KaNonErrorClassType +import org.jetbrains.kotlin.analysis.api.types.KaType +import org.jetbrains.kotlin.analysis.api.types.KaTypeParameterType +import org.jetbrains.kotlin.idea.codeinsight.api.applicators.fixes.KotlinQuickFixFactory +import org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.psi.KtCallExpression +import org.jetbrains.kotlin.psi.KtReferenceExpression +import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType + +internal object ChangeToUseSpreadOperatorFixFactory { + + val changeToUseSpreadOperatorFixFactory = KotlinQuickFixFactory.ModCommandBased { diagnostic: KaFirDiagnostic.ArgumentTypeMismatch -> + val element = diagnostic.psi as? KtReferenceExpression ?: return@ModCommandBased emptyList() + val callExpression = element.getStrictParentOfType() ?: return@ModCommandBased emptyList() + val arrayElementType = diagnostic.actualType.getArrayElementType()?.unwrap() ?: return@ModCommandBased emptyList() + val functionCall = (callExpression.resolveCall() as? KaErrorCallInfo)?.candidateCalls?.singleOrNull() as? KaFunctionCall<*> + ?: return@ModCommandBased emptyList() + + if (functionCall.argumentMapping[element]?.symbol?.isVararg != true && + functionCall.symbol.callableId?.asSingleFqName() != FqName("kotlin.collections.mapOf") + ) { + return@ModCommandBased emptyList() + } + + val buildType = substituteTypeParameterTypesWithStarTypeProjections(diagnostic.expectedType) ?: return@ModCommandBased emptyList() + if (!arrayElementType.isSubTypeOf(buildType)) return@ModCommandBased emptyList() + + listOf( + ChangeToUseSpreadOperatorFix(element) + ) + } +} + +private fun KaType.unwrap(): KaType { + return (this as? KaCapturedType)?.projection?.type ?: this +} + +/** + * Substitute type parameter types in the given [type] with star type projections. + * + * For instance, given Pair>, the function returns Pair<*, Pair>. + */ +context(KaSession) +private fun substituteTypeParameterTypesWithStarTypeProjections(type: KaType): KaType? { + return when (type) { + is KaNonErrorClassType -> buildClassType(type.classSymbol) { + type.ownTypeArguments.mapNotNull { it.type }.forEach { + if (it is KaTypeParameterType) { + argument(KaStarTypeProjection(token)) + } else { + substituteTypeParameterTypesWithStarTypeProjections(it)?.let { type -> + argument(type) + } + } + } + } + + else -> null + } +} 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 a239226ba446..38365ce9a85f 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 @@ -113,6 +113,7 @@ class KotlinK2QuickFixRegistrar : KotlinQuickFixRegistrar() { registerPsiQuickFixes(KaFirDiagnostic.InvalidIfAsExpression::class, AddIfElseBranchFix) registerFactory(RemoveSupertypeFixFactory.removeSupertypeFixFactory) registerFactory(NumberConversionFixFactory.numberConversionFixFactory) + registerFactory(ChangeToUseSpreadOperatorFixFactory.changeToUseSpreadOperatorFixFactory) } private val addAbstract = KtQuickFixesListBuilder.registerPsiQuickFix { 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 94f653d1f809..b28ba38af946 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 @@ -6093,7 +6093,69 @@ public abstract class HighLevelQuickFixTestGenerated extends AbstractHighLevelQu + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator") + public static class ChangeToUseSpreadOperator 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("differentTypeParameter.kt") + public void testDifferentTypeParameter() throws Exception { + runTest("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator/differentTypeParameter.kt"); + } + + @TestMetadata("differentTypeParameterGeneric.kt") + public void testDifferentTypeParameterGeneric() throws Exception { + runTest("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator/differentTypeParameterGeneric.kt"); + } + + @TestMetadata("mapOf.kt") + public void testMapOf() throws Exception { + runTest("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator/mapOf.kt"); + } + + @TestMetadata("multipleParams.kt") + public void testMultipleParams() throws Exception { + runTest("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator/multipleParams.kt"); + } + + @TestMetadata("nestedGeneric.kt") + public void testNestedGeneric() throws Exception { + runTest("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator/nestedGeneric.kt"); + } + + @TestMetadata("nonArray.kt") + public void testNonArray() throws Exception { + runTest("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator/nonArray.kt"); + } + + @TestMetadata("nonVarArg.kt") + public void testNonVarArg() throws Exception { + runTest("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator/nonVarArg.kt"); + } + + @TestMetadata("normal.kt") + public void testNormal() throws Exception { + runTest("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator/normal.kt"); + } + + @TestMetadata("stdlibMapOf.kt") + public void testStdlibMapOf() throws Exception { + runTest("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator/stdlibMapOf.kt"); + } + + @TestMetadata("vararg.kt") + public void testVararg() throws Exception { + runTest("../../../idea/tests/testData/quickfix/changeToUseSpreadOperator/vararg.kt"); + } + } 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 48d8472f4c6c..09387c4a834e 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 @@ -3738,6 +3738,11 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest { runTest("testData/quickfix/changeToUseSpreadOperator/differentTypeParameter.kt"); } + @TestMetadata("differentTypeParameterGeneric.kt") + public void testDifferentTypeParameterGeneric() throws Exception { + runTest("testData/quickfix/changeToUseSpreadOperator/differentTypeParameterGeneric.kt"); + } + @TestMetadata("mapOf.kt") public void testMapOf() throws Exception { runTest("testData/quickfix/changeToUseSpreadOperator/mapOf.kt"); @@ -3748,6 +3753,11 @@ public abstract class K1QuickFixTestGenerated extends AbstractK1QuickFixTest { runTest("testData/quickfix/changeToUseSpreadOperator/multipleParams.kt"); } + @TestMetadata("nestedGeneric.kt") + public void testNestedGeneric() throws Exception { + runTest("testData/quickfix/changeToUseSpreadOperator/nestedGeneric.kt"); + } + @TestMetadata("nonArray.kt") public void testNonArray() throws Exception { runTest("testData/quickfix/changeToUseSpreadOperator/nonArray.kt"); diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/differentTypeParameterGeneric.kt b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/differentTypeParameterGeneric.kt new file mode 100644 index 000000000000..2fe2730c4c29 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/differentTypeParameterGeneric.kt @@ -0,0 +1,8 @@ +// "Change 'y' to '*y'" "false" + +fun foo(vararg x: Pair, Pair>) {} + +fun bar(y: Array, Pair>>) = foo(y) + +// IGNORE_K1 +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/mapOf.kt b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/mapOf.kt index 19ba77b92707..1b2483f3f628 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/mapOf.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/mapOf.kt @@ -6,4 +6,5 @@ fun yourMapOf(vararg pairs: Pair) {} fun myMapOf(vararg pairs: Pair) { val myMap = yourMapOf(pairs) } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/mapOf.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/mapOf.kt.after index 5a8da04ebdc6..620ec07a64c3 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/mapOf.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/mapOf.kt.after @@ -6,4 +6,5 @@ fun yourMapOf(vararg pairs: Pair) {} fun myMapOf(vararg pairs: Pair) { val myMap = yourMapOf(*pairs) } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/multipleParams.kt b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/multipleParams.kt index b69f49061c98..b616eccd4043 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/multipleParams.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/multipleParams.kt @@ -4,4 +4,5 @@ fun foo(a: String, vararg x: String, b: Int) {} fun bar(array: Array) = foo("aaa", array, b = 1) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/multipleParams.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/multipleParams.kt.after index 2813ab1dde6a..c4bab8578ef0 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/multipleParams.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/multipleParams.kt.after @@ -4,4 +4,5 @@ fun foo(a: String, vararg x: String, b: Int) {} fun bar(array: Array) = foo("aaa", *array, b = 1) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/nestedGeneric.kt b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/nestedGeneric.kt new file mode 100644 index 000000000000..45c35f6ec2f3 --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/nestedGeneric.kt @@ -0,0 +1,9 @@ +// "Change 'y' to '*y'" "true" +// WITH_STDLIB + +fun foo(vararg x: Pair, Pair>) {} + +fun bar(y: Array, Pair>>) = foo(y) + +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/nestedGeneric.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/nestedGeneric.kt.after new file mode 100644 index 000000000000..46a4f7a9c9bd --- /dev/null +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/nestedGeneric.kt.after @@ -0,0 +1,9 @@ +// "Change 'y' to '*y'" "true" +// WITH_STDLIB + +fun foo(vararg x: Pair, Pair>) {} + +fun bar(y: Array, Pair>>) = foo(*y) + +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/normal.kt b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/normal.kt index e6744b1746f8..ffa920880544 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/normal.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/normal.kt @@ -4,4 +4,5 @@ fun foo(vararg x: String) {} fun bar(y: Array) = foo(y) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/normal.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/normal.kt.after index 6cdb07905f42..8b7264b31b53 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/normal.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/normal.kt.after @@ -4,4 +4,5 @@ fun foo(vararg x: String) {} fun bar(y: Array) = foo(*y) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/stdlibMapOf.kt b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/stdlibMapOf.kt index ab270005032c..c1bebf6ea461 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/stdlibMapOf.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/stdlibMapOf.kt @@ -4,4 +4,5 @@ fun myMapOf(vararg pairs: Pair) { val myMap = mapOf(pairs) } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/stdlibMapOf.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/stdlibMapOf.kt.after index 588a89077b8e..ba0b8ae250c2 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/stdlibMapOf.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/stdlibMapOf.kt.after @@ -4,4 +4,5 @@ fun myMapOf(vararg pairs: Pair) { val myMap = mapOf(*pairs) } -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/vararg.kt b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/vararg.kt index d1ece5223e58..17e336b2a041 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/vararg.kt +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/vararg.kt @@ -4,4 +4,5 @@ fun foo(vararg x: String) {} fun bar(vararg y: String) = foo(y) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file diff --git a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/vararg.kt.after b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/vararg.kt.after index 053dea597da7..59a41be9580c 100644 --- a/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/vararg.kt.after +++ b/plugins/kotlin/idea/tests/testData/quickfix/changeToUseSpreadOperator/vararg.kt.after @@ -4,4 +4,5 @@ fun foo(vararg x: String) {} fun bar(vararg y: String) = foo(*y) -// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ No newline at end of file +// FUS_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix +// FUS_K2_QUICKFIX_NAME: org.jetbrains.kotlin.idea.quickfix.ChangeToUseSpreadOperatorFix \ 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 7d8f3c6db3bc..cef7388bde1f 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 @@ -99,7 +99,7 @@ internal fun MutableTWorkspace.generateK2FixTests() { model("$idea/quickfix/changeSuperTypeListEntryTypeArgument", pattern = pattern, isIgnored = true) model("$idea/quickfix/changeToLabeledReturn", pattern = pattern) model("$idea/quickfix/changeToMutableCollection", pattern = pattern, isIgnored = true) - model("$idea/quickfix/changeToUseSpreadOperator", pattern = pattern, isIgnored = true) + model("$idea/quickfix/changeToUseSpreadOperator", pattern = pattern) model("$idea/quickfix/compilerError", pattern = pattern, isIgnored = true) model("$idea/quickfix/convertCollectionLiteralToIntArrayOf", pattern = pattern) model("$idea/quickfix/convertIllegalEscapeToUnicodeEscape", pattern = pattern, isIgnored = true)