KT-6476 Kotlin J2K converter fails with for-loops with continues
#KT-6476 Fixed
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
public class TestClass {
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
if (i == 4 || i == 8) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
System.err.println(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
public class TestClass {
|
||||
companion object {
|
||||
public fun main(args: Array<String>) {
|
||||
run {
|
||||
var i = 0
|
||||
while (i < 10) {
|
||||
if (i == 4 || i == 8) {
|
||||
i++
|
||||
++i
|
||||
continue
|
||||
}
|
||||
System.err.println(i)
|
||||
++i
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) = TestClass.main(args)
|
||||
@@ -0,0 +1,11 @@
|
||||
public class TestClass {
|
||||
public static void main(String[] args) {
|
||||
for (int i = 0, j = 1; i < 10; ++i, j *= 2) {
|
||||
if (i == 4 || i == 8) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
System.err.println(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
public class TestClass {
|
||||
companion object {
|
||||
public fun main(args: Array<String>) {
|
||||
run {
|
||||
var i = 0
|
||||
var j = 1
|
||||
while (i < 10) {
|
||||
if (i == 4 || i == 8) {
|
||||
i++
|
||||
++i
|
||||
j *= 2
|
||||
continue
|
||||
}
|
||||
System.err.println(j)
|
||||
++i
|
||||
j *= 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) = TestClass.main(args)
|
||||
@@ -0,0 +1,8 @@
|
||||
public class TestClass {
|
||||
public static void main(String[] args) {
|
||||
for (int i = 1; i < 1000; i *= 2) {
|
||||
if (i == 4 || i == 8) continue;
|
||||
System.err.println(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
public class TestClass {
|
||||
companion object {
|
||||
public fun main(args: Array<String>) {
|
||||
run {
|
||||
var i = 1
|
||||
while (i < 1000) {
|
||||
if (i == 4 || i == 8) {
|
||||
i *= 2
|
||||
continue
|
||||
}
|
||||
System.err.println(i)
|
||||
i *= 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) = TestClass.main(args)
|
||||
@@ -0,0 +1,15 @@
|
||||
public class TestClass {
|
||||
public static void main(String[] args) {
|
||||
OuterLoop1:
|
||||
OuterLoop2:
|
||||
for (int i = 1; i < 1000; i *= 2) {
|
||||
InnerLoop:
|
||||
for (int j = 1; j < 100; j *= 3) {
|
||||
if (j == 3) continue InnerLoop;
|
||||
if (i == j) continue OuterLoop1;
|
||||
System.err.println(j);
|
||||
if (j == 9) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// ERROR: The label '@OuterLoop1' does not denote a loop
|
||||
public class TestClass {
|
||||
companion object {
|
||||
public fun main(args: Array<String>) {
|
||||
run {
|
||||
var i = 1
|
||||
@OuterLoop1 @OuterLoop2 while (i < 1000) {
|
||||
run {
|
||||
var j = 1
|
||||
@InnerLoop while (j < 100) {
|
||||
if (j == 3) {
|
||||
j *= 3
|
||||
continue@InnerLoop
|
||||
}
|
||||
if (i == j) {
|
||||
i *= 2
|
||||
continue@OuterLoop1
|
||||
}
|
||||
System.err.println(j)
|
||||
if (j == 9) {
|
||||
j *= 3
|
||||
continue
|
||||
}
|
||||
j *= 3
|
||||
}
|
||||
}
|
||||
i *= 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) = TestClass.main(args)
|
||||
Reference in New Issue
Block a user