[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:
Kirill Rakhman
2023-07-18 10:16:26 +02:00
committed by Space Team
parent a55f3c5583
commit 2f3293f99e
49 changed files with 91 additions and 95 deletions
@@ -5,8 +5,8 @@ class Impl : Inv
class Scope<InterfaceT, ImplementationT : InterfaceT>(private val implClass: <!UNRESOLVED_REFERENCE!>j.Class<ImplementationT><!>) {
fun foo(c: Collection<InterfaceT>) {
val hm = c.asSequence()
.<!INAPPLICABLE_CANDIDATE!>filter<!>(implClass::<!UNRESOLVED_REFERENCE!>isInstance<!>)
.<!INAPPLICABLE_CANDIDATE!>map<!>(implClass::<!UNRESOLVED_REFERENCE!>cast<!>)
.filter(implClass::<!UNRESOLVED_REFERENCE!>isInstance<!>)
.map(implClass::<!UNRESOLVED_REFERENCE!>cast<!>)
.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>toSet<!>()
}
}
@@ -10,7 +10,7 @@ suspend fun String.id(): String = this
fun box() {
val x = "f"
builder {
<!INAPPLICABLE_CANDIDATE!>go1<!>(x::<!UNRESOLVED_REFERENCE!>id<!>)
<!INAPPLICABLE_CANDIDATE!>go2<!>(x::<!UNRESOLVED_REFERENCE!>id<!>)
go1(x::<!UNRESOLVED_REFERENCE!>id<!>)
go2(x::<!UNRESOLVED_REFERENCE!>id<!>)
}
}
@@ -14,8 +14,8 @@ suspend fun bar(x: Int) {}
fun test() {
test0(::foo)
<!INAPPLICABLE_CANDIDATE!>test1<!>(::<!UNRESOLVED_REFERENCE!>foo<!>)
test1(::<!UNRESOLVED_REFERENCE!>foo<!>)
<!INAPPLICABLE_CANDIDATE!>test0<!>(::<!UNRESOLVED_REFERENCE!>bar<!>)
test0(::<!UNRESOLVED_REFERENCE!>bar<!>)
test1(::bar)
}
@@ -3,6 +3,6 @@
internal class Z<K> {
val map = HashMap<String, String>()
inline fun compute(key: String, producer: () -> String): String {
return map.<!INAPPLICABLE_CANDIDATE!>getOrPut<!>(key, ::<!UNSUPPORTED!>producer<!>)
return map.getOrPut(key, ::<!UNSUPPORTED!>producer<!>)
}
}
@@ -9,7 +9,7 @@ class ProcessorWithParent : Entity {
}
class ProcessorWithChildren : Entity {
var processors by <!INAPPLICABLE_CANDIDATE!>children<!>(ProcessorWithParent::class.java, ProcessorWithParent::<!UNRESOLVED_REFERENCE!>processor<!>)
var processors by children(ProcessorWithParent::class.java, ProcessorWithParent::<!UNRESOLVED_REFERENCE!>processor<!>)
}
class Processor2WithParent : Entity {