Files
kotlin-fork/compiler/testData/codegen/boxInline/property/augAssignmentAndIncOnExtension.kt
T
Ilya Chernikov 78ca733c38 FIR JS: add K2 variants of all other JS tests
except tests that are not possible to add without some modifications in
the test infra. See todos on the commented-out test declarations
2022-11-12 16:28:24 +01:00

31 lines
560 B
Kotlin
Vendored

// IGNORE_BACKEND_K2: JVM_IR, JS_IR
// IGNORE_BACKEND_K2_MULTI_MODULE: JVM_IR JVM_IR_SERIALIZE
// FILE: 1.kt
package test
var result = 1
inline var Int.z: Int
get() = result
set(value) {
result = value + this
}
// FILE: 2.kt
import test.*
fun box(): String {
1.z += 0
if (result != 2) return "fail 1: $result"
var p = 1.z++
if (result != 4) return "fail 2: $result"
if (p != 2) return "fail 3: $p"
p = ++1.z
if (result != 6) return "fail 4: $result"
if (p != 6) return "fail 5: $p"
return "OK"
}