A More Reliable Compilation Scheme for Kotlin Multiplatform Modules
Kotlin 2.5.0-Beta1 introduces an optional separate compilation scheme for Multiplatform projects to align IDE analysis with compiler behavior. This feature resolves inconsistencies in overload resolution and type inference across source sets. It also enables incremental compilation for common code. The option remains experimental and disabled by default, requiring explicit configuration in Gradle properties.

Kotlin 2.5.0‑Beta1 adds an optional “separate compilation” mode for multiplatform projects. When the flag kotlin.kmp.separateCompilation=true is set in gradle.properties, the compiler stops allowing common code to reach platform‑only declarations and aligns its checks with the IDE. This change also makes incremental compilation of common source sets possible. The previous approach could let the IDE report an unresolved reference while the compiler succeeded, or let common tests call platform implementations unintentionally. By enforcing strict metadata‑based resolution, developers gain more predictable builds and clearer error locations. Incremental compilation further reduces build times for the shared part of a project. The feature remains experimental and is disabled by default, so its stability and interaction with existing codebases are not yet proven. JetBrains notes there are known issues that may surface when the option is enabled, but details have not been fully disclosed.