"it" inference supported

This commit is contained in:
Andrey Breslav
2011-09-16 15:40:13 +04:00
parent adb44244b5
commit ccaa5ee7f9
9 changed files with 165 additions and 38 deletions
@@ -0,0 +1,32 @@
fun text() {
"direct:a" to "mock:a"
"direct:a" on {it.body == "<hello/>"} to "mock:a"
"direct:a" on {it => it.body == "<hello/>"} to "mock:a"
bar <!TYPE_MISMATCH!>{1}<!>
bar <!TYPE_MISMATCH!>{<!UNRESOLVED_REFERENCE!>it<!> <!UNRESOLVED_REFERENCE!>+<!> 1}<!>
bar {it, it1 => it}
bar1 {1}
bar1 {it + 1}
bar2 <!TYPE_MISMATCH!>{<!TYPE_MISMATCH!><!>}<!>
bar2 {1}
bar2 {<!UNRESOLVED_REFERENCE!>it<!>}
bar2 <!TYPE_MISMATCH!>{<!CANNOT_INFER_PARAMETER_TYPE!>it<!> => it}<!>
}
fun bar(f : fun (Int, Int) : Int) {}
fun bar1(f : fun (Int) : Int) {}
fun bar2(f : fun () : Int) {}
fun String.to(dest : String) {
}
fun String.on(predicate : fun (s : URI) : Boolean) : URI {
return URI(this)
}
class URI(val body : Any) {
fun to(dest : String) {}
}