IR tests: check IrSimpleFunction.isFakeOverride

This commit is contained in:
Dmitry Petrov
2019-10-22 16:24:07 +03:00
parent 46745adfd9
commit 65e6a84831
@@ -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)
}