Couldn't find a separate bug report thread, so it's going in the main discussion.
The following
fun main(args: Array<String>) {
val items = listOf(1, 2, 3, 4, 5)
var i = 0
do {
val k = items[i++]
println(k)
} while (k != 4)
}
``
13:15:07 Throwable
Kotlin: [Internal Error] org.jetbrains.jet.codegen.CompilationException: Back-end (JVM) Internal error: don’t know how to generate reference val k : jet.Int defined in main[LocalVariableDescriptor@720c1f32]
Cause: don’t know how to generate reference val k : jet.Int defined in main[LocalVariableDescriptor@720c1f32]
File being compiled and position: (7,14) in C:UsersTomDropboxProjectsArmilsrcTest.kt
The root cause was thrown at: ExpressionCodegen.java:1510
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:250)
at org.jetbrains.jet.codegen.ExpressionCodegen.genQualified(ExpressionCodegen.java:222)
at org.jetbrains.jet.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:256)
… rest is cut …
Probably a problem with the scope in the do-while, since this works fine:
``
fun main(args: Array<String>) {
val items = listOf(1, 2, 3, 4, 5)
var i = 0
while (true) {
val k = items[i++]
println(k)
if (k == 4) break
}
}