Uast: KT-40578: resolve Kotlin property writes to setters (#3597)

* KT-40578: resolve Kotlin property writes to setters

* limit to non-constructor properties

* Uast: `KotlinIDERenderLogTest.testConstructors` fix

Co-authored-by: Nicolay Mitropolsky <nicolay.mitropolsky@jetbrains.com>
This commit is contained in:
Kevin Bierhoff
2020-07-28 00:03:22 -07:00
committed by GitHub
parent 5851a7dea0
commit fa8c6e7fb6
12 changed files with 187 additions and 13 deletions
+30
View File
@@ -0,0 +1,30 @@
class A(init: Int) {
private var privateProp = 0 // accesses should be field accesses
var mutableProp: Int
init {
mutableProp = init
}
fun add(x: Int): Int {
val result = privateProp
privateProp = x
return privateProp
}
}
fun properties() {
val a = A(17)
val x = -a.mutableProp
a.mutableProp = 1
a.mutableProp += x
++a.mutableProp
a.mutableProp--
}
fun A.ext() {
val x = -mutableProp
mutableProp = 1
mutableProp += x
++mutableProp
mutableProp--
}