Don't highlight "replace with +=" for read-only collections
Related to KT-20626
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// HIGHLIGHT: INFORMATION
|
||||
|
||||
fun foo() {
|
||||
var list = listOf(1, 2, 3)
|
||||
// Should not be highlighted because it's the way we use to say explicitly
|
||||
// "yes, we want to re-assign this immutable list"
|
||||
list <caret>= list + 4
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
// WITH_RUNTIME
|
||||
// HIGHLIGHT: INFORMATION
|
||||
|
||||
fun foo() {
|
||||
var list = listOf(1, 2, 3)
|
||||
// Should not be highlighted because it's the way we use to say explicitly
|
||||
// "yes, we want to re-assign this immutable list"
|
||||
list += 4
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// HIGHLIGHT: GENERIC_ERROR_OR_WARNING
|
||||
|
||||
fun foo() {
|
||||
val list = mutableListOf(1, 2, 3)
|
||||
list <caret>= list + 4
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
// WITH_RUNTIME
|
||||
// HIGHLIGHT: GENERIC_ERROR_OR_WARNING
|
||||
|
||||
fun foo() {
|
||||
val list = mutableListOf(1, 2, 3)
|
||||
list += 4
|
||||
}
|
||||
Reference in New Issue
Block a user