KT-609 Analyze not only local variables, but function parameters as well in 'unused values' analysis

This commit is contained in:
svtk
2011-11-29 19:04:15 +04:00
parent f5667874b0
commit ba49f508c9
89 changed files with 412 additions and 322 deletions
@@ -7,6 +7,6 @@ val b : Foo = Foo()
val a1 = b.compareTo(2)
class Foo() {
fun compareTo(other : Byte) : Int = 0
fun compareTo(other : Char) : Int = 0
fun compareTo(<warning>other</warning> : Byte) : Int = 0
fun compareTo(<warning>other</warning> : Char) : Int = 0
}
@@ -1,4 +1,4 @@
fun foo(u : Unit) : Int = 1
fun foo(<warning>u</warning> : Unit) : Int = 1
fun test() : Int {
foo(<error>1</error>)
+2 -2
View File
@@ -1,8 +1,8 @@
fun foo1() : fun (Int) : Int = { (x: Int) => x }
fun foo() {
val <warning>h</warning> : fun (Int) : Int = foo1();
val h : fun (Int) : Int = foo1();
h(1)
val <warning>m</warning> : fun (Int) : Int = {(a : Int) => 1}//foo1()
val m : fun (Int) : Int = {(a : Int) => 1}//foo1()
m(1)
}
+1 -1
View File
@@ -1,4 +1,4 @@
fun set(key : String, value : String) {
fun set(<warning>key</warning> : String, <warning>value</warning> : String) {
val a : String? = ""
when (a) {
"" => a<error>.</error>get(0)
+1 -1
View File
@@ -1,6 +1,6 @@
class Command() {}
fun parse(cmd: String): Command? { return null }
fun parse(<warning>cmd</warning>: String): Command? { return null }
fun Any.equals(other : Any?) : Boolean = this === other
@@ -8,7 +8,7 @@
}
this(var bar : Int) : this(1, 1, 1) {
bar = 1
bar = <warning>1</warning>
this.bar
1 : Int
val <warning>a</warning> : Int =1
@@ -1,4 +1,4 @@
fun Any.equals(other : Any?) : Boolean = true
fun Any.equals(<warning>other</warning> : Any?) : Boolean = true
fun main(args: Array<String>) {
@@ -1,8 +1,8 @@
open class Foo {}
open class Bar {}
fun <T : Bar, T1> foo(x : Int) {}
fun <T1, T : Foo> foo(x : Long) {}
fun <T : Bar, T1> foo(<warning>x</warning> : Int) {}
fun <T1, T : Foo> foo(<warning>x</warning> : Long) {}
fun f(): Unit {
foo<<error>Int</error>, Int>(1)