K2 plugins: create companions with same expect/actual as their owners

#KT-59299 Fixed
This commit is contained in:
Mikhail Glukhikh
2023-06-14 12:18:58 +02:00
committed by Space Team
parent 77e5f077f3
commit 8e882ea797
4 changed files with 39 additions and 0 deletions
@@ -0,0 +1,25 @@
// LANGUAGE: +MultiPlatformProjects
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_K1: JVM_IR
// IGNORE REASON: multimodule MPP tests are not supported for K1
// WITH_STDLIB
// MODULE: m1-common
// FILE: common.kt
import kotlinx.serialization.*
@Serializable
expect sealed class Some
fun s(): KSerializer<Some> = Some.Companion.serializer()
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
import kotlinx.serialization.*
@Serializable
actual sealed class Some
fun box(): String = if (s().descriptor.toString() == Some.serializer().descriptor.toString()) "OK" else "fail"