KT-4820: Intention to introduce an index variable to a for loop over an ordered collection via "withIndices()."

This commit is contained in:
Ross Hanson
2014-04-11 13:07:26 -04:00
parent 399c9c1175
commit 97010c7d7f
17 changed files with 199 additions and 1 deletions
@@ -0,0 +1,7 @@
//IS_APPLICABLE: FALSE
//ERROR: Unresolved reference: withIndices
fun b(c: List<String>) {
for ((<caret>indexVariable, d) in c.withIndices()) {
}
}
@@ -0,0 +1,7 @@
// IS_APPLICABLE: FALSE
// ERROR: For-loop range must have an iterator() method
fun foo(bar: Map<String, String>) {
for (a <caret>in bar) {
}
}
@@ -0,0 +1,7 @@
// ERROR: Unresolved reference: listOf
fun a() {
val b = listOf(1,2,3,4,5)
for (<caret>c : Int in b) {
}
}
@@ -0,0 +1,7 @@
// ERROR: Unresolved reference: listOf
fun a() {
val b = listOf(1,2,3,4,5)
for ((index, c : Int) in b.withIndices()) {
}
}
@@ -0,0 +1,7 @@
// ERROR: Unresolved reference: listOf
fun a() {
val b = listOf(1,2,3,4,5)
for (<caret>c in b) {
}
}
@@ -0,0 +1,7 @@
// ERROR: Unresolved reference: listOf
fun a() {
val b = listOf(1,2,3,4,5)
for ((index, c) in b.withIndices()) {
}
}
@@ -0,0 +1,6 @@
//ERROR: Unresolved reference: SortedMap
fun a(b: SortedMap<Int, String>) {
for (<caret>c in b) {
}
}
@@ -0,0 +1,6 @@
//ERROR: Unresolved reference: SortedMap
fun a(b: SortedMap<Int, String>) {
for ((index, c) in b.withIndices()) {
}
}