JS: add test to prove that KT-13523 is no more reproducible
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
var log = ""
|
||||
|
||||
fun foo(): Int {
|
||||
log += "foo;"
|
||||
return 1
|
||||
}
|
||||
fun bar(): Int {
|
||||
log += "bar;"
|
||||
return 42
|
||||
}
|
||||
|
||||
data class A(val x: Int) {
|
||||
operator fun plus(other: A) = A(x + other.x)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val array = arrayOf(0, 1)
|
||||
array[foo()] += bar()
|
||||
|
||||
if (array[0] != 0) return "fail1a: ${array[0]}"
|
||||
if (array[1] != 43) return "fail1b: ${array[0]}"
|
||||
|
||||
log += "!;"
|
||||
|
||||
val objArray = arrayOf(A(0), A(1))
|
||||
objArray[foo()] += A(bar())
|
||||
if (objArray[0] != A(0)) return "fail2a: ${array[0]}"
|
||||
if (objArray[1] != A(43)) return "fail2b: ${array[0]}"
|
||||
|
||||
if (log != "foo;bar;!;foo;bar;") return "fail3: $log"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
public final class A {
|
||||
private final field x: int
|
||||
public method <init>(p0: int): void
|
||||
public final method component1(): int
|
||||
public synthetic static method copy$default(p0: A, p1: int, p2: int, p3: java.lang.Object): A
|
||||
public final @org.jetbrains.annotations.NotNull method copy(p0: int): A
|
||||
public method equals(p0: java.lang.Object): boolean
|
||||
public final method getX(): int
|
||||
public method hashCode(): int
|
||||
public final @org.jetbrains.annotations.NotNull method plus(@org.jetbrains.annotations.NotNull p0: A): A
|
||||
public method toString(): java.lang.String
|
||||
}
|
||||
|
||||
public final class AugmentedAssignmentWithArrayLHSKt {
|
||||
private static @org.jetbrains.annotations.NotNull field log: java.lang.String
|
||||
public final static method bar(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static method foo(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method getLog(): java.lang.String
|
||||
public final static method setLog(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
|
||||
}
|
||||
Reference in New Issue
Block a user