diff --git a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/ArgumentNameHints.kt b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/ArgumentNameHints.kt index 74bc66a3662..9b9c4982959 100644 --- a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/ArgumentNameHints.kt +++ b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/ArgumentNameHints.kt @@ -17,6 +17,8 @@ package org.jetbrains.kotlin.idea.parameterInfo import com.intellij.codeInsight.hints.InlayInfo +import org.jetbrains.kotlin.builtins.extractParameterNameFromFunctionTypeArgument +import org.jetbrains.kotlin.builtins.functions.FunctionInvokeDescriptor import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.idea.caches.resolve.analyze @@ -53,6 +55,11 @@ fun provideArgumentNameHints(element: KtCallElement): List { private fun getParameterInfoForCallCandidate(resolvedCall: ResolvedCall): List { return resolvedCall.valueArguments.mapNotNull { (valueParam: ValueParameterDescriptor, resolvedArg) -> + if (resolvedCall.resultingDescriptor is FunctionInvokeDescriptor && + valueParam.type.extractParameterNameFromFunctionTypeArgument() == null) { + return@mapNotNull null + } + resolvedArg.arguments.firstOrNull()?.let { arg -> arg.getArgumentExpression()?.let { argExp -> if (!arg.isNamed() && !valueParam.name.isSpecial && argExp.isUnclearExpression()) { diff --git a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/InlayParameterHintsTest.kt b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/InlayParameterHintsTest.kt index 36d2c9a6565..2c508e0cc98 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/InlayParameterHintsTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/InlayParameterHintsTest.kt @@ -160,4 +160,16 @@ annotation class ManyArgs(val name: String, val surname: String) @ManyArgs("Ilya", "Sergey") class AnnotatedMuch """) } + + fun `test functional type`() { + check(""" + fun T.test(block: (T) -> Unit) = block(this) + """) + } + + fun `test functional type with parameter name`() { + check(""" + fun T.test(block: (receiver: T, Int) -> Unit) = block(this, 0) + """) + } }