Java.io.File.forEachLine not working?

I get compile error with the following code for reading file?

``

package test
fun main(args : Array<String>) {
     val file = java.io.File(args[0])
     file.forEachLine{ line -> println(line) }
}
output>
ERROR: /Users/zemian/apps/kotlinc-0.4.177/src/Test.kt: (4, 7) Overload resolution ambiguity:
public final fun java.io.File.forEachLine(block : (jet.String) -> jet.Any) : Unit defined in kotlin.io
internal final fun java.io.File.forEachLine(charset : jet.String = …, closure : (jet.String) -> Unit) : Unit defined in kotlin.io

ERROR: /Users/zemian/apps/kotlinc-0.4.177/src/Test.kt: (4, 20) Cannot infer a type for this parameter. To specify it explicitly use the {(p : Type) => …} notation
exec() finished with COMPILATION_ERROR return code

It's a bug in the standard library, a wrokaround would be:

package test fun main(args : Array<String>) {   val file = java.io.File(args[0])   file.forEachLine("UTF-8") { line -> println(line) } }

The problem will be fixed in the next nightly build. Thanks for the report.

I've created a ticket to track this: http://youtrack.jetbrains.com/issue/KT-3101

Zemian, This should be already fixed -- please upgrade to the latest nightly build (http://teamcity.jetbrains.com)

Yes, I can verified that it's fixed in 0.4.249 now. Thanks Andrey.