KT-740: Make sure that assign and increment operations compute receiver only once:
- Increment operation on property.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package foo
|
||||
|
||||
var c = 0
|
||||
|
||||
class A() {
|
||||
var p = 0;
|
||||
{
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : Boolean {
|
||||
++A().p
|
||||
if (c != 1) {
|
||||
return false;
|
||||
}
|
||||
--A().p
|
||||
if (c != 2) {
|
||||
return false;
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
fun main(args : Array<String>) {
|
||||
println(box())
|
||||
}
|
||||
Reference in New Issue
Block a user