Simplify call: Fix false positive in "filter {}" detection (KT-32468)
"Simplify filter {}" conversion changes semantics when the casted type is not a subtype if an initial collection element type.
This commit limits a replacement suggestion to subtype cases.
This commit is contained in:
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
interface Foo
|
||||
interface Bar
|
||||
|
||||
fun instanceOfMarkerInterface(x: List<Foo>): List<Foo> = x.<caret>filter { it is Bar }
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// PROBLEM: none
|
||||
|
||||
interface Foo
|
||||
interface Bar : Foo
|
||||
|
||||
fun instanceOfMarkerInterface(x: List<Bar>): List<Bar> = x.<caret>filter { it is Foo }
|
||||
Reference in New Issue
Block a user