Files
kotlin-fork/plugins/kotlinx-serialization/testData/boxIr/sealedClassMultifile.kt
T
Leonid Startsev 662bff7351 Make $serializer generic constructor public
If a serializable class has generic type parameters, its serializer is not an object
and has a specialized constructor. This constructor was public in K1 and should
be public in K2 so it can be called from other serializable classes
(in case class is e.g., part of sealed hierarchy).

#KT-63402 Fixed
2023-11-28 13:31:08 +00:00

29 lines
492 B
Kotlin
Vendored

// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// FILE: a.kt
import kotlinx.serialization.*
@Serializable
sealed class Base {
abstract val id: Long
}
// FILE: b.kt
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
@Serializable
class DerivedOtherFile<Value>(
override val id: Long,
val value: Value
) : Base()
fun box(): String {
val desc = Base.serializer().descriptor.kind
return if (desc == PolymorphicKind.SEALED) "OK" else desc.toString()
}