CLOVIS
08/14/2025, 8:10 AMinterface 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 workdmitriy.novozhilov
08/14/2025, 8:20 AMephemient
08/14/2025, 8:24 AMval c: List<A>
val b = buildList {
c = list.filterNot { it is B && add(it) }
}