Files
Sergey.Shanshin 2ae2f09fee [FIR] Fixed phase for FirCompanionGenerationProcessor to COMPANION_GENERATION
Phase COMPILER_REQUIRED_ANNOTATIONS causes errors in the kotlinx serialization tests:

org.jetbrains.kotlin.fir.symbols.FirLazyResolveContractViolationException: `lazyResolveToPhase(COMPILER_REQUIRED_ANNOTATIONS)` cannot be called from a transformer with a phase COMPILER_REQUIRED_ANNOTATIONS.
`lazyResolveToPhase` can be called only from a transformer with a phase which is strictly greater than a requested phase;
 i.e., `lazyResolveToPhase(A)` may be only called from a lazy transformer with a phase B, where A < B. This is a contract of lazy resolve
2024-02-12 15:54:11 +00:00

26 lines
873 B
Kotlin
Vendored

// FIR_IDENTICAL
// WITH_STDLIB
// FILE: test.kt
import kotlinx.serialization.*
import kotlinx.serialization.encoding.*
enum class SimpleEnum { A, B }
// Annotated enums do not require @Serializable if runtime has proper factory funciton (runtime ver. >= 1.5.0)
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)