Control-Flow Analysis: Reuse pseudo-value information for unused expression analysis

This commit is contained in:
Alexey Sedunov
2014-07-25 14:52:15 +04:00
parent 2a19016d58
commit 9cbcabffa4
55 changed files with 239 additions and 190 deletions
@@ -5,7 +5,7 @@ package kt1075
fun foo(b: String) {
if (<!TYPE_MISMATCH!>b<!> in 1..10) {} //type mismatch
when (b) {
<!TYPE_MISMATCH_IN_RANGE!>in<!> 1..10 -> 1 //no type mismatch, but it should be here
else -> 2
<!TYPE_MISMATCH_IN_RANGE!>in<!> 1..10 -> <!UNUSED_EXPRESSION!>1<!> //no type mismatch, but it should be here
else -> <!UNUSED_EXPRESSION!>2<!>
}
}
}
@@ -15,7 +15,7 @@ fun foo() : Int {
fun fff(): Int {
var d = 3
when(d) {
4 -> 21
4 -> <!UNUSED_EXPRESSION!>21<!>
return 2 -> <!UNREACHABLE_CODE!>return 47<!>
<!UNREACHABLE_CODE!>bar() -> 45<!>
<!UNREACHABLE_CODE!>444 -> true<!>
@@ -21,7 +21,7 @@ fun test1(t : Pair<Int, Int>) : Int {
}
//more tests
fun t1(x: Int) = when(x) {
fun t1(x: Int) = when(<!UNUSED_EXPRESSION!>x<!>) {
else -> 1
}