Graet Syntactic Shift : Syntax for function literals fixed

This commit is contained in:
Andrey Breslav
2011-12-21 10:52:58 +02:00
parent 6aad3b2662
commit 6bad4830c3
10 changed files with 234 additions and 86 deletions
+8 -8
View File
@@ -121,17 +121,17 @@ sink:
<SINK> NEXT:[] PREV:[<END>]
=====================
== flfun ==
fun flfun(f : fun () : Any) : Unit {}
fun flfun(f : () -> Any) : Unit {}
---------------------
l0:
<START> NEXT:[v(f : fun () : Any)] PREV:[]
v(f : fun () : Any) NEXT:[w(f)] PREV:[<START>]
w(f) NEXT:[read (Unit)] PREV:[v(f : fun () : Any)]
read (Unit) NEXT:[<END>] PREV:[w(f)]
<START> NEXT:[v(f : () -> Any)] PREV:[]
v(f : () -> Any) NEXT:[w(f)] PREV:[<START>]
w(f) NEXT:[read (Unit)] PREV:[v(f : () -> Any)]
read (Unit) NEXT:[<END>] PREV:[w(f)]
l1:
<END> NEXT:[<SINK>] PREV:[read (Unit)]
<END> NEXT:[<SINK>] PREV:[read (Unit)]
error:
<ERROR> NEXT:[] PREV:[]
<ERROR> NEXT:[] PREV:[]
sink:
<SINK> NEXT:[] PREV:[<END>]
<SINK> NEXT:[] PREV:[<END>]
=====================
+1 -1
View File
@@ -20,4 +20,4 @@ fun foo(a : Boolean, b : Int) : Unit {}
fun genfun<T>() : Unit {}
fun flfun(f : fun () : Any) : Unit {}
fun flfun(f : () -> Any) : Unit {}
@@ -0,0 +1,43 @@
class Foo
class Bar
fun a(vararg a : Any) = a
fun test() {
a(1
, {}
, { -> 1}
, {1}
, {x}
, {-> 1}
, {x -> 1}
, {x, y -> 1}
, {(x, y) -> 1}
, {(x, y) : Int -> 1}
, {(x) -> 1}
, {(x) : Int -> 1}
, {(x)}
, {(x).(y)}
, {x.(y)}
, {Int.(x) -> 1}
, {A.B.(x) -> 1}
, {A.B.(x, y) -> 1}
, {Int.(x) : Int -> 1}
, {Int.(x, y) -> 1}
, {Int.(x, y) : Int -> 1}
, {(Int).(x, y) -> 1}
, {(Int).(x, y) : Int -> 1}
, {(Int).(x, y) : (Int) -> Int -> {1}}
, {Int? .(x, y) -> 1}
, {This.(x, y) -> 1}
, {#(A, B).(x, y) -> 1}
, {#(a, b).(y)}
, {#(a, b)}
, {Foo<Bar>.x}
, {Foo<Bar>.(x)}
, {Foo<Bar>.(x) -> x}
, {Foo.Bar.Baz.(x) -> x}
, {Foo<Bar>.(x) : Int -> x}
, {Foo.Bar.Baz.(x) : Int -> x}
)
}