Using the latest Kotlin 1.3.10 plugin from the latest IntelliJ IDEA 2018.3, if I translate the following Java code to Kotlin:
BufferedReader br = Files.newBufferedReader(Paths.get("filename"));
String line;
while ((line = br.readLine()) != null)
System.out.println(line);
I get this:
val br = Files.newBufferedReader(Paths.get("filename"))
var line: String
while ((line = br.readLine()) != null)
println(line)
The while ((line = br.nextLine()) != null) is idiomatic Java, but its automatic translation results in illegal syntax because assignments in Kotlin are not expressions.
Is this a known bug in the Java-to-Kotlin translator?
What's the Kotlin idiomatic syntax equivalent to the above Java code?