report UNRESOLVED_REFERENCE_WRONG_RECEIVER

mentioning candidates with wrong receiver
This commit is contained in:
Svetlana Isakova
2013-06-17 19:05:54 +04:00
parent 3340b94bd8
commit 041505f5b8
19 changed files with 142 additions and 49 deletions
@@ -9,9 +9,9 @@ class Customer(name: String)
fun foo(f: File, c: Customer) {
f.name
c.<!UNRESOLVED_REFERENCE!>name<!> // name should be unresolved here
c.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>name<!> // name should be unresolved here
}
//from standard library
val File.name: String
get() = getName()
get() = getName()
@@ -6,26 +6,28 @@ package bar
fun <R> List<R>.a() {}
fun test1(i: Int?) {
1.<!UNRESOLVED_REFERENCE!>a<!>()
i.<!UNRESOLVED_REFERENCE!>a<!>()
1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>a<!>()
i.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>a<!>()
}
fun <R> test2(c: Collection<R>) {
c.<!UNRESOLVED_REFERENCE!>a<!>()
c.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>a<!>()
}
fun Int.foo() {}
fun test3(s: String?) {
"".<!UNRESOLVED_REFERENCE!>foo<!>()
s.<!UNRESOLVED_REFERENCE!>foo<!>()
"".<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>()
s.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>()
"".<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>(1)
s.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>("a")
}
trait A
fun <T: A> T.c() {}
fun test4() {
1.<!UNRESOLVED_REFERENCE!>c<!>()
1.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>c<!>()
}
@@ -46,4 +48,8 @@ fun List<String>.b() {}
fun test7(l: List<String?>) {
<!TYPE_MISMATCH!>l<!>.b()
}
fun test8(l: List<Any>?) {
<!TYPE_MISMATCH!>l<!>.b()
}
@@ -0,0 +1,14 @@
package a
class A {}
fun test(a1: A, a2: A) {
val <!UNUSED_VARIABLE!>range<!> = "island".."isle"
a1<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>..<!>a2
}
public fun <T: Comparable<T>> T.rangeTo(<!UNUSED_PARAMETER!>that<!>: T): Range<T> {
throw UnsupportedOperationException()
}