From fcda28fd46ab1d899e047b8ad2c74dff3be68b9c Mon Sep 17 00:00:00 2001 From: "Victoria.Petrakovich" Date: Tue, 8 Jul 2025 22:23:52 +0200 Subject: [PATCH] [kotlin] Port `SpecifyTypeExplicitlyInDestructuringAssignmentIntention` to K2 as shared Caret is not in desired places in lambdas KTIJ-32017 GitOrigin-RevId: 21f50626545ddb3470b461068e02c1a87bd471e2 --- .../kotlin.code-insight.intentions.shared.xml | 7 ++ ...citlyInDestructuringAssignmentIntention.kt | 92 ++++++++++++++----- .../SharedK1IntentionTestGenerated.java | 49 ++++++++++ .../SharedK2IntentionTestGenerated.java | 49 ++++++++++ .../.intention | 0 .../in.kt | 0 .../in.kt.after | 0 .../lambda.kt | 0 .../lambda.kt.after | 0 .../lambdaHasSignature.kt | 0 .../lambdaHasSignature.kt.after | 0 .../variableHasAllTypes.kt | 0 .../variableHasNoTypes.kt | 0 .../variableHasNoTypes.kt.after | 0 .../variableHasTypes.kt | 0 .../variableHasTypes.kt.after | 0 .../variableHasUnderscore.kt | 0 .../variableHasUnderscore.kt.after | 0 .../intentions/K1IntentionTestGenerated.java | 49 ---------- .../resources/META-INF/inspections-fe10.xml | 7 -- 20 files changed, 174 insertions(+), 79 deletions(-) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/.intention (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt.after (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt.after (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt.after (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasAllTypes.kt (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt.after (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt.after (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt (100%) rename plugins/kotlin/{idea => code-insight/intentions-shared}/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt.after (100%) diff --git a/plugins/kotlin/code-insight/intentions-shared/resources/kotlin.code-insight.intentions.shared.xml b/plugins/kotlin/code-insight/intentions-shared/resources/kotlin.code-insight.intentions.shared.xml index 4c1d1f17e1fc..a063ea44884d 100644 --- a/plugins/kotlin/code-insight/intentions-shared/resources/kotlin.code-insight.intentions.shared.xml +++ b/plugins/kotlin/code-insight/intentions-shared/resources/kotlin.code-insight.intentions.shared.xml @@ -413,6 +413,13 @@ group.names.kotlin + + kotlin + org.jetbrains.kotlin.idea.codeInsight.intentions.shared.SpecifyTypeExplicitlyInDestructuringAssignmentIntention + messages.KotlinBundle + group.names.kotlin + + kotlin org.jetbrains.kotlin.idea.codeInsight.intentions.shared.ConvertLazyPropertyToOrdinaryIntention diff --git a/plugins/kotlin/code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/SpecifyTypeExplicitlyInDestructuringAssignmentIntention.kt b/plugins/kotlin/code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/SpecifyTypeExplicitlyInDestructuringAssignmentIntention.kt index be916c9b029e..893b0c8c6850 100644 --- a/plugins/kotlin/code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/SpecifyTypeExplicitlyInDestructuringAssignmentIntention.kt +++ b/plugins/kotlin/code-insight/intentions-shared/src/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/SpecifyTypeExplicitlyInDestructuringAssignmentIntention.kt @@ -1,44 +1,90 @@ -// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -package org.jetbrains.kotlin.idea.intentions +package org.jetbrains.kotlin.idea.codeInsight.intentions.shared -import com.intellij.openapi.editor.Editor +import com.intellij.codeInspection.util.IntentionFamilyName +import com.intellij.modcommand.ActionContext +import com.intellij.modcommand.ModPsiUpdater import com.intellij.openapi.util.TextRange +import com.intellij.psi.SmartPsiElementPointer +import com.intellij.psi.createSmartPointer +import org.jetbrains.kotlin.analysis.api.KaExperimentalApi +import org.jetbrains.kotlin.analysis.api.KaSession +import org.jetbrains.kotlin.analysis.api.analyze +import org.jetbrains.kotlin.analysis.api.renderer.types.impl.KaTypeRendererForSource +import org.jetbrains.kotlin.analysis.api.types.KaErrorType import org.jetbrains.kotlin.idea.base.resources.KotlinBundle -import org.jetbrains.kotlin.idea.codeinsight.api.classic.intentions.SelfTargetingRangeIntention -import org.jetbrains.kotlin.idea.core.setType +import org.jetbrains.kotlin.idea.codeinsight.api.applicable.intentions.KotlinApplicableModCommandAction import org.jetbrains.kotlin.psi.KtCodeFragment import org.jetbrains.kotlin.psi.KtDestructuringDeclaration import org.jetbrains.kotlin.psi.KtDestructuringDeclarationEntry -import org.jetbrains.kotlin.psi.KtParameterList +import org.jetbrains.kotlin.psi.KtPsiFactory import org.jetbrains.kotlin.psi.psiUtil.endOffset -import org.jetbrains.kotlin.psi.psiUtil.getParentOfType import org.jetbrains.kotlin.psi.psiUtil.startOffset -import org.jetbrains.kotlin.types.isError +import org.jetbrains.kotlin.types.Variance -class SpecifyTypeExplicitlyInDestructuringAssignmentIntention : SelfTargetingRangeIntention( - KtDestructuringDeclaration::class.java, KotlinBundle.lazyMessage("specify.all.types.explicitly.in.destructuring.declaration") -) { - override fun applicabilityRange(element: KtDestructuringDeclaration): TextRange? { - if (element.containingFile is KtCodeFragment) return null +internal class SpecifyTypeExplicitlyInDestructuringAssignmentIntention : + KotlinApplicableModCommandAction( + KtDestructuringDeclaration::class + ) { + + internal class Context(val entries: List>) + + override fun getFamilyName(): @IntentionFamilyName String = + KotlinBundle.message("specify.all.types.explicitly.in.destructuring.declaration") + + override fun isApplicableByPsi(element: KtDestructuringDeclaration): Boolean { + if (element.containingFile is KtCodeFragment) return false val entries = element.entriesWithoutExplicitTypes() - if (entries.isEmpty()) return null - if (entries.any { SpecifyTypeExplicitlyIntention.getTypeForDeclaration(it).isError }) return null - val endOffset = element.initializer?.let { it.startOffset - 1 } ?: element.endOffset - return TextRange(element.startOffset, endOffset) + return entries.isNotEmpty() } - override fun applyTo(element: KtDestructuringDeclaration, editor: Editor?) { + override fun getApplicableRanges(element: KtDestructuringDeclaration): List { + val endOffset = element.initializer?.let { it.startOffset - 1 } ?: element.endOffset + return listOf(TextRange(0, endOffset - element.startOffset)) + } + + @OptIn(KaExperimentalApi::class) + override fun KaSession.prepareContext(element: KtDestructuringDeclaration): Context? { val entries = element.entriesWithoutExplicitTypes() - if (editor != null && element.getParentOfType(strict = false) == null) { - SpecifyTypeExplicitlyIntention.addTypeAnnotationWithTemplate(editor, entries.iterator()) - } else { - for (entry in entries) { - entry.setType(SpecifyTypeExplicitlyIntention.getTypeForDeclaration(entry)) + if (entries.any { entry -> + val symbol = entry.symbol + symbol.returnType is KaErrorType + }) return null + return Context(entries.map { it.createSmartPointer() }.toList()) + } + + override fun invoke( + actionContext: ActionContext, + element: KtDestructuringDeclaration, + elementContext: Context, + updater: ModPsiUpdater, + ) { + val entries = elementContext.entries + for (entry in entries) { + val element = entry.element ?: continue + setTypeForDeclaration(element) + if (entries.last() == entry) { + updater.moveCaretTo(element.endOffset) } } } + + private fun setTypeForDeclaration(entry: KtDestructuringDeclarationEntry) { + val factory = KtPsiFactory(entry.project) + val typeReference = factory.createType(entry.getKotlinType()) + entry.typeReference = typeReference + } } private fun KtDestructuringDeclaration.entriesWithoutExplicitTypes(): List = entries.filter { it.typeReference == null } + +@OptIn(KaExperimentalApi::class) +private fun KtDestructuringDeclarationEntry.getKotlinType(): String { + val entry = this + return analyze(entry) { + val symbol = entry.symbol + symbol.returnType.render(renderer = KaTypeRendererForSource.WITH_SHORT_NAMES, position = Variance.OUT_VARIANCE) + } +} \ No newline at end of file diff --git a/plugins/kotlin/code-insight/intentions-shared/tests/k1/test/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/SharedK1IntentionTestGenerated.java b/plugins/kotlin/code-insight/intentions-shared/tests/k1/test/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/SharedK1IntentionTestGenerated.java index 0b64078e7e68..def73080cb65 100644 --- a/plugins/kotlin/code-insight/intentions-shared/tests/k1/test/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/SharedK1IntentionTestGenerated.java +++ b/plugins/kotlin/code-insight/intentions-shared/tests/k1/test/org/jetbrains/kotlin/idea/codeInsight/intentions/shared/SharedK1IntentionTestGenerated.java @@ -3035,6 +3035,55 @@ public abstract class SharedK1IntentionTestGenerated extends AbstractSharedK1Int } } + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment") + public static class SpecifyTypeExplicitlyInDestructuringAssignment extends AbstractSharedK1IntentionTest { + @java.lang.Override + @org.jetbrains.annotations.NotNull + public final KotlinPluginMode getPluginMode() { + return KotlinPluginMode.K1; + } + + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("in.kt") + public void testIn() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt"); + } + + @TestMetadata("lambda.kt") + public void testLambda() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt"); + } + + @TestMetadata("lambdaHasSignature.kt") + public void testLambdaHasSignature() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt"); + } + + @TestMetadata("variableHasAllTypes.kt") + public void testVariableHasAllTypes() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasAllTypes.kt"); + } + + @TestMetadata("variableHasNoTypes.kt") + public void testVariableHasNoTypes() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt"); + } + + @TestMetadata("variableHasTypes.kt") + public void testVariableHasTypes() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt"); + } + + @TestMetadata("variableHasUnderscore.kt") + public void testVariableHasUnderscore() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt"); + } + } + @RunWith(JUnit3RunnerWithInners.class) @TestMetadata("../testData/intentions/splitIf") public abstract static class SplitIf extends AbstractSharedK1IntentionTest { diff --git a/plugins/kotlin/code-insight/intentions-shared/tests/k2/test/org/jetbrains/kotlin/idea/k2/codeInsight/intentions/shared/SharedK2IntentionTestGenerated.java b/plugins/kotlin/code-insight/intentions-shared/tests/k2/test/org/jetbrains/kotlin/idea/k2/codeInsight/intentions/shared/SharedK2IntentionTestGenerated.java index 280d7b22a765..018bf2dd51b2 100644 --- a/plugins/kotlin/code-insight/intentions-shared/tests/k2/test/org/jetbrains/kotlin/idea/k2/codeInsight/intentions/shared/SharedK2IntentionTestGenerated.java +++ b/plugins/kotlin/code-insight/intentions-shared/tests/k2/test/org/jetbrains/kotlin/idea/k2/codeInsight/intentions/shared/SharedK2IntentionTestGenerated.java @@ -3035,6 +3035,55 @@ public abstract class SharedK2IntentionTestGenerated extends AbstractSharedK2Int } } + @RunWith(JUnit3RunnerWithInners.class) + @TestMetadata("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment") + public static class SpecifyTypeExplicitlyInDestructuringAssignment extends AbstractSharedK2IntentionTest { + @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("in.kt") + public void testIn() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt"); + } + + @TestMetadata("lambda.kt") + public void testLambda() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt"); + } + + @TestMetadata("lambdaHasSignature.kt") + public void testLambdaHasSignature() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt"); + } + + @TestMetadata("variableHasAllTypes.kt") + public void testVariableHasAllTypes() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasAllTypes.kt"); + } + + @TestMetadata("variableHasNoTypes.kt") + public void testVariableHasNoTypes() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt"); + } + + @TestMetadata("variableHasTypes.kt") + public void testVariableHasTypes() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt"); + } + + @TestMetadata("variableHasUnderscore.kt") + public void testVariableHasUnderscore() throws Exception { + runTest("../testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt"); + } + } + @RunWith(JUnit3RunnerWithInners.class) @TestMetadata("../testData/intentions/splitIf") public abstract static class SplitIf extends AbstractSharedK2IntentionTest { diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/.intention b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/.intention similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/.intention rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/.intention diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt.after b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt.after similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt.after rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt.after diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt.after b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt.after similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt.after rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt.after diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt.after b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt.after similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt.after rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt.after diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasAllTypes.kt b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasAllTypes.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasAllTypes.kt rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasAllTypes.kt diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt.after b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt.after similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt.after rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt.after diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt.after b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt.after similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt.after rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt.after diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt diff --git a/plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt.after b/plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt.after similarity index 100% rename from plugins/kotlin/idea/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt.after rename to plugins/kotlin/code-insight/intentions-shared/tests/testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt.after diff --git a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/K1IntentionTestGenerated.java b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/K1IntentionTestGenerated.java index 8982675dd0dd..9d72c26d9842 100644 --- a/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/K1IntentionTestGenerated.java +++ b/plugins/kotlin/idea/tests/test/org/jetbrains/kotlin/idea/intentions/K1IntentionTestGenerated.java @@ -17846,55 +17846,6 @@ public abstract class K1IntentionTestGenerated extends AbstractK1IntentionTest { } } - @RunWith(JUnit3RunnerWithInners.class) - @TestMetadata("testData/intentions/specifyTypeExplicitlyInDestructuringAssignment") - public static class SpecifyTypeExplicitlyInDestructuringAssignment extends AbstractK1IntentionTest { - @java.lang.Override - @org.jetbrains.annotations.NotNull - public final KotlinPluginMode getPluginMode() { - return KotlinPluginMode.K1; - } - - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - @TestMetadata("in.kt") - public void testIn() throws Exception { - runTest("testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/in.kt"); - } - - @TestMetadata("lambda.kt") - public void testLambda() throws Exception { - runTest("testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambda.kt"); - } - - @TestMetadata("lambdaHasSignature.kt") - public void testLambdaHasSignature() throws Exception { - runTest("testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/lambdaHasSignature.kt"); - } - - @TestMetadata("variableHasAllTypes.kt") - public void testVariableHasAllTypes() throws Exception { - runTest("testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasAllTypes.kt"); - } - - @TestMetadata("variableHasNoTypes.kt") - public void testVariableHasNoTypes() throws Exception { - runTest("testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasNoTypes.kt"); - } - - @TestMetadata("variableHasTypes.kt") - public void testVariableHasTypes() throws Exception { - runTest("testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasTypes.kt"); - } - - @TestMetadata("variableHasUnderscore.kt") - public void testVariableHasUnderscore() throws Exception { - runTest("testData/intentions/specifyTypeExplicitlyInDestructuringAssignment/variableHasUnderscore.kt"); - } - } - @RunWith(JUnit3RunnerWithInners.class) @TestMetadata("testData/intentions/swapStringEqualsIgnoreCase") public static class SwapStringEqualsIgnoreCase extends AbstractK1IntentionTest { diff --git a/plugins/kotlin/plugin/k1/resources/META-INF/inspections-fe10.xml b/plugins/kotlin/plugin/k1/resources/META-INF/inspections-fe10.xml index 7ae55b58a006..4f80f74b31e2 100644 --- a/plugins/kotlin/plugin/k1/resources/META-INF/inspections-fe10.xml +++ b/plugins/kotlin/plugin/k1/resources/META-INF/inspections-fe10.xml @@ -35,13 +35,6 @@ group.names.kotlin - - kotlin - org.jetbrains.kotlin.idea.codeInsight.intentions.shared.SpecifyTypeExplicitlyInDestructuringAssignmentIntention - messages.KotlinBundle - group.names.kotlin - - kotlin org.jetbrains.kotlin.idea.intentions.RemoveExplicitTypeIntention