[FIR] Implement UNRESOLVED_REFERENCE_WRONG_RECEIVER

This commit is contained in:
Ivan Kochurkin
2021-08-10 16:40:51 +03:00
committed by Space
parent 34cc7e5199
commit 84c5f58cab
129 changed files with 322 additions and 481 deletions
@@ -1,17 +0,0 @@
class A<T> {
fun T.foo() {}
fun Out<T>.bar() {}
}
class Out<out E>
fun test(x: A<out CharSequence>, y: Out<CharSequence>) {
with(x) {
// TODO: this diagnostic could be replaced with TYPE_MISMATCH_DUE_TO_TYPE_PROJECTION
"".<!INAPPLICABLE_CANDIDATE!>foo<!>()
y.<!INAPPLICABLE_CANDIDATE!>bar<!>()
with(y) {
<!INAPPLICABLE_CANDIDATE!>bar<!>()
}
}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A<T> {
fun T.foo() {}
fun Out<T>.bar() {}
@@ -10,5 +10,5 @@ fun main() {
val c : ListOfLists<*> = b
val d : ArrayList<ArrayList<*>> = <!INITIALIZER_TYPE_MISMATCH!>c.x<!>
c.x checkType { <!INAPPLICABLE_CANDIDATE!>_<!><ArrayList<out ArrayList<*>>>() }
c.x checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><ArrayList<out ArrayList<*>>>() }
}
@@ -9,10 +9,10 @@ public class Clazz<T> {
// FILE: main.kt
fun test(clazz: Clazz<*>) {
clazz.t checkType { _<Any?>() }
clazz.getSuperClass() checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Clazz<*>?>() }
clazz.getSuperClass() checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Clazz<*>?>() }
clazz.getSuperClass().t checkType { _<Any?>() }
clazz.superClass checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Clazz<*>?>() }
clazz.superClass checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Clazz<*>?>() }
clazz.superClass.t checkType { _<Any?>() }
// See KT-9294