diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.kt index bcf4a60fb0c..025d3b59b5b 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.kt @@ -6,14 +6,14 @@ fun IB.extFun(x: IA) {} fun test() { val extFun1 = IA::extFun - val extFun2 = IB::extFun + val extFun2 = IB::extFun } fun testWithExpectedType() { // NB: should be resolved to kotlin/FunctionX, not kotlin/reflect/FunctionX val extFun_AB_A: IA.(IB) -> Unit = IA::extFun - val extFun_AA_B: IA.(IA) -> Unit = IB::extFun + val extFun_AA_B: IA.(IA) -> Unit = IB::extFun val extFun_BB_A: IB.(IB) -> Unit = IA::extFun val extFun_BA_B: IB.(IA) -> Unit = IB::extFun - val extFun_BB_B: IB.(IB) -> Unit = IB::extFun + val extFun_BB_B: IB.(IB) -> Unit = IB::extFun } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.txt index 97e0863bd3b..8bcf37726bb 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.txt @@ -9,12 +9,12 @@ FILE: moreSpecificAmbiguousExtensions.kt } public final fun test(): R|kotlin/Unit| { lval extFun1: R|kotlin/reflect/KFunction2| = Q|IA|::R|/extFun| - lval extFun2: R|kotlin/reflect/KFunction2| = Q|IB|::R|/extFun| + lval extFun2: = Q|IB|::# } public final fun testWithExpectedType(): R|kotlin/Unit| { lval extFun_AB_A: R|IA.(IB) -> kotlin/Unit| = Q|IA|::R|/extFun| - lval extFun_AA_B: R|IA.(IA) -> kotlin/Unit| = Q|IB|::R|/extFun| + lval extFun_AA_B: R|IA.(IA) -> kotlin/Unit| = Q|IB|::# lval extFun_BB_A: R|IB.(IB) -> kotlin/Unit| = Q|IA|::R|/extFun| lval extFun_BA_B: R|IB.(IA) -> kotlin/Unit| = Q|IB|::R|/extFun| - lval extFun_BB_B: R|IB.(IB) -> kotlin/Unit| = Q|IB|::R|/extFun| + lval extFun_BB_B: R|IB.(IB) -> kotlin/Unit| = Q|IB|::# } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt index d6225dd2abb..aaaef2706f3 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/AbstractConeCallConflictResolver.kt @@ -163,9 +163,9 @@ abstract class AbstractConeCallConflictResolver( call: Candidate, function: FirFunction<*> ): List { - return (call.resultingTypeForCallableReference?.typeArguments?.map { it as ConeKotlinType } - ?: (listOfNotNull(function.receiverTypeRef?.coneTypeUnsafe()) + - call.argumentMapping?.map { it.value.argumentType() }.orEmpty())) + return listOfNotNull(function.receiverTypeRef?.coneTypeUnsafe()) + + (call.resultingTypeForCallableReference?.typeArguments?.map { it as ConeKotlinType } + ?: call.argumentMapping?.map { it.value.argumentType() }.orEmpty()) } private fun createFlatSignature(call: Candidate, klass: FirClass<*>): FlatSignature { diff --git a/compiler/testData/codegen/box/callableReference/bound/boundReferenceToOverloadedFunction.kt b/compiler/testData/codegen/box/callableReference/bound/boundReferenceToOverloadedFunction.kt index 2c420b008d6..68131027466 100644 --- a/compiler/testData/codegen/box/callableReference/bound/boundReferenceToOverloadedFunction.kt +++ b/compiler/testData/codegen/box/callableReference/bound/boundReferenceToOverloadedFunction.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +NewInference -// IGNORE_BACKEND_FIR: JVM_IR interface JsonParser interface JsonCodingParser : JsonParser diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/kt9601.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/kt9601.fir.kt deleted file mode 100644 index 377c0bad1e0..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/kt9601.fir.kt +++ /dev/null @@ -1,15 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION - -open class A -class B: A() - -fun A.foo() {} -fun B.foo() {} // more specific - -fun bar(a: Any) {} -fun bar(a: Int) {} // more specific - -fun test() { - B::foo - ::bar -} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/kt9601.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/kt9601.kt index 31a083c6212..c8c23d0262f 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/kt9601.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/kt9601.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION open class A diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.fir.kt index 37ad6523f03..a3ba638c686 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.fir.kt @@ -9,13 +9,13 @@ fun IB.extFun(x: IA) {} fun test() { val extFun1 = IA::extFun - val extFun2 = IB::extFun + val extFun2 = IB::extFun } fun testWithExpectedType() { val extFun_AB_A: IA.(IB) -> Unit = IA::extFun - val extFun_AA_B: IA.(IA) -> Unit = IB::extFun + val extFun_AA_B: IA.(IA) -> Unit = IB::extFun val extFun_BB_A: IB.(IB) -> Unit = IA::extFun val extFun_BA_B: IB.(IA) -> Unit = IB::extFun - val extFun_BB_B: IB.(IB) -> Unit = IB::extFun + val extFun_BB_B: IB.(IB) -> Unit = IB::extFun } \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificSimple.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificSimple.fir.kt deleted file mode 100644 index 432f4e57d12..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificSimple.fir.kt +++ /dev/null @@ -1,12 +0,0 @@ -// !CHECK_TYPE - -interface IA -interface IB : IA - -fun IA.extFun() {} -fun IB.extFun() {} - -fun test() { - val extFun = IB::extFun - checkSubtype Unit>(extFun) -} diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificSimple.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificSimple.kt index 3c591688e56..75562cd6cbb 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificSimple.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificSimple.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE interface IA diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/overloads.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/overloads.fir.kt index b5d54864ccd..d67e86ca269 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/overloads.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/overloads.fir.kt @@ -20,7 +20,7 @@ fun fas() {} fun fas(i: Int = 1) {} fun test() { - B::foo // todo KT-9601 Chose maximally specific function in callable reference + B::foo // todo KT-9601 Chose maximally specific function in callable reference B::bar checkType { _>() }