Iterate Intention: Fix detection of extension iterators

#KT-8616 Fixed
This commit is contained in:
Alexey Sedunov
2015-12-17 20:55:55 +03:00
parent ee9389d089
commit 1c74bab1cc
14 changed files with 99 additions and 16 deletions
@@ -0,0 +1,8 @@
// WITH_RUNTIME
class T<U>
operator fun <U> T<U>.iterator(): Iterator<U> = listOf<U>().iterator()
fun test() {
T<Int>()<caret>
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
class T<U>
operator fun <U> T<U>.iterator(): Iterator<U> = listOf<U>().iterator()
fun test() {
for (i in T<Int>()) {
<caret>
}
}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
class T<U, V>
operator fun <X> T<X, String>.iterator(): Iterator<X> = listOf<X>().iterator()
fun test() {
T<Int, String>()<caret>
}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
class T<U, V>
operator fun <X> T<X, String>.iterator(): Iterator<X> = listOf<X>().iterator()
fun test() {
for (i in T<Int, String>()) {
<caret>
}
}
@@ -0,0 +1,9 @@
// WITH_RUNTIME
// IS_APPLICABLE: false
class T<U, V>
operator fun <X> T<X, String>.iterator(): Iterator<X> = listOf<X>().iterator()
fun test() {
T<Int, Boolean>()<caret>
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun test() {
mapOf(1 to "1", 2 to "2")<caret>
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun test() {
for (entry in mapOf(1 to "1", 2 to "2")) {
<caret>
}
}