mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-17 15:54:03 +00:00
"Unused expression" should be reported on unused double colon expressions, this is postponed #KT-12551 Open
24 lines
455 B
Kotlin
Vendored
24 lines
455 B
Kotlin
Vendored
fun unusedExpression(s: String) {
|
|
// TODO: report UNUSED_EXPRESSION (KT-12551)
|
|
s::hashCode
|
|
s::class
|
|
}
|
|
|
|
fun noUnusedParameter(s: String): Int {
|
|
val f = s::hashCode
|
|
return f()
|
|
}
|
|
|
|
fun unreachableCode(): Int {
|
|
(if (true) return 1 else return 0)::toString
|
|
<!UNREACHABLE_CODE!>return 0<!>
|
|
}
|
|
|
|
fun unreachableCodeInLoop(): Int {
|
|
while (true) {
|
|
(break)::toString
|
|
<!UNREACHABLE_CODE!>return 1<!>
|
|
}
|
|
return 2
|
|
}
|