fe5dbf75fa
type of the property. Check for serializer type mismatch only when custom serializer is present Otherwise, there are too many false positives on e.g. PolymorphicSerializer #KT-36329 Fixed Fixes https://github.com/Kotlin/kotlinx.serialization/issues/830
24 lines
822 B
Kotlin
Vendored
24 lines
822 B
Kotlin
Vendored
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
|
|
|
|
// FILE: test.kt
|
|
import kotlinx.serialization.*
|
|
import kotlinx.serialization.encoding.*
|
|
|
|
enum class SimpleEnum { A, B }
|
|
|
|
<!EXPLICIT_SERIALIZABLE_IS_REQUIRED!>enum<!> class MarkedNameEnum { @SerialName("a") A, B}
|
|
|
|
@Serializable
|
|
enum class ExplicitlyMarkedEnum { @SerialName("a") A, B}
|
|
|
|
@Serializable(EnumSerializer::class)
|
|
enum class ExplicitlyMarkedEnumCustom { @SerialName("a") A, B}
|
|
|
|
object EnumSerializer: KSerializer<ExplicitlyMarkedEnumCustom> {
|
|
override val descriptor = TODO()
|
|
override fun serialize(encoder: Encoder, value: ExplicitlyMarkedEnumCustom) = TODO()
|
|
override fun deserialize(decoder: Decoder): ExplicitlyMarkedEnumCustom = TODO()
|
|
}
|
|
|
|
@Serializable
|
|
data class EnumUsage(val s: SimpleEnum, val m: MarkedNameEnum, val e: ExplicitlyMarkedEnum) |