Inline val: more correct and simple detection of write usages
#KT-17489 Fixed
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
fun foo(list: MutableList<Int>) {
|
||||
val <caret>list1 = list
|
||||
list1 += 10
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
fun foo(list: MutableList<Int>) {
|
||||
list += 10
|
||||
}
|
||||
+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
|
||||
}
|
||||
+9
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user