Files
kotlin-fork/compiler/testData/diagnostics/tests/controlStructures/valVarLoopParameter.kt
T
Denis Zharkov 4c69416f2b Report warning on unused entities that can be renamed to _
Currently it's all about lambda parameters/destructuring entries

 #KT-14347 In Progress
2016-10-24 10:19:25 +03:00

33 lines
629 B
Kotlin
Vendored

class Pair {
operator fun component1(): Int = null!!
operator fun component2(): Int = null!!
}
class Coll {
operator fun iterator(): It = It()
}
class It {
operator fun next() = Pair()
operator fun hasNext() = false
}
fun f() {
for (<!VAL_OR_VAR_ON_LOOP_PARAMETER!>val<!> i in 1..4) {
}
for (<!VAL_OR_VAR_ON_LOOP_PARAMETER!>var<!> i in 1..4) {
}
for (<!VAL_OR_VAR_ON_LOOP_PARAMETER!>val<!> (<!UNUSED_VARIABLE!>i<!>,<!UNUSED_VARIABLE!>j<!>) in Coll()) {
}
for (<!VAL_OR_VAR_ON_LOOP_PARAMETER!>var<!> (<!UNUSED_VARIABLE!>i<!>,<!UNUSED_VARIABLE!>j<!>) in Coll()) {
}
}