It only happens in certain situations. It can be reproduced using following test:
class PersistentListTest {
@Test
fun `persistent list fails`() {
var xs = persistentListOf(
*(1..1885).map { it }.toTypedArray()
)
xs = xs.removeAll(
(1..1837).map { it }
)
println(xs.size)
xs.forEach {
print(it)
}
}
}
print(it.i) fails with exception
java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class java.lang.Number
([Ljava.lang.Object; and java.lang.Number are in module java.base of loader 'bootstrap')
It only happens in certain situations. It can be reproduced using following test:
print(it.i)
fails with exception