https://kotlinlang.org logo
Title
a

Alexander Maryanovsky

05/30/2022, 3:06 PM
Whoever decided to have both
Flow{ fun collect() }
and
Flow.collect
(an extension function) needs to have a stern talking to.
I have IntelliJ telling me
import kotlinx.coroutines.flow.collect
is unused, and when I remove it, it tries to use the regular function, which the compiler doesn’t like.
and it’s always fun trying to import it
e

ephemient

05/30/2022, 4:14 PM
https://github.com/Kotlin/kotlinx.coroutines/pull/3047 Perhaps something is wrong with your setup, as
.collect {}
is usable in 1.6+ without an extension, and
.collect()
requires an extension in all versions
a

Alexander Maryanovsky

05/30/2022, 5:06 PM
I'm using compose 1.1.1 which is kotlin 1.5 if I’m not mistaken.
e

ephemient

05/30/2022, 5:07 PM
what matters is kotlinx.coroutines version, not kotlin version
a

Alexander Maryanovsky

05/30/2022, 5:08 PM
Clearing the cache solved the IntelliJ problem, btw.
e

ephemient

05/30/2022, 5:08 PM
but if you are seeing inconsistency between your ide and your compiler, they probably disagree on what version you're using
a

Alexander Maryanovsky

05/30/2022, 5:10 PM
Doesn't IntelliJ take all the info from gradle?
e

ephemient

05/30/2022, 5:19 PM
it should, but clearly something went wrong in your case
a

Alexander Maryanovsky

05/31/2022, 9:24 AM
Also, I didn’t add
kotlinx.coroutines
as a dependency, I’m just using the one brought in by
implementation(compose.desktop.currentOs)