Add quickfix for ASSIGN_OPERATOR_AMBIGUITY on mutable collection '+=', '-='
KT-26236 Fixed
This commit is contained in:
committed by
Natalia Selezneva
parent
725cb88f41
commit
b0c3461eab
@@ -0,0 +1,7 @@
|
||||
// "Change 'list' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
var list = ArrayList<Int>()
|
||||
list <caret>-= 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Change 'list' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
val list = ArrayList<Int>()
|
||||
list <caret>-= 2
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// "Change 'list' to val" "false"
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with 'plusAssign()' call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// ERROR: Assignment operators ambiguity: <br>public operator fun <T> Collection<Int>.plus(element: Int): List<Int> defined in kotlin.collections<br>@InlineOnly public inline operator fun <T> MutableCollection<in Int>.plusAssign(element: Int): Unit defined in kotlin.collections
|
||||
// WITH_RUNTIME
|
||||
|
||||
class Test {
|
||||
var list = mutableListOf(1)
|
||||
|
||||
fun test() {
|
||||
list <caret>+= 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Change 'set' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
var set = HashMap<Int, Int>()
|
||||
set <caret>+= 2 to 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Change 'set' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
val set = HashMap<Int, Int>()
|
||||
set <caret>+= 2 to 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Change 'set' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
var set = HashSet<Int>()
|
||||
set <caret>-= 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Change 'set' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
val set = HashSet<Int>()
|
||||
set <caret>-= 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Change 'list' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
var list = mutableListOf(1)
|
||||
list <caret>+= 2
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Change 'list' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
val list = mutableListOf(1)
|
||||
list <caret>+= 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Change 'map' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
var map = mutableMapOf(1 to 1)
|
||||
map <caret>+= 2 to 2
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Change 'map' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
val map = mutableMapOf(1 to 1)
|
||||
map <caret>+= 2 to 2
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Change 'set' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
var set = mutableSetOf(1)
|
||||
set <caret>+= 2
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Change 'set' to val" "true"
|
||||
// WITH_RUNTIME
|
||||
|
||||
fun test() {
|
||||
val set = mutableSetOf(1)
|
||||
set <caret>+= 2
|
||||
}
|
||||
Reference in New Issue
Block a user