mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-18 15:52:31 +00:00
filterIsInstanceTo NOT supported
This commit is contained in:
12
idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt
vendored
Normal file
12
idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt
vendored
Normal file
@@ -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<Any>, target: MutableCollection<String>) {
|
||||
<caret>for (o in list) {
|
||||
if (o is String) {
|
||||
target.add(o)
|
||||
}
|
||||
}
|
||||
}
|
||||
8
idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt.after
vendored
Normal file
8
idea/testData/intentions/loopToCallChain/filterIsInstanceTo.kt.after
vendored
Normal file
@@ -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<Any>, target: MutableCollection<String>) {
|
||||
<caret>target += list.filterIsInstance<String>()
|
||||
}
|
||||
Reference in New Issue
Block a user