Debugger: Fix evaluation for local extension functions (KT-13188)
This commit is contained in:
+14
-14
@@ -122,7 +122,7 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre
|
||||
val functionalTypeExpected = expectedType.isBuiltinFunctionalType()
|
||||
|
||||
// We forbid anonymous function expressions to suspend type coercion for now, until `suspend fun` syntax is supported
|
||||
val resultType = functionDescriptor.createFunctionType(suspendFunction = false)
|
||||
val resultType = functionDescriptor.createFunctionType(components.builtIns, suspendFunction = false)
|
||||
|
||||
if (components.languageVersionSettings.supportsFeature(LanguageFeature.NewInference) && functionalTypeExpected && !expectedType.isSuspendFunctionType)
|
||||
createTypeInfo(resultType, context)
|
||||
@@ -131,18 +131,6 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre
|
||||
}
|
||||
}
|
||||
|
||||
private fun SimpleFunctionDescriptor.createFunctionType(suspendFunction: Boolean = false): KotlinType? {
|
||||
return createFunctionType(
|
||||
components.builtIns,
|
||||
Annotations.EMPTY,
|
||||
extensionReceiverParameter?.type,
|
||||
valueParameters.map { it.type },
|
||||
null,
|
||||
returnType ?: return null,
|
||||
suspendFunction = suspendFunction
|
||||
)
|
||||
}
|
||||
|
||||
override fun visitLambdaExpression(expression: KtLambdaExpression, context: ExpressionTypingContext): KotlinTypeInfo? {
|
||||
checkReservedYieldBeforeLambda(expression, context.trace)
|
||||
if (!expression.functionLiteral.hasBody()) return null
|
||||
@@ -159,7 +147,7 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre
|
||||
val safeReturnType = computeReturnType(expression, context, functionDescriptor, functionTypeExpected)
|
||||
functionDescriptor.setReturnType(safeReturnType)
|
||||
|
||||
val resultType = functionDescriptor.createFunctionType(suspendFunctionTypeExpected)!!
|
||||
val resultType = functionDescriptor.createFunctionType(components.builtIns, suspendFunctionTypeExpected)!!
|
||||
if (functionTypeExpected) {
|
||||
// all checks were done before
|
||||
return createTypeInfo(resultType, context)
|
||||
@@ -365,3 +353,15 @@ internal class FunctionsTypingVisitor(facade: ExpressionTypingInternals) : Expre
|
||||
return returns
|
||||
}
|
||||
}
|
||||
|
||||
fun SimpleFunctionDescriptor.createFunctionType(builtIns: KotlinBuiltIns, suspendFunction: Boolean = false): KotlinType? {
|
||||
return createFunctionType(
|
||||
builtIns,
|
||||
Annotations.EMPTY,
|
||||
extensionReceiverParameter?.type,
|
||||
valueParameters.map { it.type },
|
||||
null,
|
||||
returnType ?: return null,
|
||||
suspendFunction = suspendFunction
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user