[FIR] Add checking receivers of callable references

This commit is contained in:
Dmitriy Novozhilov
2020-04-07 15:16:55 +03:00
parent b54148a6f1
commit 8a2b39d647
14 changed files with 36 additions and 17 deletions
@@ -6,10 +6,10 @@ public interface J {
// FILE: test.kt
fun f1(x: Int?): Any = x::hashCode
fun f1(x: Int?): Any = <!UNRESOLVED_REFERENCE!>x::hashCode<!>
fun <T> f2(t: T): Any = t::hashCode
fun <S : String?> f3(s: S): Any = s::hashCode
fun <U : Any> f4(u: U?): Any = u::hashCode
fun f5(c: List<*>): Any = c[0]::hashCode
fun <U : Any> f4(u: U?): Any = <!UNRESOLVED_REFERENCE!>u::hashCode<!>
fun f5(c: List<*>): Any = <!UNRESOLVED_REFERENCE!>c[0]::hashCode<!>
fun f6(j: J): Any = j.platformString()::hashCode
@@ -18,9 +18,9 @@ class Test {
val <T> List<T>.b: Int? get() = size
fun <T> List<T>.testCallable1(): () -> Unit = a<T>::foo
fun <T> List<T>.testCallable2(): () -> Unit = b?::foo
fun <T> List<T>.testCallable3(): () -> Unit = b<T, Any>::foo
fun <T> List<T>.testCallable4(): () -> Unit = b<T>?::foo
fun <T> List<T>.testCallable2(): () -> Unit = <!UNRESOLVED_REFERENCE!>b?::foo<!>
fun <T> List<T>.testCallable3(): () -> Unit = <!UNRESOLVED_REFERENCE!>b<T, Any>::foo<!>
fun <T> List<T>.testCallable4(): () -> Unit = <!UNRESOLVED_REFERENCE!>b<T>?::foo<!>
fun <T> List<T>.testClassLiteral1() = a<T>::class
fun <T> List<T>.testClassLiteral2() = b?::class
@@ -4,4 +4,4 @@ package test
fun nullableFun(): Int? = null
fun Int.foo() {}
val test1 = nullableFun()?::foo
val test1 = <!UNRESOLVED_REFERENCE!>nullableFun()?::foo<!>
@@ -4,10 +4,10 @@ class A {
fun A.extA(x: String) = x
fun main() {
Int::extInt
<!UNRESOLVED_REFERENCE!>Int::extInt<!>
A::extA
eat(Int::extInt)
<!INAPPLICABLE_CANDIDATE!>eat<!>(<!UNRESOLVED_REFERENCE!>Int::extInt<!>)
eat(A::extA)
}
}
@@ -15,11 +15,11 @@ class A {
fun test() {
String::ext
Obj::ext
<!UNRESOLVED_REFERENCE!>Obj::ext<!>
String::ext2
A.Companion::ext2
A::ext2
<!UNRESOLVED_REFERENCE!>A.Companion::ext2<!>
<!UNRESOLVED_REFERENCE!>A::ext2<!>
<!UNRESOLVED_REFERENCE!>A::foo<!>
<!UNRESOLVED_REFERENCE!>A::bar<!>