Fix for KT-11762: "VerifyError: Bad local variable type" caused by explicit loop variable type

#KT-11762 Fixed
This commit is contained in:
Michael Bogdanov
2016-04-04 16:21:06 +03:00
parent f2237f675d
commit dec53c8d6c
4 changed files with 41 additions and 4 deletions
@@ -0,0 +1,11 @@
// WITH_RUNTIME
val alist = arrayListOf(1, 2, 3) // : j.u.ArrayList<k.Int>
fun box(): String {
var result = 0
for (i: Int in alist) {
result += i
}
return if (result == 6) "OK" else "fail: $result"
}
@@ -0,0 +1,12 @@
// WITH_RUNTIME
val alist = arrayListOf(1 to 2, 2 to 3, 3 to 4)
fun box(): String {
var result = 0
for ((i: Int, z: Int) in alist) {
result += i + z
}
return if (result == 15) "OK" else "fail: $result"
}