diff --git a/idea/testData/intentions/loopToCallChain/addToCollection_addAfterLoop.kt b/idea/testData/intentions/loopToCallChain/addToCollection_addAfterLoop.kt new file mode 100644 index 00000000000..7931528654f --- /dev/null +++ b/idea/testData/intentions/loopToCallChain/addToCollection_addAfterLoop.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME +// INTENTION_TEXT: "Replace with 'toMutableList()'" +import java.util.ArrayList + +fun foo(map: Map): List { + val result = ArrayList() + for (s in map.values) { + result.add(s) + } + result.add("") + return result +} \ No newline at end of file diff --git a/idea/testData/intentions/loopToCallChain/addToCollection_addAfterLoop.kt.after b/idea/testData/intentions/loopToCallChain/addToCollection_addAfterLoop.kt.after new file mode 100644 index 00000000000..1c73a60021e --- /dev/null +++ b/idea/testData/intentions/loopToCallChain/addToCollection_addAfterLoop.kt.after @@ -0,0 +1,9 @@ +// WITH_RUNTIME +// INTENTION_TEXT: "Replace with 'toMutableList()'" +import java.util.ArrayList + +fun foo(map: Map): List { + val result = map.values.toMutableList() + result.add("") + return result +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java index ea4e2b6cdc7..20177de8492 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/intentions/IntentionTestGenerated.java @@ -7155,6 +7155,12 @@ public class IntentionTestGenerated extends AbstractIntentionTest { doTest(fileName); } + @TestMetadata("addToCollection_addAfterLoop.kt") + public void testAddToCollection_addAfterLoop() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/loopToCallChain/addToCollection_addAfterLoop.kt"); + doTest(fileName); + } + @TestMetadata("addToCollection_badReceiver1.kt") public void testAddToCollection_badReceiver1() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/intentions/loopToCallChain/addToCollection_badReceiver1.kt");