diff --git a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinFunctionParameterInfoHandler.kt b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinFunctionParameterInfoHandler.kt index c5856e9992b..c0a02ce642f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinFunctionParameterInfoHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinFunctionParameterInfoHandler.kt @@ -25,14 +25,17 @@ import com.intellij.psi.impl.source.tree.LeafPsiElement import com.intellij.psi.util.PsiTreeUtil import com.intellij.ui.Gray import com.intellij.ui.JBColor -import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.config.LanguageFeature +import org.jetbrains.kotlin.descriptors.CallableDescriptor import org.jetbrains.kotlin.descriptors.FunctionDescriptor import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor import org.jetbrains.kotlin.idea.FrontendInternals import org.jetbrains.kotlin.idea.caches.resolve.analyze import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade +import org.jetbrains.kotlin.idea.completion.canBeUsedWithoutNameInCall import org.jetbrains.kotlin.idea.core.OptionalParametersHelper import org.jetbrains.kotlin.idea.core.resolveCandidates +import org.jetbrains.kotlin.idea.project.languageVersionSettings import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.idea.resolve.frontendService import org.jetbrains.kotlin.idea.util.ShadowedDeclarationsFilter @@ -213,6 +216,9 @@ abstract class KotlinParameterInfoWithCallHandlerBase() var namedMode = false + var argumentIndex = 0 if (call.callType == Call.CallType.ARRAY_SET_METHOD) { // for set-operator the last parameter is used for the value assigned @@ -238,7 +245,9 @@ abstract class KotlinParameterInfoWithCallHandlerBase 0) { append(", ") } @@ -248,7 +257,7 @@ abstract class KotlinParameterInfoWithCallHandlerBase) + // we should not compare descriptors directly because partial resolve is involved private fun descriptorsEqual(descriptor1: FunctionDescriptor, descriptor2: FunctionDescriptor): Boolean { if (descriptor1.original == descriptor2.original) return true diff --git a/idea/testData/parameterInfo/functionCall/MixedNamedArguments.kt b/idea/testData/parameterInfo/functionCall/MixedNamedArguments.kt new file mode 100644 index 00000000000..ee42dd4f567 --- /dev/null +++ b/idea/testData/parameterInfo/functionCall/MixedNamedArguments.kt @@ -0,0 +1,12 @@ +open class A(x: Int) { + fun m(x: Boolean, y: Int) = 1 + fun m(x: Boolean, y: Int, z: Int) = 2 + + fun d(x: Int) { + m(false, y = 23) + } +} +/* +Text: (x: Boolean, [y: Int]), Disabled: false, Strikeout: false, Green: true +Text: (x: Boolean, [y: Int], z: Int), Disabled: false, Strikeout: false, Green: false +*/ \ No newline at end of file diff --git a/idea/testData/parameterInfo/functionCall/MixedNamedArguments2.kt b/idea/testData/parameterInfo/functionCall/MixedNamedArguments2.kt new file mode 100644 index 00000000000..0ce703d4ebe --- /dev/null +++ b/idea/testData/parameterInfo/functionCall/MixedNamedArguments2.kt @@ -0,0 +1,14 @@ +// COMPILER_ARGUMENTS: -XXLanguage:-MixedNamedArgumentsInTheirOwnPosition + +open class A(x: Int) { + fun m(x: Boolean, y: Int) = 1 + fun m(x: Boolean, y: Int, z: Int) = 2 + + fun d(x: Int) { + m(false, y = 23) + } +} +/* +Text: (x: Boolean, [y: Int]), Disabled: false, Strikeout: false, Green: true +Text: (x: Boolean, [y: Int], [z: Int]), Disabled: false, Strikeout: false, Green: false +*/ \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/ParameterInfoTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/ParameterInfoTestGenerated.java index be267a7693b..747b8a461be 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/ParameterInfoTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/ParameterInfoTestGenerated.java @@ -196,6 +196,16 @@ public class ParameterInfoTestGenerated extends AbstractParameterInfoTest { runTest("idea/testData/parameterInfo/functionCall/LocalFunctionBug.kt"); } + @TestMetadata("MixedNamedArguments.kt") + public void testMixedNamedArguments() throws Exception { + runTest("idea/testData/parameterInfo/functionCall/MixedNamedArguments.kt"); + } + + @TestMetadata("MixedNamedArguments2.kt") + public void testMixedNamedArguments2() throws Exception { + runTest("idea/testData/parameterInfo/functionCall/MixedNamedArguments2.kt"); + } + @TestMetadata("NamedAndDefaultParameter.kt") public void testNamedAndDefaultParameter() throws Exception { runTest("idea/testData/parameterInfo/functionCall/NamedAndDefaultParameter.kt");