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"
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import test.*
|
||||
|
||||
fun test1(b: Boolean): String {
|
||||
val localResult = doCall ((@local {
|
||||
val localResult = doCall ((local@ {
|
||||
if (b) {
|
||||
return@local "local"
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import test.*
|
||||
|
||||
fun test1(b: Boolean): String {
|
||||
val localResult = doCall @local {
|
||||
val localResult = doCall local@ {
|
||||
if (b) {
|
||||
return@local "local"
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import test.*
|
||||
|
||||
fun test1(b: Boolean): String {
|
||||
val localResult = doCall @local {
|
||||
val localResult = doCall local@ {
|
||||
if (b) {
|
||||
return@local "local"
|
||||
} else {
|
||||
|
||||
@@ -15,9 +15,9 @@ class Global(val value: String)
|
||||
|
||||
fun test1(intKind: Kind, extKind: Kind): Global {
|
||||
|
||||
var externalResult = doCall @ext {
|
||||
var externalResult = doCall ext@ {
|
||||
|
||||
val internalResult = doCall @int {
|
||||
val internalResult = doCall int@ {
|
||||
if (intKind == Kind.GLOBAL) {
|
||||
return@test1 Global("internal -> global")
|
||||
} else if (intKind == EXTERNAL) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import test.*
|
||||
|
||||
fun test1(b: Boolean): String {
|
||||
val localResult = noInlineCall @local {
|
||||
val localResult = noInlineCall local@ {
|
||||
if (b) {
|
||||
return@local 1
|
||||
} else {
|
||||
|
||||
@@ -4,12 +4,12 @@ fun test(): String = fun (): String {
|
||||
return "fail"
|
||||
} ()
|
||||
|
||||
fun test2(): String = (@l fun (): String {
|
||||
fun test2(): String = (l@ fun (): String {
|
||||
foo { return@l "OK" }
|
||||
return "fail"
|
||||
}) ()
|
||||
|
||||
fun test3(): String = (@l fun bar(): String {
|
||||
fun test3(): String = (l@ fun bar(): String {
|
||||
foo { return@bar "OK" }
|
||||
return "fail"
|
||||
}) ()
|
||||
|
||||
+2
-2
@@ -22,10 +22,10 @@ class Global(val value: String)
|
||||
fun test1(intKind: Kind, extKind: Kind, holder: Holder): Global {
|
||||
holder.value = ""
|
||||
try {
|
||||
var externalResult = doCall @ext {
|
||||
var externalResult = doCall ext@ {
|
||||
|
||||
try {
|
||||
val internalResult = doCall @int {
|
||||
val internalResult = doCall int@ {
|
||||
try {
|
||||
if (intKind == Kind.GLOBAL) {
|
||||
return@test1 Global("internal -> global")
|
||||
|
||||
+2
-2
@@ -22,10 +22,10 @@ class Global(val value: String)
|
||||
fun test1(intKind: Kind, extKind: Kind, holder: Holder): Global {
|
||||
holder.value = ""
|
||||
try {
|
||||
var externalResult = doCall (@ext {
|
||||
var externalResult = doCall (ext@ {
|
||||
|
||||
try {
|
||||
val internalResult = doCall (@int {
|
||||
val internalResult = doCall (int@ {
|
||||
try {
|
||||
if (intKind == Kind.GLOBAL) {
|
||||
return@test1 Global("internal -> global")
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ fun test1(h: Holder): String {
|
||||
|
||||
|
||||
fun test2(h: Holder): String {
|
||||
val localResult = doCall (@lambda {
|
||||
val localResult = doCall (lambda@ {
|
||||
h.value += "OK_LOCAL"
|
||||
return@lambda "OK_LOCAL"
|
||||
}, {
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ fun test1(h: Holder): String {
|
||||
|
||||
fun test2(h: Holder): String {
|
||||
val localResult = doCall (
|
||||
@lambda {
|
||||
lambda@ {
|
||||
h.value += "OK_NONLOCAL"
|
||||
return@lambda "OK_NONLOCAL"
|
||||
}, {
|
||||
@@ -51,7 +51,7 @@ fun test4(h: Holder): String {
|
||||
h.value += "OK_NONLOCAL"
|
||||
return "OK_NONLOCAL"
|
||||
},
|
||||
@l2 {
|
||||
l2@ {
|
||||
h.value += ", OK_FINALLY"
|
||||
return@l2 "OK_FINALLY"
|
||||
})
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun findPairless(a : IntArray) : Int {
|
||||
@loop for (i in a.indices) {
|
||||
loop@ for (i in a.indices) {
|
||||
for (j in a.indices) {
|
||||
if (i != j && a[i] == a[j]) continue@loop
|
||||
}
|
||||
@@ -10,7 +10,7 @@ fun findPairless(a : IntArray) : Int {
|
||||
|
||||
fun hasDuplicates(a : IntArray) : Boolean {
|
||||
var duplicate = false
|
||||
@loop for (i in a.indices) {
|
||||
loop@ for (i in a.indices) {
|
||||
for (j in a.indices) {
|
||||
if (i != j && a[i] == a[j]) {
|
||||
duplicate = true
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
fun main(args: Array<String>) {
|
||||
var i = 10
|
||||
++i
|
||||
++(@l i)
|
||||
++(l@ i)
|
||||
++(i: Int)
|
||||
++(@l (i: Int))
|
||||
++(l@ (i: Int))
|
||||
}
|
||||
|
||||
// 4 IINC
|
||||
@@ -1,6 +1,6 @@
|
||||
fun main()
|
||||
{
|
||||
@l if (2 != 1) "fail 3"
|
||||
l@ if (2 != 1) "fail 3"
|
||||
}
|
||||
|
||||
// 0 GETSTATIC
|
||||
Reference in New Issue
Block a user