[FIR] Report INAPPLICABLE_CANDIDATE or more specific diagnostic for callable references
... instead of just UNRESOLVED_REFERENCE when something went wrong during resolution. #KT-59401 related
This commit is contained in:
committed by
Space Team
parent
6b7eeec181
commit
d91000e39c
+2
-2
@@ -16,14 +16,14 @@ fun <T> bar(s: T) {}
|
||||
fun <T> complex(t: T, f: (T) -> Unit) {}
|
||||
|
||||
fun test1() {
|
||||
foo(1, A::<!UNRESOLVED_REFERENCE!>invokeLater<!>) // KT-24507 SAM conversion accidentally applied to callable reference and incorrectly handled via BE
|
||||
foo(1, A::<!INAPPLICABLE_CANDIDATE!>invokeLater<!>) // KT-24507 SAM conversion accidentally applied to callable reference and incorrectly handled via BE
|
||||
foo(1, ::bar)
|
||||
|
||||
complex(1, ::bar)
|
||||
}
|
||||
|
||||
fun <R> test2(x: R) {
|
||||
foo(x, A::<!UNRESOLVED_REFERENCE!>invokeLater<!>) // KT-24507 SAM conversion accidentally applied to callable reference and incorrectly handled via BE
|
||||
foo(x, A::<!INAPPLICABLE_CANDIDATE!>invokeLater<!>) // KT-24507 SAM conversion accidentally applied to callable reference and incorrectly handled via BE
|
||||
foo(x, ::bar)
|
||||
|
||||
complex(x, ::bar)
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ fun <T> Wrapper<T>.baz(transform: (T) -> Unit): T = TODO()
|
||||
|
||||
fun test() {
|
||||
takeFun<String>(::foo)
|
||||
takeFun<String>(::<!UNRESOLVED_REFERENCE!>fooInt<!>)
|
||||
takeFun<String>(::<!INAPPLICABLE_CANDIDATE!>fooInt<!>)
|
||||
|
||||
callFun<String, Wrapper<String>>(::createWrapper)
|
||||
callFun<Int, Wrapper<Number>>(::createWrapper)
|
||||
|
||||
Vendored
+2
-2
@@ -22,8 +22,8 @@ fun test1() {
|
||||
fun <T> test2() {
|
||||
bar<Wrapper, Int, String>(Wrapper::fooReturnString).checkType { _<Tripple<Wrapper, Int, String>>() }
|
||||
bar<Wrapper, T, String>(Wrapper::fooReturnString).checkType { _<Tripple<Wrapper, T, String>>() }
|
||||
bar<Wrapper, T, T>(Wrapper::<!UNRESOLVED_REFERENCE!>fooReturnString<!>)
|
||||
bar<Wrapper, Int, Int>(Wrapper::<!UNRESOLVED_REFERENCE!>fooReturnString<!>)
|
||||
bar<Wrapper, T, T>(Wrapper::<!INAPPLICABLE_CANDIDATE!>fooReturnString<!>)
|
||||
bar<Wrapper, Int, Int>(Wrapper::<!INAPPLICABLE_CANDIDATE!>fooReturnString<!>)
|
||||
|
||||
bar<Wrapper, Int, T>(Wrapper::fooTakeInt).checkType { _<Tripple<Wrapper, Int, T>>() }
|
||||
bar<Wrapper, Int, String>(Wrapper::fooTakeInt).checkType { _<Tripple<Wrapper, Int, String>>() }
|
||||
|
||||
Reference in New Issue
Block a user