blob: beada243c12d7d66232f6018838a192e6a539efa [file] [log] [blame]
import java.util.*;
fun <T> checkSubtype(t: T) = t
class NotRange1() {
}
abstract class NotRange2() {
abstract operator fun iterator() : Unit
}
abstract class ImproperIterator1 {
abstract operator fun hasNext() : Boolean
}
abstract class NotRange3() {
abstract operator fun iterator() : ImproperIterator1
}
abstract class ImproperIterator2 {
abstract operator fun next() : Boolean
}
abstract class NotRange4() {
abstract operator fun iterator() : ImproperIterator2
}
abstract class ImproperIterator3 {
abstract operator fun hasNext() : Int
abstract operator fun next() : Int
}
abstract class NotRange5() {
abstract operator fun iterator() : ImproperIterator3
}
abstract class AmbiguousHasNextIterator {
abstract operator fun hasNext() : Boolean
val hasNext : Boolean get() = false
abstract operator fun next() : Int
}
abstract class NotRange6() {
abstract operator fun iterator() : AmbiguousHasNextIterator
}
abstract class ImproperIterator4 {
val hasNext : Int get() = 1
abstract operator fun next() : Int
}
abstract class NotRange7() {
abstract operator fun iterator() : ImproperIterator3
}
abstract class GoodIterator {
abstract operator fun hasNext() : Boolean
abstract operator fun next() : Int
}
abstract class Range0() {
abstract operator fun iterator() : GoodIterator
}
abstract class Range1() {
abstract operator fun iterator() : Iterator<Int>
}
fun test(notRange1: NotRange1, notRange2: NotRange2, notRange3: NotRange3, notRange4: NotRange4, notRange5: NotRange5, notRange6: NotRange6, notRange7: NotRange7, range0: Range0, range1: Range1) {
for (i in <error descr="[ITERATOR_MISSING] ">notRange1</error>);
for (i in <error descr="[HAS_NEXT_MISSING] "><error descr="[NEXT_MISSING] ">notRange2</error></error>);
for (i in <error descr="[NEXT_MISSING] ">notRange3</error>);
for (i in <error descr="[HAS_NEXT_MISSING] ">notRange4</error>);
<error descr="[CONDITION_TYPE_MISMATCH] Condition type mismatch: inferred type is kotlin/Int but Boolean was expected">for (i in notRange5)</error>;
for (i in notRange6);
<error descr="[CONDITION_TYPE_MISMATCH] Condition type mismatch: inferred type is kotlin/Int but Boolean was expected">for (i in notRange7)</error>;
for (i in range0);
for (i in range1);
for (i in (checkSubtype<List<Int>>(ArrayList<Int>())));
}