[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
+1
-1
@@ -22,6 +22,6 @@ object Local {
|
||||
fun baz(x: Int, y: Int = 0): Int = 0
|
||||
|
||||
fun test() {
|
||||
bar(::<!UNRESOLVED_REFERENCE!>baz<!>)
|
||||
bar(::<!INAPPLICABLE_CANDIDATE!>baz<!>)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ object Local {
|
||||
fun baz(x: Int, y: Int = 0): Int = 0
|
||||
|
||||
fun test() {
|
||||
bar(::<!UNRESOLVED_REFERENCE!>baz<!>)
|
||||
bar(::<!INAPPLICABLE_CANDIDATE!>baz<!>)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,4 +5,4 @@ import kotlin.reflect.KProperty0
|
||||
object A
|
||||
|
||||
fun <TProperty> property0(property: KProperty0<TProperty>) = A
|
||||
val <K> K.key get() : A = property0(Map.Entry<K, *>::<!UNRESOLVED_REFERENCE!>key<!>) // should be forbidden
|
||||
val <K> K.key get() : A = property0(Map.Entry<K, *>::<!INAPPLICABLE_CANDIDATE!>key<!>) // should be forbidden
|
||||
|
||||
+2
-2
@@ -10,6 +10,6 @@ fun <T> baz(e: T, f: (T) -> Unit) {}
|
||||
|
||||
fun test(a: A, b: B) {
|
||||
// Note that diagnostic is always on callable references as they are resolved after simple arguments
|
||||
baz(a, ::<!UNRESOLVED_REFERENCE!>fooB<!>)
|
||||
bar(::<!UNRESOLVED_REFERENCE!>fooB<!>, a)
|
||||
baz(a, ::<!INAPPLICABLE_CANDIDATE!>fooB<!>)
|
||||
bar(::<!INAPPLICABLE_CANDIDATE!>fooB<!>, a)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user