Replies: 2 comments 3 replies
-
It works for me on Kotlin 1.6.21 at the command line. In IntelliJ the symbol doesn’t resolve. I consider this to be a bug in IntelliJ. |
Beta Was this translation helpful? Give feedback.
3 replies
-
When using v3.1.0, reference to FileSystem.SYSTEM inside common source will fail the compiler. Define a custom actual/expect to use FileSystem can avoid the error before new version was shipped.😅 internal expect fun defaultFileSystem(): FileSystem internal actual fun defaultFileSystem(): FileSystem {
return FileSystem.SYSTEM
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am developing an app for JVM, LinuxX64, MingwX64 and MacosX64 targets. I am trying to place common logic in a common source set for all four targets like this (Okio 3.1.0, Kotlin 1.6.21 with HMPP enabled, Gradle 7.4.2):
and then use this source set like this:
src/commonNonJsMain/kotlin/org/example/Main.kt
:However, this code doesn't compile. This can be fixed by adding
expect val FileSystem.SYSTEM
incommonNonJsMain
and addingactual
declarations in just two source sets:jvmMain
andnativeMain
. Is it supposed to be working like this or am I doing something wrong? I suspect that the reason may be that there is noexpect val SYSTEM
in any high-level source set in Okio;FileSystem.SYSTEM
just appears in some of target source sets, unlike e.g.runBlocking
in this example.Also, disabling HMPP by adding
kotlin.mpp.hierarchicalStructureSupport=false
ingradle.properties
makes this example compile, even though symbols are still unresolved in IDEA.Beta Was this translation helpful? Give feedback.
All reactions