diff --git a/compiler/testData/diagnostics/tests/extensions/GenericIterator.jet b/compiler/testData/diagnostics/tests/extensions/GenericIterator.jet new file mode 100644 index 00000000000..21d20539a15 --- /dev/null +++ b/compiler/testData/diagnostics/tests/extensions/GenericIterator.jet @@ -0,0 +1,27 @@ +import java.util.Enumeration + +fun a(e : java.util.Enumeration) { + for (i in e) { + i : Int + } +} + +fun T?.iterator() = object { + var hasNext = this@iterator != null + private set + + fun next() : T { + if (hasNext) { + hasNext = false + return this@iterator.sure() + } + throw java.util.NoSuchElementException() + } +} + +fun main(args : Array) { + val i : Int? = 1 + for (x in i) { + println(x) + } +} \ No newline at end of file