Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/deadCode/deadCodeInBinaryExpressions.kt
T
2015-09-25 19:20:20 +03:00

39 lines
707 B
Kotlin
Vendored

fun testBinary1() {
operator fun Int.times(<!UNUSED_PARAMETER!>s<!>: String) {}
todo() <!UNREACHABLE_CODE!>* ""<!>
}
fun testBinary2() {
"1" <!UNREACHABLE_CODE!>+<!> todo()
}
fun testElvis1() {
todo() <!USELESS_ELVIS, 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() {}