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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user