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
@@ -23,40 +23,40 @@ val x : Any? = 1
fun Any?.vars(<!UNUSED_PARAMETER!>a<!>: Any?) : Int {
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>b<!>: Int = 0
if (ns.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>ns.y<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>ns.y<!>
}
if (ns.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>example.ns.y<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>example.ns.y<!>
}
if (example.ns.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>ns.y<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>ns.y<!>
}
if (example.ns.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>example.ns.y<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>example.ns.y<!>
}
// if (package.bottles.ns.y is Int) {
// b = ns.y
// }
if (Obj.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>Obj.y<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>Obj.y<!>
}
if (example.Obj.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>Obj.y<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>Obj.y<!>
}
if (AClass.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>AClass.y<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>AClass.y<!>
}
if (example.AClass.y is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>AClass.y<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>AClass.y<!>
}
if (x is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>x<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>x<!>
}
if (example.x is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>x<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>x<!>
}
if (example.x is Int) {
b = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>example.x<!>
<!UNUSED_VALUE!>b =<!> <!DEBUG_INFO_SMARTCAST!>example.x<!>
}
return 1
}
@@ -80,16 +80,16 @@ open class C {
fun foo() {
var <!ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE!>t<!> : T? = null
if (this is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this<!>
<!UNUSED_VALUE!>t =<!> <!DEBUG_INFO_SMARTCAST!>this<!>
}
if (this is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this@C<!>
<!UNUSED_VALUE!>t =<!> <!DEBUG_INFO_SMARTCAST!>this@C<!>
}
if (this@C is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this<!>
<!UNUSED_VALUE!>t =<!> <!DEBUG_INFO_SMARTCAST!>this<!>
}
if (this@C is T) {
t = <!UNUSED_VALUE, DEBUG_INFO_SMARTCAST!>this@C<!>
<!UNUSED_VALUE!>t =<!> <!DEBUG_INFO_SMARTCAST!>this@C<!>
}
}
}