Replace with ordinary assignment: do not suggest when operator is augmented assignment operator function

#KT-34715 Fixed
This commit is contained in:
Toshiaki Kameyama
2019-11-27 10:46:43 +09:00
committed by Yan Zhulanow
parent 55d55446c8
commit 73e319ca7a
9 changed files with 65 additions and 7 deletions
@@ -0,0 +1,7 @@
// IS_APPLICABLE: false
operator fun Int.minusAssign(element: Int) {}
fun test() {
val x = 1
x <caret>-= 9
}
@@ -0,0 +1,6 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun main() {
val mutableList = mutableListOf(4, 5, 6, 7, 8)
mutableList <caret>+= 9
}
@@ -0,0 +1,7 @@
// IS_APPLICABLE: false
operator fun Int.plusAssign(element: Int) {}
fun test() {
val x = 1
x <caret>+= 9
}
@@ -0,0 +1,8 @@
class Foo {
var x: Int = 1
}
fun main() {
val foo = Foo()
foo.x <caret>+= 1
}
@@ -0,0 +1,8 @@
class Foo {
var x: Int = 1
}
fun main() {
val foo = Foo()
foo.x = foo.x + 1
}