Files
kotlin-fork/compiler/testData/diagnostics/tests/callableReference/bound/controlFlow.kt
T

25 lines
537 B
Kotlin
Vendored

// !DIAGNOSTICS: +UNUSED_EXPRESSION
fun unusedExpression(s: String) {
<!UNUSED_EXPRESSION!>s::hashCode<!>
<!UNUSED_EXPRESSION!>s::class<!>
}
fun noUnusedParameter(s: String): Int {
val f = s::hashCode
return f()
}
fun unreachableCode(): Int {
(if (true) return 1 else return 0)<!UNREACHABLE_CODE!>::toString<!>
<!UNREACHABLE_CODE!>return 0<!>
}
fun unreachableCodeInLoop(): Int {
while (true) {
(break)<!UNREACHABLE_CODE!>::toString<!>
<!UNREACHABLE_CODE!>return 1<!>
}
return 2
}