Skip to content

Commit

Permalink
[IR] update testdata: support labels on loops, break & continue
Browse files Browse the repository at this point in the history
  • Loading branch information
bashor authored and teamcityserver committed Nov 25, 2020
1 parent 9daa86c commit 5c8a93c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ fun test1() {
}

fun test2() {
while (true) { // BLOCK
L1@ while (true) { // BLOCK
error("") /* ERROR EXPRESSION */
error("") /* ERROR EXPRESSION */
}
}

fun test3() {
while (true) { // BLOCK
L1@ while (true) { // BLOCK
val lambda: Function0<Nothing> = local fun <anonymous>(): Nothing {
error("") /* ERROR EXPRESSION */
error("") /* ERROR EXPRESSION */
Expand Down
36 changes: 18 additions & 18 deletions compiler/testData/ir/irText/expressions/breakContinue.kt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,34 @@ fun test1() {
}

fun test2() {
while (true) { // BLOCK
while (true) { // BLOCK
break
break
OUTER@ while (true) { // BLOCK
INNER@ while (true) { // BLOCK
break@INNER
break@OUTER
}
break
break@OUTER
}
while (true) { // BLOCK
while (true) { // BLOCK
continue
continue
OUTER@ while (true) { // BLOCK
INNER@ while (true) { // BLOCK
continue@INNER
continue@OUTER
}
continue
continue@OUTER
}
}

fun test3() {
while (true) { // BLOCK
while (true) { // BLOCK
break
L@ while (true) { // BLOCK
L@ while (true) { // BLOCK
break@L
}
break
break@L
}
while (true) { // BLOCK
while (true) { // BLOCK
continue
L@ while (true) { // BLOCK
L@ while (true) { // BLOCK
continue@L
}
continue
continue@L
}
}

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fun test1(c: Boolean?) {
while (true) { // BLOCK
while ({ // BLOCK
L@ while (true) { // BLOCK
L2@ while ({ // BLOCK
val tmp0_elvis_lhs: Boolean? = c
when {
EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> break
Expand All @@ -11,8 +11,8 @@ fun test1(c: Boolean?) {
}

fun test2(c: Boolean?) {
while (true) { // BLOCK
while ({ // BLOCK
L@ while (true) { // BLOCK
L2@ while ({ // BLOCK
val tmp0_elvis_lhs: Boolean? = c
when {
EQEQ(arg0 = tmp0_elvis_lhs, arg1 = null) -> continue
Expand All @@ -23,7 +23,7 @@ fun test2(c: Boolean?) {
}

fun test3(ss: List<String>?) {
while (true) { // BLOCK
L@ while (true) { // BLOCK
{ // BLOCK
val tmp1_iterator: Iterator<String> = { // BLOCK
val tmp0_elvis_lhs: List<String>? = ss
Expand All @@ -32,15 +32,15 @@ fun test3(ss: List<String>?) {
true -> tmp0_elvis_lhs
}
}.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK
L2@ while (tmp1_iterator.hasNext()) { // BLOCK
val s: String = tmp1_iterator.next()
}
}
}
}

fun test4(ss: List<String>?) {
while (true) { // BLOCK
L@ while (true) { // BLOCK
{ // BLOCK
val tmp1_iterator: Iterator<String> = { // BLOCK
val tmp0_elvis_lhs: List<String>? = ss
Expand All @@ -49,7 +49,7 @@ fun test4(ss: List<String>?) {
true -> tmp0_elvis_lhs
}
}.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK
L2@ while (tmp1_iterator.hasNext()) { // BLOCK
val s: String = tmp1_iterator.next()
}
}
Expand All @@ -58,14 +58,14 @@ fun test4(ss: List<String>?) {

fun test5() {
var i: Int = 0
while (true) { // BLOCK
Outer@ while (true) { // BLOCK
{ // BLOCK
i = i.inc()
i
} /*~> Unit */
var j: Int = 0
{ // BLOCK
do// COMPOSITE {
Inner@ do// COMPOSITE {
{ // BLOCK
j = j.inc()
j
Expand Down
20 changes: 10 additions & 10 deletions compiler/testData/ir/irText/expressions/forWithBreakContinue.kt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ fun testForBreak1(ss: List<String>) {
fun testForBreak2(ss: List<String>) {
{ // BLOCK
val tmp0_iterator: Iterator<String> = ss.iterator()
while (tmp0_iterator.hasNext()) { // BLOCK
OUTER@ while (tmp0_iterator.hasNext()) { // BLOCK
val s1: String = tmp0_iterator.next()
{ // BLOCK
{ // BLOCK
val tmp1_iterator: Iterator<String> = ss.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK
INNER@ while (tmp1_iterator.hasNext()) { // BLOCK
val s2: String = tmp1_iterator.next()
{ // BLOCK
break
break
break@OUTER
break@INNER
break
}
}
}
break
break@OUTER
}
}
}
Expand All @@ -48,21 +48,21 @@ fun testForContinue1(ss: List<String>) {
fun testForContinue2(ss: List<String>) {
{ // BLOCK
val tmp0_iterator: Iterator<String> = ss.iterator()
while (tmp0_iterator.hasNext()) { // BLOCK
OUTER@ while (tmp0_iterator.hasNext()) { // BLOCK
val s1: String = tmp0_iterator.next()
{ // BLOCK
{ // BLOCK
val tmp1_iterator: Iterator<String> = ss.iterator()
while (tmp1_iterator.hasNext()) { // BLOCK
INNER@ while (tmp1_iterator.hasNext()) { // BLOCK
val s2: String = tmp1_iterator.next()
{ // BLOCK
continue
continue
continue@OUTER
continue@INNER
continue
}
}
}
continue
continue@OUTER
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/testData/ir/irText/expressions/kt24804.kt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ inline fun foo(): Boolean {
fun run(x: Boolean, y: Boolean): String {
var z: Int = 10
{ // BLOCK
do// COMPOSITE {
l2@ do// COMPOSITE {
z = z.plus(other = 1)
when {
greater(arg0 = z, arg1 = 100) -> return "NOT_OK"
}
when {
x -> continue
x -> continue@l2
}
when {
y -> continue
y -> continue@l2
}
// } while (foo())
}
Expand Down

0 comments on commit 5c8a93c

Please sign in to comment.