JS: fix translation of reassignment of inline properties. See KT-15590
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// CHECK_VARS_COUNT: function=test1 count=0
|
||||
// CHECK_VARS_COUNT: function=test2 count=1
|
||||
// CHECK_VARS_COUNT: function=test3 count=0
|
||||
|
||||
class A {
|
||||
var result = 1
|
||||
|
||||
inline var z: Int
|
||||
get() = result
|
||||
set(value) {
|
||||
result = value
|
||||
}
|
||||
}
|
||||
|
||||
val a = A()
|
||||
|
||||
fun test1(): Int {
|
||||
a.z += 1
|
||||
return a.z
|
||||
}
|
||||
|
||||
fun test2(): Int {
|
||||
return a.z++
|
||||
}
|
||||
|
||||
fun test3(): Int {
|
||||
return ++a.z
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (test1() != 2) return "fail 1: ${a.z}"
|
||||
|
||||
var p = test2()
|
||||
if (a.z != 3) return "fail 2: ${a.z}"
|
||||
if (p != 2) return "fail 3: $p"
|
||||
|
||||
p = test3()
|
||||
if (a.z != 4) return "fail 4: ${a.z}"
|
||||
if (p != 4) return "fail 5: $p"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
var global = "";
|
||||
|
||||
function log(x) {
|
||||
global += x + ";"
|
||||
}
|
||||
|
||||
function box() {
|
||||
var $x = log(1);
|
||||
var result = (log(2), log(3));
|
||||
if (global != "1;2;3;") return "fail: " + global;
|
||||
return "OK";
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
var global = "";
|
||||
|
||||
function log(x) {
|
||||
global += x + ";"
|
||||
}
|
||||
|
||||
function box() {
|
||||
var $x = log(1);
|
||||
var result = (log(2), $x, log(3));
|
||||
if (global != "1;2;3;") return "fail: " + global;
|
||||
return "OK";
|
||||
}
|
||||
Reference in New Issue
Block a user