Files
kotlin-fork/compiler/testData/diagnostics/tests/UnusedInDestructuring.kt
T

12 lines
331 B
Kotlin
Vendored

// !DIAGNOSTICS: +UNUSED_VARIABLE
data class D(val x: Int, val y: Int, val z: Int)
fun foo(): Int {
val (<!UNUSED_VARIABLE!>x<!>, y, z) = D(1, 2, 3)
return y + z // x is not used, but we cannot do anything with it
}
fun bar(): Int {
val (x, y, <!UNUSED_VARIABLE!>z<!>) = D(1, 2, 3)
return y + x // z is not used
}