diff --git a/compiler/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt b/compiler/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt index 6c40fad78ee..dceb15239ef 100644 --- a/compiler/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt +++ b/compiler/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt @@ -101,6 +101,8 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { private class IrVerifier : IrElementVisitorVoid { private val errors = ArrayList() + private val symbolForDeclaration = HashMap() + val hasErrors get() = errors.isNotEmpty() val errorsAsMessage get() = errors.joinToString(prefix = "IR verifier errors:\n", separator = "\n") @@ -183,9 +185,14 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { expression.setter?.checkBinding("setter", expression) } - private fun IrSymbol.checkBinding(kind: String, owner: IrElement) { + private fun IrSymbol.checkBinding(kind: String, irElement: IrElement) { if (!isBound) { - error("$kind ${javaClass.simpleName} ${descriptor} is unbound: ${owner.render()}") + error("${javaClass.simpleName} $descriptor is unbound @$kind ${irElement.render()}") + } + + val otherSymbol = symbolForDeclaration.getOrPut(owner) { this } + if (this != otherSymbol) { + error("Multiple symbols for $descriptor @$kind ${irElement.render()}") } }