title: Kotlin: For-loop must have an iterator method - is this a bug?
body: <p>I have the following code:</p>
  
  <pre><code>public fun findSomeLikeThis(): ArrayList&lt;T&gt;? {
      val result = Db4o.objectContainer()!!.queryByExample&lt;T&gt;(this as T) as Collection&lt;T&gt;
      if (result == null) return null
      return ArrayList(result)
  }
  </code></pre>
  
  <p>If I call this like:</p>
  
  <pre><code>var list : ArrayList&lt;Person&gt;? = p1.findSomeLikeThis()
  
  for (p2 in list) {
      p2.delete()
      p2.commit()
  }
  </code></pre>
  
  <p>It would give me the error:</p>
  
  <blockquote>
    <p>For-loop range must have an 'iterator()' method</p>
  </blockquote>
  
  <p>Am I missing something here?</p>