https://kotlinlang.org logo
#intellij
Title
# intellij
k

Klitos Kyriacou

09/18/2023, 10:06 AM
The following code produces a false positive "useless cast" warning for `as MutableList<String>`:
Copy code
val map = (0..3).associateWithTo(mutableMapOf()) { ArrayList<String>() as MutableList<String> }
    val groups = listOf("a", "aa").groupByTo(map) { it.length }
Removing the "useless cast" causes a compiler error. Looking at existing logged issues, is this the same issue as KT-36281?
(This is a bit contrived, by the way. I know there are other ways of writing it.)
a

Anton Mefodichev

09/20/2023, 10:28 AM
@Klitos Kyriacou can you please create a new Youtrack ticket? Thank you!