JS backend: add the support function expression
#KT-7242 Fixed
This commit is contained in:
@@ -18,12 +18,12 @@ fun box() : String {
|
||||
if( 1.(fun Int.(i: Int) = i + this)(1) != 2) return "test 6 failed";
|
||||
if( (fooT1<String>()("mama")) != "mama") return "test 7 failed";
|
||||
|
||||
val a = [A] fun Int.() = this + 1 //
|
||||
val a = [A] fun Int.() = this + 1
|
||||
if (1.a() != 2) return "test 8 failed"
|
||||
val b = ( fun Int.() = this + 1)
|
||||
if (1.a() != 2) return "test 9 failed"
|
||||
if (1.b() != 2) return "test 9 failed"
|
||||
val c = (@c fun Int.() = this + 1)
|
||||
if (1.a() != 2) return "test 10 failed"
|
||||
if (1.c() != 2) return "test 10 failed"
|
||||
|
||||
val d = @d fun (): Int { return@d 4}
|
||||
if (d() != 4) return "test 11 failed"
|
||||
|
||||
+2
-2
@@ -21,9 +21,9 @@ fun box() : String {
|
||||
val a = [A] fun Int.name() = this + 1 // name
|
||||
if (1.a() != 2) return "test 8 failed"
|
||||
val b = ( fun Int.name() = this + 1)
|
||||
if (1.a() != 2) return "test 9 failed"
|
||||
if (1.b() != 2) return "test 9 failed"
|
||||
val c = (@c fun Int.name() = this + 1)
|
||||
if (1.a() != 2) return "test 10 failed"
|
||||
if (1.c() != 2) return "test 10 failed"
|
||||
|
||||
val d = fun name(): Int { return@name 4}
|
||||
if (d() != 4) return "test 11 failed"
|
||||
|
||||
+3
-1
@@ -10,6 +10,8 @@ fun fooT1<T>(t : T) = { t.toString() }
|
||||
|
||||
fun fooT2<T>(t: T) = { x:T -> t.toString() + x.toString() }
|
||||
|
||||
object t
|
||||
|
||||
fun box() : String {
|
||||
if( (10.foo1())() != "23910") return "foo1 fail"
|
||||
if( (10.foo2())(1) != 11 ) return "foo2 fail"
|
||||
@@ -18,7 +20,7 @@ fun box() : String {
|
||||
if( {1}() != 1) return "test 4 failed";
|
||||
if( {x : Int -> x}(1) != 1) return "test 5 failed";
|
||||
if( 1.(fun Int.(x: Int) = x + this)(1) != 2) return "test 6 failed";
|
||||
if( 1.(fun Int.() = this)() != 1) return "test 7 failed";
|
||||
if( t.(fun Any.() = this)() != t) return "test 7 failed";
|
||||
if( (fooT1<String>("mama"))() != "mama") return "test 8 failed";
|
||||
if( (fooT2<String>("mama"))("papa") != "mamapapa") return "test 9 failed";
|
||||
return "OK"
|
||||
|
||||
Reference in New Issue
Block a user