Adjust testData to new labels syntax
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
fun box(): String {
|
||||
var s1 = (@l1 "s")
|
||||
val s2 = (@l2 if (@l3 true) s1 else null)
|
||||
var s1 = (l1@ "s")
|
||||
val s2 = (l2@ if (l3@ true) s1 else null)
|
||||
return if (s2 == "s") "OK" else "fail"
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
fun box(): String {
|
||||
val a = 1
|
||||
val explicitlyReturned = run1 @f{
|
||||
val explicitlyReturned = run1 f@{
|
||||
if (a > 0)
|
||||
return@f "OK"
|
||||
else "Fail 1"
|
||||
}
|
||||
if (explicitlyReturned != "OK") return explicitlyReturned
|
||||
|
||||
val implicitlyReturned = run1 @f{
|
||||
val implicitlyReturned = run1 f@{
|
||||
if (a < 0)
|
||||
return@f "Fail 2"
|
||||
else "OK"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
fun for_int_range(): Int {
|
||||
var c = 0
|
||||
@loop for (i in 1..10) {
|
||||
if (c >= 5) continue @loop
|
||||
loop@ for (i in 1..10) {
|
||||
if (c >= 5) continue@loop
|
||||
c++
|
||||
}
|
||||
return c
|
||||
@@ -11,8 +11,8 @@ fun for_byte_range(): Int {
|
||||
var c = 0
|
||||
val from: Byte = 1
|
||||
val to: Byte = 10
|
||||
@loop for (i in from..to) {
|
||||
if (c >= 5) continue @loop
|
||||
loop@ for (i in from..to) {
|
||||
if (c >= 5) continue@loop
|
||||
c++
|
||||
}
|
||||
return c
|
||||
@@ -22,8 +22,8 @@ fun for_long_range(): Int {
|
||||
var c = 0
|
||||
val from: Long = 1
|
||||
val to: Long = 10
|
||||
@loop for (i in from..to) {
|
||||
if (c >= 5) continue @loop
|
||||
loop@ for (i in from..to) {
|
||||
if (c >= 5) continue@loop
|
||||
c++
|
||||
}
|
||||
return c
|
||||
@@ -34,8 +34,8 @@ fun for_int_list(): Int {
|
||||
a.add(0); a.add(0); a.add(0); a.add(0); a.add(0)
|
||||
a.add(0); a.add(0); a.add(0); a.add(0); a.add(0)
|
||||
var c = 0
|
||||
@loop for (i in a) {
|
||||
if (c >= 5) continue @loop
|
||||
loop@ for (i in a) {
|
||||
if (c >= 5) continue@loop
|
||||
c++
|
||||
}
|
||||
return c
|
||||
@@ -46,8 +46,8 @@ fun for_byte_list(): Int {
|
||||
a.add(0); a.add(0); a.add(0); a.add(0); a.add(0)
|
||||
a.add(0); a.add(0); a.add(0); a.add(0); a.add(0)
|
||||
var c = 0
|
||||
@loop for (i in a) {
|
||||
if (c >= 5) continue @loop
|
||||
loop@ for (i in a) {
|
||||
if (c >= 5) continue@loop
|
||||
c++
|
||||
}
|
||||
return c
|
||||
@@ -58,8 +58,8 @@ fun for_long_list(): Int {
|
||||
a.add(0); a.add(0); a.add(0); a.add(0); a.add(0)
|
||||
a.add(0); a.add(0); a.add(0); a.add(0); a.add(0)
|
||||
var c = 0
|
||||
@loop for (i in a) {
|
||||
if (c >= 5) continue @loop
|
||||
loop@ for (i in a) {
|
||||
if (c >= 5) continue@loop
|
||||
c++
|
||||
}
|
||||
return c
|
||||
@@ -70,8 +70,8 @@ fun for_double_list(): Int {
|
||||
a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0)
|
||||
a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0)
|
||||
var c = 0
|
||||
@loop for (i in a) {
|
||||
if (c >= 5) continue @loop
|
||||
loop@ for (i in a) {
|
||||
if (c >= 5) continue@loop
|
||||
c++
|
||||
}
|
||||
return c
|
||||
@@ -82,8 +82,8 @@ fun for_object_list(): Int {
|
||||
a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0)
|
||||
a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0); a.add(0.0)
|
||||
var c = 0
|
||||
@loop for (i in a) {
|
||||
if (c >= 5) continue @loop
|
||||
loop@ for (i in a) {
|
||||
if (c >= 5) continue@loop
|
||||
c++
|
||||
}
|
||||
return c
|
||||
@@ -92,8 +92,8 @@ fun for_object_list(): Int {
|
||||
fun for_str_array(): Int {
|
||||
val a = arrayOfNulls<String>(10)
|
||||
var c = 0
|
||||
@loop for (i in a) {
|
||||
if (c >= 5) continue @loop
|
||||
loop@ for (i in a) {
|
||||
if (c >= 5) continue@loop
|
||||
c++
|
||||
}
|
||||
return c
|
||||
@@ -102,8 +102,8 @@ fun for_str_array(): Int {
|
||||
fun for_intarray(): Int {
|
||||
val a = IntArray(10)
|
||||
var c = 0
|
||||
@loop for (i in a) {
|
||||
if (c >= 5) continue @loop
|
||||
loop@ for (i in a) {
|
||||
if (c >= 5) continue@loop
|
||||
c++
|
||||
}
|
||||
return c
|
||||
|
||||
@@ -22,10 +22,10 @@ fun box() : String {
|
||||
if (1.a() != 2) return "test 8 failed"
|
||||
val b = ( fun Int.() = this + 1)
|
||||
if (1.b() != 2) return "test 9 failed"
|
||||
val c = (@c fun Int.() = this + 1)
|
||||
val c = (c@ fun Int.() = this + 1)
|
||||
if (1.c() != 2) return "test 10 failed"
|
||||
|
||||
val d = @d fun (): Int { return@d 4}
|
||||
val d = d@ fun (): Int { return@d 4}
|
||||
if (d() != 4) return "test 11 failed"
|
||||
|
||||
return "OK"
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ fun box() : String {
|
||||
if (1.a() != 2) return "test 8 failed"
|
||||
val b = ( fun Int.name() = this + 1)
|
||||
if (1.b() != 2) return "test 9 failed"
|
||||
val c = (@c fun Int.name() = this + 1)
|
||||
val c = (c@ fun Int.name() = this + 1)
|
||||
if (1.c() != 2) return "test 10 failed"
|
||||
|
||||
val d = fun name(): Int { return@name 4}
|
||||
|
||||
@@ -3,8 +3,8 @@ fun simple() = fun (): Boolean { return true }
|
||||
fun simpleNamed() = fun name(): Boolean { return true }
|
||||
fun simpleNamed2() = fun name(): Boolean { return@name true }
|
||||
|
||||
fun withLabel() = @l fun (): Boolean { return@l true }
|
||||
fun withLabelNamed() = @l fun name(): Boolean { return@l true }
|
||||
fun withLabel() = l@ fun (): Boolean { return@l true }
|
||||
fun withLabelNamed() = l@ fun name(): Boolean { return@l true }
|
||||
|
||||
fun box(): String {
|
||||
if (!simple()()) return "Test simple failed"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
fun box(): String {
|
||||
var x = 1
|
||||
(@foo x)++
|
||||
++(@foo x)
|
||||
(foo@ x)++
|
||||
++(foo@ x)
|
||||
(x: Int)++
|
||||
++(x: Int)
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ data class A(val a: Int, val b: Int)
|
||||
|
||||
fun box() : String
|
||||
{
|
||||
@a val x = 1
|
||||
@b fun a() = 2
|
||||
@c val (z, z2) = A(1, 2)
|
||||
a@ val x = 1
|
||||
b@ fun a() = 2
|
||||
c@ val (z, z2) = A(1, 2)
|
||||
|
||||
if (x != 1) return "fail 1"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user