JS: fix translation of augmented assignment in class initializer. See KT-15569
This commit is contained in:
+45
@@ -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"
|
||||
}
|
||||
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
@kotlin.Metadata
|
||||
public abstract class A {
|
||||
private final @org.jetbrains.annotations.NotNull field b: B
|
||||
private final @org.jetbrains.annotations.NotNull field c: B
|
||||
private final @org.jetbrains.annotations.NotNull field d: B
|
||||
private @org.jetbrains.annotations.NotNull field e: java.lang.String
|
||||
public method <init>(): void
|
||||
public final @org.jetbrains.annotations.NotNull method getB(): B
|
||||
public @org.jetbrains.annotations.NotNull method getC(): B
|
||||
public final @org.jetbrains.annotations.NotNull method getD(): B
|
||||
public final @org.jetbrains.annotations.NotNull method getE(): java.lang.String
|
||||
public final method setE(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class AugmentedAssignmentInInitializerKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class B {
|
||||
private @org.jetbrains.annotations.NotNull field value: java.lang.String
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final @org.jetbrains.annotations.NotNull method getValue(): java.lang.String
|
||||
public final method plusAssign(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
public final method setValue(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class C {
|
||||
public method <init>(): void
|
||||
}
|
||||
Reference in New Issue
Block a user