Improved error reporting for invoke on expression

This commit is contained in:
Svetlana Isakova
2014-03-18 15:02:53 +04:00
parent db253ae7e1
commit 75fbecceda
13 changed files with 86 additions and 37 deletions
@@ -44,9 +44,9 @@ fun main(args : Array<String>) {
b : Int
<!TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>fooT2<!>()(1) // : Any?
<!CALLEE_NOT_A_FUNCTION!>1<!>()
<!CALLEE_NOT_A_FUNCTION!>1<!>{}
<!CALLEE_NOT_A_FUNCTION!>1<!>(){}
<!FUNCTION_EXPECTED!>1<!>()
<!FUNCTION_EXPECTED!>1<!>{}
<!FUNCTION_EXPECTED!>1<!>(){}
}
fun f() : Int.() -> Unit = {}
@@ -63,7 +63,7 @@ fun main1() {
1.if(true){Int.() -> 1}else{f()}()
1.if(true){Int.() -> 1}else{Int.() -> 1}()
1.<!CALLEE_NOT_A_FUNCTION!>"sdf"<!>()
1.<!FUNCTION_EXPECTED!>"sdf"<!>()
1.<!ILLEGAL_SELECTOR!>"sdf"<!>
1.<!ILLEGAL_SELECTOR!>{}<!>
@@ -0,0 +1,11 @@
fun test1(f: String.() -> Unit) {
<!MISSING_RECEIVER!>(f)<!>()
<!MISSING_RECEIVER!>f<!>()
}
fun test2(f: (Int) -> Int) {
1.<!UNRESOLVED_REFERENCE!>f<!>(2)
2.<!NO_RECEIVER_ADMITTED!>(f)<!>(2)
}
@@ -1,4 +1,4 @@
fun foo(i: Int) {
<!FUNCTION_EXPECTED!>i<!>()
<!CALLEE_NOT_A_FUNCTION!>1<!>()
<!FUNCTION_EXPECTED!>1<!>()
}
@@ -0,0 +1,15 @@
fun test1() {
<!TYPE_MISMATCH!>1<!>. { String.(i: Int) -> i }(1)
<!TYPE_MISMATCH!>1<!>.(@label{ String.(i: Int) -> i })(1)
}
fun test2(f: String.(Int) -> Unit) {
<!TYPE_MISMATCH!>11<!>.(f)(1)
<!TYPE_MISMATCH!>11<!>.(f)(<!NO_VALUE_FOR_PARAMETER!>)<!>
}
fun test3() {
fun foo(): String.(Int) -> Unit = {}
<!TYPE_MISMATCH!>1<!>.(foo())(1)
}
@@ -5,5 +5,5 @@ fun String.invoke(i: Int) {}
fun foo(i: Int) {
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>i<!>(1)
<!CALLEE_NOT_A_FUNCTION!>1<!>(1)
<!FUNCTION_EXPECTED!>1<!>(1)
}