kotlinx.serialization: Support InheritableSerialInfo

This commit is contained in:
Leonid Startsev
2021-07-21 10:06:12 +00:00
committed by Space
parent 8eea749231
commit 4bc521249b
12 changed files with 131 additions and 11 deletions
@@ -0,0 +1,49 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
// WITH_RUNTIME
// SKIP_TXT
// !USE_EXPERIMENTAL: kotlinx.serialization.ExperimentalSerializationApi
// FILE: test.kt
import kotlinx.serialization.*
import kotlin.reflect.KClass
// TODO: for this test to work, runtime dependency should be updated to (yet unreleased) serialization 1.3.0
//@InheritableSerialInfo
annotation class I(val value: String)
enum class E { A, B }
//@InheritableSerialInfo
annotation class I2(val e: E, val k: KClass<*>)
@Serializable
@I("a")
sealed class Result {
// @I("b")
@Serializable class OK(val s: String): Result()
}
@Serializable
@I("a")
@I2(E.A, E::class)
open class A
@Serializable
@I("a")
@I2(E.A, E::class)
open class Correct: A()
@Serializable
@I("a")
//@I2(E.B, E::class)
open class B: A()
@Serializable
@I("a")
//@I2(E.A, I::class)
open class B2: A()
@Serializable
//@I("b")
//@I2(E.A, E::class)
open class C: B()