Replace deprecated lambda syntax in testData
It's done with similar constructions where possible trying to preserve intended behavior. Some usages are removed because they test exactly the feature that we are going to drop soon.
This commit is contained in:
+1
-1
@@ -25,7 +25,7 @@ fun box():String {
|
||||
r = run(a, "!!", A::locExtBar)
|
||||
if (r != "sA:locExtBar:!!") return r
|
||||
|
||||
r = run(a, "!!") {(a: A, other: String): String -> a.s + ":literal:" + other }
|
||||
r = run(a, "!!") { a: A, other: String -> a.s + ":literal:" + other }
|
||||
if (r != "sA:literal:!!") return r
|
||||
|
||||
return "OK"
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ fun Int.sum0(other: Int): Int = this + other
|
||||
fun box(): String {
|
||||
fun Int.sum1(other: Int): Int = this + other
|
||||
|
||||
val sum2 = {Int.(other : Int) : Int -> this + other}
|
||||
val sum2 = fun Int.(other: Int): Int = this + other
|
||||
|
||||
var x = 10
|
||||
x = x.sum0(5)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun box(): String {
|
||||
return apply("OK", {(arg: String) -> arg })
|
||||
return apply("OK", { arg: String -> arg })
|
||||
}
|
||||
|
||||
fun apply(arg: String, f: (p: String) -> String): String {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fun box(): String {
|
||||
return if (apply(5) {(arg: Int) -> arg + 13 } == 18) "OK" else "fail"
|
||||
return if (apply(5) { arg: Int -> arg + 13 } == 18) "OK" else "fail"
|
||||
}
|
||||
|
||||
fun apply(arg: Int, f: (p: Int) -> Int): Int {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class Point(val x: Int, val y: Int)
|
||||
|
||||
fun box(): String {
|
||||
val answer = apply(Point(3, 5), { Point.(scalar: Int): Point ->
|
||||
val answer = apply(Point(3, 5), { scalar: Int ->
|
||||
Point(x * scalar, y * scalar)
|
||||
})
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package foo
|
||||
|
||||
fun box(): String {
|
||||
val a = 23.{ Int.(a: Int) -> a * a + this }(3)
|
||||
val a = 23.(fun Int.(a: Int): Int = a * a + this)(3)
|
||||
if (a != 32) return "a != 32, a = $a";
|
||||
|
||||
return "OK";
|
||||
|
||||
@@ -16,11 +16,11 @@ fun box(): Any? {
|
||||
if ( (10.foo1())() != "23910") return "foo1 fail"
|
||||
if ( (10.foo2())(1) != 11 ) return "foo2 fail"
|
||||
|
||||
if (1.{ Int.() -> this + 1 }() != 2) return "test 3 failed";
|
||||
if (1.(fun Int.(): Int = this + 1)() != 2) return "test 3 failed";
|
||||
if ( { 1 }() != 1) return "test 4 failed";
|
||||
if ( { x: Int -> x }(1) != 1) return "test 5 failed";
|
||||
if ( 1.{ Int.(x: Int) -> x + this }(1) != 2) return "test 6 failed";
|
||||
val tmp = 1.({ Int.() -> this })()
|
||||
if ( 1.(fun Int.(x: Int): Int = x + this)(1) != 2) return "test 6 failed";
|
||||
val tmp = 1.(fun Int.(): Int = this)()
|
||||
if (+tmp != 1) return "test 7 failed, res: $tmp ${tmp is Int}";
|
||||
if ( (fooT1<String>("mama"))() != "mama") return "test 8 failed";
|
||||
if ( (fooT2<String>("mama"))("papa") != "mamapapa") return "test 9 failed";
|
||||
|
||||
@@ -3,12 +3,12 @@ package foo
|
||||
|
||||
fun Int.foo(a: Int) = this + a
|
||||
|
||||
val bar = { Int.(a: Int) -> this * a }
|
||||
val bar = fun Int.(a: Int): Int = this * a
|
||||
|
||||
fun test(op: Int.(Int) -> Int) = 3 op 20
|
||||
|
||||
fun box(): String {
|
||||
val op = { Int.(a: Int) -> this / a }
|
||||
val op = fun Int.(a: Int): Int = this / a
|
||||
|
||||
assertEquals(41, 34 foo 7)
|
||||
assertEquals(28, 4 bar 7)
|
||||
|
||||
@@ -124,8 +124,8 @@ public val A.boo: Int
|
||||
get() = 1
|
||||
public fun A.boo(): Int = 2
|
||||
|
||||
val public_ext_f = { A.(): Int -> this.foo() + this.foo }
|
||||
val public_ext_b = { A.(): Int -> this.boo() + this.boo }
|
||||
val public_ext_f: A.() -> Int = { -> this.foo() + this.foo }
|
||||
val public_ext_b: A.() -> Int = { -> this.boo() + this.boo }
|
||||
|
||||
interface TestPublicInTrait {
|
||||
public fun foo(): Int = 2
|
||||
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
package foo
|
||||
|
||||
fun box(): Boolean {
|
||||
val v1 = 1.{ Int.(x: Int) -> this + x }(2)
|
||||
val v1 = 1.(fun Int.(x: Int) = this + x)(2)
|
||||
|
||||
val f = { Int.(x: Int) -> this + x }
|
||||
val f = fun Int.(x: Int) = this + x
|
||||
val v2 = 1.(f)(2)
|
||||
|
||||
return v1 == 3 && v2 == 3
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ class M() {
|
||||
|
||||
fun eval() {
|
||||
var d = {
|
||||
var c = { Int.() -> this + 3 }
|
||||
var c = fun Int.(): Int = this + 3
|
||||
m += 3.c()
|
||||
}
|
||||
d();
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ fun test1(): Int {
|
||||
|
||||
fun test2(): Int {
|
||||
val inlineX = Inline(9)
|
||||
return inlineX.calcExt2({Int.() -> this}, 25)
|
||||
return inlineX.calcExt2({ -> this}, 25)
|
||||
}
|
||||
|
||||
fun test3(): Int {
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ package foo
|
||||
|
||||
fun test1(): Int {
|
||||
val inlineX = Inline()
|
||||
return inlineX.foo({ z: Int -> "" + z}, 25, { String.() -> this.length() })
|
||||
return inlineX.foo({ z: Int -> "" + z}, 25, { -> this.length() })
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
|
||||
@@ -3,12 +3,12 @@ package foo
|
||||
|
||||
class A(val v: Int)
|
||||
|
||||
val times = { A.(a: Int) -> this.v * a }
|
||||
val times: A.(Int) -> Int = { a -> this.v * a }
|
||||
|
||||
fun test(div: A.(Int) -> Int) = A(20) / 4
|
||||
|
||||
fun box(): String {
|
||||
val compareTo = { A.(a: A) -> this.v - a.v }
|
||||
val compareTo: A.(A) -> Int = { a: A -> this.v - a.v }
|
||||
|
||||
assertEquals(28, A(4) * 7)
|
||||
assertEquals(5, test { this.v / it })
|
||||
|
||||
Reference in New Issue
Block a user