mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 08:31:29 +00:00
26 lines
580 B
Kotlin
Vendored
26 lines
580 B
Kotlin
Vendored
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// TARGET_BACKEND: JVM
|
|
// FULL_JDK
|
|
// WITH_RUNTIME
|
|
|
|
val xsl = arrayListOf("a", "b", "c", "d")
|
|
val xs = xsl.asSequence()
|
|
|
|
fun box(): String {
|
|
val s = StringBuilder()
|
|
|
|
var cmeThrown = false
|
|
try {
|
|
for ((index, x) in xs.withIndex()) {
|
|
s.append("$index:$x;")
|
|
xsl.clear()
|
|
}
|
|
} catch (e: java.util.ConcurrentModificationException) {
|
|
cmeThrown = true
|
|
}
|
|
|
|
if (!cmeThrown) return "Fail: CME should be thrown"
|
|
|
|
val ss = s.toString()
|
|
return if (ss == "0:a;") "OK" else "fail: '$ss'"
|
|
} |