[FIR] Extract function type kind for lambda in argument position

^KT-56381 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-02-02 15:04:03 +02:00
committed by Space Team
parent e36d3c94a5
commit 791a7b1c31
4 changed files with 65 additions and 1 deletions
@@ -63,8 +63,11 @@ fun Candidate.preprocessLambdaArgument(
if (expectedType != null) {
val parameters = resolvedArgument.parameters
val functionTypeKind = context.session.functionTypeService.extractSingleSpecialKindForFunction(anonymousFunction.symbol)
?: resolvedArgument.expectedFunctionTypeKind
?: FunctionTypeKind.Function
val lambdaType = createFunctionType(
resolvedArgument.expectedFunctionTypeKind ?: FunctionTypeKind.Function,
functionTypeKind,
if (resolvedArgument.coerceFirstParameterToExtensionReceiver) parameters.drop(1) else parameters,
resolvedArgument.receiver,
resolvedArgument.returnType,