Files
kotlin-fork/js/js.translator/testData/box/labels/siblingLabelsInlinedClashing.kt
T
2021-10-06 09:23:50 +00:00

52 lines
998 B
Kotlin
Vendored

// EXPECTED_REACHABLE_NODES: 1283
package foo
// CHECK_NOT_CALLED: testLabelInline
// CHECK_LABELS_COUNT: function=testLabel name=loop count=1
// CHECK_LABELS_COUNT: function=testLabel name=loop_0 count=2 TARGET_BACKENDS=JS
// CHECK_LABELS_COUNT: function=testLabel name=loop_0 count=1 IGNORED_BACKENDS=JS
// CHECK_LABELS_COUNT: function=testLabel name=loop_1 count=1 IGNORED_BACKENDS=JS
inline fun testLabelInline(): Int {
var a = 0
loop@ for (i in 1..10) {
if (i == 1) continue@loop
a += i
if (i == 2) break@loop
}
loop@ for (i in 1..10) {
if (i == 1) continue@loop
a += i
if (i == 2) break@loop
}
return a
}
fun testLabel(): String {
var a = 0
loop@ for (i in 1..10) {
if (i == 1) continue@loop
a += testLabelInline()
if (i == 2) break@loop
}
if (a != 4) return a.toString()
return "OK"
}
fun box(): String {
assertEquals("OK", testLabel())
return "OK"
}