diff --git a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt index 83e49433457..04283e9c0aa 100644 --- a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt @@ -369,6 +369,7 @@ fun main(args: Array) { model("intentions/insertCurlyBracestsToTemplate", testMethod = "doTestInsertCurlyToTemplate") model("intentions/moveLambdaInsideParentheses", testMethod = "doTestMoveLambdaInsideParentheses") model("intentions/moveLambdaOutsideParentheses", testMethod = "doTestMoveLambdaOutsideParentheses") + model("intentions/replaceExplicitFunctionLiteralParamWithIt", testMethod = "doTestReplaceExplicitFunctionLiteralParamWithIt") } testClass(javaClass()) { diff --git a/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/after.kt.template b/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/after.kt.template new file mode 100644 index 00000000000..1ff32f3c4e2 --- /dev/null +++ b/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/after.kt.template @@ -0,0 +1 @@ +array(1, 2, 3).filter { it % 2 == 0 } diff --git a/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/before.kt.template b/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/before.kt.template new file mode 100644 index 00000000000..9cab6176e61 --- /dev/null +++ b/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/before.kt.template @@ -0,0 +1 @@ +array(1, 2, 3).filter { x -> x % 2 == 0 } diff --git a/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/description.html b/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/description.html new file mode 100644 index 00000000000..becf4aaf250 --- /dev/null +++ b/idea/resources/intentionDescriptions/ReplaceExplicitFunctionLiteralParamWithItIntention/description.html @@ -0,0 +1,5 @@ + + + This intention replaces the explicit parameter of a single-parameter function literal with the implicit 'it' parameter. + + diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 98867f22613..18bc5805a8d 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -528,6 +528,11 @@ Kotlin + + org.jetbrains.jet.plugin.intentions.ReplaceExplicitFunctionLiteralParamWithItIntention + Kotlin + + diff --git a/idea/src/org/jetbrains/jet/plugin/JetBundle.properties b/idea/src/org/jetbrains/jet/plugin/JetBundle.properties index 3ba77edd7a5..b5f9f945e16 100644 --- a/idea/src/org/jetbrains/jet/plugin/JetBundle.properties +++ b/idea/src/org/jetbrains/jet/plugin/JetBundle.properties @@ -233,6 +233,8 @@ replace.with.dot.qualified.method.call.intention=Replace with simple method call replace.with.dot.qualified.method.call.intention.family=Replace with simple method call replace.with.infix.function.call.intention=Replace with infix function call replace.with.infix.function.call.intention.family=Replace with infix function call +replace.explicit.function.literal.param.with.it=Replace explicit parameter ''{0}'' with ''it'' +replace.explicit.function.literal.param.with.it.family=Replace Explicit Parameter With 'it' move.lambda.inside.parentheses=Move lambda function into parentheses move.lambda.inside.parentheses.family=Move lambda function into parentheses move.lambda.outside.parentheses=Move lambda expression out of parentheses diff --git a/idea/src/org/jetbrains/jet/plugin/intentions/ReplaceExplicitFunctionLiteralParamWithItIntention.kt b/idea/src/org/jetbrains/jet/plugin/intentions/ReplaceExplicitFunctionLiteralParamWithItIntention.kt new file mode 100644 index 00000000000..85840c770e0 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/intentions/ReplaceExplicitFunctionLiteralParamWithItIntention.kt @@ -0,0 +1,115 @@ +/* + * 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 com.intellij.codeInsight.intention.PsiElementBaseIntentionAction +import com.intellij.openapi.editor.Editor +import com.intellij.openapi.project.Project +import com.intellij.psi.PsiElement +import com.intellij.psi.util.PsiTreeUtil +import com.intellij.refactoring.rename.RenameProcessor +import com.intellij.usageView.UsageInfo +import org.jetbrains.jet.lang.psi.* +import org.jetbrains.jet.plugin.JetBundle +import com.intellij.psi.codeStyle.CodeStyleManager +import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache +import org.jetbrains.jet.lang.descriptors.impl.AnonymousFunctionDescriptor +import org.jetbrains.jet.lang.resolve.BindingContextUtils +import org.jetbrains.jet.plugin.references.JetReference +import org.jetbrains.jet.plugin.codeInsight.firstOrNull +import org.jetbrains.jet.lang.descriptors.VariableDescriptor + +public class ReplaceExplicitFunctionLiteralParamWithItIntention() : PsiElementBaseIntentionAction() { + override fun invoke(project: Project, editor: Editor, element: PsiElement) { + val funcExpr = findFunctionLiteralToActOn(element)!! + val cursorWasOverParameterList = PsiTreeUtil.getParentOfType(element, javaClass()) != null + ParamRenamingProcessor(editor, funcExpr, cursorWasOverParameterList).run() + } + + override fun isAvailable(project: Project, editor: Editor, element: PsiElement): Boolean { + val funcExpr = findFunctionLiteralToActOn(element) + if (funcExpr == null || funcExpr.getValueParameters().size() != 1) { + return false + } + + val parameter = funcExpr.getValueParameters().first() + if (parameter.getTypeReference() != null) { + return false + } + + setText(JetBundle.message("replace.explicit.function.literal.param.with.it", parameter.getName())) + return true + } + + override fun getFamilyName(): String { + return JetBundle.message("replace.explicit.function.literal.param.with.it.family") + } + + private fun findFunctionLiteralToActOn(element: PsiElement): JetFunctionLiteral? { + if (PsiTreeUtil.getParentOfType(element, javaClass()) == null) { + return null + } + + val expression = PsiTreeUtil.getParentOfType(element, javaClass(), javaClass()) + if (expression == null) { + return null + } + + when (expression) { + is JetParameter -> { + return PsiTreeUtil.skipParentsOfType(expression, javaClass()) as? JetFunctionLiteral + } + is JetSimpleNameExpression -> { + val reference = expression.getReference() as JetReference? + val variableDescriptor = reference?.resolveToDescriptors()?.firstOrNull() as? VariableDescriptor? + if (variableDescriptor != null) { + val containingDescriptor = variableDescriptor.getContainingDeclaration() + if (containingDescriptor is AnonymousFunctionDescriptor) { + val context = AnalyzerFacadeWithCache.getContextForElement(expression) + return BindingContextUtils.descriptorToDeclaration(context, containingDescriptor) as? JetFunctionLiteral + } + } + + return null + } + else -> return null + } + } + + private class ParamRenamingProcessor( + val editor: Editor, + val funcLiteral: JetFunctionLiteral, + val cursorWasOverParameterList: Boolean) : RenameProcessor(editor.getProject(), + funcLiteral.getValueParameters().first(), + "it", + false, + false + ) { + public override fun performRefactoring(usages: Array?) { + super.performRefactoring(usages) + funcLiteral.deleteChildRange(funcLiteral.getValueParameterList(), funcLiteral.getArrowNode()!!.getPsi()) + if (cursorWasOverParameterList) { + editor.getCaretModel().moveToOffset(funcLiteral.getBodyExpression()!!.getTextOffset()) + } + + CodeStyleManager.getInstance(editor.getProject()!!)!!.reformatText(funcLiteral.getContainingFile()!!, + funcLiteral.getTextRange()!!.getStartOffset(), + funcLiteral.getTextRange()!!.getEndOffset()) + + } + } +} diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursofOverParamInInnerLiteral.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursofOverParamInInnerLiteral.kt new file mode 100644 index 00000000000..b96b17dbf83 --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursofOverParamInInnerLiteral.kt @@ -0,0 +1,2 @@ +fun foo(a: (Int) -> Int): Int = a(1) +val x = foo { p -> foo { y -> p } } \ No newline at end of file diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursofOverParamInInnerLiteral.kt.after b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursofOverParamInInnerLiteral.kt.after new file mode 100644 index 00000000000..163ae9fea82 --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursofOverParamInInnerLiteral.kt.after @@ -0,0 +1,2 @@ +fun foo(a: (Int) -> Int): Int = a(1) +val x = foo { foo { y -> it } } \ No newline at end of file diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterDeclaration.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterDeclaration.kt new file mode 100644 index 00000000000..d0d3a7c2ff0 --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterDeclaration.kt @@ -0,0 +1,2 @@ +fun applyTwice(f: (A) -> A, x: A) = f(f(x)) +val x = applyTwice({ x -> 1 + x }, 40) diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterDeclaration.kt.after b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterDeclaration.kt.after new file mode 100644 index 00000000000..f976c977dc9 --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterDeclaration.kt.after @@ -0,0 +1,2 @@ +fun applyTwice(f: (A) -> A, x: A) = f(f(x)) +val x = applyTwice({ 1 + it }, 40) diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterUse.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterUse.kt new file mode 100644 index 00000000000..ee7a7faceba --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterUse.kt @@ -0,0 +1,2 @@ +fun applyTwice(f: (A) -> A, x: A) = f(f(x)) +val x = applyTwice({ x -> x + 1 }, 40) diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterUse.kt.after b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterUse.kt.after new file mode 100644 index 00000000000..30e6e65a715 --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterUse.kt.after @@ -0,0 +1,2 @@ +fun applyTwice(f: (A) -> A, x: A) = f(f(x)) +val x = applyTwice({ it + 1 }, 40) diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt new file mode 100644 index 00000000000..67a5347a6d3 --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt @@ -0,0 +1,6 @@ +fun foo(i: (Int) -> Unit) {} +fun test() { + foo { x -> + array(1, 2, 3).filter { x -> x % 2 == 0 } + } +} diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt.after b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt.after new file mode 100644 index 00000000000..9367f9c4f05 --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt.after @@ -0,0 +1,6 @@ +fun foo(i: (Int) -> Unit) {} +fun test() { + foo { + array(1, 2, 3).filter { x -> x % 2 == 0 } + } +} diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_alreadyUsesImplicitIt.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_alreadyUsesImplicitIt.kt new file mode 100644 index 00000000000..c85d05dccd7 --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_alreadyUsesImplicitIt.kt @@ -0,0 +1,4 @@ +// IS_APPLICABLE: false + +fun applyTwice(f: (A) -> A, x: A) = f(f(x)) +val x = applyTwice({ it + 1 }, 40) diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_hasMultipleParameters.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_hasMultipleParameters.kt new file mode 100644 index 00000000000..85846b125d5 --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_hasMultipleParameters.kt @@ -0,0 +1,4 @@ +// IS_APPLICABLE: false + +fun call2(f: (Int, Int) -> Int, x: Int, y: Int) = f(x, y) +val foo = call2({ x, y -> x + y }, 40, 2) diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_notFunctionLiteralParameter.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_notFunctionLiteralParameter.kt new file mode 100644 index 00000000000..166e396a5b2 --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_notFunctionLiteralParameter.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: false + +val foo = { (x: Int) -> + class Inner() { + fun temp(y: Int) : Int { return x + y } + } + Inner() +} diff --git a/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_parameterHasExplicitType.kt b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_parameterHasExplicitType.kt new file mode 100644 index 00000000000..4ceeb0e877e --- /dev/null +++ b/idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_parameterHasExplicitType.kt @@ -0,0 +1,2 @@ +// IS_APPLICABLE: false +val incr = { (x: Int) -> x + 1} diff --git a/idea/tests/org/jetbrains/jet/plugin/intentions/AbstractCodeTransformationTest.java b/idea/tests/org/jetbrains/jet/plugin/intentions/AbstractCodeTransformationTest.java index 2a46f698842..8a7659b27b7 100644 --- a/idea/tests/org/jetbrains/jet/plugin/intentions/AbstractCodeTransformationTest.java +++ b/idea/tests/org/jetbrains/jet/plugin/intentions/AbstractCodeTransformationTest.java @@ -142,6 +142,10 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes doTestIntention(path, new ReplaceWithInfixFunctionCallIntention()); } + public void doTestReplaceExplicitFunctionLiteralParamWithIt(@NotNull String path) throws Exception { + doTestIntention(path, new ReplaceExplicitFunctionLiteralParamWithItIntention()); + } + 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 3d56b0843f9..0597d899a00 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.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}) +@InnerTestClasses({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}) public class CodeTransformationTestGenerated extends AbstractCodeTransformationTest { @TestMetadata("idea/testData/intentions/branched/folding/ifToAssignment") public static class IfToAssignment extends AbstractCodeTransformationTest { @@ -1478,6 +1478,54 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT } + @TestMetadata("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt") + public static class ReplaceExplicitFunctionLiteralParamWithIt extends AbstractCodeTransformationTest { + public void testAllFilesPresentInReplaceExplicitFunctionLiteralParamWithIt() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("applicable_cursofOverParamInInnerLiteral.kt") + public void testApplicable_cursofOverParamInInnerLiteral() throws Exception { + doTestReplaceExplicitFunctionLiteralParamWithIt("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursofOverParamInInnerLiteral.kt"); + } + + @TestMetadata("applicable_cursorOverParameterDeclaration.kt") + public void testApplicable_cursorOverParameterDeclaration() throws Exception { + doTestReplaceExplicitFunctionLiteralParamWithIt("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterDeclaration.kt"); + } + + @TestMetadata("applicable_cursorOverParameterUse.kt") + public void testApplicable_cursorOverParameterUse() throws Exception { + doTestReplaceExplicitFunctionLiteralParamWithIt("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_cursorOverParameterUse.kt"); + } + + @TestMetadata("applicable_formatsProperly.kt") + public void testApplicable_formatsProperly() throws Exception { + doTestReplaceExplicitFunctionLiteralParamWithIt("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/applicable_formatsProperly.kt"); + } + + @TestMetadata("notApplicable_alreadyUsesImplicitIt.kt") + public void testNotApplicable_alreadyUsesImplicitIt() throws Exception { + doTestReplaceExplicitFunctionLiteralParamWithIt("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_alreadyUsesImplicitIt.kt"); + } + + @TestMetadata("notApplicable_hasMultipleParameters.kt") + public void testNotApplicable_hasMultipleParameters() throws Exception { + doTestReplaceExplicitFunctionLiteralParamWithIt("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_hasMultipleParameters.kt"); + } + + @TestMetadata("notApplicable_notFunctionLiteralParameter.kt") + public void testNotApplicable_notFunctionLiteralParameter() throws Exception { + doTestReplaceExplicitFunctionLiteralParamWithIt("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_notFunctionLiteralParameter.kt"); + } + + @TestMetadata("notApplicable_parameterHasExplicitType.kt") + public void testNotApplicable_parameterHasExplicitType() throws Exception { + doTestReplaceExplicitFunctionLiteralParamWithIt("idea/testData/intentions/replaceExplicitFunctionLiteralParamWithIt/notApplicable_parameterHasExplicitType.kt"); + } + + } + public static Test suite() { TestSuite suite = new TestSuite("CodeTransformationTestGenerated"); suite.addTestSuite(IfToAssignment.class); @@ -1507,6 +1555,7 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT suite.addTestSuite(RemoveCurlyBracesFromTemplate.class); suite.addTestSuite(MoveLambdaInsideParentheses.class); suite.addTestSuite(MoveLambdaOutsideParentheses.class); + suite.addTestSuite(ReplaceExplicitFunctionLiteralParamWithIt.class); return suite; } }