The following runs fine in the WebDemo, but failed with command line compiler
fun main(args : Array<String>) {
for (n in arrayList(1,2,3))
println(n)
}
ERROR: /Users/zemian/apps/kotlinc/./Test.kt: (2, 12) None of the hasNext() functions is applicable for iterator() of type 'jet.MutableIterator<jet.Int>?'
ERROR: /Users/zemian/apps/kotlinc/./Test.kt: (2, 12) None of the next() functions is applicable for iterator() of type 'jet.MutableIterator<jet.Int>?'
WARNING: /Users/zemian/apps/kotlinc/./Test.kt: (4, 28) Unnecessary safe call on a non-null receiver of type java.util.ArrayList<jet.Int>
exec() finished with COMPILATION_ERROR return code
What happened here?
I am using Kotlin Compiler version 0.4.68
Zemian