[FIR] Do not sort declarations in deserialized classes, keep order from metadata

KT-57769
KT-54792
This commit is contained in:
Dmitriy Novozhilov
2023-04-04 15:15:14 +03:00
committed by Space Team
parent 839026b6fe
commit 7685284cb7
59 changed files with 510 additions and 485 deletions
@@ -203,16 +203,6 @@ fun deserializeClassToSymbol(
configure(classId)
}
declarations.sortWith(object : Comparator<FirDeclaration> {
override fun compare(a: FirDeclaration, b: FirDeclaration): Int {
// Reorder members based on their type and name only.
// See FE 1.0's [DeserializedMemberScope#addMembers].
if (a is FirMemberDeclaration && b is FirMemberDeclaration) {
return FirMemberDeclarationComparator.TypeAndNameComparator.compare(a, b)
}
return 0
}
})
companionObjectSymbol = (declarations.firstOrNull { it is FirRegularClass && it.isCompanion } as FirRegularClass?)?.symbol
contextReceivers.addAll(classDeserializer.createContextReceiversForClass(classProto))