From 35c5a62b111a149d9f04b980baf807e54592a598 Mon Sep 17 00:00:00 2001 From: Ross Hanson Date: Mon, 21 Apr 2014 09:31:28 -0400 Subject: [PATCH] KT-4820: Intention to remove an unused index variable from a for loop. --- .../jet/generators/tests/GenerateTests.kt | 1 + .../after.kt.template | 3 + .../before.kt.template | 3 + .../description.html | 5 ++ idea/src/META-INF/plugin.xml | 5 ++ .../jetbrains/jet/plugin/JetBundle.properties | 2 + .../RemoveForLoopIndicesIntention.kt | 83 +++++++++++++++++++ .../inapplicableForLoop.kt | 6 ++ .../inapplicableIndexUse.kt | 7 ++ .../loopWithType.kt | 6 ++ .../loopWithType.kt.after | 6 ++ .../simpleLoopWithIndices.kt | 6 ++ .../simpleLoopWithIndices.kt.after | 6 ++ .../AbstractCodeTransformationTest.java | 4 + .../CodeTransformationTestGenerated.java | 33 +++++++- 15 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/after.kt.template create mode 100644 idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/before.kt.template create mode 100644 idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/description.html create mode 100644 idea/src/org/jetbrains/jet/plugin/intentions/RemoveForLoopIndicesIntention.kt create mode 100644 idea/testData/intentions/removeForLoopIndicesIntention/inapplicableForLoop.kt create mode 100644 idea/testData/intentions/removeForLoopIndicesIntention/inapplicableIndexUse.kt create mode 100644 idea/testData/intentions/removeForLoopIndicesIntention/loopWithType.kt create mode 100644 idea/testData/intentions/removeForLoopIndicesIntention/loopWithType.kt.after create mode 100644 idea/testData/intentions/removeForLoopIndicesIntention/simpleLoopWithIndices.kt create mode 100644 idea/testData/intentions/removeForLoopIndicesIntention/simpleLoopWithIndices.kt.after diff --git a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt index e017cb32dca..786f8c455bf 100644 --- a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt @@ -415,6 +415,7 @@ fun main(args: Array) { model("intentions/convertToForEachLoop", testMethod = "doTestConvertToForEachLoop") model("intentions/convertToForEachFunctionCall", testMethod = "doTestConvertToForEachFunctionCall") model("intentions/addForLoopIndicesIntention", testMethod = "doTestAddForLoopIndicesIntention") + model("intentions/removeForLoopIndicesIntention", testMethod = "doTestRemoveForLoopIndicesIntention") } testClass(javaClass()) { diff --git a/idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/after.kt.template b/idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/after.kt.template new file mode 100644 index 00000000000..8b1fae6e977 --- /dev/null +++ b/idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/after.kt.template @@ -0,0 +1,3 @@ +for (x in foo) { + +} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/before.kt.template b/idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/before.kt.template new file mode 100644 index 00000000000..362674c6894 --- /dev/null +++ b/idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/before.kt.template @@ -0,0 +1,3 @@ +for ((i,x) in foo.withIndices()) { + +} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/description.html b/idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/description.html new file mode 100644 index 00000000000..dfdfe1e2a0c --- /dev/null +++ b/idea/resources/intentionDescriptions/RemoveForLoopIndicesIntention/description.html @@ -0,0 +1,5 @@ + + +This intention removes the index variable from a for loop iterating over a collection. + + diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 5ec97031ea1..89c1a612d3e 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -661,6 +661,11 @@ Kotlin + + org.jetbrains.jet.plugin.intentions.RemoveForLoopIndicesIntention + Kotlin + S + org.jetbrains.jet.plugin.intentions.SwapBinaryExpression Kotlin diff --git a/idea/src/org/jetbrains/jet/plugin/JetBundle.properties b/idea/src/org/jetbrains/jet/plugin/JetBundle.properties index e1b8ecbd9aa..46ccada2a0d 100644 --- a/idea/src/org/jetbrains/jet/plugin/JetBundle.properties +++ b/idea/src/org/jetbrains/jet/plugin/JetBundle.properties @@ -294,6 +294,8 @@ convert.negated.expression.with.demorgans.law=Convert negated expression to DeMo convert.negated.expression.with.demorgans.law.family=Convert negated expression to DeMorgan's equivalent add.for.loop.indices=Add indices to for loop add.for.loop.indices.family=Add indices to for loop +remove.for.loop.indices=Remove indices from for loop +remove.for.loop.indices.family=Remove indices from for loop split.if=Split into 2 if's split.if.family=Split If replace.with.operator.assign.intention=Replace with an Operator-Assign Expression diff --git a/idea/src/org/jetbrains/jet/plugin/intentions/RemoveForLoopIndicesIntention.kt b/idea/src/org/jetbrains/jet/plugin/intentions/RemoveForLoopIndicesIntention.kt new file mode 100644 index 00000000000..593902be45e --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/intentions/RemoveForLoopIndicesIntention.kt @@ -0,0 +1,83 @@ +/* + * Copyright 2010-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.jet.plugin.intentions + +import org.jetbrains.jet.lang.psi.JetForExpression +import com.intellij.openapi.editor.Editor +import org.jetbrains.jet.lang.psi.JetPsiFactory +import org.jetbrains.jet.lang.psi.JetDotQualifiedExpression +import org.jetbrains.jet.lang.psi.JetPsiUtil +import org.jetbrains.jet.lang.cfg.PseudocodeVariablesData.VariableUseState +import org.jetbrains.jet.lang.cfg.pseudocode.PseudocodeUtil +import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache +import org.jetbrains.jet.lang.psi.JetFile +import org.jetbrains.jet.lang.resolve.ObservableBindingTrace +import org.jetbrains.jet.lang.resolve.BindingTraceContext +import org.jetbrains.jet.lang.cfg.JetFlowInformationProvider +import org.jetbrains.jet.lang.cfg.JetControlFlowProcessor +import com.intellij.debugger.jdi.LocalVariablesUtil +import com.siyeh.ig.psiutils.VariableAccessUtils +import com.google.dart.compiler.util.AstUtil +import com.intellij.find.FindManager +import com.intellij.find.impl.FindManagerImpl +import com.intellij.usageView.UsageInfo +import com.intellij.util.Processor +import org.jetbrains.jet.plugin.findUsages.KotlinPropertyFindUsagesOptions + +public class RemoveForLoopIndicesIntention : JetSelfTargetingIntention( + "remove.for.loop.indices", javaClass()) { + override fun applyTo(element: JetForExpression, editor: Editor) { + val parameter = element.getMultiParameter()!! + val range = element.getLoopRange() as JetDotQualifiedExpression + val parameters = parameter.getEntries() + if (parameters.size() == 2) { + parameter.replace(parameters[1]) + } else { + JetPsiUtil.deleteElementWithDelimiters(parameters[0]) + } + + range.replace(range.getReceiverExpression()) + } + + override fun isApplicableTo(element: JetForExpression): Boolean { + if (element.getMultiParameter() == null) return false + val range = element.getLoopRange() as? JetDotQualifiedExpression ?: return false + val selector = range.getSelectorExpression() ?: return false + if (!selector.textMatches("withIndices()")) return false + + val indexVar = element.getMultiParameter()!!.getEntries()[0] + + val findManager = FindManager.getInstance(element.getProject()) as FindManagerImpl + val findHandler = findManager.getFindUsagesManager().getFindUsagesHandler(indexVar,false) ?: return false + val options = KotlinPropertyFindUsagesOptions(element.getProject()) + val usageCount = array(0) + val usageFinderRunnable = object : Runnable { + override fun run() { + val processor = object : Processor { + override fun process(t: UsageInfo?): Boolean { + usageCount[0] = usageCount[0] + 1 + return true + } + } + findHandler.processElementUsages(indexVar,processor,options) + } + } + usageFinderRunnable.run() + return usageCount[0] == 0 + } + +} \ No newline at end of file diff --git a/idea/testData/intentions/removeForLoopIndicesIntention/inapplicableForLoop.kt b/idea/testData/intentions/removeForLoopIndicesIntention/inapplicableForLoop.kt new file mode 100644 index 00000000000..6a70ccdd704 --- /dev/null +++ b/idea/testData/intentions/removeForLoopIndicesIntention/inapplicableForLoop.kt @@ -0,0 +1,6 @@ +//IS_APPLICABLE: FALSE +fun foo(bar: List) { + for (a in bar) { + + } +} \ No newline at end of file diff --git a/idea/testData/intentions/removeForLoopIndicesIntention/inapplicableIndexUse.kt b/idea/testData/intentions/removeForLoopIndicesIntention/inapplicableIndexUse.kt new file mode 100644 index 00000000000..554c2be803d --- /dev/null +++ b/idea/testData/intentions/removeForLoopIndicesIntention/inapplicableIndexUse.kt @@ -0,0 +1,7 @@ +// IS_APPLICABLE: FALSE +//ERROR: Unresolved reference: withIndices +fun foo(b: List) { + for ((i, c) in b.withIndices()) { + return i + } +} \ No newline at end of file diff --git a/idea/testData/intentions/removeForLoopIndicesIntention/loopWithType.kt b/idea/testData/intentions/removeForLoopIndicesIntention/loopWithType.kt new file mode 100644 index 00000000000..ce29523424a --- /dev/null +++ b/idea/testData/intentions/removeForLoopIndicesIntention/loopWithType.kt @@ -0,0 +1,6 @@ +//ERROR: Unresolved reference: withIndices +fun foo(bar: List) { + for ((i : Int, b: Int) in bar.withIndices()) { + + } +} \ No newline at end of file diff --git a/idea/testData/intentions/removeForLoopIndicesIntention/loopWithType.kt.after b/idea/testData/intentions/removeForLoopIndicesIntention/loopWithType.kt.after new file mode 100644 index 00000000000..401456e86c3 --- /dev/null +++ b/idea/testData/intentions/removeForLoopIndicesIntention/loopWithType.kt.after @@ -0,0 +1,6 @@ +//ERROR: Unresolved reference: withIndices +fun foo(bar: List) { + for (b: Int in bar) { + + } +} \ No newline at end of file diff --git a/idea/testData/intentions/removeForLoopIndicesIntention/simpleLoopWithIndices.kt b/idea/testData/intentions/removeForLoopIndicesIntention/simpleLoopWithIndices.kt new file mode 100644 index 00000000000..b66702744fd --- /dev/null +++ b/idea/testData/intentions/removeForLoopIndicesIntention/simpleLoopWithIndices.kt @@ -0,0 +1,6 @@ +//ERROR: Unresolved reference: withIndices +fun foo(bar: List) { + for ((i,a) in bar.withIndices()) { + + } +} \ No newline at end of file diff --git a/idea/testData/intentions/removeForLoopIndicesIntention/simpleLoopWithIndices.kt.after b/idea/testData/intentions/removeForLoopIndicesIntention/simpleLoopWithIndices.kt.after new file mode 100644 index 00000000000..08489a0e8a4 --- /dev/null +++ b/idea/testData/intentions/removeForLoopIndicesIntention/simpleLoopWithIndices.kt.after @@ -0,0 +1,6 @@ +//ERROR: Unresolved reference: withIndices +fun foo(bar: List) { + for (a in bar) { + + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/jet/plugin/intentions/AbstractCodeTransformationTest.java b/idea/tests/org/jetbrains/jet/plugin/intentions/AbstractCodeTransformationTest.java index 1bc7e13a38b..1cd83727e07 100644 --- a/idea/tests/org/jetbrains/jet/plugin/intentions/AbstractCodeTransformationTest.java +++ b/idea/tests/org/jetbrains/jet/plugin/intentions/AbstractCodeTransformationTest.java @@ -278,6 +278,10 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes doTestIntention(path, new ConvertToForEachFunctionCallIntention()); } + public void doTestRemoveForLoopIndicesIntention(@NotNull String path) throws Exception { + doTestIntention(path, new RemoveForLoopIndicesIntention()); + } + private void doTestIntention(@NotNull String path, @NotNull IntentionAction intentionAction) throws Exception { configureByFile(path); diff --git a/idea/tests/org/jetbrains/jet/plugin/intentions/CodeTransformationTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/intentions/CodeTransformationTestGenerated.java index cfac143f5e0..a89feba5e2d 100644 --- a/idea/tests/org/jetbrains/jet/plugin/intentions/CodeTransformationTestGenerated.java +++ b/idea/tests/org/jetbrains/jet/plugin/intentions/CodeTransformationTestGenerated.java @@ -30,7 +30,7 @@ import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationTest; /** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") -@InnerTestClasses({CodeTransformationTestGenerated.DoubleBangToIfThen.class, CodeTransformationTestGenerated.IfThenToDoubleBang.class, CodeTransformationTestGenerated.ElvisToIfThen.class, CodeTransformationTestGenerated.IfThenToElvis.class, CodeTransformationTestGenerated.SafeAccessToIfThen.class, CodeTransformationTestGenerated.IfThenToSafeAccess.class, CodeTransformationTestGenerated.IfToAssignment.class, CodeTransformationTestGenerated.IfToReturn.class, CodeTransformationTestGenerated.IfToReturnAsymmetrically.class, CodeTransformationTestGenerated.WhenToAssignment.class, CodeTransformationTestGenerated.WhenToReturn.class, CodeTransformationTestGenerated.AssignmentToIf.class, CodeTransformationTestGenerated.AssignmentToWhen.class, CodeTransformationTestGenerated.PropertyToIf.class, CodeTransformationTestGenerated.PropertyToWhen.class, CodeTransformationTestGenerated.ReturnToIf.class, CodeTransformationTestGenerated.ReturnToWhen.class, CodeTransformationTestGenerated.IfToWhen.class, CodeTransformationTestGenerated.WhenToIf.class, CodeTransformationTestGenerated.Flatten.class, CodeTransformationTestGenerated.Merge.class, CodeTransformationTestGenerated.IntroduceSubject.class, CodeTransformationTestGenerated.EliminateSubject.class, CodeTransformationTestGenerated.Split.class, CodeTransformationTestGenerated.Join.class, CodeTransformationTestGenerated.ConvertMemberToExtension.class, CodeTransformationTestGenerated.ReconstructedType.class, CodeTransformationTestGenerated.RemoveUnnecessaryParentheses.class, CodeTransformationTestGenerated.ReplaceWithDotQualifiedMethodCall.class, CodeTransformationTestGenerated.ReplaceWithInfixFunctionCall.class, CodeTransformationTestGenerated.RemoveCurlyBracesFromTemplate.class, CodeTransformationTestGenerated.MoveLambdaInsideParentheses.class, CodeTransformationTestGenerated.MoveLambdaOutsideParentheses.class, CodeTransformationTestGenerated.ReplaceExplicitFunctionLiteralParamWithIt.class, CodeTransformationTestGenerated.ReplaceItWithExplicitFunctionLiteralParam.class, CodeTransformationTestGenerated.RemoveBraces.class, CodeTransformationTestGenerated.AddBraces.class, CodeTransformationTestGenerated.ReplaceGetIntention.class, CodeTransformationTestGenerated.ReplaceContainsIntention.class, CodeTransformationTestGenerated.ReplaceBinaryInfixIntention.class, CodeTransformationTestGenerated.ReplaceUnaryPrefixIntention.class, CodeTransformationTestGenerated.ReplaceInvokeIntention.class, CodeTransformationTestGenerated.SimplifyNegatedBinaryExpressionIntention.class, CodeTransformationTestGenerated.ConvertNegatedBooleanSequence.class, CodeTransformationTestGenerated.ConvertNegatedExpressionWithDemorgansLaw.class, CodeTransformationTestGenerated.SwapBinaryExpression.class, CodeTransformationTestGenerated.SplitIf.class, CodeTransformationTestGenerated.ReplaceWithOperatorAssign.class, CodeTransformationTestGenerated.ReplaceWithTraditionalAssignment.class, CodeTransformationTestGenerated.SimplifyBooleanWithConstants.class, CodeTransformationTestGenerated.InsertExplicitTypeArguments.class, CodeTransformationTestGenerated.RemoveExplicitTypeArguments.class, CodeTransformationTestGenerated.ConvertAssertToIf.class, CodeTransformationTestGenerated.ConvertIfToAssert.class, CodeTransformationTestGenerated.MakeTypeExplicitInLambda.class, CodeTransformationTestGenerated.MakeTypeImplicitInLambda.class, CodeTransformationTestGenerated.ConvertToForEachLoop.class, CodeTransformationTestGenerated.ConvertToForEachFunctionCall.class, CodeTransformationTestGenerated.AddForLoopIndicesIntention.class}) +@InnerTestClasses({CodeTransformationTestGenerated.DoubleBangToIfThen.class, CodeTransformationTestGenerated.IfThenToDoubleBang.class, CodeTransformationTestGenerated.ElvisToIfThen.class, CodeTransformationTestGenerated.IfThenToElvis.class, CodeTransformationTestGenerated.SafeAccessToIfThen.class, CodeTransformationTestGenerated.IfThenToSafeAccess.class, CodeTransformationTestGenerated.IfToAssignment.class, CodeTransformationTestGenerated.IfToReturn.class, CodeTransformationTestGenerated.IfToReturnAsymmetrically.class, CodeTransformationTestGenerated.WhenToAssignment.class, CodeTransformationTestGenerated.WhenToReturn.class, CodeTransformationTestGenerated.AssignmentToIf.class, CodeTransformationTestGenerated.AssignmentToWhen.class, CodeTransformationTestGenerated.PropertyToIf.class, CodeTransformationTestGenerated.PropertyToWhen.class, CodeTransformationTestGenerated.ReturnToIf.class, CodeTransformationTestGenerated.ReturnToWhen.class, CodeTransformationTestGenerated.IfToWhen.class, CodeTransformationTestGenerated.WhenToIf.class, CodeTransformationTestGenerated.Flatten.class, CodeTransformationTestGenerated.Merge.class, CodeTransformationTestGenerated.IntroduceSubject.class, CodeTransformationTestGenerated.EliminateSubject.class, CodeTransformationTestGenerated.Split.class, CodeTransformationTestGenerated.Join.class, CodeTransformationTestGenerated.ConvertMemberToExtension.class, CodeTransformationTestGenerated.ReconstructedType.class, CodeTransformationTestGenerated.RemoveUnnecessaryParentheses.class, CodeTransformationTestGenerated.ReplaceWithDotQualifiedMethodCall.class, CodeTransformationTestGenerated.ReplaceWithInfixFunctionCall.class, CodeTransformationTestGenerated.RemoveCurlyBracesFromTemplate.class, CodeTransformationTestGenerated.MoveLambdaInsideParentheses.class, CodeTransformationTestGenerated.MoveLambdaOutsideParentheses.class, CodeTransformationTestGenerated.ReplaceExplicitFunctionLiteralParamWithIt.class, CodeTransformationTestGenerated.ReplaceItWithExplicitFunctionLiteralParam.class, CodeTransformationTestGenerated.RemoveBraces.class, CodeTransformationTestGenerated.AddBraces.class, CodeTransformationTestGenerated.ReplaceGetIntention.class, CodeTransformationTestGenerated.ReplaceContainsIntention.class, CodeTransformationTestGenerated.ReplaceBinaryInfixIntention.class, CodeTransformationTestGenerated.ReplaceUnaryPrefixIntention.class, CodeTransformationTestGenerated.ReplaceInvokeIntention.class, CodeTransformationTestGenerated.SimplifyNegatedBinaryExpressionIntention.class, CodeTransformationTestGenerated.ConvertNegatedBooleanSequence.class, CodeTransformationTestGenerated.ConvertNegatedExpressionWithDemorgansLaw.class, CodeTransformationTestGenerated.SwapBinaryExpression.class, CodeTransformationTestGenerated.SplitIf.class, CodeTransformationTestGenerated.ReplaceWithOperatorAssign.class, CodeTransformationTestGenerated.ReplaceWithTraditionalAssignment.class, CodeTransformationTestGenerated.SimplifyBooleanWithConstants.class, CodeTransformationTestGenerated.InsertExplicitTypeArguments.class, CodeTransformationTestGenerated.RemoveExplicitTypeArguments.class, CodeTransformationTestGenerated.ConvertAssertToIf.class, CodeTransformationTestGenerated.ConvertIfToAssert.class, CodeTransformationTestGenerated.MakeTypeExplicitInLambda.class, CodeTransformationTestGenerated.MakeTypeImplicitInLambda.class, CodeTransformationTestGenerated.ConvertToForEachLoop.class, CodeTransformationTestGenerated.ConvertToForEachFunctionCall.class, CodeTransformationTestGenerated.AddForLoopIndicesIntention.class, CodeTransformationTestGenerated.RemoveForLoopIndicesIntention.class}) public class CodeTransformationTestGenerated extends AbstractCodeTransformationTest { @TestMetadata("idea/testData/intentions/branched/doubleBangToIfThen") public static class DoubleBangToIfThen extends AbstractCodeTransformationTest { @@ -4241,7 +4241,7 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT } - @TestMetadata("idea/testData/intentions/addForLoopIndicesIntention") + @TestMetadata("idea/testData/intentions/addForLoopIndicesIntention") public static class AddForLoopIndicesIntention extends AbstractCodeTransformationTest { public void testAllFilesPresentInAddForLoopIndicesIntention() throws Exception { JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/intentions/addForLoopIndicesIntention"), Pattern.compile("^(.+)\\.kt$"), true); @@ -4274,6 +4274,34 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT } + @TestMetadata("idea/testData/intentions/removeForLoopIndicesIntention") + public static class RemoveForLoopIndicesIntention extends AbstractCodeTransformationTest { + public void testAllFilesPresentInRemoveForLoopIndicesIntention() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/intentions/removeForLoopIndicesIntention"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("inapplicableForLoop.kt") + public void testInapplicableForLoop() throws Exception { + doTestRemoveForLoopIndicesIntention("idea/testData/intentions/removeForLoopIndicesIntention/inapplicableForLoop.kt"); + } + + @TestMetadata("inapplicableIndexUse.kt") + public void testInapplicableIndexUse() throws Exception { + doTestRemoveForLoopIndicesIntention("idea/testData/intentions/removeForLoopIndicesIntention/inapplicableIndexUse.kt"); + } + + @TestMetadata("loopWithType.kt") + public void testLoopWithType() throws Exception { + doTestRemoveForLoopIndicesIntention("idea/testData/intentions/removeForLoopIndicesIntention/loopWithType.kt"); + } + + @TestMetadata("simpleLoopWithIndices.kt") + public void testSimpleLoopWithIndices() throws Exception { + doTestRemoveForLoopIndicesIntention("idea/testData/intentions/removeForLoopIndicesIntention/simpleLoopWithIndices.kt"); + } + + } + public static Test suite() { TestSuite suite = new TestSuite("CodeTransformationTestGenerated"); suite.addTestSuite(DoubleBangToIfThen.class); @@ -4335,6 +4363,7 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT suite.addTestSuite(ConvertToForEachLoop.class); suite.addTestSuite(ConvertToForEachFunctionCall.class); suite.addTestSuite(AddForLoopIndicesIntention.class); + suite.addTestSuite(RemoveForLoopIndicesIntention.class); return suite; } }