Adjust testData to new labels syntax
This commit is contained in:
@@ -4,9 +4,9 @@ val a1 = arrayOfNulls<Int>(0)
|
||||
|
||||
fun box(): Boolean {
|
||||
var bar = 33
|
||||
@outer for (a in array(1, 2)) {
|
||||
outer@ for (a in array(1, 2)) {
|
||||
for (b in array(1, 4)) {
|
||||
break @outer
|
||||
break@outer
|
||||
}
|
||||
bar = 42
|
||||
}
|
||||
|
||||
@@ -12,23 +12,23 @@ fun up(s: String, value: Int): Int {
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@list
|
||||
list@
|
||||
for (i in 0..up("A", 5)) {
|
||||
continue @list
|
||||
continue@list
|
||||
}
|
||||
assertEquals("A", global)
|
||||
|
||||
global = ""
|
||||
@list1
|
||||
list1@
|
||||
for (i in up("A", 0)..try { global += "B"; 5} finally {}) {
|
||||
continue @list1
|
||||
continue@list1
|
||||
}
|
||||
assertEquals("AB", global)
|
||||
|
||||
global = ""
|
||||
@list2
|
||||
list2@
|
||||
for (i in try { up("A", 0) } finally {}..try { global += "B"; 5} finally {}) {
|
||||
continue @list2
|
||||
continue@list2
|
||||
}
|
||||
assertEquals("AB", global)
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ package foo
|
||||
|
||||
fun box(): String {
|
||||
var n = 0
|
||||
@forLabel0 for(i in 0..10) {
|
||||
forLabel0@ for(i in 0..10) {
|
||||
var j = 0
|
||||
@whileLabel0 while(j++<i) {
|
||||
whileLabel0@ while(j++<i) {
|
||||
n++;
|
||||
if (j==2)
|
||||
continue@forLabel0
|
||||
@@ -13,9 +13,9 @@ fun box(): String {
|
||||
assertEquals(19, n)
|
||||
|
||||
n = 0
|
||||
@forLabel1 for(i in 0..10) {
|
||||
forLabel1@ for(i in 0..10) {
|
||||
var j = 0
|
||||
@whileLabel1 while(try {j++} finally {} <i) {
|
||||
whileLabel1@ while(try {j++} finally {} <i) {
|
||||
n++;
|
||||
if (j==2)
|
||||
continue@forLabel1
|
||||
@@ -24,9 +24,9 @@ fun box(): String {
|
||||
assertEquals(19, n)
|
||||
|
||||
n = 0
|
||||
@forLabel2 for(i in 0..10) {
|
||||
forLabel2@ for(i in 0..10) {
|
||||
var j = 0
|
||||
@whileLabel2 while(j++<i) {
|
||||
whileLabel2@ while(j++<i) {
|
||||
n++;
|
||||
if (j==2)
|
||||
break@forLabel2
|
||||
@@ -35,9 +35,9 @@ fun box(): String {
|
||||
assertEquals(3, n)
|
||||
|
||||
n = 0
|
||||
@forLabel3 for(i in 0..10) {
|
||||
forLabel3@ for(i in 0..10) {
|
||||
var j = 0
|
||||
@whileLabel3 while(j++<i) {
|
||||
whileLabel3@ while(j++<i) {
|
||||
n++;
|
||||
if (j==2)
|
||||
break@whileLabel3
|
||||
|
||||
@@ -4,7 +4,7 @@ package foo
|
||||
fun box(): Boolean {
|
||||
var result = false
|
||||
var i = 1
|
||||
@loop while(i==1)
|
||||
loop@ while(i==1)
|
||||
when (i) {
|
||||
1 -> { result = true; break@loop }
|
||||
else -> result = false
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ fun box(): String {
|
||||
|
||||
i = 0
|
||||
global = ""
|
||||
@labelA do {
|
||||
labelA@ do {
|
||||
if (i<3) {i++; continue@labelA}
|
||||
break
|
||||
} while(try { global += "A"; i } finally {} < 10)
|
||||
@@ -27,7 +27,7 @@ fun box(): String {
|
||||
i = 0
|
||||
var j = 0
|
||||
global = ""
|
||||
@outer do {
|
||||
outer@ do {
|
||||
j = 0
|
||||
while( try {global += "B"; j++ } finally {} < 2) {
|
||||
if (j==1) continue@outer
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@ fun box(): String {
|
||||
|
||||
i = 0
|
||||
global = ""
|
||||
@labelA while(try { global += "A"; i } finally {} < 10) {
|
||||
labelA@ while(try { global += "A"; i } finally {} < 10) {
|
||||
if (i<3) {i++; continue@labelA}
|
||||
break
|
||||
}
|
||||
@@ -27,7 +27,7 @@ fun box(): String {
|
||||
i = 0
|
||||
var j = 0
|
||||
global = ""
|
||||
@outer while(try { global += "A"; i++ } finally {} < 3) {
|
||||
outer@ while(try { global += "A"; i++ } finally {} < 3) {
|
||||
j = 0
|
||||
while( try {global += "B"; j++ } finally {} < 2) {
|
||||
if (j==1) continue@outer
|
||||
|
||||
@@ -10,7 +10,7 @@ fun box(): String {
|
||||
val skipOuter = 8
|
||||
|
||||
|
||||
@block for (i in range) {
|
||||
block@ for (i in range) {
|
||||
sum += i
|
||||
|
||||
if (i == skipOuter) break@block
|
||||
|
||||
@@ -8,24 +8,24 @@ package foo
|
||||
fun myRun<R>(f: () -> R) = f()
|
||||
|
||||
fun test0() {
|
||||
val a = @aa 1
|
||||
val a = aa@ 1
|
||||
|
||||
assertEquals(1, a)
|
||||
assertEquals(3, @l1 a + @l2 2)
|
||||
assertEquals(3, l1@ a + l2@ 2)
|
||||
|
||||
val b = @bb if (true) @t "then block" else @e "else block"
|
||||
val b = bb@ if (true) t@ "then block" else e@ "else block"
|
||||
|
||||
assertEquals("then block", b)
|
||||
}
|
||||
|
||||
fun test1() {
|
||||
run @label {
|
||||
run label@ {
|
||||
return@label false
|
||||
}
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
myRun @label {
|
||||
myRun label@ {
|
||||
return@label false
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ fun test2() {
|
||||
// KT-7487
|
||||
public fun test3() {
|
||||
val f = Foo()
|
||||
f.iter @label {
|
||||
f.iter label@ {
|
||||
return@label false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ package foo
|
||||
fun test1() {
|
||||
var `loop$` = 0
|
||||
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
`loop$` = i
|
||||
if (i == 5) break@loop
|
||||
}
|
||||
@@ -17,7 +17,7 @@ fun test1() {
|
||||
fun test2() {
|
||||
var loop = 0
|
||||
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
loop = i
|
||||
if (i == 5) break@loop
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ fun test() {
|
||||
var i = 0
|
||||
var j = 0
|
||||
|
||||
@loop for (k in 1..10) {
|
||||
@loop for (m in 1..10) {
|
||||
if (m == 4) break @loop
|
||||
loop@ for (k in 1..10) {
|
||||
loop@ for (m in 1..10) {
|
||||
if (m == 4) break@loop
|
||||
j = m
|
||||
}
|
||||
|
||||
if (k == 8) break @loop
|
||||
if (k == 8) break@loop
|
||||
i = k
|
||||
}
|
||||
|
||||
|
||||
@@ -10,21 +10,21 @@ class State() {
|
||||
}
|
||||
|
||||
inline fun test1(state: State) {
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
state.value++
|
||||
if (i == 2) break@loop
|
||||
}
|
||||
}
|
||||
|
||||
inline fun test2(state: State) {
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
test1(state)
|
||||
if (i == 2) break@loop
|
||||
}
|
||||
}
|
||||
|
||||
inline fun test3(state: State) {
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
test2(state)
|
||||
if (i == 2) break@loop
|
||||
}
|
||||
|
||||
+3
-3
@@ -12,19 +12,19 @@ noinline fun test(state: State) {
|
||||
[inline] fun test3() {
|
||||
[inline] fun test2() {
|
||||
[inline] fun test1() {
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
state.value++
|
||||
if (i == 2) break@loop
|
||||
}
|
||||
}
|
||||
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
test1()
|
||||
if (i == 2) break@loop
|
||||
}
|
||||
}
|
||||
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
test2()
|
||||
if (i == 2) break@loop
|
||||
}
|
||||
|
||||
@@ -6,13 +6,13 @@ fun test() {
|
||||
var i = 0
|
||||
var j = 0
|
||||
|
||||
@loop for (m in 1..10) {
|
||||
if (m == 4) break @loop
|
||||
loop@ for (m in 1..10) {
|
||||
if (m == 4) break@loop
|
||||
j = m
|
||||
}
|
||||
|
||||
@loop for (k in 1..10) {
|
||||
if (k == 4) break @loop
|
||||
loop@ for (k in 1..10) {
|
||||
if (k == 4) break@loop
|
||||
i = k
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ package foo
|
||||
inline fun testInline(): Int {
|
||||
var c = 0
|
||||
|
||||
@loop for (i in 1..9) {
|
||||
loop@ for (i in 1..9) {
|
||||
c++
|
||||
if (c == 2) break@loop
|
||||
}
|
||||
|
||||
|
||||
@loop for (j in 1..9) {
|
||||
loop@ for (j in 1..9) {
|
||||
c++
|
||||
if (c == 4) break@loop
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ package foo
|
||||
inline fun testLabelInline(): Int {
|
||||
var a = 0
|
||||
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
if (i == 1) continue@loop
|
||||
|
||||
a += i
|
||||
@@ -15,7 +15,7 @@ inline fun testLabelInline(): Int {
|
||||
if (i == 2) break@loop
|
||||
}
|
||||
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
if (i == 1) continue@loop
|
||||
|
||||
a += i
|
||||
@@ -29,7 +29,7 @@ inline fun testLabelInline(): Int {
|
||||
fun testLabel(): String {
|
||||
var a = 0
|
||||
|
||||
@loop for (i in 1..10) {
|
||||
loop@ for (i in 1..10) {
|
||||
if (i == 1) continue@loop
|
||||
|
||||
a += testLabelInline()
|
||||
|
||||
@@ -6,8 +6,8 @@ package foo
|
||||
fun testBreak() {
|
||||
var i = 0
|
||||
|
||||
@loop for (j in 1..10) {
|
||||
if (j == 5) break @loop
|
||||
loop@ for (j in 1..10) {
|
||||
if (j == 5) break@loop
|
||||
|
||||
i = j
|
||||
}
|
||||
@@ -18,8 +18,8 @@ fun testBreak() {
|
||||
fun testContinue() {
|
||||
var sum = 0
|
||||
|
||||
@loop for (j in 1..5) {
|
||||
if (j % 2 != 0) continue @loop
|
||||
loop@ for (j in 1..5) {
|
||||
if (j % 2 != 0) continue@loop
|
||||
|
||||
sum += j
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ package foo
|
||||
inline fun testBreak(): Int {
|
||||
var i = 0
|
||||
|
||||
@loop for (j in 1..10) {
|
||||
if (j == 5) break @loop
|
||||
loop@ for (j in 1..10) {
|
||||
if (j == 5) break@loop
|
||||
|
||||
i = j
|
||||
}
|
||||
@@ -24,8 +24,8 @@ noinline fun testBreakNoinline() {
|
||||
inline fun testContinue(): Int {
|
||||
var sum = 0
|
||||
|
||||
@loop for (j in 1..5) {
|
||||
if (j % 2 != 0) continue @loop
|
||||
loop@ for (j in 1..5) {
|
||||
if (j % 2 != 0) continue@loop
|
||||
|
||||
sum += j
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class TraitImpl : Trait {
|
||||
|
||||
class TestDelegate : Trait by TraitImpl() {
|
||||
fun test() {
|
||||
testRenamed("debugger", { @debugger while (false) {} })
|
||||
testRenamed("debugger", { debugger@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class TraitImpl : Trait {
|
||||
|
||||
class TestDelegate : Trait by TraitImpl() {
|
||||
fun test() {
|
||||
testRenamed("default", { @default while (false) {} })
|
||||
testRenamed("default", { default@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class TraitImpl : Trait {
|
||||
|
||||
class TestDelegate : Trait by TraitImpl() {
|
||||
fun test() {
|
||||
testRenamed("var", { @`var` while (false) {} })
|
||||
testRenamed("var", { `var`@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class TraitImpl : Trait {
|
||||
|
||||
class TestDelegate : Trait by TraitImpl() {
|
||||
fun test() {
|
||||
testRenamed("while", { @`while` while (false) {} })
|
||||
testRenamed("while", { `while`@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ enum class Foo {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("import", { @import while (false) {} })
|
||||
testRenamed("import", { import@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ enum class Foo {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("in", { @`in` while (false) {} })
|
||||
testRenamed("in", { `in`@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ enum class Foo {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("instanceof", { @instanceof while (false) {} })
|
||||
testRenamed("instanceof", { instanceof@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ enum class Foo {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("null", { @`null` while (false) {} })
|
||||
testRenamed("null", { `null`@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class TestClass {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("break", { @`break` while (false) {} })
|
||||
testRenamed("break", { `break`@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class TestClass {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("case", { @case while (false) {} })
|
||||
testRenamed("case", { case@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class TestClass {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("catch", { @catch while (false) {} })
|
||||
testRenamed("catch", { catch@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class TestClass {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("class", { @`class` while (false) {} })
|
||||
testRenamed("class", { `class`@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ class TestClass {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("finally", { @finally while (false) {} })
|
||||
testRenamed("finally", { finally@ while (false) {} })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class TestClass {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("function", { @function while (false) {} })
|
||||
testRenamed("function", { function@ while (false) {} })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class TestClass {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("package", { @`package` while (false) {} })
|
||||
testRenamed("package", { `package`@ while (false) {} })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class TestClass {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("return", { @`return` while (false) {} })
|
||||
testRenamed("return", { `return`@ while (false) {} })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ object TestObject {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("class", { @`class` while (false) {} })
|
||||
testRenamed("class", { `class`@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ object TestObject {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("continue", { @`continue` while (false) {} })
|
||||
testRenamed("continue", { `continue`@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ object TestObject {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("public", { @public while (false) {} })
|
||||
testRenamed("public", { public@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ object TestObject {
|
||||
val t: Int = 0
|
||||
|
||||
fun test() {
|
||||
testRenamed("static", { @static while (false) {} })
|
||||
testRenamed("static", { static@ while (false) {} })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ package foo
|
||||
fun box(): String {
|
||||
val t: Int = 0
|
||||
|
||||
testRenamed("if", { @`if` while (false) {} })
|
||||
testRenamed("if", { `if`@ while (false) {} })
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -5,7 +5,7 @@ package foo
|
||||
fun box(): String {
|
||||
val t: Int = 0
|
||||
|
||||
testRenamed("in", { @`in` while (false) {} })
|
||||
testRenamed("in", { `in`@ while (false) {} })
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -5,7 +5,7 @@ package foo
|
||||
fun box(): String {
|
||||
val t: Int = 0
|
||||
|
||||
testRenamed("static", { @static while (false) {} })
|
||||
testRenamed("static", { static@ while (false) {} })
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -5,7 +5,7 @@ package foo
|
||||
fun box(): String {
|
||||
val t: Int = 0
|
||||
|
||||
testRenamed("switch", { @switch while (false) {} })
|
||||
testRenamed("switch", { switch@ while (false) {} })
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -5,7 +5,7 @@ package foo
|
||||
val t: Int = 0
|
||||
|
||||
fun box(): String {
|
||||
testRenamed("debugger", { @debugger while (false) {} })
|
||||
testRenamed("debugger", { debugger@ while (false) {} })
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -5,7 +5,7 @@ package foo
|
||||
val t: Int = 0
|
||||
|
||||
fun box(): String {
|
||||
testRenamed("default", { @default while (false) {} })
|
||||
testRenamed("default", { default@ while (false) {} })
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -5,7 +5,7 @@ package foo
|
||||
val t: Int = 0
|
||||
|
||||
fun box(): String {
|
||||
testRenamed("in", { @`in` while (false) {} })
|
||||
testRenamed("in", { `in`@ while (false) {} })
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -5,7 +5,7 @@ package foo
|
||||
val t: Int = 0
|
||||
|
||||
fun box(): String {
|
||||
testRenamed("null", { @`null` while (false) {} })
|
||||
testRenamed("null", { `null`@ while (false) {} })
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -241,7 +241,7 @@ class CanvasState(val canvas: HTMLCanvasElement) {
|
||||
}
|
||||
|
||||
jq(canvas).dblclick {
|
||||
val newCreature = Creature(mousePos(it), this @CanvasState)
|
||||
val newCreature = Creature(mousePos(it), this@CanvasState)
|
||||
addShape(newCreature)
|
||||
valid = false
|
||||
}
|
||||
|
||||
@@ -381,7 +381,7 @@ class CanvasState(val canvas: HTMLCanvasElement) {
|
||||
init {
|
||||
jq(canvas).click {
|
||||
val mousePos = mousePos(it)
|
||||
@shapeLoop for (shape in shapes) {
|
||||
shapeLoop@ for (shape in shapes) {
|
||||
if (shape is Button && mousePos in shape) {
|
||||
val name = shape.src
|
||||
shape.mouseClick()
|
||||
|
||||
Reference in New Issue
Block a user