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

#KT-12582 Fixed
This commit is contained in:
Mikhael Bogdanov
2016-06-02 11:21:30 +03:00
parent e7f9d3417f
commit a6cf169646
5 changed files with 98 additions and 21 deletions
@@ -0,0 +1,12 @@
fun box(): String {
var result = 0
val intRange: IntProgression = 1..3
for (i: Int? in intRange) {
result = sum(result, i)
}
return if (result == 6) "OK" else "fail: $result"
}
fun sum(i: Int, z: Int?): Int {
return i + z!!
}