Files
kotlin-fork/plugins/kotlin-serialization/kotlin-serialization-compiler/testData/diagnostics/NullabilityIncompatible.kt
T
Leonid Startsev b78d84c120 Add some tests for kotlinx.serialization plugin:
- declaration checker
- bytecode listings
- JVM IR

Improve @Transient redundant reporting
2019-06-11 19:32:40 +03:00

16 lines
589 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_PARAMETER,-UNUSED_VARIABLE
// FILE: test.kt
import kotlinx.serialization.*
@Serializable(NopeNullableSerializer::class)
class Nope {}
class NopeNullableSerializer: KSerializer<Nope?> {
override val descriptor: SerialDescriptor get() = TODO()
override fun deserialize(decoder: Decoder): Nope? = TODO()
override fun serialize(encoder: Encoder, obj: Nope?) = TODO()
}
@Serializable
class Foo(val foo: <!PLUGIN_ERROR("Type 'Nope' is non-nullable and therefore can not be serialized with serializer for nullable type 'NopeNullableSerializer'")!>Nope<!>)