Add "Suspicious collection reassignment" inspection #KT-20626 Fixed
This commit is contained in:
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var list: List<Int> = listOf(1)
|
||||
list +=<caret> 2
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
val list: MutableList<Int> = mutableListOf(1)<caret>
|
||||
list += 2
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var list = listOf<Int>(1)
|
||||
list +=<caret> 2
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
val list = mutableListOf<Int>(1)<caret>
|
||||
list += 2
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var list = listOf(1)
|
||||
list +=<caret> 2
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
val list = mutableListOf(1)<caret>
|
||||
list += 2
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var map = mapOf(1 to 2)
|
||||
map +=<caret> 3 to 4
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
val map = mutableMapOf(1 to 2)<caret>
|
||||
map += 3 to 4
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var set = setOf(1)
|
||||
set +=<caret> 1
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
val set = mutableSetOf(1)<caret>
|
||||
set += 1
|
||||
}
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// "Change type to mutable" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var list: List<Int>
|
||||
list = listOf(1)
|
||||
list +=<caret> 2
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Change type to mutable" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
class Test {
|
||||
var list = listOf(1)
|
||||
fun test() {
|
||||
list +=<caret> 2
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var list = foo()
|
||||
list -=<caret> 2
|
||||
}
|
||||
|
||||
fun foo() = listOf(1)
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
val list = foo().toMutableList()<caret>
|
||||
list -= 2
|
||||
}
|
||||
|
||||
fun foo() = listOf(1)
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(a: Any) {
|
||||
var list = a as List<Int>
|
||||
list -=<caret> 2
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(a: Any) {
|
||||
val list = (a as List<Int>).toMutableList()<caret>
|
||||
list -= 2
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun toMutableMap() {
|
||||
var map = foo()
|
||||
map -=<caret> 3
|
||||
}
|
||||
|
||||
fun foo() = mapOf(1 to 2)
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun toMutableMap() {
|
||||
val map = foo().toMutableMap()<caret>
|
||||
map -= 3
|
||||
}
|
||||
|
||||
fun foo() = mapOf(1 to 2)
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var set = foo()
|
||||
set -=<caret> 1
|
||||
}
|
||||
|
||||
fun foo() = setOf(1)
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Change type to mutable" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
val set = foo().toMutableSet()<caret>
|
||||
set -= 1
|
||||
}
|
||||
|
||||
fun foo() = setOf(1)
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Join with initializer" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list: List<Int>
|
||||
list = createList()
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun createList(): List<Int> = listOf(1, 2, 3)
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Join with initializer" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
class Test {
|
||||
var list = createList()
|
||||
|
||||
fun test(otherList: List<Int>) {
|
||||
// comment
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun createList(): List<Int> = listOf(1, 2, 3)
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Join with initializer" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = createList()
|
||||
// comment
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun createList(): List<Int> = listOf(1, 2, 3)
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Join with initializer" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = createList() + otherList<caret>
|
||||
// comment
|
||||
}
|
||||
|
||||
fun createList(): List<Int> = listOf(1, 2, 3)
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Join with initializer" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = createList()
|
||||
foo(list)
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun createList(): List<Int> = listOf(1, 2, 3)
|
||||
|
||||
fun foo(list: List<Int>) {}
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with assignment" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test(other: Set<Int>) {
|
||||
var list = emptyList<Int>()
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= other
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = emptyList<Int>()
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = emptyList<Int>()
|
||||
foo()
|
||||
bar()
|
||||
list = otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = listOf<Int>()
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = listOf<Int>()
|
||||
foo()
|
||||
bar()
|
||||
list = otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherMap: Map<Int, Int>) {
|
||||
var list = emptyMap<Int, Int>()
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= otherMap
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherMap: Map<Int, Int>) {
|
||||
var list = emptyMap<Int, Int>()
|
||||
foo()
|
||||
bar()
|
||||
list = otherMap
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherMap: Map<Int, Int>) {
|
||||
var list = mapOf<Int, Int>()
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= otherMap
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherMap: Map<Int, Int>) {
|
||||
var list = mapOf<Int, Int>()
|
||||
foo()
|
||||
bar()
|
||||
list = otherMap
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: Set<Int>) {
|
||||
var list = emptySet<Int>()
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: Set<Int>) {
|
||||
var list = emptySet<Int>()
|
||||
foo()
|
||||
bar()
|
||||
list = otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: Set<Int>) {
|
||||
var list = setOf<Int>()
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with assignment" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: Set<Int>) {
|
||||
var list = setOf<Int>()
|
||||
foo()
|
||||
bar()
|
||||
list = otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with assignment" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = listOf<Int>(1, 2, 3)
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with assignment" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test(otherMap: Map<Int, Int>) {
|
||||
var list = mapOf<Int, Int>(1 to 1, 2 to 2)
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= otherMap
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Replace with assignment" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with filter
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = emptyList<Int>()
|
||||
foo()
|
||||
bar()
|
||||
list <caret>-= otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with assignment" "false"
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list: List<Int>
|
||||
list = emptyList<Int>()
|
||||
list +=<caret> otherList
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with assignment" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = listOf(1, 2, 3)
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace with assignment" "false"
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
class Test {
|
||||
var list = emptyList<Int>()
|
||||
fun test(otherList: List<Int>) {
|
||||
list +=<caret> otherList
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with assignment" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: Set<Int>) {
|
||||
var list = setOf<Int>(1, 2, 3)
|
||||
foo()
|
||||
bar()
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun foo() {}
|
||||
fun bar() {}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with assignment" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test(otherList: List<Int>) {
|
||||
var list = listOf<Int>()
|
||||
foo(list)
|
||||
bar()
|
||||
list <caret>+= otherList
|
||||
}
|
||||
|
||||
fun foo(list: List<Int>) {}
|
||||
fun bar() {}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with filter" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Join with initializer
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var map = mapOf(1 to 10)
|
||||
map <caret>-= listOf(1)
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Replace with filter" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var list = listOf(1, 2, 3)
|
||||
list -=<caret> listOf(2)
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// "Replace with filter" "true"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var list = listOf(1, 2, 3)
|
||||
list = list.filter { it !in listOf(2) }
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with filter" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Join with initializer
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var list = listOf(1, 2, 3)
|
||||
list -=<caret> 2
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with filter" "false"
|
||||
// TOOL: org.jetbrains.kotlin.idea.inspections.SuspiciousCollectionReassignmentInspection
|
||||
// ACTION: Change type to mutable
|
||||
// ACTION: Join with initializer
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ACTION: Replace with ordinary assignment
|
||||
// WITH_RUNTIME
|
||||
fun test() {
|
||||
var list = listOf(1, 2, 3)
|
||||
list +=<caret> listOf (4)
|
||||
}
|
||||
Reference in New Issue
Block a user