JET-140 Change function type syntax

and tests for
JET-168 Improve the parser for function and tuple types as receiver types
This commit is contained in:
Andrey Breslav
2011-07-06 17:49:35 +04:00
parent 4cf00a8548
commit e0d597a1bc
56 changed files with 279 additions and 1874 deletions
@@ -2,6 +2,6 @@ fun box() : String {
return apply( "OK", {(arg: String) => arg } )
}
fun apply(arg : String, f : {(p:String) : String}) : String {
fun apply(arg : String, f : fun (p:String) : String) : String {
return f(arg)
}
@@ -2,6 +2,6 @@ fun box() : String {
return if (apply( 5, {(arg: Int) => arg + 13 } ) == 18) "OK" else "fail"
}
fun apply(arg : Int, f : {(p:Int) : Int}) : Int {
fun apply(arg : Int, f : fun (p:Int) : Int) : Int {
return f(arg)
}
@@ -3,6 +3,6 @@ fun box() : String {
return if (sum(200, { cl }) == 239) "OK" else "FAIL"
}
fun sum(arg:Int, f : {() : Int}) : Int {
fun sum(arg:Int, f : fun () : Int) : Int {
return arg + f()
}
@@ -8,6 +8,6 @@ fun box() : String {
return if (answer.x == 6 && answer.y == 10) "OK" else "FAIL"
}
fun apply(arg:Point, f : {Point.(scalar : Int) : Point}) : Point {
fun apply(arg:Point, f : fun Point.(scalar : Int) : Point) : Point {
return arg.f(2)
}
@@ -2,6 +2,6 @@ fun box() : String {
return invoker( {"OK"} )
}
fun invoker(gen : {() : String}) : String {
fun invoker(gen : fun () : String) : String {
return gen()
}
@@ -2,6 +2,6 @@ fun box() : String {
return if (int_invoker( { 7 } ) == 7) "OK" else "fail"
}
fun int_invoker(gen : {() : Int}) : Int {
fun int_invoker(gen : fun () : Int) : Int {
return gen()
}