From ec68a3a24e89c541ea22e5aef3253c4f6e91bccf Mon Sep 17 00:00:00 2001 From: Vasily Levchenko Date: Thu, 9 Mar 2017 17:44:23 +0300 Subject: [PATCH] IR: defaults: calculate right `this` dispatch receiver parameter. previously in case: ``` fun box(): String { val a: A = B(1) a.copy(1) a.component1() return "OK" } interface A { fun copy(x: Int): A fun component1(): Any } data class B(val x: Int) : A ``` in stab `B::copy$default` `B::copy` called with `A::this` that behaviour isn't correct, should be `B::this` used. --- .../kotlin/backend/konan/lower/DefaultArgumentStubGenerator.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultArgumentStubGenerator.kt b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultArgumentStubGenerator.kt index 79bd154e406..9bf1ad1a211 100644 --- a/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultArgumentStubGenerator.kt +++ b/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/DefaultArgumentStubGenerator.kt @@ -342,7 +342,7 @@ private fun FunctionDescriptor.generateDefaultsDescription(context: Context): Fu val name = Name.identifier("$name\$default") SimpleFunctionDescriptorImpl.create( - /* containingDeclaration = */ if (DescriptorUtils.isOverride(this)) this.overriddenDescriptors.first().containingDeclaration as ClassDescriptor else containingDeclaration, + /* containingDeclaration = */ containingDeclaration, /* annotations = */ annotations, /* name = */ name, /* kind = */ CallableMemberDescriptor.Kind.SYNTHESIZED,