fix for KT-245

This commit is contained in:
Alex Tkachman
2011-08-31 13:00:03 +02:00
parent bda26a18ff
commit d6a9e89175
4 changed files with 44 additions and 8 deletions
@@ -0,0 +1,32 @@
fun foo() {
val l = java.util.ArrayList<Int>(2)
l.add(1)
for (el in l) {}
//verify error "Expecting to find integer on stack"
val iterator = l.iterator()
//another verify error "Mismatched stack types"
while (iterator?.hasNext() ?: false) {
val i = iterator?.next()
}
//the same
if (iterator != null) {
while (iterator.hasNext()) {
val i = iterator?.next()
}
}
//this way it works
if (iterator != null) {
while (iterator.hasNext()) {
iterator.next() //because of the bug KT-244 i can't write "val i = iterator.next()"
}
}
}
fun box() : String {
return "OK"
}