// "Create member function 'next'" "true" class FooIterator { operator fun hasNext(): Boolean { return false } operator fun next(): T { throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates. } } class Foo { operator fun iterator(): FooIterator { throw Exception("not implemented") } } fun foo() { for (i: Int in Foo()) { } }