[PSI2IR] Check that a given function has the right descriptor

The issue was discovered during work on IR serialization and
this is just a safety check.

#KT-56230
This commit is contained in:
Ivan Kylchik
2023-08-03 12:44:01 +02:00
committed by Space Team
parent 5f2de9dbff
commit 55092da03b
@@ -87,6 +87,14 @@ internal class FunctionGenerator(declarationGenerator: DeclarationGenerator) : D
generateBody: BodyGenerator.() -> IrBody?
): IrSimpleFunction =
declareSimpleFunctionInner(descriptor, ktFunction, origin).buildWithScope { irFunction ->
if (descriptor != irFunction.descriptor) {
val message = """
|IrSymbolTable contains function with wrong descriptor.
|Expected: $descriptor
|Actual: ${irFunction.descriptor}
""".trimMargin()
error(message)
}
generateFunctionParameterDeclarationsAndReturnType(irFunction, ktFunction, ktReceiver, ktContextReceivers)
irFunction.body = createBodyGenerator(irFunction.symbol, parentLoopResolver).generateBody()
}