filterIsInstanceTo NOT supported

This commit is contained in:
Valentin Kipyatkov
2016-04-21 21:39:02 +03:00
parent 395e61ca57
commit 0a61e5b0b2
2 changed files with 20 additions and 0 deletions

View 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)
}
}
}

View 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>()
}