Mark only unreachable parts of element if it has reachable parts

like for 'return todo()' mark only 'return'
This commit is contained in:
Svetlana Isakova
2014-06-11 19:35:00 +04:00
parent 88ecc5cc59
commit 79cec6411d
38 changed files with 597 additions and 84 deletions
@@ -0,0 +1,39 @@
fun testBinary1() {
fun Int.times(<!UNUSED_PARAMETER!>s<!>: String) {}
todo() <!UNREACHABLE_CODE!>* ""<!>
}
fun testBinary2() {
"1" <!UNREACHABLE_CODE!>+<!> todo()
}
fun testElvis1() {
<!USELESS_ELVIS!>todo()<!> <!UNREACHABLE_CODE!>?: ""<!>
}
fun testElvis2(s: String?) {
s ?: todo()
bar()
}
fun testAnd1(b: Boolean) {
b && todo()
bar()
}
fun testAnd2(<!UNUSED_PARAMETER!>b<!>: Boolean) {
todo() <!UNREACHABLE_CODE!>&& b<!>
}
fun returnInBinary1(): Boolean {
(return true) <!UNREACHABLE_CODE!>&& (return false)<!>
}
fun returnInBinary2(): Boolean {
(return true) <!UNREACHABLE_CODE!>|| (return false)<!>
}
fun todo() = throw Exception()
fun bar() {}