Implement "Merge when" intention

This commit is contained in:
Alexey Sedunov
2013-11-18 18:45:13 +04:00
parent d9b1c88bf4
commit 9f5ee13c20
35 changed files with 742 additions and 6 deletions
@@ -23,6 +23,10 @@ import org.jetbrains.jet.lang.psi.JetDeclaration
import org.jetbrains.jet.lang.psi.JetClass
import org.jetbrains.jet.lang.psi.JetClassOrObject
import org.jetbrains.jet.lexer.JetTokens
import org.jetbrains.jet.lang.psi.JetElement
import org.jetbrains.jet.lang.psi.JetBlockExpression
import org.jetbrains.jet.lang.psi.JetPsiUtil
import org.jetbrains.jet.lang.psi.JetPsiFactory
fun PsiElement.getParentByTypeAndPredicate<T: PsiElement>(
parentClass : Class<T>, strict : Boolean = false, predicate: (T) -> Boolean
@@ -72,3 +76,19 @@ fun JetClass.isAbstract() = isTrait() || hasModifier(JetTokens.ABSTRACT_KEYWORD)
[suppress("UNCHECKED_CAST")]
fun <T: PsiElement> PsiElement.replaced(newElement: T): T = replace(newElement)!! as T
fun JetElement.blockExpressionsOrSingle(): Iterator<JetElement> =
if (this is JetBlockExpression) getStatements().iterator() else SingleIterator(this)
fun JetElement.outermostLastBlockElement(predicate: (JetElement) -> Boolean = { true }): JetElement? {
return JetPsiUtil.getOutermostLastBlockElement(this) { e -> e != null && predicate(e) }
}
fun JetBlockExpression.appendElement(element: JetElement): JetElement =
addAfter(element, getRBrace()!!.getPrevSibling()!!)!! as JetElement
fun JetElement.wrapInBlock(): JetBlockExpression {
val block = JetPsiFactory.createEmptyBody(getProject()) as JetBlockExpression
block.appendElement(this)
return block
}
@@ -387,6 +387,7 @@ public class GenerateTests {
testModel("idea/testData/intentions/branched/ifWhen/ifToWhen", "doTestIfToWhen"),
testModel("idea/testData/intentions/branched/ifWhen/whenToIf", "doTestWhenToIf"),
testModel("idea/testData/intentions/branched/when/flatten", "doTestFlattenWhen"),
testModel("idea/testData/intentions/branched/when/merge", "doTestMergeWhen"),
testModel("idea/testData/intentions/branched/when/introduceSubject", "doTestIntroduceWhenSubject"),
testModel("idea/testData/intentions/branched/when/eliminateSubject", "doTestEliminateWhenSubject"),
testModel("idea/testData/intentions/declarations/split", "doTestSplitProperty"),
@@ -0,0 +1,14 @@
when (n) {
1 -> {
res = "one"
println("A")
}
2 -> {
res = "two"
println("B")
}
else -> {
res = "unknown"
println("C")
}
}
@@ -0,0 +1,11 @@
when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "unknown"
}
when (n) {
1 -> println("A")
2 -> println("B")
else -> println("C")
}
@@ -0,0 +1,5 @@
<html>
<body>
This intention merges two successive 'when' expressions with equivalent branches into the single one
</body>
</html>
+5
View File
@@ -444,6 +444,11 @@
<category>Kotlin</category>
</intentionAction>
<intentionAction>
<className>org.jetbrains.jet.plugin.intentions.branchedTransformations.intentions.MergeWhenIntention</className>
<category>Kotlin</category>
</intentionAction>
<intentionAction>
<className>org.jetbrains.jet.plugin.intentions.RemoveUnnecessaryParenthesesIntention</className>
<category>Kotlin</category>
@@ -195,6 +195,8 @@ when.to.if=Replace 'when' with 'if'
when.to.if.family=Replace 'when' with 'if'
flatten.when=Flatten 'when' expression
flatten.when.family=Flatten 'when' Expression
merge.when=Merge 'when' expressions
merge.when.family=Merge 'when' Expression
introduce.when.subject=Introduce argument to 'when'
introduce.when.subject.family=Introduce Argument to 'when'
eliminate.when.subject=Eliminate argument of 'when'
@@ -23,6 +23,10 @@ import org.jetbrains.jet.plugin.util.JetPsiMatcher
import org.jetbrains.jet.lang.psi.JetPsiUnparsingUtils.*
import org.jetbrains.jet.lang.psi.psiUtil.*
import java.util.ArrayList
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.psi.PsiWhiteSpace
import java.util.Collections
import com.intellij.util.containers.ContainerUtil
public val TRANSFORM_WITHOUT_CHECK: String = "Expression must be checked before applying transformation"
@@ -129,11 +133,11 @@ public fun JetWhenExpression.canEliminateSubject(): Boolean {
public fun JetWhenExpression.flatten(): JetWhenExpression {
val subjectExpression = getSubjectExpression()
val elseBranch = getElseExpression()
assert(elseBranch is JetWhenExpression, TRANSFORM_WITHOUT_CHECK)
val nestedWhenExpression = (elseBranch as JetWhenExpression)
val outerEntries = getEntries()
val innerEntries = nestedWhenExpression.getEntries()
val builder = JetPsiFactory.WhenBuilder(subjectExpression)
@@ -152,7 +156,7 @@ public fun JetWhenExpression.flatten(): JetWhenExpression {
public fun JetWhenExpression.introduceSubject(): JetWhenExpression {
val subject = getSubjectCandidate()!!
val builder = JetPsiFactory.WhenBuilder(subject)
for (entry in getEntries()) {
val branchExpression = entry.getExpression()
@@ -163,7 +167,7 @@ public fun JetWhenExpression.introduceSubject(): JetWhenExpression {
for (condition in entry.getConditions()) {
assert(condition is JetWhenConditionWithExpression, TRANSFORM_WITHOUT_CHECK)
val conditionExpression = ((condition as JetWhenConditionWithExpression)).getExpression()
when (conditionExpression) {
is JetIsExpression -> {
@@ -316,3 +320,62 @@ public fun JetWhenExpression.transformToIf() {
replace(builder.toExpression(getProject()))
}
public fun JetWhenExpression.canMergeWithNext(): Boolean {
fun checkConditions(e1: JetWhenEntry, e2: JetWhenEntry): Boolean {
if (e1.isElse() != e2.isElse()) return false
val conditions1 = e1.getConditions()
val conditions2 = e2.getConditions()
return conditions1.size == conditions2.size &&
(conditions1.iterator() zip conditions2.iterator()).all { pair -> JetPsiMatcher.checkElementMatch(pair.first, pair.second)}
}
fun JetWhenEntry.declarationNames(): Set<String> =
getExpression()?.blockExpressionsOrSingle()
?.filterIsInstance(javaClass<JetNamedDeclaration>())
?.map { decl -> decl.getName() }
?.filterNotNull()?.toHashSet() ?: Collections.emptySet<String>()
fun checkBodies(e1: JetWhenEntry, e2: JetWhenEntry): Boolean {
if (ContainerUtil.intersects(e1.declarationNames(), e2.declarationNames())) return false
return when (e1.getExpression()?.outermostLastBlockElement()) {
is JetReturnExpression, is JetThrowExpression, is JetBreakExpression, is JetContinueExpression -> false
else -> true
}
}
val sibling = PsiTreeUtil.skipSiblingsForward(this, javaClass<PsiWhiteSpace>())
if (sibling !is JetWhenExpression) return false
if (!JetPsiMatcher.checkElementMatch(getSubjectExpression(), sibling.getSubjectExpression())) return false
val entries1 = getEntries()
val entries2 = sibling.getEntries()
return entries1.size == entries2.size && (entries1.iterator() zip entries2.iterator()).all { pair ->
checkConditions(pair.first, pair.second) && checkBodies(pair.first, pair.second)
}
}
public fun JetWhenExpression.mergeWithNext() {
fun JetExpression?.mergeWith(that: JetExpression?): JetExpression? = when {
this == null -> that
that == null -> this
else -> {
val block = if (this is JetBlockExpression) this else replaced(wrapInBlock())
for (element in that.blockExpressionsOrSingle()) {
val expression = block.appendElement(element)
block.addBefore(JetPsiFactory.createNewLine(getProject()), expression)
}
block
}
}
val sibling = PsiTreeUtil.skipSiblingsForward(this, javaClass<PsiWhiteSpace>()) as JetWhenExpression
for ((entry1, entry2) in getEntries().iterator() zip sibling.getEntries().iterator()) {
entry1.getExpression() mergeWith entry2.getExpression()
}
getParent()?.deleteChildRange(getNextSibling(), sibling)
}
@@ -0,0 +1,30 @@
/*
* Copyright 2010-2013 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.branchedTransformations.intentions
import org.jetbrains.jet.plugin.intentions.JetSelfTargetingIntention
import org.jetbrains.jet.plugin.intentions.branchedTransformations.*
import org.jetbrains.jet.lang.psi.JetWhenExpression
import com.intellij.openapi.editor.Editor
public class MergeWhenIntention : JetSelfTargetingIntention<JetWhenExpression>("merge.when", javaClass()) {
override fun isApplicableTo(element: JetWhenExpression): Boolean = element.canMergeWithNext()
override fun applyTo(element: JetWhenExpression, editor: Editor) {
element.mergeWithNext()
}
}
@@ -235,6 +235,25 @@ public class JetPsiMatcher {
public Boolean visitNullableType(@NotNull JetNullableType nullableType, JetElement data) {
return checkElementMatch(nullableType.getInnerType(), ((JetNullableType) data).getInnerType());
}
@Override
public Boolean visitWhenConditionExpression(@NotNull JetWhenConditionWithExpression condition, JetElement data) {
return checkElementMatch(condition.getExpression(), ((JetWhenConditionWithExpression) data).getExpression());
}
@Override
public Boolean visitWhenConditionInRange(@NotNull JetWhenConditionInRange condition, JetElement data) {
JetWhenConditionInRange other = (JetWhenConditionInRange) data;
return condition.isNegated() == other.isNegated() &&
checkElementMatch(condition.getRangeExpression(), other.getRangeExpression());
}
@Override
public Boolean visitWhenConditionIsPattern(@NotNull JetWhenConditionIsPattern condition, JetElement data) {
JetWhenConditionIsPattern other = (JetWhenConditionIsPattern) data;
return condition.isNegated() == other.isNegated() &&
checkElementMatch(condition.getTypeRef(), other.getTypeRef());
}
};
private static JetElement unwrap(JetElement e) {
@@ -0,0 +1,33 @@
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> {
res = "one"
println("A")
}
2 -> {
res = "two"
println("B")
}
else -> {
res = "unknown"
println("C")
}
}
when (n) {
1 -> {
println("A")
println("AA")
}
2 -> {
println("B")
println("BB")
}
else -> {
println("C")
println("CC")
}
}
}
@@ -0,0 +1,24 @@
fun test(n: Int) {
val res: String
when (n) {
1 -> {
res = "one"
println("A")
println("A")
println("AA")
}
2 -> {
res = "two"
println("B")
println("B")
println("BB")
}
else -> {
res = "unknown"
println("C")
println("C")
println("CC")
}
}
}
@@ -0,0 +1,24 @@
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> {
res = "one"
println("A")
}
2 -> {
res = "two"
println("B")
}
else -> {
res = "unknown"
println("C")
}
}
when (n) {
1 -> println("AA")
2 -> println("BB")
else -> println("CC")
}
}
@@ -0,0 +1,21 @@
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> {
res = "one"
println("A")
println("AA")
}
2 -> {
res = "two"
println("B")
println("BB")
}
else -> {
res = "unknown"
println("C")
println("CC")
}
}
}
@@ -0,0 +1,37 @@
// IS_APPLICABLE: false
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> {
res = "one"
val x = "A"
println(x)
}
2 -> {
res = "two"
val x = "B"
println(x)
}
else -> {
res = "unknown"
val x = "C"
println(x)
}
}
when (n) {
1 -> {
val x = "AA"
println(x)
}
2 -> {
val x = "BB"
println(x)
}
else -> {
val x = "CC"
println(x)
}
}
}
@@ -0,0 +1,36 @@
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> {
res = "one"
val x = "A"
println(x)
}
2 -> {
res = "two"
val x = "B"
println(x)
}
else -> {
res = "unknown"
val x = "C"
println(x)
}
}
when (n) {
1 -> {
val y = "AA"
println(y)
}
2 -> {
val y = "BB"
println(y)
}
else -> {
val y = "CC"
println(y)
}
}
}
@@ -0,0 +1,27 @@
fun test(n: Int) {
val res: String
when (n) {
1 -> {
res = "one"
val x = "A"
println(x)
val y = "AA"
println(y)
}
2 -> {
res = "two"
val x = "B"
println(x)
val y = "BB"
println(y)
}
else -> {
res = "unknown"
val x = "C"
println(x)
val y = "CC"
println(y)
}
}
}
@@ -0,0 +1,18 @@
fun test(n: Int) {
var res: String = ""
<caret>when (n) {
1 -> println("A")
2 -> println("B")
else -> println("C")
}
when (n) {
1 -> res = "one"
2 -> res = "two"
else -> {
res = "unknown"
return
}
}
}
@@ -0,0 +1,19 @@
fun test(n: Int) {
var res: String = ""
<caret>when (n) {
1 -> {
println("A")
res = "one"
}
2 -> {
println("B")
res = "two"
}
else -> {
println("C")
res = "unknown"
return
}
}
}
@@ -0,0 +1,19 @@
// IS_APPLICABLE: false
fun test(n: Int) {
var res: String = ""
<caret>when (n) {
1 -> res = "one"
2 -> res = "two"
else -> {
res = "unknown"
return
}
}
when (n) {
1 -> println("A")
2 -> println("B")
else -> println("C")
}
}
@@ -0,0 +1,15 @@
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "unknown"
}
when (n) {
1 -> println("A")
2 -> println("B")
else -> println("C")
}
}
@@ -0,0 +1,18 @@
fun test(n: Int) {
val res: String
when (n) {
1 -> {
res = "one"
println("A")
}
2 -> {
res = "two"
println("B")
}
else -> {
res = "unknown"
println("C")
}
}
}
@@ -0,0 +1,15 @@
// IS_APPLICABLE: false
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "unknown"
}
when (n) {
1 -> println("A")
else -> println("C")
}
}
@@ -0,0 +1,17 @@
// IS_APPLICABLE: false
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "unknown"
}
when (n) {
1 -> println("A")
2 -> println("B")
3 -> println("D")
else -> println("C")
}
}
@@ -0,0 +1,16 @@
// IS_APPLICABLE: false
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "unknown"
}
when (n) {
2 -> println("B")
1 -> println("A")
else -> println("C")
}
}
@@ -0,0 +1,15 @@
// IS_APPLICABLE: false
fun test(n: Int) {
val res: String
<caret>when {
n == 1 -> res = "one"
n == 2 -> res = "two"
else -> res = "unknown"
}
when {
n == 1 -> println("A")
else -> println("C")
}
}
@@ -0,0 +1,17 @@
// IS_APPLICABLE: false
fun test(n: Int) {
val res: String
<caret>when {
n == 1 -> res = "one"
n == 2 -> res = "two"
else -> res = "unknown"
}
when {
n == 1 -> println("A")
n == 2 -> println("B")
n == 3 -> println("D")
else -> println("C")
}
}
@@ -0,0 +1,16 @@
// IS_APPLICABLE: false
fun test(n: Int) {
val res: String
<caret>when {
n == 1 -> res = "one"
n == 2 -> res = "two"
else -> res = "unknown"
}
when {
n == 2 -> println("B")
n == 1 -> println("A")
else -> println("C")
}
}
@@ -0,0 +1,16 @@
// IS_APPLICABLE: false
fun test(n: Int) {
val res: String
<caret>when {
n == 1 -> res = "one"
n == 2 -> res = "two"
else -> res = "unknown"
}
when {
n + 1 == 2 -> println("B")
n + 1 == 3 -> println("A")
else -> println("C")
}
}
@@ -0,0 +1,16 @@
// IS_APPLICABLE: false
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "unknown"
}
when {
n == 1 -> println("A")
n == 2 -> println("B")
else -> println("C")
}
}
@@ -0,0 +1,16 @@
// IS_APPLICABLE: false
fun test(n: Int) {
val res: String
<caret>when (n) {
1 -> res = "one"
2 -> res = "two"
else -> res = "unknown"
}
when (n + 1) {
1 -> println("A")
2 -> println("B")
else -> println("C")
}
}
@@ -0,0 +1,15 @@
fun test(n: Int) {
val res: String
<caret>when {
n == 1 -> res = "one"
n == 2 -> res = "two"
else -> res = "unknown"
}
when {
n == 1 -> println("A")
n == 2 -> println("B")
else -> println("C")
}
}
@@ -0,0 +1,18 @@
fun test(n: Int) {
val res: String
<caret>when {
n == 1 -> {
res = "one"
println("A")
}
n == 2 -> {
res = "two"
println("B")
}
else -> {
res = "unknown"
println("C")
}
}
}
@@ -86,6 +86,10 @@ public abstract class AbstractCodeTransformationTest extends LightCodeInsightTes
doTestIntention(path, new FlattenWhenIntention());
}
public void doTestMergeWhen(@NotNull String path) throws Exception {
doTestIntention(path, new MergeWhenIntention());
}
public void doTestIntroduceWhenSubject(@NotNull String path) throws Exception {
doTestIntention(path, new IntroduceWhenSubjectIntention());
}
@@ -30,7 +30,7 @@ import org.jetbrains.jet.plugin.intentions.AbstractCodeTransformationTest;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@InnerTestClasses({CodeTransformationsTestGenerated.IfToAssignment.class, CodeTransformationsTestGenerated.IfToReturn.class, CodeTransformationsTestGenerated.IfToReturnAsymmetrically.class, CodeTransformationsTestGenerated.WhenToAssignment.class, CodeTransformationsTestGenerated.WhenToReturn.class, CodeTransformationsTestGenerated.AssignmentToIf.class, CodeTransformationsTestGenerated.AssignmentToWhen.class, CodeTransformationsTestGenerated.PropertyToIf.class, CodeTransformationsTestGenerated.PropertyToWhen.class, CodeTransformationsTestGenerated.ReturnToIf.class, CodeTransformationsTestGenerated.ReturnToWhen.class, CodeTransformationsTestGenerated.IfToWhen.class, CodeTransformationsTestGenerated.WhenToIf.class, CodeTransformationsTestGenerated.Flatten.class, CodeTransformationsTestGenerated.IntroduceSubject.class, CodeTransformationsTestGenerated.EliminateSubject.class, CodeTransformationsTestGenerated.Split.class, CodeTransformationsTestGenerated.Join.class, CodeTransformationsTestGenerated.ConvertMemberToExtension.class, CodeTransformationsTestGenerated.ReconstructedType.class, CodeTransformationsTestGenerated.RemoveUnnecessaryParentheses.class})
@InnerTestClasses({CodeTransformationsTestGenerated.IfToAssignment.class, CodeTransformationsTestGenerated.IfToReturn.class, CodeTransformationsTestGenerated.IfToReturnAsymmetrically.class, CodeTransformationsTestGenerated.WhenToAssignment.class, CodeTransformationsTestGenerated.WhenToReturn.class, CodeTransformationsTestGenerated.AssignmentToIf.class, CodeTransformationsTestGenerated.AssignmentToWhen.class, CodeTransformationsTestGenerated.PropertyToIf.class, CodeTransformationsTestGenerated.PropertyToWhen.class, CodeTransformationsTestGenerated.ReturnToIf.class, CodeTransformationsTestGenerated.ReturnToWhen.class, CodeTransformationsTestGenerated.IfToWhen.class, CodeTransformationsTestGenerated.WhenToIf.class, CodeTransformationsTestGenerated.Flatten.class, CodeTransformationsTestGenerated.Merge.class, CodeTransformationsTestGenerated.IntroduceSubject.class, CodeTransformationsTestGenerated.EliminateSubject.class, CodeTransformationsTestGenerated.Split.class, CodeTransformationsTestGenerated.Join.class, CodeTransformationsTestGenerated.ConvertMemberToExtension.class, CodeTransformationsTestGenerated.ReconstructedType.class, CodeTransformationsTestGenerated.RemoveUnnecessaryParentheses.class})
public class CodeTransformationsTestGenerated extends AbstractCodeTransformationTest {
@TestMetadata("idea/testData/intentions/branched/folding/ifToAssignment")
public static class IfToAssignment extends AbstractCodeTransformationTest {
@@ -544,6 +544,99 @@ public class CodeTransformationsTestGenerated extends AbstractCodeTransformation
}
@TestMetadata("idea/testData/intentions/branched/when/merge")
public static class Merge extends AbstractCodeTransformationTest {
public void testAllFilesPresentInMerge() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("idea/testData/intentions/branched/when/merge"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("mergeBlockWithBlock.kt")
public void testMergeBlockWithBlock() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeBlockWithBlock.kt");
}
@TestMetadata("mergeBlockWithSingle.kt")
public void testMergeBlockWithSingle() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeBlockWithSingle.kt");
}
@TestMetadata("mergeWithConflictingDeclarations.kt")
public void testMergeWithConflictingDeclarations() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithConflictingDeclarations.kt");
}
@TestMetadata("mergeWithDeclarations.kt")
public void testMergeWithDeclarations() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithDeclarations.kt");
}
@TestMetadata("mergeWithReturnAfter.kt")
public void testMergeWithReturnAfter() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithReturnAfter.kt");
}
@TestMetadata("mergeWithReturnBefore.kt")
public void testMergeWithReturnBefore() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithReturnBefore.kt");
}
@TestMetadata("mergeWithSubject.kt")
public void testMergeWithSubject() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithSubject.kt");
}
@TestMetadata("mergeWithUnmatchedConditions1.kt")
public void testMergeWithUnmatchedConditions1() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions1.kt");
}
@TestMetadata("mergeWithUnmatchedConditions2.kt")
public void testMergeWithUnmatchedConditions2() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions2.kt");
}
@TestMetadata("mergeWithUnmatchedConditions3.kt")
public void testMergeWithUnmatchedConditions3() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions3.kt");
}
@TestMetadata("mergeWithUnmatchedConditions4.kt")
public void testMergeWithUnmatchedConditions4() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions4.kt");
}
@TestMetadata("mergeWithUnmatchedConditions5.kt")
public void testMergeWithUnmatchedConditions5() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions5.kt");
}
@TestMetadata("mergeWithUnmatchedConditions6.kt")
public void testMergeWithUnmatchedConditions6() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions6.kt");
}
@TestMetadata("mergeWithUnmatchedConditions7.kt")
public void testMergeWithUnmatchedConditions7() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithUnmatchedConditions7.kt");
}
@TestMetadata("mergeWithUnmatchedSubjects1.kt")
public void testMergeWithUnmatchedSubjects1() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithUnmatchedSubjects1.kt");
}
@TestMetadata("mergeWithUnmatchedSubjects2.kt")
public void testMergeWithUnmatchedSubjects2() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithUnmatchedSubjects2.kt");
}
@TestMetadata("mergeWithoutSubject.kt")
public void testMergeWithoutSubject() throws Exception {
doTestMergeWhen("idea/testData/intentions/branched/when/merge/mergeWithoutSubject.kt");
}
}
@TestMetadata("idea/testData/intentions/branched/when/introduceSubject")
public static class IntroduceSubject extends AbstractCodeTransformationTest {
public void testAllFilesPresentInIntroduceSubject() throws Exception {
@@ -1101,6 +1194,7 @@ public class CodeTransformationsTestGenerated extends AbstractCodeTransformation
suite.addTestSuite(IfToWhen.class);
suite.addTestSuite(WhenToIf.class);
suite.addTestSuite(Flatten.class);
suite.addTestSuite(Merge.class);
suite.addTestSuite(IntroduceSubject.class);
suite.addTestSuite(EliminateSubject.class);
suite.addTestSuite(Split.class);