KT-1273 Unused assignment - should highlight assignment instead of expression

#KT-1273 Fixed
This commit is contained in:
Valentin Kipyatkov
2015-05-16 17:31:56 +03:00
parent 189286efee
commit 7edff172a2
26 changed files with 79 additions and 69 deletions
@@ -2,14 +2,14 @@ package unused_variables
fun testSimpleCases() {
var i = <!VARIABLE_WITH_REDUNDANT_INITIALIZER!>2<!>
i = <!UNUSED_VALUE!>34<!>
<!UNUSED_VALUE!>i =<!> 34
i = 34
doSmth(i)
i = <!UNUSED_VALUE!>5<!>
<!UNUSED_VALUE!>i =<!> 5
var j = 2
j = <!UNUSED_CHANGED_VALUE!>j++<!>
j = <!UNUSED_VALUE, UNUSED_CHANGED_VALUE!>j--<!>
<!UNUSED_VALUE!>j =<!> <!UNUSED_CHANGED_VALUE!>j--<!>
}
class IncDec() {
@@ -27,14 +27,14 @@ class MyTest() {
x = <!UNUSED_CHANGED_VALUE!>x++<!>
x = <!UNUSED_CHANGED_VALUE!>x--<!>
x = ++x
x = <!UNUSED_VALUE!>--x<!>
<!UNUSED_VALUE!>x =<!> --x
}
var a: String = "s"
set(v: String) {
var i: Int = 23
doSmth(i)
i = <!UNUSED_VALUE!>34<!>
<!UNUSED_VALUE!>i =<!> 34
$a = v
}
@@ -46,8 +46,8 @@ class MyTest() {
a = "rro"
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>i<!> = 1;
i = <!UNUSED_VALUE!>34<!>;
i = <!UNUSED_VALUE!>456<!>;
<!UNUSED_VALUE!>i =<!> 34;
<!UNUSED_VALUE!>i =<!> 456;
}
fun testWhile() {
@@ -57,7 +57,7 @@ class MyTest() {
a = null
}
while (b != null) {
a = <!UNUSED_VALUE!>null<!>
<!UNUSED_VALUE!>a =<!> null
}
}
@@ -73,10 +73,10 @@ class MyTest() {
doSmth(a)
if (1 < 2) {
a = <!UNUSED_VALUE!>23<!>
<!UNUSED_VALUE!>a =<!> 23
}
else {
a = <!UNUSED_VALUE!>"ss"<!>
<!UNUSED_VALUE!>a =<!> "ss"
}
}