Verify mangled names against descriptions of signatures computed from IR

...instead of those computed from a frontend representation
(`symbol.signature`).

This is more robust; besides, we are going to turn off building
signatures from FIR, so `symbol.signature` is going to return null soon.
This commit is contained in:
Sergej Jaskiewicz
2024-01-12 15:52:53 +01:00
committed by Space Team
parent c8f8316e9b
commit a5031edd1a
2 changed files with 5 additions and 11 deletions
@@ -223,13 +223,10 @@ class IrMangledNameAndSignatureDumpHandler(
val fullMangledNames = mutableListOf<ComputedMangledName>()
val signatureMangledNames = mutableListOf<ComputedMangledName>()
signatureComposer.inFile(declaration.fileOrNull?.symbol) {
addSignatureTo(
signatures,
signatureComposer.computeSignature(declaration),
ComputedBy.IR,
isPublic = true
)
val signatureComputedFromIr = signatureComposer.inFile(declaration.fileOrNull?.symbol) {
signatureComposer.computeSignature(declaration).also {
addSignatureTo(signatures, it, ComputedBy.IR, isPublic = true)
}
}
irMangler.addFullMangledNameTo(fullMangledNames, declaration)
@@ -255,7 +252,7 @@ class IrMangledNameAndSignatureDumpHandler(
// Signature mangled names computed from descriptors, IR and FIR of declarations that are not
// effectively private must be all equal to the signature description, which we already print
// (see the printSignatures() function below). If this is not the case, print them separately.
if (signatureMangledNames.any { it.value != symbol.signature?.asPublic()?.description.orEmpty() }) {
if (signatureMangledNames.any { it.value != signatureComputedFromIr.asPublic()?.description.orEmpty() }) {
printMangledNames(signatureMangledNames, prefix = "Mangled name for the signature")
}
}