Support increment and '*=' operations on inline properties
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
// FILE: 1.kt
|
||||
// IGNORE_BACKEND: JS
|
||||
package test
|
||||
|
||||
class A {
|
||||
var result = 1
|
||||
|
||||
inline var z: Int
|
||||
get() = result
|
||||
set(value) {
|
||||
result = value
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// FILE: 2.kt
|
||||
import test.*
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
a.z += 1
|
||||
if (a.z != 2) return "fail 1: $a.z"
|
||||
|
||||
var p = a.z++
|
||||
if (a.z != 3) return "fail 2: $a.z"
|
||||
if (p != 2) return "fail 3: $p"
|
||||
|
||||
p = ++a.z
|
||||
if (a.z != 4) return "fail 4: $a.z"
|
||||
if (p != 4) return "fail 5: $p"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user