Fix captured range bounds in launched for-loops

This commit is contained in:
sergeych committed 2026-04-09 17:05:00 +03:00
1 parent fbb1683ba3
commit 840cd32574
3 files changed
+47 -31

No files matched your search

@@ -199,6 +199,25 @@ class TestCoroutines {
)
}
@Test
fun testLaunchCanUseCapturedRangeBoundInForLoop() = runTest {
eval(
"""
val count = 8
val outer = launch {
val jobs = []
for( i in 0..<count ) {
val x = i
jobs += launch { x }
}
jobs.joinAll()
}
assertEquals([0,1,2,3,4,5,6,7], outer.await())
""".trimIndent()
)
}
@Test
fun testFlows() = runTest {
eval("""