K2: discriminate candidates with adaptations in the first place in ConeOverloadConflictResolver

Before this commit, we discriminated particular candidates with callable
reference adaptations during resolution stages.
After disabling compatibility mode for new inference, it's not so,
but now we discriminate similar candidates in ConeOverloadConflictResolver;
more precisely, it's candidates with callable reference adaptation
in their postponed atoms.
This does not allow going up the tower,
but allows to select better candidate at similar tower level.

Related to KT-63558, KT-64307, KT-64308
This commit is contained in:
Mikhail Glukhikh
2023-12-19 11:02:03 +01:00
committed by Space Team
parent 087edc026d
commit d3a0a6cabe
10 changed files with 130 additions and 9 deletions
@@ -0,0 +1,18 @@
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.*
interface A
interface B : A
fun A.foo() {}
fun take(f: (A) -> Unit) {}
fun take(f: () -> Unit) {}
fun test() {
B::foo checkType { _<KFunction1<B, Unit>>() }
take(B::<!INAPPLICABLE_CANDIDATE!>foo<!>)
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !CHECK_TYPE
// !DIAGNOSTICS: -UNUSED_PARAMETER