[FIR] Skip redundant INAPPLICABLE_CANDIDATE on call with unresolved callable reference argument
A new resolution diagnostic UnsuccessfulCallableReferenceAtom is introduced that is used in EagerResolveOfCallableReferences. No diagnostic is reported on unresolved calls with this diagnostic because #KT-59856
This commit is contained in:
committed by
Space Team
parent
a55f3c5583
commit
2f3293f99e
+1
-1
@@ -22,6 +22,6 @@ object Local {
|
||||
fun baz(x: Int, y: Int = 0): Int = 0
|
||||
|
||||
fun test() {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(::<!UNRESOLVED_REFERENCE!>baz<!>)
|
||||
bar(::<!UNRESOLVED_REFERENCE!>baz<!>)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -7,4 +7,4 @@ fun foo(s: String) {}
|
||||
|
||||
val x1 = ofType<() -> Unit>(::foo)
|
||||
val x2 = ofType<(String) -> Unit>(::foo)
|
||||
val x3 = <!INAPPLICABLE_CANDIDATE!>ofType<!><(Int) -> Unit>(::<!UNRESOLVED_REFERENCE!>foo<!>)
|
||||
val x3 = ofType<(Int) -> Unit>(::<!UNRESOLVED_REFERENCE!>foo<!>)
|
||||
|
||||
+1
-1
@@ -22,6 +22,6 @@ object Local {
|
||||
fun baz(x: Int, y: Int = 0): Int = 0
|
||||
|
||||
fun test() {
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(::<!UNRESOLVED_REFERENCE!>baz<!>)
|
||||
bar(::<!UNRESOLVED_REFERENCE!>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 = <!INAPPLICABLE_CANDIDATE!>property0<!>(Map.Entry<K, *>::<!UNRESOLVED_REFERENCE!>key<!>) // should be forbidden
|
||||
val <K> K.key get() : A = property0(Map.Entry<K, *>::<!UNRESOLVED_REFERENCE!>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
|
||||
<!INAPPLICABLE_CANDIDATE!>baz<!>(a, ::<!UNRESOLVED_REFERENCE!>fooB<!>)
|
||||
<!INAPPLICABLE_CANDIDATE!>bar<!>(::<!UNRESOLVED_REFERENCE!>fooB<!>, a)
|
||||
baz(a, ::<!UNRESOLVED_REFERENCE!>fooB<!>)
|
||||
bar(::<!UNRESOLVED_REFERENCE!>fooB<!>, a)
|
||||
}
|
||||
|
||||
+1
-1
@@ -8,4 +8,4 @@ fun foo(s: String) {}
|
||||
|
||||
val x1 = apply(1, ::foo)
|
||||
val x2 = apply("hello", ::foo)
|
||||
val x3 = <!INAPPLICABLE_CANDIDATE!>apply<!>(true, ::<!UNRESOLVED_REFERENCE!>foo<!>)
|
||||
val x3 = apply(true, ::<!UNRESOLVED_REFERENCE!>foo<!>)
|
||||
|
||||
Reference in New Issue
Block a user