2ae2f09fee
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
28 lines
653 B
Kotlin
Vendored
28 lines
653 B
Kotlin
Vendored
// WITH_STDLIB
|
|
|
|
package com.example
|
|
|
|
import kotlinx.serialization.*
|
|
import kotlinx.serialization.json.*
|
|
import kotlinx.serialization.encoding.*
|
|
import kotlinx.serialization.descriptors.*
|
|
|
|
|
|
class Data(val j: Int)
|
|
|
|
@Serializer(forClass = Data::class)
|
|
object ObjectSerializer
|
|
|
|
@Serializer(forClass = Data::class)
|
|
class ClassSerializer
|
|
|
|
fun box(): String {
|
|
val encodedForClass = Json.encodeToString(ClassSerializer(), Data(1))
|
|
if (encodedForClass != """{"j":1}""") return encodedForClass
|
|
|
|
val encodedForObject = Json.encodeToString(ObjectSerializer, Data(2))
|
|
if (encodedForObject != """{"j":2}""") return encodedForObject
|
|
|
|
return "OK"
|
|
}
|