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.
This commit is contained in:
Vasily Levchenko
2017-03-09 17:44:23 +03:00
committed by vvlevchenko
parent 10eef395f4
commit ec68a3a24e
@@ -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,