Jeff Lockhart
10/13/2023, 5:53 PM-Xexpect-actual-classes
flag to the compiler in 1.9.20-RC? Previously in 1.9.20-Beta2 I had:
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
But this top-level compilerOptions
has been removed now.
I've tried
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
and
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs += "-Xexpect-actual-classes"
}
}
but still get the warning
'expect'/'actual' classes (including interfaces, objects, annotations, enums, and 'actual' typealiases) are in Beta. You can use -Xexpect-actual-classes flag to suppress this warning. Also see: https://youtrack.jetbrains.com/issue/KT-61573during compilation.
tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
Alexander.Likhachev
10/13/2023, 6:16 PMcompilerOptions
and it’s now postponed until 2.0
Please try using
kotlin {
targets.all {
compilations.all {
compilerOptions.configure {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
}
Jeff Lockhart
10/13/2023, 6:46 PMfreeCompilerArgs
don't work?Alexander.Likhachev
10/13/2023, 10:53 PMJeff Lockhart
10/13/2023, 11:08 PMaltavir
10/18/2023, 7:27 AMArkadii Ivanov
11/02/2023, 9:26 PMkotlin {
targets.all {
compilations.all {
compilerOptions.configure {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}
}
Gives:
> Ambiguous method overloading for method org.jetbrains.kotlin.gradle.targets.native.NativeCompilerOptions#configure.
Cannot resolve which method to invoke for [class build_a61yfy2uoq4qbs0ma6w75b74a$_run_closure2$_closure4$_closure7$_closure8] due to overlapping prototypes between:
[interface kotlin.jvm.functions.Function1]
[interface org.gradle.api.Action]
kotlin {
targets.configureEach {
compilations.configureEach {
compilerOptions.configure((Action) { it.freeCompilerArgs.add("-Xexpect-actual-classes") })
}
}
}
elect
11/08/2023, 10:01 AMkotlin {
targets.all {
compilations.all {
compilerOptions.configure {
freeCompilerArgs.addAll("-opt-in=kotlin.ExperimentalUnsignedTypes,kotlin.RequiresOptIn", "-Xexpect-actual-classes")
}
}
}
}
Arkadii Ivanov
11/08/2023, 10:07 AMall
with configureEach
, though.elect
11/08/2023, 10:09 AMtargets.configureEach {
compilations.configureEach {
compilerOptions.configure {
freeCompilerArgs.addAll("-opt-in=kotlin.ExperimentalUnsignedTypes,kotlin.RequiresOptIn", "-Xexpect-actual-classes")
}
}
}
same results(Action) { it.freeCompilerArgs
doesn't even compile (kts)Arkadii Ivanov
11/08/2023, 10:24 AM