diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index 2c7f7357710..bd66f4fb323 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -3528,6 +3528,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/callableReference/kt52503.kt"); } + @Test + @TestMetadata("kt55373.kt") + public void testKt55373() throws Exception { + runTest("compiler/testData/diagnostics/tests/callableReference/kt55373.kt"); + } + @Test @TestMetadata("kt7430_wrongClassOnLHS.kt") public void testKt7430_wrongClassOnLHS() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index 1001f6964a6..fe8cf605482 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -3528,6 +3528,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/callableReference/kt52503.kt"); } + @Test + @TestMetadata("kt55373.kt") + public void testKt55373() throws Exception { + runTest("compiler/testData/diagnostics/tests/callableReference/kt55373.kt"); + } + @Test @TestMetadata("kt7430_wrongClassOnLHS.kt") public void testKt7430_wrongClassOnLHS() throws Exception { diff --git a/compiler/fir/analysis-tests/testData/resolve/references/leakedImplicitType.fir.txt b/compiler/fir/analysis-tests/testData/resolve/references/leakedImplicitType.fir.txt index e8d7505fb0f..be4d9317e88 100644 --- a/compiler/fir/analysis-tests/testData/resolve/references/leakedImplicitType.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/references/leakedImplicitType.fir.txt @@ -21,5 +21,5 @@ FILE: leakedImplicitType.kt public final fun R|IB|.extFun(x: R|IA|): R|kotlin/Unit| { } public final fun testWithExpectedType(): R|kotlin/Unit| { - lval extFun_AA_B: R|IA.(IA) -> kotlin/Unit| = Q|IB|::# + lval extFun_AA_B: R|IA.(IA) -> kotlin/Unit| = Q|IB|::# } diff --git a/compiler/fir/analysis-tests/testData/resolve/references/leakedImplicitType.kt b/compiler/fir/analysis-tests/testData/resolve/references/leakedImplicitType.kt index 50284e07ef8..1a599f5619c 100644 --- a/compiler/fir/analysis-tests/testData/resolve/references/leakedImplicitType.kt +++ b/compiler/fir/analysis-tests/testData/resolve/references/leakedImplicitType.kt @@ -14,5 +14,5 @@ fun IA.extFun(x: IB) {} fun IB.extFun(x: IA) {} fun testWithExpectedType() { - val extFun_AA_B: IA.(IA) -> Unit = IB::extFun // extFun is unresolved, type of IB::extFun is implicit + val extFun_AA_B: IA.(IA) -> Unit = IB::extFun // extFun is unresolved, type of IB::extFun is implicit } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.fir.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.fir.txt index ab9470ad090..3a337f24c4b 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.fir.txt @@ -13,7 +13,7 @@ FILE: moreSpecificAmbiguousExtensions.kt } 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|::# + 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|::# 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 88890ac51ec..f72e61d97d4 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/fromBasicDiagnosticTests/moreSpecificAmbiguousExtensions.kt @@ -12,7 +12,7 @@ fun test() { 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 diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index 6d015f5dd8c..4540ce58637 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -3528,6 +3528,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/callableReference/kt52503.kt"); } + @Test + @TestMetadata("kt55373.kt") + public void testKt55373() throws Exception { + runTest("compiler/testData/diagnostics/tests/callableReference/kt55373.kt"); + } + @Test @TestMetadata("kt7430_wrongClassOnLHS.kt") public void testKt7430_wrongClassOnLHS() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index f13b2bc8f0e..db7311f0593 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -3534,6 +3534,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/callableReference/kt52503.kt"); } + @Test + @TestMetadata("kt55373.kt") + public void testKt55373() throws Exception { + runTest("compiler/testData/diagnostics/tests/callableReference/kt55373.kt"); + } + @Test @TestMetadata("kt7430_wrongClassOnLHS.kt") public void testKt7430_wrongClassOnLHS() throws Exception { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt index 2dcb0a30f40..896c2d5a7fe 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirSyntheticCallGenerator.kt @@ -26,15 +26,19 @@ import org.jetbrains.kotlin.fir.expressions.* import org.jetbrains.kotlin.fir.expressions.builder.buildArgumentList import org.jetbrains.kotlin.fir.expressions.builder.buildFunctionCall import org.jetbrains.kotlin.fir.moduleData +import org.jetbrains.kotlin.fir.references.FirErrorNamedReference import org.jetbrains.kotlin.fir.references.FirReference import org.jetbrains.kotlin.fir.references.FirResolvedCallableReference +import org.jetbrains.kotlin.fir.references.builder.buildErrorNamedReference import org.jetbrains.kotlin.fir.references.builder.buildResolvedErrorReference +import org.jetbrains.kotlin.fir.references.impl.FirSimpleNamedReference import org.jetbrains.kotlin.fir.references.impl.FirStubReference import org.jetbrains.kotlin.fir.references.isError import org.jetbrains.kotlin.fir.resolve.BodyResolveComponents import org.jetbrains.kotlin.fir.resolve.ResolutionMode import org.jetbrains.kotlin.fir.resolve.calls.* import org.jetbrains.kotlin.fir.resolve.createErrorReferenceWithExistingCandidate +import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguityError import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeInapplicableCandidateError import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider import org.jetbrains.kotlin.fir.resolve.toErrorReference @@ -53,6 +57,7 @@ import org.jetbrains.kotlin.name.CallableId import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.ArrayFqNames import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind +import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability import org.jetbrains.kotlin.resolve.calls.tower.isSuccess import org.jetbrains.kotlin.types.Variance @@ -213,7 +218,7 @@ class FirSyntheticCallGenerator( callableReferenceAccess: FirCallableReferenceAccess, expectedTypeRef: FirTypeRef?, context: ResolutionContext - ): FirCallableReferenceAccess? { + ): FirCallableReferenceAccess { val argumentList = buildUnaryArgumentList(callableReferenceAccess) val parameterTypeRef = @@ -222,6 +227,80 @@ class FirSyntheticCallGenerator( else -> context.session.builtinTypes.anyType } + var reference = generateCalleeReferenceWithCandidate(callableReferenceAccess, argumentList, parameterTypeRef, context) + var initialCallWasUnresolved = false + + if (reference is FirErrorReferenceWithCandidate && reference.diagnostic is ConeInapplicableCandidateError) { + // If the callable reference cannot be resolved with the expected type, let's try to resolve it with any type and report + // something like INITIALIZER_TYPE_MISMATCH or NONE_APPLICABLE instead of UNRESOLVED_REFERENCE. + + check(callableReferenceAccess.calleeReference is FirSimpleNamedReference && callableReferenceAccess.typeRef is FirImplicitTypeRef) { + "Expected FirCallableReferenceAccess to be unresolved." + } + + reference = + generateCalleeReferenceWithCandidate(callableReferenceAccess, argumentList, context.session.builtinTypes.anyType, context) + initialCallWasUnresolved = true + } + + val fakeCall = buildFunctionCall { + calleeReference = reference + this.argumentList = argumentList + } + + components.callCompleter.completeCall(fakeCall, ResolutionMode.ContextIndependent) + + return callableReferenceAccess.apply { updateErrorsIfNecessary(fakeCall, initialCallWasUnresolved) } + } + + private fun FirCallableReferenceAccess.updateErrorsIfNecessary(fakeCall: FirFunctionCall, initialCallWasUnresolved: Boolean) { + val fakeCallCalleeReference = fakeCall.calleeReference + val calleeReference = calleeReference + + if (fakeCallCalleeReference.isError()) { + (calleeReference as? FirNamedReferenceWithCandidate) + ?.toErrorReference(fakeCallCalleeReference.diagnostic) + ?.let { replaceCalleeReference(it) } + + if (!calleeReference.isError()) { + val resolvedReference = calleeReference as? FirResolvedCallableReference + ?: error("By this time the actual callable reference must have already been resolved") + + replaceCalleeReference( + buildResolvedErrorReference { + this.name = resolvedReference.name + this.source = resolvedReference.source + this.resolvedSymbol = resolvedReference.resolvedSymbol + this.diagnostic = fakeCallCalleeReference.diagnostic + } + ) + } + } else if (initialCallWasUnresolved && calleeReference is FirErrorNamedReference) { + // If the initial call was unresolved, we tried to resolve with target type Any. + // If there are multiple applicable overloads, the applicability of the error reference is set to RESOLVED meaning we would + // report OVERLOAD_RESOLUTION_AMBIGUITY. + // This would be misleading since the opposite is actually true - no overloads were applicable. + // To fix this, we manually set the applicability to INAPPLICABLE. + (calleeReference.diagnostic as? ConeAmbiguityError)?.let { + val newCalleeReference = buildErrorNamedReference { + source = calleeReference.source + diagnostic = ConeAmbiguityError( + it.name, + CandidateApplicability.INAPPLICABLE, + it.candidates, + ) + } + replaceCalleeReference(newCalleeReference) + } + } + } + + private fun generateCalleeReferenceWithCandidate( + callableReferenceAccess: FirCallableReferenceAccess, + argumentList: FirArgumentList, + parameterTypeRef: FirResolvedTypeRef, + context: ResolutionContext, + ): FirNamedReferenceWithCandidate { val callableId = SyntheticCallableId.ACCEPT_SPECIFIC_TYPE val functionSymbol = FirSyntheticFunctionSymbol(callableId) // fun accept(p: ): Unit @@ -230,45 +309,14 @@ class FirSyntheticCallGenerator( valueParameters += parameterTypeRef.toValueParameter("reference", functionSymbol, isVararg = false) }.build() - val reference = - generateCalleeReferenceWithCandidate( - callableReferenceAccess, - function, - argumentList, - callableId.callableName, - CallKind.SyntheticIdForCallableReferencesResolution, - context, - ) - val fakeCallElement = buildFunctionCall { - calleeReference = reference - this.argumentList = argumentList - } - - val result = components.callCompleter.completeCall(fakeCallElement, ResolutionMode.ContextIndependent) - val completedCallableReference = result.argument as FirCallableReferenceAccess? - - val callCalleeReference = result.calleeReference - if (callCalleeReference.isError()) { - (completedCallableReference?.calleeReference as? FirNamedReferenceWithCandidate) - ?.toErrorReference(callCalleeReference.diagnostic) - ?.let { completedCallableReference.replaceCalleeReference(it) } - - if (!callableReferenceAccess.calleeReference.isError()) { - val resolvedReference = callableReferenceAccess.calleeReference as? FirResolvedCallableReference - ?: error("By this time the actual callable reference must have already been resolved") - - callableReferenceAccess.replaceCalleeReference( - buildResolvedErrorReference { - this.name = resolvedReference.name - this.source = resolvedReference.source - this.resolvedSymbol = resolvedReference.resolvedSymbol - this.diagnostic = callCalleeReference.diagnostic - } - ) - } - } - - return completedCallableReference + return generateCalleeReferenceWithCandidate( + callableReferenceAccess, + function, + argumentList, + callableId.callableName, + CallKind.SyntheticIdForCallableReferencesResolution, + context, + ) } private fun generateCalleeReferenceWithCandidate( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index d0ea2fbb342..2defdfe1105 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -1076,7 +1076,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT } else { components.syntheticCallGenerator.resolveCallableReferenceWithSyntheticOuterCall( callableReferenceAccess, data.expectedType, resolutionContext, - ) ?: callableReferenceAccess + ) }.also { dataFlowAnalyzer.exitCallableReference(it) } diff --git a/compiler/testData/diagnostics/tests/callableReference/adapted/noKFunctionForAdaptation.fir.kt b/compiler/testData/diagnostics/tests/callableReference/adapted/noKFunctionForAdaptation.fir.kt index 257dd95b438..8eab7076077 100644 --- a/compiler/testData/diagnostics/tests/callableReference/adapted/noKFunctionForAdaptation.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/adapted/noKFunctionForAdaptation.fir.kt @@ -4,9 +4,9 @@ fun bar(x: String = "K"): String = x fun dump(dumpStrategy: String) { val k0: kotlin.reflect.KFunction0 = returnAdapter(::foo) // Error: ADAPTED_CALLABLE_REFERENCE_AGAINST_REFLECTION_TYPE - val k1: kotlin.reflect.KFunction0 = ::foo + val k1: kotlin.reflect.KFunction0 = ::foo // Should be error here, too - val k2: kotlin.reflect.KFunction0 = if (dumpStrategy == "KotlinLike") ::foo else ::bar + val k2: kotlin.reflect.KFunction0 = if (dumpStrategy == "KotlinLike") ::foo else ::bar val f0: Function0 = returnAdapter(::foo) val f1: Function0 = ::foo diff --git a/compiler/testData/diagnostics/tests/callableReference/generic/expectedFunctionType.fir.kt b/compiler/testData/diagnostics/tests/callableReference/generic/expectedFunctionType.fir.kt index cf1d20db9bc..cc1dbb02c5c 100644 --- a/compiler/testData/diagnostics/tests/callableReference/generic/expectedFunctionType.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/generic/expectedFunctionType.fir.kt @@ -22,6 +22,6 @@ class A3 { fun test2(): (T) -> Unit = A3()::a3 fun test3(): (Int) -> String = A3()::a3 - fun test4(): (R) -> Unit = this::a3 + fun test4(): (R) -> Unit = this::a3 fun test5(): (T) -> R = this::a3 } diff --git a/compiler/testData/diagnostics/tests/callableReference/kt55373.fir.kt b/compiler/testData/diagnostics/tests/callableReference/kt55373.fir.kt new file mode 100644 index 00000000000..4f8c9a4d422 --- /dev/null +++ b/compiler/testData/diagnostics/tests/callableReference/kt55373.fir.kt @@ -0,0 +1,7 @@ +class One +fun one() = Unit +class Two + +val test: Two = ::One +val test2: Two = ::one +val test3: (String) -> One = ::One diff --git a/compiler/testData/diagnostics/tests/callableReference/kt55373.kt b/compiler/testData/diagnostics/tests/callableReference/kt55373.kt new file mode 100644 index 00000000000..fbabcb65416 --- /dev/null +++ b/compiler/testData/diagnostics/tests/callableReference/kt55373.kt @@ -0,0 +1,7 @@ +class One +fun one() = Unit +class Two + +val test: Two = ::One +val test2: Two = ::one +val test3: (String) -> One = ::One diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/byValType.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/byValType.fir.kt deleted file mode 100644 index 4618ff917eb..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/byValType.fir.kt +++ /dev/null @@ -1,9 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER - -fun foo() {} -fun foo(s: String) {} - -val x1 = ::foo -val x2: () -> Unit = ::foo -val x3: (String) -> Unit = ::foo -val x4: (Int) -> Unit = ::foo diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/byValType.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/byValType.kt index 4aa6dac8397..e79abdd3034 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/byValType.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/byValType.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER fun foo() {} diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.fir.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.fir.kt deleted file mode 100644 index 3b516fe4caf..00000000000 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.fir.kt +++ /dev/null @@ -1,21 +0,0 @@ -// !CHECK_TYPE -// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE - -interface IA -interface IB : IA - -fun IA.extFun(x: IB) {} -fun IB.extFun(x: IA) {} - -fun test() { - val extFun1 = IA::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_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 -} diff --git a/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.kt b/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.kt index b24dc4d963b..e9b87d408e6 100644 --- a/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.kt +++ b/compiler/testData/diagnostics/tests/callableReference/resolve/moreSpecificAmbiguousExtensions.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE diff --git a/compiler/testData/diagnostics/tests/j+k/sam/referenceToSamFunctionAgainstExpectedType.fir.kt b/compiler/testData/diagnostics/tests/j+k/sam/referenceToSamFunctionAgainstExpectedType.fir.kt index 934f581a0cc..48c9bef96a7 100644 --- a/compiler/testData/diagnostics/tests/j+k/sam/referenceToSamFunctionAgainstExpectedType.fir.kt +++ b/compiler/testData/diagnostics/tests/j+k/sam/referenceToSamFunctionAgainstExpectedType.fir.kt @@ -17,7 +17,7 @@ public class Inv { // FILE: test.kt fun test(inv: Inv) { - val m: ((String) -> String) -> Inv = inv::map + val m: ((String) -> String) -> Inv = inv::map take(inv::map) } diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index b70ca74ec04..cdd8152ed7d 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -3534,6 +3534,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/callableReference/kt52503.kt"); } + @Test + @TestMetadata("kt55373.kt") + public void testKt55373() throws Exception { + runTest("compiler/testData/diagnostics/tests/callableReference/kt55373.kt"); + } + @Test @TestMetadata("kt7430_wrongClassOnLHS.kt") public void testKt7430_wrongClassOnLHS() throws Exception {