From 0a61e5b0b253b71f1ce8d41b073940cd0730b8b2 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Thu, 21 Apr 2016 21:39:02 +0300 Subject: [PATCH] filterIsInstanceTo NOT supported --- .../intentions/loopToCallChain/filterIsInstanceTo.kt | 12 ++++++++++++ .../loopToCallChain/filterIsInstanceTo.kt.after | 8 ++++++++ 2 files changed, 20 insertions(+) create mode 100644 idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt create mode 100644 idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt.after diff --git a/idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt b/idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt new file mode 100644 index 00000000000..92e20d58550 --- /dev/null +++ b/idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt @@ -0,0 +1,12 @@ +// WITH_RUNTIME +// INTENTION_TEXT: "Replace with '+= filterIsInstance<>()'" + +// decided to not generate "filterIsInstanceTo" because it either requires 2 type arguments (looks awful) or no type arguments at all (looks confusing) + +fun foo(list: List, target: MutableCollection) { + for (o in list) { + if (o is String) { + target.add(o) + } + } +} \ No newline at end of file diff --git a/idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt.after b/idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt.after new file mode 100644 index 00000000000..683f488ae11 --- /dev/null +++ b/idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt.after @@ -0,0 +1,8 @@ +// WITH_RUNTIME +// INTENTION_TEXT: "Replace with '+= filterIsInstance<>()'" + +// decided to not generate "filterIsInstanceTo" because it either requires 2 type arguments (looks awful) or no type arguments at all (looks confusing) + +fun foo(list: List, target: MutableCollection) { + target += list.filterIsInstance() +} \ No newline at end of file