New Intention Action: Invert If Condition

Inverts the conditional expression in an if expression.
This commit is contained in:
Pradyoth Kukkapalli
2014-05-12 19:39:32 +04:00
committed by Alexey Sedunov
parent aa20af3cf3
commit 5550924dc5
35 changed files with 486 additions and 1 deletions
@@ -412,6 +412,7 @@ fun main(args: Array<String>) {
model("intentions/convertIfToAssert", testMethod = "doTestConvertIfWithThrowToAssertIntention")
model("intentions/makeTypeExplicitInLambda", testMethod = "doTestMakeTypeExplicitInLambda")
model("intentions/makeTypeImplicitInLambda", testMethod = "doTestMakeTypeImplicitInLambda")
model("intentions/invertIfCondition", testMethod = "doTestInvertIfCondition")
model("intentions/convertToForEachLoop", testMethod = "doTestConvertToForEachLoop")
model("intentions/convertToForEachFunctionCall", testMethod = "doTestConvertToForEachFunctionCall")
}
@@ -0,0 +1,5 @@
if (<spot>foo()</spot>) {
baz()
} else {
bar()
}
@@ -0,0 +1,5 @@
if (!foo()) {
bar()
} else {
baz()
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention inverts the conditional expression in an 'if' expression.
</body>
</html>
+5
View File
@@ -741,6 +741,11 @@
level="WARNING"
/>
<intentionAction>
<className>org.jetbrains.jet.plugin.intentions.InvertIfConditionIntention</className>
<category>Kotlin</category>
</intentionAction>
<project.converterProvider implementation="org.jetbrains.jet.plugin.converters.JetRunConfigurationSettingsFormatConverterProvider"/>
</extensions>
@@ -312,6 +312,8 @@ make.type.explicit.in.lambda=Make types explicit in lambda
make.type.explicit.in.lambda.family=Make Types Explicit In Lambda
make.type.implicit.in.lambda=Make types implicit in lambda (may break code)
make.type.implicit.in.lambda.family=Make Types Implicit In Lambda (May Break Code)
invert.if.condition=Invert If Condition
invert.if.condition.family=Invert If Condition
convert.to.for.each.loop.intention=Replace with a for each loop
convert.to.for.each.loop.intention.family=Replace with a For Each Loop
convert.to.for.each.function.call.intention=Replace with a forEach function call
@@ -0,0 +1,170 @@
/*
* 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.JetIfExpression
import com.intellij.openapi.editor.Editor
import org.jetbrains.jet.lang.psi.JetExpression
import org.jetbrains.jet.lang.psi.JetUnaryExpression
import org.jetbrains.jet.lang.psi.JetBinaryExpression
import org.jetbrains.jet.lexer.JetTokens
import org.jetbrains.jet.lexer.JetToken
import com.intellij.psi.tree.IElementType
import org.jetbrains.jet.lang.psi.JetConstantExpression
import org.jetbrains.jet.lang.psi.JetPsiFactory
import org.jetbrains.jet.lang.psi.JetPsiUtil
import org.jetbrains.jet.lang.psi.JetParenthesizedExpression
import com.sun.javaws.exceptions.InvalidArgumentException
import org.jetbrains.jet.lexer.JetSingleValueToken
import org.jetbrains.jet.lexer.JetKeywordToken
import org.jetbrains.jet.lang.psi.psiUtil.getParentByType
import org.jetbrains.jet.lang.psi.JetElement
import org.jetbrains.jet.lang.psi.JetForExpression
import org.jetbrains.jet.lang.psi.JetNamedFunction
import org.jetbrains.jet.lang.psi.JetBlockExpression
public class InvertIfConditionIntention : JetSelfTargetingIntention<JetIfExpression>("invert.if.condition", javaClass()) {
fun checkForNegation(element: JetUnaryExpression): Boolean {
return element.getOperationReference().getReferencedName().equals("!")
}
override fun isApplicableTo(element: JetIfExpression): Boolean {
val condition = element.getCondition()
val thenBranch = element.getThen()
return condition != null && thenBranch != null && when (condition) {
is JetUnaryExpression -> {
when {
checkForNegation(condition) -> {
val baseExpression = condition.getBaseExpression()
when (baseExpression) {
is JetParenthesizedExpression -> baseExpression.getExpression() != null
else -> condition.getBaseExpression() != null
}
}
else -> true
}
}
is JetBinaryExpression -> {
condition.getOperationToken() != null && condition.getLeft() != null && condition.getRight() != null
}
else -> true
}
}
override fun applyTo(element: JetIfExpression, editor: Editor) {
fun isNegatableOperator(token: IElementType): Boolean {
return token in array(JetTokens.EQEQ, JetTokens.EXCLEQ, JetTokens.EQEQEQ, JetTokens.EXCLEQEQEQ, JetTokens.IS_KEYWORD, JetTokens.NOT_IS, JetTokens.IN_KEYWORD, JetTokens.NOT_IN, JetTokens.LT, JetTokens.LTEQ, JetTokens.GT, JetTokens.GTEQ)
}
fun getNegatedOperator(token: IElementType): JetToken {
return when {
token == JetTokens.EQEQ -> JetTokens.EXCLEQ
token == JetTokens.EXCLEQ -> JetTokens.EQEQ
token == JetTokens.EQEQEQ -> JetTokens.EXCLEQEQEQ
token == JetTokens.EXCLEQEQEQ -> JetTokens.EQEQEQ
token == JetTokens.IS_KEYWORD -> JetTokens.NOT_IS
token == JetTokens.NOT_IS -> JetTokens.IS_KEYWORD
token == JetTokens.IN_KEYWORD -> JetTokens.NOT_IN
token == JetTokens.NOT_IN -> JetTokens.IN_KEYWORD
token == JetTokens.LT -> JetTokens.GTEQ
token == JetTokens.LTEQ -> JetTokens.GT
token == JetTokens.GT -> JetTokens.LTEQ
token == JetTokens.GTEQ -> JetTokens.LT
else -> throw InvalidArgumentException(array("The token, \"${token.toString()}\", does not have a negated equivalent."))
}
}
fun getTokenText(token: JetToken): String {
return when (token) {
is JetSingleValueToken -> token.getValue()
is JetKeywordToken -> token.getValue()
else -> throw InvalidArgumentException(array("The token, ${token.toString()}, does not have an applicable string value."))
}
}
fun negateExpressionText(element: JetExpression): String {
val negatedParenthesizedExpressionText = "!(${element.getText()})"
val possibleNewExpression = JetPsiFactory.createExpression(element.getProject(), negatedParenthesizedExpressionText) as JetUnaryExpression
val innerExpression = possibleNewExpression.getBaseExpression() as JetParenthesizedExpression
return when {
JetPsiUtil.areParenthesesUseless(innerExpression) -> "!${element.getText()}"
else -> negatedParenthesizedExpressionText
}
}
fun getNegation(element: JetExpression): JetExpression {
return JetPsiFactory.createExpression(element.getProject(), when (element) {
is JetBinaryExpression -> {
val operator = element.getOperationToken()!!
when {
isNegatableOperator(operator) -> "${element.getLeft()!!.getText()} ${getTokenText(getNegatedOperator(operator))} ${element.getRight()!!.getText()}"
else -> negateExpressionText(element)
}
}
is JetConstantExpression -> {
when {
element.textMatches("true") -> "false"
element.textMatches("false") -> "true"
else -> negateExpressionText(element)
}
}
else -> negateExpressionText(element)
})
}
fun removeNegation(element: JetUnaryExpression): JetExpression {
val baseExpression = element.getBaseExpression()!!
return when (baseExpression) {
is JetParenthesizedExpression -> baseExpression.getExpression()!!
else -> baseExpression
}
}
fun getFinalExpressionOfFunction(element: JetNamedFunction): JetExpression? {
val body = element.getBodyExpression()
return when (body) {
is JetBlockExpression -> body.getStatements().last() as JetExpression
else -> body
}
}
val condition = element.getCondition()!!
val replacementCondition = when (condition) {
is JetUnaryExpression -> {
when {
checkForNegation(condition) -> removeNegation(condition)
else -> getNegation(condition)
}
}
else -> getNegation(condition)
}
val thenBranch = element.getThen()
val elseBranch = element.getElse() ?: JetPsiFactory.createEmptyBody(element.getProject())
element.replace(JetPsiFactory.createIf(element.getProject(), replacementCondition, when (elseBranch) {
is JetIfExpression -> JetPsiFactory.wrapInABlock(elseBranch)
else -> elseBranch
}, if (thenBranch is JetBlockExpression && thenBranch.getStatements().isEmpty()) null else thenBranch))
}
}
@@ -0,0 +1,4 @@
fun main() {
val a = -1
val t = <caret>if (a > 0) a else -a
}
@@ -0,0 +1,4 @@
fun main() {
val a = -1
val t = if (a <= 0) -a else a
}
@@ -0,0 +1,11 @@
fun foo(): Boolean {
return true
}
fun main() {
<caret>if (foo() && foo()) {
foo()
} else {
foo()
}
}
@@ -0,0 +1,11 @@
fun foo(): Boolean {
return true
}
fun main() {
if (!(foo() && foo())) {
foo()
} else {
foo()
}
}
@@ -0,0 +1,7 @@
fun main() {
<caret>if (true) {
} else {
}
}
@@ -0,0 +1,5 @@
fun main() {
if (false) {
}
}
@@ -0,0 +1,10 @@
fun main() {
val a = 10
<caret>if (a > 0)
a
else if (a < -5)
a + 1
else
a + 2
}
@@ -0,0 +1,10 @@
fun main() {
val a = 10
if (a <= 0) {
if (a < -5)
a + 1
else
a + 2
} else a
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
fun main() {
val list = 1..4
for (x in list) {
<caret>if (x == 2) {
list
}
list.equals(list)
}
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
fun main() {
val list = 1..4
for (x in list) {
if (x != 2) {
} else {
list
}
list.equals(list)
}
}
@@ -0,0 +1,9 @@
fun foo(): Int {
val x = 0
<caret>if (x == 1) {
x + 1
}
return x
}
@@ -0,0 +1,10 @@
fun foo(): Int {
val x = 0
if (x != 1) {
} else {
x + 1
}
return x
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
fun main() {
val list = 1..4
for (x in list) {
<caret>if (x == 2) {
list
}
}
}
@@ -0,0 +1,11 @@
// WITH_RUNTIME
fun main() {
val list = 1..4
for (x in list) {
if (x != 2) {
} else {
list
}
}
}
@@ -0,0 +1,8 @@
fun foo(): Int {
val x = 0
<caret>if (x == 1)
return x + 1
return 0
}
@@ -0,0 +1,8 @@
fun foo(): Int {
val x = 0
if (x != 1) {
} else return x + 1
return 0
}
@@ -0,0 +1,5 @@
fun main() {
<caret>if (true == false) {
}
}
@@ -0,0 +1,4 @@
fun main() {
if (true != false) {
}
}
@@ -0,0 +1,9 @@
fun foo(): Boolean {
return true
}
fun main() {
<caret>if (!foo()) {
}
}
@@ -0,0 +1,8 @@
fun foo(): Boolean {
return true
}
fun main() {
if (foo()) {
}
}
@@ -0,0 +1,9 @@
fun foo(): Int {
val a = 10
return <caret>if (a > 0) {
a
} else {
a + 1
}
}
@@ -0,0 +1,9 @@
fun foo(): Int {
val a = 10
return if (a <= 0) {
a + 1
} else {
a
}
}
@@ -0,0 +1,9 @@
fun foo(): Boolean {
return true
}
fun main() {
<caret>if (foo()) {
}
}
@@ -0,0 +1,8 @@
fun foo(): Boolean {
return true
}
fun main() {
<caret>if (!foo()) {
}
}
@@ -0,0 +1,6 @@
fun foo(): Int {
val a = 1
val t = <caret>if (a > 1) a else return 0
return t
}
@@ -0,0 +1,6 @@
fun foo(): Int {
val a = 1
val t = if (a <= 1) return 0 else a
return t
}
@@ -258,6 +258,10 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes
doTestIntention(path, new SimplifyBooleanWithConstantsIntention());
}
public void doTestInvertIfCondition(@NotNull String path) throws Exception {
doTestIntention(path, new InvertIfConditionIntention());
}
public void doTestMakeTypeExplicitInLambda(@NotNull String path) throws Exception {
doTestIntention(path, new MakeTypeExplicitInLambdaIntention());
}
@@ -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})
@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.InvertIfCondition.class, CodeTransformationTestGenerated.ConvertToForEachLoop.class, CodeTransformationTestGenerated.ConvertToForEachFunctionCall.class})
public class CodeTransformationTestGenerated extends AbstractCodeTransformationTest {
@TestMetadata("idea/testData/intentions/branched/doubleBangToIfThen")
public static class DoubleBangToIfThen extends AbstractCodeTransformationTest {
@@ -4140,6 +4140,79 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT
}
@TestMetadata("idea/testData/intentions/invertIfCondition")
public static class InvertIfCondition extends AbstractCodeTransformationTest {
public void testAllFilesPresentInInvertIfCondition() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.TestsPackage", new File("idea/testData/intentions/invertIfCondition"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("assignedToValue.kt")
public void testAssignedToValue() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/assignedToValue.kt");
}
@TestMetadata("binaryExpression.kt")
public void testBinaryExpression() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/binaryExpression.kt");
}
@TestMetadata("booleanLiteral.kt")
public void testBooleanLiteral() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/booleanLiteral.kt");
}
@TestMetadata("branchingIfStatements.kt")
public void testBranchingIfStatements() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/branchingIfStatements.kt");
}
@TestMetadata("forLoopWithMultipleExpressions.kt")
public void testForLoopWithMultipleExpressions() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/forLoopWithMultipleExpressions.kt");
}
@TestMetadata("functionWithReturnExpression.kt")
public void testFunctionWithReturnExpression() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/functionWithReturnExpression.kt");
}
@TestMetadata("ifExpressionInsideForLoop.kt")
public void testIfExpressionInsideForLoop() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/ifExpressionInsideForLoop.kt");
}
@TestMetadata("ifExpressionWithReturn.kt")
public void testIfExpressionWithReturn() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/ifExpressionWithReturn.kt");
}
@TestMetadata("invertableOperator.kt")
public void testInvertableOperator() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/invertableOperator.kt");
}
@TestMetadata("negatedExpression.kt")
public void testNegatedExpression() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/negatedExpression.kt");
}
@TestMetadata("returnIfExpression.kt")
public void testReturnIfExpression() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/returnIfExpression.kt");
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/simple.kt");
}
@TestMetadata("valueAndReturnBranches.kt")
public void testValueAndReturnBranches() throws Exception {
doTestInvertIfCondition("idea/testData/intentions/invertIfCondition/valueAndReturnBranches.kt");
}
}
@TestMetadata("idea/testData/intentions/convertToForEachLoop")
public static class ConvertToForEachLoop extends AbstractCodeTransformationTest {
public void testAllFilesPresentInConvertToForEachLoop() throws Exception {
@@ -4299,6 +4372,7 @@ public class CodeTransformationTestGenerated extends AbstractCodeTransformationT
suite.addTestSuite(ConvertIfToAssert.class);
suite.addTestSuite(MakeTypeExplicitInLambda.class);
suite.addTestSuite(MakeTypeImplicitInLambda.class);
suite.addTestSuite(InvertIfCondition.class);
suite.addTestSuite(ConvertToForEachLoop.class);
suite.addTestSuite(ConvertToForEachFunctionCall.class);
return suite;