diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolverParts.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolverParts.kt index c40545b3885..84f7c3b755e 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolverParts.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/calls/ResolverParts.kt @@ -233,7 +233,8 @@ internal object CheckCallableReferenceExpectedType : CheckerStage() { val resultingType: ConeKotlinType = when (fir) { is FirFunction -> createKFunctionType( fir, resultingReceiverType, returnTypeRef, - expectedParameterNumberWithReceiver = expectedType?.let { it.typeArguments.size - 1 } + expectedParameterNumberWithReceiver = expectedType?.let { it.typeArguments.size - 1 }, + isSuspend = (fir as? FirSimpleFunction)?.isSuspend == true ) is FirVariable<*> -> createKPropertyType(fir, resultingReceiverType, returnTypeRef) else -> ConeKotlinErrorType("Unknown callable kind: ${fir::class}") @@ -289,7 +290,8 @@ private fun createKFunctionType( function: FirFunction<*>, receiverType: ConeKotlinType?, returnTypeRef: FirResolvedTypeRef, - expectedParameterNumberWithReceiver: Int? + expectedParameterNumberWithReceiver: Int?, + isSuspend: Boolean ): ConeKotlinType { val parameterTypes = mutableListOf() val expectedParameterNumber = when { @@ -307,7 +309,8 @@ private fun createKFunctionType( return createFunctionalType( parameterTypes, receiverType = receiverType, rawReturnType = returnTypeRef.coneTypeSafe() ?: ConeKotlinErrorType("No type for return type of $function"), - isKFunctionType = true + isKFunctionType = true, + isSuspend = isSuspend ) } diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/genericCallableReferencesWithNullableTypes.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/genericCallableReferencesWithNullableTypes.kt index 57d6f25eea9..3f9a13de024 100644 --- a/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/genericCallableReferencesWithNullableTypes.kt +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/callableReference/function/genericCallableReferencesWithNullableTypes.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: NATIVE // WITH_REFLECT // WITH_COROUTINES diff --git a/compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt b/compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt index 4a0c545d52a..927084af868 100644 --- a/compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt +++ b/compiler/testData/codegen/box/coroutines/inlineClasses/boxReturnValueOfSuspendFunctionReference.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR // IGNORE_BACKEND: JS_IR // WITH_RUNTIME // WITH_COROUTINES diff --git a/compiler/testData/diagnostics/tests/coroutines/callableReference/outsideSuspend.fir.kt b/compiler/testData/diagnostics/tests/coroutines/callableReference/outsideSuspend.fir.kt deleted file mode 100644 index b765a7bd023..00000000000 --- a/compiler/testData/diagnostics/tests/coroutines/callableReference/outsideSuspend.fir.kt +++ /dev/null @@ -1,11 +0,0 @@ -// !CHECK_TYPE -// !LANGUAGE: +ReleaseCoroutines -// SKIP_TXT - -import kotlin.reflect.KSuspendFunction0 - -suspend fun foo() {} - -fun test() { - ::foo checkType { _>() } -} diff --git a/compiler/testData/diagnostics/tests/coroutines/callableReference/outsideSuspend.kt b/compiler/testData/diagnostics/tests/coroutines/callableReference/outsideSuspend.kt index 50d9f453c69..b65f283465e 100644 --- a/compiler/testData/diagnostics/tests/coroutines/callableReference/outsideSuspend.kt +++ b/compiler/testData/diagnostics/tests/coroutines/callableReference/outsideSuspend.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !CHECK_TYPE // !LANGUAGE: +ReleaseCoroutines // SKIP_TXT