JS: fix translation of augmented assignment in class initializer. See KT-15569

This commit is contained in:
Alexey Andreev
2017-01-10 13:31:36 +03:00
parent ee74342fbe
commit 4eed7c1fcb
9 changed files with 130 additions and 31 deletions
@@ -0,0 +1,45 @@
abstract class A {
val b = B("O")
open val c: B
val d: B
get() = field
var e: String
get() = field
init {
c = B("O")
d = B("O")
e = "O"
b += ","
c += "."
d += ";"
e += "|"
}
}
class B(var value: String) {
operator fun plusAssign(o: String) {
value += o
}
}
class C : A() {
init {
b += "K"
c += "K"
d += "K"
e += "K"
}
}
fun box(): String {
val c = C()
val result = "${c.b.value} ${c.c.value} ${c.d.value} ${c.e}"
if (result != "O,K O.K O;K O|K") return "fail: $result"
return "OK"
}