From a269e9bc00c2ee65d4886e7cfb37ed39f46599fe Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Tue, 12 Mar 2019 13:14:38 +0100 Subject: [PATCH] JVM IR: fix typo in condition in KCallableNamePropertyLowering This however makes testLocalFunctionName fail because currently isSubclassOf (incorrectly) returns false and therefore an anonymous class is generated and the name is taken from there. The name there is "box$OK" which is incorrect. The isSubclassOf issue is KT-28198 and will be fixed separately; the incorrect name issue will be investigated later --- .../backend/common/lower/KCallableNamePropertyLowering.kt | 2 +- .../box/callableReference/function/local/localFunctionName.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/KCallableNamePropertyLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/KCallableNamePropertyLowering.kt index 76853ad85f3..fb812a78ca6 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/KCallableNamePropertyLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/KCallableNamePropertyLowering.kt @@ -55,7 +55,7 @@ private class KCallableNamePropertyTransformer(val lower: KCallableNamePropertyL (it as? IrSimpleFunction)?.correspondingProperty ?: it } val irClass = directMember.parent as? IrClass ?: return expression - if (irClass.isSubclassOf(lower.context.irBuiltIns.kCallableClass.owner)) return expression + if (!irClass.isSubclassOf(lower.context.irBuiltIns.kCallableClass.owner)) return expression val name = when (directMember) { is IrSimpleFunction -> directMember.name is IrProperty -> directMember.name diff --git a/compiler/testData/codegen/box/callableReference/function/local/localFunctionName.kt b/compiler/testData/codegen/box/callableReference/function/local/localFunctionName.kt index 2b61581b45e..211252d3587 100644 --- a/compiler/testData/codegen/box/callableReference/function/local/localFunctionName.kt +++ b/compiler/testData/codegen/box/callableReference/function/local/localFunctionName.kt @@ -1,4 +1,5 @@ -// IGNORE_BACKEND: JS_IR +// IGNORE_BACKEND: JVM_IR, JS_IR + fun box(): String { fun OK() {}