Next statement throws a ClassCastException
:
val foo = listOf(listOf("hello")).filterIsInstance<List<Int>>().first().first()
There are no compile errors or warnings, nor is there anything in the Kotlin documentation that explicitly mentions this behavior. I understand the type erasure feature and that filterIsInstance
is simply performing an is
check. However, shouldn’t this behavior be documented?