Do not create cacheableChildSerializers unless it is necessary

Creation of this property in the SerializerIrGenerator.<init> can lead to
a 'Serializer not found' internal error when generator is applied to a fully-customized external serializer.
In that case, generator is still created, but none of the generateSave/Load functions are called,
so cacheableChildSerializers(Property) is not necessary.

#KT-57730 Fixed
Fixes https://github.com/Kotlin/kotlinx.serialization/issues/2260
This commit is contained in:
Leonid Startsev
2023-04-05 18:35:18 +02:00
committed by Space Team
parent 54c07f5ebb
commit d9e16fb76e
5 changed files with 58 additions and 10 deletions
@@ -25,4 +25,4 @@ object URLSerializer : KSerializer<URL> {
fun box(): String {
if (URLSerializer.descriptor.toString() != "PrimitiveDescriptor(java.net.URL)") return URLSerializer.descriptor.toString()
return "OK"
}
}