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
This commit is contained in:
Dmitry Petrov
2017-11-24 12:48:55 +03:00
parent 7bee2ceac7
commit 70d3e6592d
9 changed files with 199 additions and 12 deletions
@@ -0,0 +1,24 @@
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"
}