From 65e6a84831299a5a519645dc5fa38c92b6834669 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 22 Oct 2019 16:24:07 +0300 Subject: [PATCH] IR tests: check IrSimpleFunction.isFakeOverride --- .../org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt b/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt index dc430329bd6..dfff8994878 100644 --- a/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt +++ b/compiler/tests-common/tests/org/jetbrains/kotlin/ir/AbstractIrTextTestCase.kt @@ -70,7 +70,8 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { val path = wholeFile.path val replacedPath = path.replace(".kt", "__") - val externalFilePaths = wholeFile.parentFile.listFiles().mapNotNullTo(mutableListOf()) { + val filesInDir = wholeFile.parentFile.listFiles() ?: return + val externalFilePaths = filesInDir.mapNotNullTo(mutableListOf()) { if (it.path.startsWith(replacedPath)) it.path else null } for (externalClassFqn in parseDumpExternalClasses(wholeText)) { @@ -232,6 +233,14 @@ abstract class AbstractIrTextTestCase : AbstractIrGeneratorTestCase() { } } + override fun visitSimpleFunction(declaration: IrSimpleFunction) { + visitFunction(declaration) + + require((declaration.origin == IrDeclarationOrigin.FAKE_OVERRIDE) == declaration.isFakeOverride) { + "${declaration.descriptor}: origin: ${declaration.origin}; isFakeOverride: ${declaration.isFakeOverride}" + } + } + override fun visitDeclarationReference(expression: IrDeclarationReference) { expression.symbol.checkBinding("ref", expression) }