-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
Description
Describe the bug
It seems there is an import conflict regarding Dispatchers.IO on the K/N vs JVM.
Following code compiles on the JVM:
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
suspend fun test() {
withContext(Dispatchers.IO) {
}
}But it fails on the K/N:
Cannot access 'val IO: CoroutineDispatcher': it is internal in 'kotlinx.coroutines.Dispatchers'.
the solution is to add the import manually:
import kotlinx.coroutines.IO
however, when performing "Optimize imports" actions in the KMP common code, IntelliJ will remove that import, causing the K/N builds to fail afterwards, without IDE showing anything red.
This makes it difficult to work in the common code with automatic import optimizations enabled as IntelliJ will keep removing this.
Is this a bug in the IntelliJ or the coroutines library?