KT-11030 Fix referencing wrong field generated for captured variable when this captured variable referenced both from constructor and non-constructor method. Avoid duplicate generation of call to delegated constructor.

This commit is contained in:
Alexey Andreev
2016-03-30 16:40:41 +03:00
parent a5e0c70988
commit 4ac730e5ed
7 changed files with 83 additions and 40 deletions
@@ -0,0 +1,18 @@
package foo
interface B {
fun result(): Int
}
class A(private val x: Int) {
fun test() = object : B {
val y = x + 1
override fun result() = x * 10 + y
}
}
fun box(): String {
assertEquals(23, A(2).test().result())
return "OK"
}