Supporting function literals as selectors

This commit is contained in:
Andrey Breslav
2011-11-03 22:23:26 +03:00
parent 4012fc8a5f
commit 73292bd4d6
5 changed files with 50 additions and 4 deletions
@@ -47,4 +47,26 @@ fun main(args : Array<String>) {
<!CALLEE_NOT_A_FUNCTION!>1<!>()
<!CALLEE_NOT_A_FUNCTION!>1<!>{}
<!CALLEE_NOT_A_FUNCTION!>1<!>(){}
}
}
fun f() : fun Int.() : Unit = {}
fun main1(args : Array<String>) {
1.{Int.() => 1}();
{1}()
{(x : Int) => x}(1)
1.{Int.(x : Int) => x}(1)
@l{1}()
1.({Int.() => 1})()
1.(f())()
1.if(true){f()}else{f()}()
1.if(true){Int.() => 1}else{f()}()
1.if(true){Int.() => 1}else{Int.() => 1}()
1.<!CALLEE_NOT_A_FUNCTION!>"sdf"<!>()
1.<!ILLEGAL_SELECTOR!>"sdf"<!>
1.<!ILLEGAL_SELECTOR!>{}<!>
1.<!ILLEGAL_SELECTOR!>if (true) {}<!>
}