Report resolution ambiguity on '+=' by taking into account full resolution result including post type checking for '+'

^KT-45503 Fixed
This commit is contained in:
Victor Petukhov
2021-03-26 20:25:01 +03:00
parent 1da35029a6
commit 5d78b0a962
42 changed files with 279 additions and 354 deletions
@@ -1,7 +0,0 @@
// "Change 'list' to val" "true"
// WITH_RUNTIME
fun test() {
var list = ArrayList<Int>()
list <caret>-= 2
}
@@ -1,7 +0,0 @@
// "Change 'list' to val" "true"
// WITH_RUNTIME
fun test() {
val list = ArrayList<Int>()
list <caret>-= 2
}
@@ -1,14 +0,0 @@
// "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>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
}
}
@@ -1,7 +0,0 @@
// "Change 'set' to val" "true"
// WITH_RUNTIME
fun test() {
var set = HashMap<Int, Int>()
set <caret>+= 2 to 2
}
@@ -1,7 +0,0 @@
// "Change 'set' to val" "true"
// WITH_RUNTIME
fun test() {
val set = HashMap<Int, Int>()
set <caret>+= 2 to 2
}
@@ -1,7 +0,0 @@
// "Change 'set' to val" "true"
// WITH_RUNTIME
fun test() {
var set = HashSet<Int>()
set <caret>-= 2
}
@@ -1,7 +0,0 @@
// "Change 'set' to val" "true"
// WITH_RUNTIME
fun test() {
val set = HashSet<Int>()
set <caret>-= 2
}
@@ -1,7 +0,0 @@
// "Change 'list' to val" "true"
// WITH_RUNTIME
fun test() {
var list = mutableListOf(1)
list <caret>+= 2
}
@@ -1,7 +0,0 @@
// "Change 'list' to val" "true"
// WITH_RUNTIME
fun test() {
val list = mutableListOf(1)
list <caret>+= 2
}
@@ -1,7 +0,0 @@
// "Change 'map' to val" "true"
// WITH_RUNTIME
fun test() {
var map = mutableMapOf(1 to 1)
map <caret>+= 2 to 2
}
@@ -1,7 +0,0 @@
// "Change 'map' to val" "true"
// WITH_RUNTIME
fun test() {
val map = mutableMapOf(1 to 1)
map <caret>+= 2 to 2
}
@@ -1,7 +0,0 @@
// "Change 'set' to val" "true"
// WITH_RUNTIME
fun test() {
var set = mutableSetOf(1)
set <caret>+= 2
}
@@ -1,7 +0,0 @@
// "Change 'set' to val" "true"
// WITH_RUNTIME
fun test() {
val set = mutableSetOf(1)
set <caret>+= 2
}
@@ -1,7 +0,0 @@
// "Replace with 'minusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var list = ArrayList<Int>()
list <caret>-= 2
}
@@ -1,7 +0,0 @@
// "Replace with 'minusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var list = ArrayList<Int>()
list.minusAssign(2)<caret>
}
@@ -1,7 +0,0 @@
// "Replace with 'plusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var set = HashMap<Int, Int>()
set <caret>+= 2 to 2
}
@@ -1,7 +0,0 @@
// "Replace with 'plusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var set = HashMap<Int, Int>()
set.plusAssign(2 to 2)
}
@@ -1,7 +0,0 @@
// "Replace with 'minusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var set = HashSet<Int>()
set <caret>-= 2
}
@@ -1,7 +0,0 @@
// "Replace with 'minusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var set = HashSet<Int>()
set.minusAssign(2)<caret>
}
@@ -1,7 +0,0 @@
// "Replace with 'plusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var list = mutableListOf(1)
list <caret>+= 2
}
@@ -1,7 +0,0 @@
// "Replace with 'plusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var list = mutableListOf(1)
list.plusAssign(2)<caret>
}
@@ -1,7 +0,0 @@
// "Replace with 'plusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var map = mutableMapOf(1 to 1)
map <caret>+= 2 to 2
}
@@ -1,7 +0,0 @@
// "Replace with 'plusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var map = mutableMapOf(1 to 1)
map.plusAssign(2 to 2)<caret>
}
@@ -1,7 +0,0 @@
// "Replace with 'plusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var set = mutableSetOf(1)
set <caret>+= 2
}
@@ -1,7 +0,0 @@
// "Replace with 'plusAssign()' call" "true"
// WITH_RUNTIME
fun test() {
var set = mutableSetOf(1)
set.plusAssign(2)<caret>
}