Inline val: more correct and simple detection of write usages

#KT-17489 Fixed
This commit is contained in:
Valentin Kipyatkov
2017-05-22 19:21:44 +03:00
parent 55979aca74
commit 940ce27925
8 changed files with 69 additions and 34 deletions
@@ -0,0 +1,4 @@
fun foo(list: MutableList<Int>) {
val <caret>list1 = list
list1 += 10
}
@@ -0,0 +1,3 @@
fun foo(list: MutableList<Int>) {
list += 10
}
@@ -0,0 +1,10 @@
class Predicate(val x: Int) {
operator fun plusAssign(y: Int) {}
operator fun unaryMinus() = Predicate(-x)
}
fun test(p: Predicate) {
val <caret>x = -p
x += 42
}
@@ -0,0 +1,9 @@
class Predicate(val x: Int) {
operator fun plusAssign(y: Int) {}
operator fun unaryMinus() = Predicate(-x)
}
fun test(p: Predicate) {
-p += 42
}