// !WITH_NEW_INFERENCE // See also KT-7428 class Container(val k: K) // iterator() must be an extension, otherwise code will not compile operator fun Container.iterator(): Iterator = null!! fun test() { val container: Container? = null // Error container.iterator() // for extension iterator, this code compiles, but should not for (s in container) {} } class OtherContainer(val k: K) { operator fun iterator(): Iterator = null!! } fun test2() { val other: OtherContainer? = null // Error for (s in other) {} }