```interface A class B(val b: Int) : A class C(val...
# stdlib
c
Copy code
interface A
class B(val b: Int) : A
class C(val c: Int) : A

val list: List<A> = // …

val (b, c) = list.partition { it is B }
println(b.b)    ⚠ doesn't compile! 'b' is of type A
It would be great if the correct contracts were added to
.partition
for this example to work
1
d
It's quite a complex feature for data-flow analyzer. The relevant issue is KT-29236.
🙏 1
e
it's a bit wacky but the current calls-in-place contract should be enough to make this work
Copy code
val c: List<A>
val b = buildList {
    c = list.filterNot { it is B && add(it) }
}