Files
kotlin/compiler/testData/codegen/box/objects/compoundAssignmentToExtensionPropertyImportedFromObject.kt
Dmitry Petrov 70d3e6592d Unwrap object member imported by name before determining receivers
Existing code for receiver generation accidentally worked in most cases
for object members imported by name. However, it generated strange
bytecode (such as
    GETFIELD AnObject.INSTANCE
    GETFIELD AnObject.INSTANCE
    POP
), and worked incorrectly for augmented assignments.

 #KT-21343 Fixed Target versions 1.2.20
2017-11-27 17:15:16 +03:00

24 lines
321 B
Kotlin
Vendored

import Host.x
object A {
var xx = 0
}
object Host {
var A.x
get() = A.xx
set(v) { A.xx = v }
}
fun box(): String {
A.x += 1
if (A.x != 1) return "Fail 1: ${A.x}"
A.x++
if (A.x != 2) return "Fail 2: ${A.x}"
++A.x
if (A.x != 3) return "Fail 3: ${A.x}"
return "OK"
}