KT-42909 fix missing loop variable in 'withIndex' ranges

This commit is contained in:
Dmitry Petrov
2020-11-23 10:46:42 +03:00
parent a9c9406a55
commit bf7fdcda6e
10 changed files with 59 additions and 6 deletions
@@ -0,0 +1,16 @@
// WITH_RUNTIME
// KJS_WITH_FULL_RUNTIME
fun box(): String {
var r = test()
if (r != "01") throw AssertionError(r.toString())
return "OK"
}
private fun test(): String {
var r = ""
for ((i, _) in (1..'c' - 'a').withIndex()) {
r += i.toString()
}
return r
}