How do I enable context receivers in common code? ...
# multiplatform
m
How do I enable context receivers in common code? Using the following in gradle:
Copy code
tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"
    kotlinOptions.freeCompilerArgs = listOf("-Xcontext-receivers")
}

tasks.withType<Kotlin2JsCompile> {
    kotlinOptions.freeCompilerArgs = listOf("-Xcontext-receivers")
}

tasks.withType<KotlinCompileCommon> {
    kotlinOptions.freeCompilerArgs = listOf("-Xcontext-receivers")
}

tasks.withType<KotlinNativeCompile> {
    kotlinOptions.freeCompilerArgs = listOf("-Xcontext-receivers")
}
And then inspecting it in File -> Project Settings -> Modules shows it being added to every target except commonMain/commonTest
e
Copy code
kotlin {
    targets.all {
        compilations.all {
            kotlinOptions.freeCompilerArgs
        }
    }
}
m
That still doesn't seem to apply it to the common sourceset, which is causing the issues.
and adding @file:Suppress("UNSUPPORTED_FEATURE") to the top of the file doesn't seem to fix it either, the error is gone but attributes from the type still are not resolved like they were with extension functions.
t
Pretty sure it only supports JVM right now
1
m
Is there an ETA for multiplatform support?
115 Views