From 8cf965db7e6b4a33e004d3b2c9050a3d73592aae Mon Sep 17 00:00:00 2001 From: Tal Man Date: Sat, 8 Feb 2014 19:20:25 -0500 Subject: [PATCH] 2 intentions for moving lambda functions; moves lambda functions in function calls inside and outside of the parenthesis: foo({ it }) <-> foo() { it } --- .../jet/generators/tests/GenerateTests.kt | 2 + .../after.kt.template | 3 + .../before.kt.template | 3 + .../description.html | 5 + .../after.kt.template | 3 + .../before.kt.template | 3 + .../description.html | 5 + idea/src/META-INF/plugin.xml | 10 ++ .../jetbrains/jet/plugin/JetBundle.properties | 4 + .../MoveLambdaInsideParenthesesIntention.kt | 52 ++++++++ .../MoveLambdaOutsideParenthesesIntention.kt | 40 ++++++ .../inapplicable1.kt | 8 ++ .../inapplicable2.kt | 6 + .../moveLambda1.kt | 10 ++ .../moveLambda1.kt.after | 10 ++ .../moveLambda2.kt | 8 ++ .../moveLambda2.kt.after | 8 ++ .../moveLambda3.kt | 11 ++ .../moveLambda3.kt.after | 11 ++ .../moveLambda4.kt | 11 ++ .../moveLambda4.kt.after | 11 ++ .../moveLambda5.kt | 8 ++ .../moveLambda5.kt.after | 8 ++ .../moveLambda6.kt | 8 ++ .../moveLambda6.kt.after | 8 ++ .../moveLambda7.kt | 8 ++ .../moveLambda7.kt.after | 8 ++ .../moveLambda8.kt | 8 ++ .../moveLambda8.kt.after | 8 ++ .../moveLambda9.kt | 8 ++ .../moveLambda9.kt.after | 8 ++ .../inapplicable1.kt | 8 ++ .../inapplicable2.kt | 6 + .../inapplicable3.kt | 8 ++ .../moveLambda1.kt | 8 ++ .../moveLambda1.kt.after | 8 ++ .../moveLambda2.kt | 8 ++ .../moveLambda2.kt.after | 8 ++ .../moveLambda3.kt | 8 ++ .../moveLambda3.kt.after | 8 ++ .../moveLambda4.kt | 11 ++ .../moveLambda4.kt.after | 11 ++ .../moveLambda7.kt | 8 ++ .../moveLambda7.kt.after | 8 ++ .../moveLambda8.kt | 8 ++ .../moveLambda8.kt.after | 8 ++ .../AbstractCodeTransformationTest.java | 8 ++ .../CodeTransformationTestGenerated.java | 120 +++++++++++++++++- 48 files changed, 555 insertions(+), 1 deletion(-) create mode 100644 idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/after.kt.template create mode 100644 idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/before.kt.template create mode 100644 idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/description.html create mode 100644 idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/after.kt.template create mode 100644 idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/before.kt.template create mode 100644 idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/description.html create mode 100644 idea/src/org/jetbrains/jet/plugin/intentions/MoveLambdaInsideParenthesesIntention.kt create mode 100644 idea/src/org/jetbrains/jet/plugin/intentions/MoveLambdaOutsideParenthesesIntention.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/inapplicable1.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/inapplicable2.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt.after create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt.after create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt.after create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt.after create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt.after create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt.after create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt.after create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt.after create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt create mode 100644 idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt.after create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable1.kt create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable2.kt create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable3.kt create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt.after create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt.after create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt.after create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt.after create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt.after create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt create mode 100644 idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.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 a9ea0665d50..2fd7d21162a 100644 --- a/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/jet/generators/tests/GenerateTests.kt @@ -366,6 +366,8 @@ fun main(args: Array) { model("intentions/replaceWithInfixFunctionCall", testMethod = "doTestReplaceWithInfixFunctionCall") model("intentions/removeCurlyBracesFromTemplate", testMethod = "doTestRemoveCurlyFromTemplate") model("intentions/insertCurlyBracestsToTemplate", testMethod = "doTestInsertCurlyToTemplate") + model("intentions/moveLambdaInsideParentheses", testMethod = "doTestMoveLambdaInsideParentheses") + model("intentions/moveLambdaOutsideParentheses", testMethod = "doTestMoveLambdaOutsideParentheses") } testClass(javaClass()) { diff --git a/idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/after.kt.template b/idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/after.kt.template new file mode 100644 index 00000000000..15506d7509b --- /dev/null +++ b/idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/after.kt.template @@ -0,0 +1,3 @@ +fun foo() { + bar(2, { it * 3 }) +} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/before.kt.template b/idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/before.kt.template new file mode 100644 index 00000000000..faedcfcb4d4 --- /dev/null +++ b/idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/before.kt.template @@ -0,0 +1,3 @@ +fun foo() { + bar(2) { it * 3 } +} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/description.html b/idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/description.html new file mode 100644 index 00000000000..14d14e59897 --- /dev/null +++ b/idea/resources/intentionDescriptions/MoveLambdaInsideParenthesesIntention/description.html @@ -0,0 +1,5 @@ + + +This intention moves a lambda expression inside parentheses + + \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/after.kt.template b/idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/after.kt.template new file mode 100644 index 00000000000..faedcfcb4d4 --- /dev/null +++ b/idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/after.kt.template @@ -0,0 +1,3 @@ +fun foo() { + bar(2) { it * 3 } +} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/before.kt.template b/idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/before.kt.template new file mode 100644 index 00000000000..15506d7509b --- /dev/null +++ b/idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/before.kt.template @@ -0,0 +1,3 @@ +fun foo() { + bar(2, { it * 3 }) +} \ No newline at end of file diff --git a/idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/description.html b/idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/description.html new file mode 100644 index 00000000000..f9a71edf19f --- /dev/null +++ b/idea/resources/intentionDescriptions/MoveLambdaOutsideParenthesesIntention/description.html @@ -0,0 +1,5 @@ + + +This intention moves a lambda expression outside parentheses + + \ No newline at end of file diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index b2e2b5a1ddc..ccdb4e7b10a 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -491,6 +491,16 @@ Kotlin + + org.jetbrains.jet.plugin.intentions.MoveLambdaInsideParenthesesIntention + Kotlin + + + + org.jetbrains.jet.plugin.intentions.MoveLambdaOutsideParenthesesIntention + Kotlin + + org.jetbrains.jet.plugin.intentions.declarations.SplitPropertyDeclarationIntention Kotlin diff --git a/idea/src/org/jetbrains/jet/plugin/JetBundle.properties b/idea/src/org/jetbrains/jet/plugin/JetBundle.properties index cff849d0a22..3ba77edd7a5 100644 --- a/idea/src/org/jetbrains/jet/plugin/JetBundle.properties +++ b/idea/src/org/jetbrains/jet/plugin/JetBundle.properties @@ -233,6 +233,10 @@ 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 +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 +move.lambda.outside.parentheses.family=Move lambda expression out of parentheses property.is.implemented.too.many=Has implementations property.is.overridden.too.many=Is overridden in subclasses diff --git a/idea/src/org/jetbrains/jet/plugin/intentions/MoveLambdaInsideParenthesesIntention.kt b/idea/src/org/jetbrains/jet/plugin/intentions/MoveLambdaInsideParenthesesIntention.kt new file mode 100644 index 00000000000..500a5a26198 --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/intentions/MoveLambdaInsideParenthesesIntention.kt @@ -0,0 +1,52 @@ +/* + * 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.openapi.editor.Editor +import org.jetbrains.jet.lang.psi.JetCallExpression +import org.jetbrains.jet.lang.psi.JetPsiFactory +import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache +import org.jetbrains.jet.lang.resolve.BindingContext +import org.jetbrains.jet.lang.psi.JetFile + +public class MoveLambdaInsideParenthesesIntention : JetSelfTargetingIntention( + "move.lambda.inside.parentheses", javaClass()) { + + override fun isApplicableTo(element: JetCallExpression): Boolean = !element.getFunctionLiteralArguments().isEmpty() + + override fun applyTo(element: JetCallExpression, editor: Editor) { + val funName = element.getCalleeExpression()?.getText() + if (funName == null) return + val sb = StringBuilder() + sb.append("(") + for (value in element.getValueArguments()) { + if (value.getArgumentName() != null) { + sb.append("${value.getArgumentName()?.getText()} = ${value.getArgumentExpression()?.getText()},") + } else { + sb.append("${value.getArgumentExpression()?.getText()},") + } + } + if (element.getValueArguments().any { it.getArgumentName() != null}) { + val context = AnalyzerFacadeWithCache.analyzeFileWithCache(element.getContainingFile() as JetFile).getBindingContext() + val resolvedCall = context[BindingContext.RESOLVED_CALL, element.getCalleeExpression()] + val literalName = resolvedCall?.getResultingDescriptor()?.getValueParameters()?.last?.getName().toString() + sb.append("$literalName = ") + } + val newExpression = "$funName${sb.toString()}${element.getFunctionLiteralArguments()[0].getText()})" + element.replace(JetPsiFactory.createExpression(element.getProject(),newExpression)) + } +} \ No newline at end of file diff --git a/idea/src/org/jetbrains/jet/plugin/intentions/MoveLambdaOutsideParenthesesIntention.kt b/idea/src/org/jetbrains/jet/plugin/intentions/MoveLambdaOutsideParenthesesIntention.kt new file mode 100644 index 00000000000..c4b8cac1bec --- /dev/null +++ b/idea/src/org/jetbrains/jet/plugin/intentions/MoveLambdaOutsideParenthesesIntention.kt @@ -0,0 +1,40 @@ +/* + * 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.openapi.editor.Editor +import org.jetbrains.jet.lang.psi.JetCallExpression +import org.jetbrains.jet.lang.psi.JetFunctionLiteralExpression +import org.jetbrains.jet.lang.psi.JetPsiFactory + +public class MoveLambdaOutsideParenthesesIntention : JetSelfTargetingIntention( + "move.lambda.outside.parentheses", javaClass()) { + + override fun isApplicableTo(element: JetCallExpression): Boolean { + val args = element.getValueArguments() + return args.size > 0 && args.last?.getArgumentExpression() is JetFunctionLiteralExpression + } + + override fun applyTo(element: JetCallExpression, editor: Editor) { + val args = element.getValueArguments() + val literal = args.last!!.getArgumentExpression()?.getText() // we know args.last is non null + val callText = element.getText() + if (callText == null || literal == null) return + val endIndex = Math.max(callText.lastIndexOf(","), callText.indexOf("(") + 1) // in case of single parameter + element.replace(JetPsiFactory.createExpression(element.getProject(), "${callText.substring(0,endIndex)})$literal")) + } +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable1.kt b/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable1.kt new file mode 100644 index 00000000000..d594faca84c --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable1.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: false +fun foo() { + bar({ it }) +} + +fun bar(b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable2.kt b/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable2.kt new file mode 100644 index 00000000000..720df5a0303 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/inapplicable2.kt @@ -0,0 +1,6 @@ +// IS_APPLICABLE: false +fun foo(x: Int) { + if (x == 1) { + println(x) + } +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt new file mode 100644 index 00000000000..835fb1c444f --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt @@ -0,0 +1,10 @@ +// IS_APPLICABLE: true +fun foo() { + bar(2) { + it * 3 + } +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt.after new file mode 100644 index 00000000000..58cb2a46461 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt.after @@ -0,0 +1,10 @@ +// IS_APPLICABLE: true +fun foo() { + bar(2, { + it * 3 + }) +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt new file mode 100644 index 00000000000..d6b2663a1c9 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(2) {it * 3} +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt.after new file mode 100644 index 00000000000..8868f1bc3de --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(2, { it * 3 }) +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt new file mode 100644 index 00000000000..31004bf69ac --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt @@ -0,0 +1,11 @@ +// IS_APPLICABLE: true +fun foo() { + bar(2) { + val x = 3 + it * x + } +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt.after new file mode 100644 index 00000000000..cb6e7f4ddae --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt.after @@ -0,0 +1,11 @@ +// IS_APPLICABLE: true +fun foo() { + bar(2, { + val x = 3 + it * x + }) +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt new file mode 100644 index 00000000000..dfdc8710052 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt @@ -0,0 +1,11 @@ +// IS_APPLICABLE: true +fun foo() { + bar(a = 2) { + val x = 3 + it * x + } +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt.after new file mode 100644 index 00000000000..9d3647d77d3 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt.after @@ -0,0 +1,11 @@ +// IS_APPLICABLE: true +fun foo() { + bar(a = 2, b = { + val x = 3 + it * x + }) +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt new file mode 100644 index 00000000000..437fb26f84e --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar() { it } +} + +fun bar(b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt.after new file mode 100644 index 00000000000..8fba2fbc9b0 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar({ it }) +} + +fun bar(b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt new file mode 100644 index 00000000000..486e27aea22 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(name1 = 3) { it } +} + +fun bar(name1: Int, name2: Int->Int) : Int { + return name2(name1) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt.after new file mode 100644 index 00000000000..233b34e7518 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(name1 = 3, name2 = { it }) +} + +fun bar(name1: Int, name2: Int->Int) : Int { + return name2(name1) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt new file mode 100644 index 00000000000..a04d1da3929 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(name1 = 3, name2 = 2, name3 = 1) { it } +} + +fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { + return name4(name1) + name2 + name3 +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt.after new file mode 100644 index 00000000000..d74f1767df4 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(name1 = 3, name2 = 2, name3 = 1, name4 = { it }) +} + +fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { + return name4(name1) + name2 + name3 +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt new file mode 100644 index 00000000000..e0d0dbffbe5 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(3, 2, 1) { it } +} + +fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { + return name4(name1) + name2 + name3 +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt.after new file mode 100644 index 00000000000..be1c8bdf05e --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(3, 2, 1, { it }) +} + +fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { + return name4(name1) + name2 + name3 +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt new file mode 100644 index 00000000000..95dfd348567 --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar { it } +} + +fun bar(a: Int->Int) : Int { + return a(1) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt.after b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt.after new file mode 100644 index 00000000000..cc854b360bd --- /dev/null +++ b/idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar({ it }) +} + +fun bar(a: Int->Int) : Int { + return a(1) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable1.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable1.kt new file mode 100644 index 00000000000..e9d9247c9dd --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable1.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: false +fun foo() { + bar() { it } +} + +fun bar(b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable2.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable2.kt new file mode 100644 index 00000000000..720df5a0303 --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable2.kt @@ -0,0 +1,6 @@ +// IS_APPLICABLE: false +fun foo(x: Int) { + if (x == 1) { + println(x) + } +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable3.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable3.kt new file mode 100644 index 00000000000..10bf413bbe8 --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable3.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: false +fun foo(x: Int) { + if (x == 1) { + println(x) + } +} + +fun x() { println("x") } \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt new file mode 100644 index 00000000000..e74421c044d --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(2, { it }) +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt.after new file mode 100644 index 00000000000..3b0a33d1273 --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(2) { it } +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt new file mode 100644 index 00000000000..13666b8ae25 --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(a = 2, b = { it }) +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt.after new file mode 100644 index 00000000000..5240c827bc4 --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(a = 2) { it } +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt new file mode 100644 index 00000000000..a22b80ccb36 --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar({ it }) +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt.after new file mode 100644 index 00000000000..1400b53367b --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar() { it } +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt new file mode 100644 index 00000000000..713b1794978 --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt @@ -0,0 +1,11 @@ +// IS_APPLICABLE: true +fun foo() { + bar(2, { + val x = 3 + it * x + }) +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt.after new file mode 100644 index 00000000000..71374ae005a --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt.after @@ -0,0 +1,11 @@ +// IS_APPLICABLE: true +fun foo() { + bar(2) { + val x = 3 + it * x + } +} + +fun bar(a: Int, b: Int->Int) { + return b(a) +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt new file mode 100644 index 00000000000..de5b956ae7d --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(name1 = 3, name2 = 2, name3 = 1, name4 = { it }) +} + +fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { + return name4(name1) + name2 + name3 +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt.after new file mode 100644 index 00000000000..6df9201fde4 --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(name1 = 3, name2 = 2, name3 = 1) { it } +} + +fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { + return name4(name1) + name2 + name3 +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt new file mode 100644 index 00000000000..91c281d86fd --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(3, 2, 1, { it }) +} + +fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { + return name4(name1) + name2 + name3 +} \ No newline at end of file diff --git a/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt.after b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt.after new file mode 100644 index 00000000000..c12751d9c40 --- /dev/null +++ b/idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt.after @@ -0,0 +1,8 @@ +// IS_APPLICABLE: true +fun foo() { + bar(3, 2, 1) { it } +} + +fun bar(name1: Int, name2: Int, name3: Int, name4: Int->Int) : Int { + return name4(name1) + name2 + name3 +} \ 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 9de65d46c30..2a46f698842 100644 --- a/idea/tests/org/jetbrains/jet/plugin/intentions/AbstractCodeTransformationTest.java +++ b/idea/tests/org/jetbrains/jet/plugin/intentions/AbstractCodeTransformationTest.java @@ -118,6 +118,14 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes doTestIntention(path, new InsertCurlyBracesToTemplateIntention()); } + public void doTestMoveLambdaInsideParentheses(@NotNull String path) throws Exception { + doTestIntention(path, new MoveLambdaInsideParenthesesIntention()); + } + + public void doTestMoveLambdaOutsideParentheses(@NotNull String path) throws Exception { + doTestIntention(path, new MoveLambdaOutsideParenthesesIntention()); + } + public void doTestConvertMemberToExtension(@NotNull String path) throws Exception { doTestIntention(path, new ConvertMemberToExtension()); } diff --git a/idea/tests/org/jetbrains/jet/plugin/intentions/CodeTransformationTestGenerated.java b/idea/tests/org/jetbrains/jet/plugin/intentions/CodeTransformationTestGenerated.java index 91fa4a7ed9b..3d56b0843f9 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}) +@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}) public class CodeTransformationTestGenerated extends AbstractCodeTransformationTest { @TestMetadata("idea/testData/intentions/branched/folding/ifToAssignment") public static class IfToAssignment extends AbstractCodeTransformationTest { @@ -1362,6 +1362,122 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT } + @TestMetadata("idea/testData/intentions/moveLambdaInsideParentheses") + public static class MoveLambdaInsideParentheses extends AbstractCodeTransformationTest { + public void testAllFilesPresentInMoveLambdaInsideParentheses() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/intentions/moveLambdaInsideParentheses"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("inapplicable1.kt") + public void testInapplicable1() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/inapplicable1.kt"); + } + + @TestMetadata("inapplicable2.kt") + public void testInapplicable2() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/inapplicable2.kt"); + } + + @TestMetadata("moveLambda1.kt") + public void testMoveLambda1() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/moveLambda1.kt"); + } + + @TestMetadata("moveLambda2.kt") + public void testMoveLambda2() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/moveLambda2.kt"); + } + + @TestMetadata("moveLambda3.kt") + public void testMoveLambda3() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/moveLambda3.kt"); + } + + @TestMetadata("moveLambda4.kt") + public void testMoveLambda4() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/moveLambda4.kt"); + } + + @TestMetadata("moveLambda5.kt") + public void testMoveLambda5() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/moveLambda5.kt"); + } + + @TestMetadata("moveLambda6.kt") + public void testMoveLambda6() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/moveLambda6.kt"); + } + + @TestMetadata("moveLambda7.kt") + public void testMoveLambda7() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/moveLambda7.kt"); + } + + @TestMetadata("moveLambda8.kt") + public void testMoveLambda8() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/moveLambda8.kt"); + } + + @TestMetadata("moveLambda9.kt") + public void testMoveLambda9() throws Exception { + doTestMoveLambdaInsideParentheses("idea/testData/intentions/moveLambdaInsideParentheses/moveLambda9.kt"); + } + + } + + @TestMetadata("idea/testData/intentions/moveLambdaOutsideParentheses") + public static class MoveLambdaOutsideParentheses extends AbstractCodeTransformationTest { + public void testAllFilesPresentInMoveLambdaOutsideParentheses() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/intentions/moveLambdaOutsideParentheses"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("inapplicable1.kt") + public void testInapplicable1() throws Exception { + doTestMoveLambdaOutsideParentheses("idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable1.kt"); + } + + @TestMetadata("inapplicable2.kt") + public void testInapplicable2() throws Exception { + doTestMoveLambdaOutsideParentheses("idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable2.kt"); + } + + @TestMetadata("inapplicable3.kt") + public void testInapplicable3() throws Exception { + doTestMoveLambdaOutsideParentheses("idea/testData/intentions/moveLambdaOutsideParentheses/inapplicable3.kt"); + } + + @TestMetadata("moveLambda1.kt") + public void testMoveLambda1() throws Exception { + doTestMoveLambdaOutsideParentheses("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda1.kt"); + } + + @TestMetadata("moveLambda2.kt") + public void testMoveLambda2() throws Exception { + doTestMoveLambdaOutsideParentheses("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda2.kt"); + } + + @TestMetadata("moveLambda3.kt") + public void testMoveLambda3() throws Exception { + doTestMoveLambdaOutsideParentheses("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda3.kt"); + } + + @TestMetadata("moveLambda4.kt") + public void testMoveLambda4() throws Exception { + doTestMoveLambdaOutsideParentheses("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda4.kt"); + } + + @TestMetadata("moveLambda7.kt") + public void testMoveLambda7() throws Exception { + doTestMoveLambdaOutsideParentheses("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda7.kt"); + } + + @TestMetadata("moveLambda8.kt") + public void testMoveLambda8() throws Exception { + doTestMoveLambdaOutsideParentheses("idea/testData/intentions/moveLambdaOutsideParentheses/moveLambda8.kt"); + } + + } + public static Test suite() { TestSuite suite = new TestSuite("CodeTransformationTestGenerated"); suite.addTestSuite(IfToAssignment.class); @@ -1389,6 +1505,8 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT suite.addTestSuite(ReplaceWithDotQualifiedMethodCall.class); suite.addTestSuite(ReplaceWithInfixFunctionCall.class); suite.addTestSuite(RemoveCurlyBracesFromTemplate.class); + suite.addTestSuite(MoveLambdaInsideParentheses.class); + suite.addTestSuite(MoveLambdaOutsideParentheses.class); return suite; } }