JVM_IR: avoid duplication in declaration lists during deserialization

This commit is contained in:
Georgy Bronnikov
2021-06-24 21:44:54 +03:00
committed by TeamCityServer
parent fa4efd3303
commit dffb22de9d
@@ -325,9 +325,11 @@ class IrDeclarationDeserializer(
superTypes = proto.superTypeList.map { deserializeIrType(it) }
withExternalValue(isExternal) {
val oldDeclarations = declarations.toSet()
proto.declarationList
.filterNot { isSkippableFakeOverride(it, this) }
.mapNotNullTo(declarations) { declProto -> deserializeDeclaration(declProto) }
// On JVM, deserialization may fill bodies of existing declarations, so avoid adding duplicates.
.mapNotNullTo(declarations) { declProto -> deserializeDeclaration(declProto).takeIf { it !in oldDeclarations } }
}
thisReceiver = deserializeIrValueParameter(proto.thisReceiver, -1)