diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/genericInReceiver.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/genericInReceiver.kt new file mode 100644 index 00000000000..0785e1b9ca7 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/genericInReceiver.kt @@ -0,0 +1,7 @@ +fun test_1(a: String, s: String) { + val pair = s.let(a::to) +} + +fun test_2(a: String, s: String) { + val pair = s.let { a.to(it) } +} \ No newline at end of file diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/genericInReceiver.txt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/genericInReceiver.txt new file mode 100644 index 00000000000..e4d5c03b6d7 --- /dev/null +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/genericInReceiver.txt @@ -0,0 +1,10 @@ +FILE: genericInReceiver.kt + public final fun test_1(a: R|kotlin/String|, s: R|kotlin/String|): R|kotlin/Unit| { + lval pair: R|kotlin/Pair| = R|/s|.R|kotlin/let||>(R|/a|::R|kotlin/to|) + } + public final fun test_2(a: R|kotlin/String|, s: R|kotlin/String|): R|kotlin/Unit| { + lval pair: R|kotlin/Pair| = R|/s|.R|kotlin/let||>( = let@fun (it: R|kotlin/String|): R|kotlin/Pair| { + ^ R|/a|.R|kotlin/to|(R|/it|) + } + ) + } diff --git a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java index 6a7cff8a59d..d7edc7cb90c 100644 --- a/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java +++ b/compiler/fir/analysis-tests/tests/org/jetbrains/kotlin/fir/FirDiagnosticsWithStdlibTestGenerated.java @@ -310,6 +310,11 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/extensionReceiverInference.kt"); } + @TestMetadata("genericInReceiver.kt") + public void testGenericInReceiver() throws Exception { + runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/genericInReceiver.kt"); + } + @TestMetadata("ifWithCR.kt") public void testIfWithCR() throws Exception { runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/callableReferences/ifWithCR.kt"); diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt index 0ccc674cb3a..aba3d8abe0e 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/CallKind.kt @@ -51,6 +51,8 @@ enum class CallKind(vararg resolutionSequence: ResolutionStage) { DiscriminateSynthetics, NoTypeArguments, CreateFreshTypeVariableSubstitutorStage, + CheckReceivers.Dispatch, + CheckReceivers.Extension, CheckCallableReferenceExpectedType ), SyntheticIdForCallableReferencesResolution( diff --git a/compiler/testData/codegen/box/callableReference/builtinFunctionReferenceOwner.kt b/compiler/testData/codegen/box/callableReference/builtinFunctionReferenceOwner.kt index 82665c10923..4e6c6dc1425 100644 --- a/compiler/testData/codegen/box/callableReference/builtinFunctionReferenceOwner.kt +++ b/compiler/testData/codegen/box/callableReference/builtinFunctionReferenceOwner.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME fun box(): String { diff --git a/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassExtensionFun.kt b/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassExtensionFun.kt index d2ae172b140..ec97a9b91a8 100644 --- a/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassExtensionFun.kt +++ b/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassExtensionFun.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME inline class Z(val x: Int) diff --git a/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassExtensionVal.kt b/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassExtensionVal.kt index b62bf3e3c8a..f2c4757e960 100644 --- a/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassExtensionVal.kt +++ b/compiler/testData/codegen/box/inlineClasses/callableReferences/boundInlineClassExtensionVal.kt @@ -1,5 +1,4 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME inline class Z(val x: Int) diff --git a/compiler/testData/codegen/box/properties/genericPropertyMultiModule.kt b/compiler/testData/codegen/box/properties/genericPropertyMultiModule.kt index 3e9088a8a50..5922a3102b6 100644 --- a/compiler/testData/codegen/box/properties/genericPropertyMultiModule.kt +++ b/compiler/testData/codegen/box/properties/genericPropertyMultiModule.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // WITH_RUNTIME // MODULE: lib // FILE: common.kt diff --git a/compiler/testData/codegen/box/reflection/methodsFromAny/functionFromStdlibSingleFileFacade.kt b/compiler/testData/codegen/box/reflection/methodsFromAny/functionFromStdlibSingleFileFacade.kt index 584eef02958..ce927cf4e20 100644 --- a/compiler/testData/codegen/box/reflection/methodsFromAny/functionFromStdlibSingleFileFacade.kt +++ b/compiler/testData/codegen/box/reflection/methodsFromAny/functionFromStdlibSingleFileFacade.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // KT-12630 KotlinReflectionInternalError on referencing some functions from stdlib diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/expressionWithNullableType.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/expressionWithNullableType.fir.kt index 90a9adae93b..2d28635fbe5 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/expressionWithNullableType.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/expressionWithNullableType.fir.kt @@ -6,10 +6,10 @@ public interface J { // FILE: test.kt -fun f1(x: Int?): Any = x::hashCode +fun f1(x: Int?): Any = x::hashCode fun f2(t: T): Any = t::hashCode fun f3(s: S): Any = s::hashCode -fun f4(u: U?): Any = u::hashCode -fun f5(c: List<*>): Any = c[0]::hashCode +fun f4(u: U?): Any = u::hashCode +fun f5(c: List<*>): Any = c[0]::hashCode fun f6(j: J): Any = j.platformString()::hashCode diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt index 554a28491c1..0004c530a0d 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax.fir.kt @@ -18,9 +18,9 @@ class Test { val List.b: Int? get() = size fun List.testCallable1(): () -> Unit = a::foo - fun List.testCallable2(): () -> Unit = b?::foo - fun List.testCallable3(): () -> Unit = b::foo - fun List.testCallable4(): () -> Unit = b?::foo + fun List.testCallable2(): () -> Unit = b?::foo + fun List.testCallable3(): () -> Unit = b::foo + fun List.testCallable4(): () -> Unit = b?::foo fun List.testClassLiteral1() = a::class fun List.testClassLiteral2() = b?::class diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax2.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax2.fir.kt index 1283a601da5..7a3f93a01f9 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax2.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax2.fir.kt @@ -4,4 +4,4 @@ package test fun nullableFun(): Int? = null fun Int.foo() {} -val test1 = nullableFun()?::foo \ No newline at end of file +val test1 = nullableFun()?::foo \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/callableReference/function/extensionInClassDisallowed.fir.kt b/compiler/testData/diagnostics/tests/callableReference/function/extensionInClassDisallowed.fir.kt index 33d81eee6f6..4362e431590 100644 --- a/compiler/testData/diagnostics/tests/callableReference/function/extensionInClassDisallowed.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/function/extensionInClassDisallowed.fir.kt @@ -4,10 +4,10 @@ class A { fun A.extA(x: String) = x fun main() { - Int::extInt + Int::extInt A::extA - eat(Int::extInt) + eat(Int::extInt) eat(A::extA) } } diff --git a/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt b/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt index 3920a8fb636..029f5682d26 100644 --- a/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/memberExtensionsImportedFromObjectsUnsupported.fir.kt @@ -15,11 +15,11 @@ class A { fun test() { String::ext - Obj::ext + Obj::ext String::ext2 - A.Companion::ext2 - A::ext2 + A.Companion::ext2 + A::ext2 A::foo A::bar