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
48 lines
1.5 KiB
Kotlin
Vendored
48 lines
1.5 KiB
Kotlin
Vendored
// FIR_IDENTICAL
|
|
// WITH_STDLIB
|
|
// SKIP_TXT
|
|
|
|
import kotlinx.serialization.*
|
|
import kotlinx.serialization.descriptors.*
|
|
import kotlinx.serialization.encoding.*
|
|
|
|
fun container() {
|
|
@Serializable
|
|
class X // local classes are allowed
|
|
|
|
val y = <!ANONYMOUS_OBJECTS_NOT_SUPPORTED!>@Serializable<!> object {
|
|
fun inObjectFun() {
|
|
<!ANONYMOUS_OBJECTS_NOT_SUPPORTED!>@Serializable<!>
|
|
class X // local classes in anonymous object functions are not allowed
|
|
}
|
|
}
|
|
|
|
|
|
class LocalSerializer : KSerializer<Any?> {
|
|
override val descriptor: SerialDescriptor = buildSerialDescriptor("tmp", PrimitiveKind.INT)
|
|
override fun serialize(encoder: Encoder, value: Any?) {
|
|
encoder.encodeNull()
|
|
}
|
|
|
|
override fun deserialize(decoder: Decoder): Any? {
|
|
return decoder.decodeNull()
|
|
}
|
|
}
|
|
|
|
@Serializable
|
|
class WithLocalSerializerInProperty(<!LOCAL_SERIALIZER_USAGE!>@Serializable(with = LocalSerializer::class)<!> val x: Any?)
|
|
|
|
<!LOCAL_SERIALIZER_USAGE, SERIALIZER_TYPE_INCOMPATIBLE!>@Serializable(with = LocalSerializer::class)<!>
|
|
data class WithLocalSerializer(val i: Int)
|
|
}
|
|
|
|
val topLevelAnon = <!ANONYMOUS_OBJECTS_NOT_SUPPORTED!>@Serializable<!> object {}
|
|
|
|
@Serializable class A {
|
|
@Serializable class B // nested classes are allowed
|
|
|
|
<!INNER_CLASSES_NOT_SUPPORTED!>@Serializable<!> inner class C // inner classes are not
|
|
|
|
@Serializable object F {} // regular named object, OK
|
|
}
|