Resolve invoke on any kind of expressions, not only on simple name expressions

This commit is contained in:
Svetlana Isakova
2014-02-04 19:07:06 +04:00
parent c7087d170e
commit a829da185d
31 changed files with 391 additions and 101 deletions
@@ -0,0 +1,10 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun Int.invoke(i: Int, a: Any) {}
fun Int.invoke(a: Any, i: Int) {}
fun foo(i: Int) {
<!OVERLOAD_RESOLUTION_AMBIGUITY!>i<!>(1, 1)
<!OVERLOAD_RESOLUTION_AMBIGUITY!>5<!>(1, 2)
}
@@ -0,0 +1,10 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class My {
private fun Int.invoke(s: String) {}
}
fun My.foo(i: Int) {
<!INVISIBLE_MEMBER!>i<!>("")
<!INVISIBLE_MEMBER!>1<!>("")
}
@@ -0,0 +1,13 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
class A<T>
fun <T> T.invoke(a: A<T>) {}
fun foo(s: String, ai: A<Int>) {
1(ai)
<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>s<!>(ai)
<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS!>""<!>(ai)
}
@@ -0,0 +1,4 @@
fun foo(i: Int) {
<!FUNCTION_EXPECTED!>i<!>()
<!CALLEE_NOT_A_FUNCTION!>1<!>()
}
@@ -0,0 +1,9 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun String.invoke(i: Int) {}
fun foo(s: String?) {
<!UNSAFE_CALL!>s<!>(1)
<!UNSAFE_CALL!>(s ?: null)<!>(1)
}
@@ -0,0 +1,9 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun String.invoke(i: Int) {}
fun foo(i: Int) {
<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>i<!>(1)
<!CALLEE_NOT_A_FUNCTION!>1<!>(1)
}