``` @Test fun coroutineTest() { ru...
# coroutines
d
Copy code
@Test
    fun coroutineTest() {
        runBlocking {
            flowOf("any").map {
                val result = ioFunction() //crash java.lang.ClassCastException: kotlin.coroutines.intrinsics.CoroutineSingletons cannot be cast to java.util.Map
                result
            }.collect { result ->
                Log.v("$result")
            }
        }
    }

    suspend fun ioFunction(): Map<Long, Int> = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
        mapOf(1L to 4)
    }
how can is use suspend function in when mapping Flow? above code crashes, but it works when I remove suspend function and use normal blocking function
✔️ 1
should I use different operator then map?
o
that looks like a bug in the compiler, should be fine code except you should use
delay
and not sleep
the CCE would be coming from the
COROUTINE_SUSPENDED
internal value being leaked
d
removed sleep it doesn't matter here
I am using kotlin_version = '1.3.21'
o
yes, probably
d
It works with 1.3.50, thank you ✔️