Fixed missing fallback serializer in contextual serializer
Fixes Kotlin/kotlinx.serialization#2158 Merge-request: KT-MR-8338 Merged-by: Sergey Shanshin <Sergey.Shanshin@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
da24e5559b
commit
d063db3ce0
+8
@@ -467,6 +467,14 @@ abstract class BaseIrGenerator(private val currentClass: IrClass, final override
|
||||
typeArgs = listOf(kType)
|
||||
}
|
||||
contextSerializerId -> {
|
||||
// don't create an instance if the serializer is being created for the cache
|
||||
if (genericIndex == null && kType.genericIndex != null) {
|
||||
// if context serializer parametrized by generic type (kType.genericIndex != null)
|
||||
// and generic types are not allowed (always genericIndex == null for cache)
|
||||
// then serializer can't be cached
|
||||
return null
|
||||
}
|
||||
|
||||
args = listOf(classReference(kType.classOrUpperBound()!!))
|
||||
typeArgs = listOf(kType)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user