From ab41641a1906a4678f5b176e33d2f7ceb9e096f1 Mon Sep 17 00:00:00 2001 From: Valentin Kipyatkov Date: Tue, 6 Oct 2015 15:21:21 +0300 Subject: [PATCH] KT-8794 Parameter Information should work in index expression #KT-8794 Fixed --- .../kotlin/resolve/calls/CallResolver.java | 9 + .../kotlin/generators/tests/GenerateTests.kt | 6 +- idea/src/META-INF/plugin.xml | 1 + .../KotlinFunctionParameterInfoHandler.kt | 403 ++++++++++-------- .../parameterInfo/arrayAccess/Overloads.kt | 12 + .../parameterInfo/arrayAccess/Overloads2.kt | 14 + .../testData/parameterInfo/arrayAccess/Set.kt | 12 + .../arrayAccess/SetTooManyArgs.kt | 12 + .../parameterInfo/arrayAccess/Simple.kt | 9 + .../DefaultValuesFromLib.kt | 0 .../Deprecated.kt | 0 .../ExtensionOnClassObject.kt | 0 .../FunctionalValue1.kt | 0 .../FunctionalValue2.kt | 0 .../InheritedFunctions.kt | 0 .../InheritedWithCurrentFunctions.kt | 0 .../Invoke.kt | 0 .../LocalFunctionBug.kt | 0 .../NamedAndDefaultParameter.kt | 0 .../NamedParameter.kt | 0 .../NamedParameter2.kt | 0 .../NoAnnotations.kt | 0 .../NotAccessible.kt | 0 .../NotGreen.kt | 0 .../NullableTypeCall.kt | 0 .../Println.kt | 0 .../Simple.kt | 0 .../SimpleConstructor.kt | 0 .../SubstituteExpectedType.kt | 0 .../SubstituteExplicitTypeArgs.kt | 0 .../SubstituteFromArguments1.kt | 0 .../SubstituteFromArguments2.kt | 0 .../SubstituteFromArguments3.kt | 0 .../SubstituteFromArguments4.kt | 0 .../SubstituteFromArgumentsOnTyping.kt | 0 .../SuperConstructorCall.kt | 0 .../parameterInfo/functionCall/TooManyArgs.kt | 8 + .../TwoFunctions.kt | 0 .../TwoFunctionsGrey.kt | 0 .../UpdateOnTyping.kt | 0 ...foTest.kt => AbstractParameterInfoTest.kt} | 23 +- .../FunctionParameterInfoTestGenerated.java | 217 ---------- .../MockParameterInfoUIContext.java | 2 +- .../ParameterInfoTestGenerated.java | 271 ++++++++++++ 44 files changed, 585 insertions(+), 414 deletions(-) create mode 100644 idea/testData/parameterInfo/arrayAccess/Overloads.kt create mode 100644 idea/testData/parameterInfo/arrayAccess/Overloads2.kt create mode 100644 idea/testData/parameterInfo/arrayAccess/Set.kt create mode 100644 idea/testData/parameterInfo/arrayAccess/SetTooManyArgs.kt create mode 100644 idea/testData/parameterInfo/arrayAccess/Simple.kt rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/DefaultValuesFromLib.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/Deprecated.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/ExtensionOnClassObject.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/FunctionalValue1.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/FunctionalValue2.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/InheritedFunctions.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/InheritedWithCurrentFunctions.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/Invoke.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/LocalFunctionBug.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/NamedAndDefaultParameter.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/NamedParameter.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/NamedParameter2.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/NoAnnotations.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/NotAccessible.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/NotGreen.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/NullableTypeCall.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/Println.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/Simple.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/SimpleConstructor.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/SubstituteExpectedType.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/SubstituteExplicitTypeArgs.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/SubstituteFromArguments1.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/SubstituteFromArguments2.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/SubstituteFromArguments3.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/SubstituteFromArguments4.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/SubstituteFromArgumentsOnTyping.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/SuperConstructorCall.kt (100%) create mode 100644 idea/testData/parameterInfo/functionCall/TooManyArgs.kt rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/TwoFunctions.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/TwoFunctionsGrey.kt (100%) rename idea/testData/parameterInfo/{functionParameterInfo => functionCall}/UpdateOnTyping.kt (100%) rename idea/tests/org/jetbrains/kotlin/idea/parameterInfo/{AbstractFunctionParameterInfoTest.kt => AbstractParameterInfoTest.kt} (75%) delete mode 100644 idea/tests/org/jetbrains/kotlin/idea/parameterInfo/FunctionParameterInfoTestGenerated.java create mode 100644 idea/tests/org/jetbrains/kotlin/idea/parameterInfo/ParameterInfoTestGenerated.java diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java index 834c072186f..252fbc2efca 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/CallResolver.java @@ -280,6 +280,15 @@ public class CallResolver { public OverloadResolutionResults resolveFunctionCall(@NotNull BasicCallResolutionContext context) { ProgressIndicatorAndCompilationCanceledStatus.checkCanceled(); + Call.CallType callType = context.call.getCallType(); + if (callType == Call.CallType.ARRAY_GET_METHOD || callType == Call.CallType.ARRAY_SET_METHOD) { + Name name = Name.identifier(callType == Call.CallType.ARRAY_GET_METHOD ? "get" : "set"); + JetArrayAccessExpression arrayAccessExpression = (JetArrayAccessExpression) context.call.getCallElement(); + return computeTasksAndResolveCall( + context, name, arrayAccessExpression, + CallableDescriptorCollectors.FUNCTIONS_AND_VARIABLES, CallTransformer.FUNCTION_CALL_TRANSFORMER); + } + JetExpression calleeExpression = context.call.getCalleeExpression(); if (calleeExpression instanceof JetSimpleNameExpression) { JetSimpleNameExpression expression = (JetSimpleNameExpression) calleeExpression; diff --git a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt index 2bae7f5f4f0..48e12581573 100644 --- a/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt +++ b/generators/src/org/jetbrains/kotlin/generators/tests/GenerateTests.kt @@ -79,7 +79,7 @@ import org.jetbrains.kotlin.idea.kdoc.AbstractKDocTypingTest import org.jetbrains.kotlin.idea.navigation.AbstractGotoSuperTest import org.jetbrains.kotlin.idea.navigation.AbstractKotlinGotoImplementationTest import org.jetbrains.kotlin.idea.navigation.AbstractKotlinGotoTest -import org.jetbrains.kotlin.idea.parameterInfo.AbstractFunctionParameterInfoTest +import org.jetbrains.kotlin.idea.parameterInfo.AbstractParameterInfoTest import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixMultiFileTest import org.jetbrains.kotlin.idea.quickfix.AbstractQuickFixTest import org.jetbrains.kotlin.idea.refactoring.inline.AbstractInlineTest @@ -392,8 +392,8 @@ fun main(args: Array) { model("navigation/gotoSuper", extension = "test") } - testClass() { - model("parameterInfo/functionParameterInfo") + testClass() { + model("parameterInfo", recursive = true) } testClass() { diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index c433c448f75..3551c81cc6e 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -341,6 +341,7 @@ + diff --git a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinFunctionParameterInfoHandler.kt b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinFunctionParameterInfoHandler.kt index 6082f113dfd..2931d6e9c1f 100644 --- a/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinFunctionParameterInfoHandler.kt +++ b/idea/src/org/jetbrains/kotlin/idea/parameterInfo/KotlinFunctionParameterInfoHandler.kt @@ -21,6 +21,7 @@ import com.intellij.codeInsight.lookup.LookupElement import com.intellij.lang.parameterInfo.* import com.intellij.openapi.project.Project 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 @@ -35,7 +36,10 @@ import org.jetbrains.kotlin.idea.resolve.ResolutionFacade import org.jetbrains.kotlin.idea.resolve.frontendService import org.jetbrains.kotlin.lexer.JetTokens import org.jetbrains.kotlin.psi.* -import org.jetbrains.kotlin.psi.psiUtil.* +import org.jetbrains.kotlin.psi.psiUtil.allChildren +import org.jetbrains.kotlin.psi.psiUtil.getQualifiedExpressionForSelectorOrThis +import org.jetbrains.kotlin.psi.psiUtil.parents +import org.jetbrains.kotlin.psi.psiUtil.startOffset import org.jetbrains.kotlin.renderer.DescriptorRenderer import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.DelegatingBindingTrace @@ -61,36 +65,69 @@ import org.jetbrains.kotlin.types.expressions.ExpressionTypingUtils import org.jetbrains.kotlin.types.typeUtil.containsError import java.awt.Color import java.util.* +import kotlin.reflect.KClass -class KotlinFunctionParameterInfoHandler : ParameterInfoHandlerWithTabActionSupport { - +class KotlinFunctionParameterInfoHandler : KotlinParameterInfoWithCallHandlerBase(JetValueArgumentList::class, JetValueArgument::class) { override fun getActualParameters(arguments: JetValueArgumentList) = arguments.arguments.toTypedArray() - override fun getActualParameterDelimiterType() = JetTokens.COMMA - override fun getActualParametersRBraceType() = JetTokens.RPAR override fun getArgumentListAllowedParentClasses() = setOf(JetCallElement::class.java) +} + +class KotlinArrayAccessParameterInfoHandler : KotlinParameterInfoWithCallHandlerBase(JetContainerNode::class, JetExpression::class) { + override fun getArgumentListAllowedParentClasses() = setOf(JetArrayAccessExpression::class.java) + + override fun getActualParameters(containerNode: JetContainerNode): Array = containerNode.allChildren.filterIsInstance().toList().toTypedArray() + + override fun getActualParametersRBraceType() = JetTokens.RBRACKET +} + +abstract class KotlinParameterInfoWithCallHandlerBase( + private val argumentListClass: KClass, + private val argumentClass: KClass +) : ParameterInfoHandlerWithTabActionSupport { + + companion object { + val GREEN_BACKGROUND: Color = JBColor(Color(231, 254, 234), Gray._100) + } + + private fun findCall(argumentList: TArgumentList, bindingContext: BindingContext): Call? { + return (argumentList.parent as JetElement).getCall(bindingContext) + } + + override fun getActualParameterDelimiterType() = JetTokens.COMMA override fun getArgListStopSearchClasses() = setOf(JetNamedFunction::class.java, JetVariableDeclaration::class.java) - override fun getArgumentListClass() = JetValueArgumentList::class.java + override fun getArgumentListClass() = argumentListClass.java - override fun couldShowInLookup() = true + override fun showParameterInfo(element: TArgumentList, context: CreateParameterInfoContext) { + context.showHint(element, element.textRange.startOffset, this) + } - override fun getParametersForLookup(item: LookupElement, context: ParameterInfoContext) = emptyArray() //todo: ? + override fun findElementForUpdatingParameterInfo(context: UpdateParameterInfoContext): TArgumentList? { + val element = context.file.findElementAt(context.offset) ?: return null + val argumentList = PsiTreeUtil.getParentOfType(element, argumentListClass.java) ?: return null + val argument = element.parents.takeWhile { it != argumentList }.lastOrNull() + if (argument != null && !argumentClass.java.isInstance(argument)) { + val arguments = getActualParameters(argumentList) + val index = arguments.indexOf(element) + context.setCurrentParameter(index) + context.setHighlightedParameter(element) + } + return argumentList + } - override fun getParametersForDocumentation(item: FunctionDescriptor, context: ParameterInfoContext) = emptyArray() //todo: ? - - override fun findElementForParameterInfo(context: CreateParameterInfoContext): JetValueArgumentList? { + override fun findElementForParameterInfo(context: CreateParameterInfoContext): TArgumentList? { //todo: calls to this constructors, when we will have auxiliary constructors val file = context.file as? JetFile ?: return null - val argumentList = file.findElementAt(context.offset)?.getStrictParentOfType() ?: return null + val token = file.findElementAt(context.offset) ?: return null + val argumentList = PsiTreeUtil.getParentOfType(token, argumentListClass.java) ?: return null - val callElement = argumentList.parent as? JetCallElement ?: return null - val bindingContext = callElement.analyze(BodyResolveMode.PARTIAL) - val call = callElement.getCall(bindingContext) ?: return null + val bindingContext = argumentList.analyze(BodyResolveMode.PARTIAL) + val call = findCall(argumentList, bindingContext) ?: return null val candidates = detectCandidates(call, bindingContext, file.getResolutionFacade()) @@ -98,23 +135,7 @@ class KotlinFunctionParameterInfoHandler : ParameterInfoHandlerWithTabActionSupp return argumentList } - override fun showParameterInfo(element: JetValueArgumentList, context: CreateParameterInfoContext) { - context.showHint(element, element.textRange.startOffset, this) - } - - override fun findElementForUpdatingParameterInfo(context: UpdateParameterInfoContext): JetValueArgumentList? { - val element = context.file.findElementAt(context.offset) ?: return null - val argumentList = element.getStrictParentOfType() ?: return null - val argument = element.parents.takeWhile { it != argumentList }.lastOrNull() as? JetValueArgument - if (argument != null) { - val index = argumentList.arguments.indexOf(element) - context.setCurrentParameter(index) - context.setHighlightedParameter(element) - } - return argumentList - } - - override fun updateParameterInfo(argumentList: JetValueArgumentList, context: UpdateParameterInfoContext) { + override fun updateParameterInfo(argumentList: TArgumentList, context: UpdateParameterInfoContext) { if (context.parameterOwner !== argumentList) { context.removeHint() } @@ -126,10 +147,6 @@ class KotlinFunctionParameterInfoHandler : ParameterInfoHandlerWithTabActionSupp context.setCurrentParameter(parameterIndex) } - override fun getParameterCloseChars() = ParameterInfoUtils.DEFAULT_PARAMETER_CLOSE_CHARS - - override fun tracksParameterIndex() = true - override fun updateUI(itemToShow: FunctionDescriptor, context: ParameterInfoUIContext) { if (!updateUIOrFail(itemToShow, context)) { context.isUIComponentEnabled = false @@ -138,22 +155,21 @@ class KotlinFunctionParameterInfoHandler : ParameterInfoHandlerWithTabActionSupp } private fun updateUIOrFail(itemToShow: FunctionDescriptor, context: ParameterInfoUIContext): Boolean { - //todo: when we will have ability to pass Array as vararg, implement such feature here too? if (context.parameterOwner == null || !context.parameterOwner.isValid) return false + if (!argumentListClass.java.isInstance(context.parameterOwner)) return false + @Suppress("UNCHECKED_CAST") + val argumentList = context.parameterOwner as TArgumentList - val argumentList = context.parameterOwner as? JetValueArgumentList ?: return false + val currentArgumentIndex = context.currentParameterIndex + if (currentArgumentIndex < 0) return false // by some strange reason we are invoked with currentParameterIndex == -1 during initialization val bindingContext = argumentList.analyze(BodyResolveMode.PARTIAL) - val callElement = argumentList.parent as? JetCallElement ?: return false - val call = callElement.getCall(bindingContext) ?: return false + val call = findCall(argumentList, bindingContext) ?: return false - val project = callElement.project - - val currentParameterIndex = context.currentParameterIndex - if (currentParameterIndex < 0) return false // by some strange reason we are invoked with currentParameterIndex == -1 during initialization + val project = argumentList.project val (substitutedDescriptor, argumentToParameter, highlightParameterIndex, isGrey) = matchCallWithSignature( - call, itemToShow, currentParameterIndex, bindingContext, argumentList.getResolutionFacade() + call, itemToShow, currentArgumentIndex, bindingContext, argumentList.getResolutionFacade() ) ?: return false var boldStartOffset = -1 @@ -162,6 +178,11 @@ class KotlinFunctionParameterInfoHandler : ParameterInfoHandlerWithTabActionSupp val usedParameterIndices = HashSet() var namedMode = false + if (call.callType == Call.CallType.ARRAY_SET_METHOD) { + // for set-operator the last parameter is used for the value assigned + usedParameterIndices.add(substitutedDescriptor.valueParameters.lastIndex) + } + fun appendParameter(parameter: ValueParameterDescriptor) { if (length() > 0) { append(", ") @@ -179,7 +200,8 @@ class KotlinFunctionParameterInfoHandler : ParameterInfoHandlerWithTabActionSupp } } - for (argument in argumentList.arguments) { + for (argument in call.valueArguments) { + if (argument is FunctionLiteralArgument) continue val parameter = argumentToParameter(argument) ?: continue if (!usedParameterIndices.add(parameter.index)) continue @@ -203,7 +225,7 @@ class KotlinFunctionParameterInfoHandler : ParameterInfoHandlerWithTabActionSupp val color = if (isResolvedToDescriptor(call, itemToShow, bindingContext)) - GREEN_BACKGROUND + KotlinParameterInfoWithCallHandlerBase.GREEN_BACKGROUND else context.defaultParameterColor @@ -214,169 +236,178 @@ class KotlinFunctionParameterInfoHandler : ParameterInfoHandlerWithTabActionSupp return true } - companion object { - val GREEN_BACKGROUND: Color = JBColor(Color(231, 254, 234), Gray._100) + override fun getParameterCloseChars() = ParameterInfoUtils.DEFAULT_PARAMETER_CLOSE_CHARS - private fun renderParameter(parameter: ValueParameterDescriptor, named: Boolean, project: Project): String { - return StringBuilder { - if (named) append("[") + override fun tracksParameterIndex() = true - if (parameter.varargElementType != null) { - append("vararg ") - } - append(parameter.name) - append(": ") - append(DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(parameterTypeToRender(parameter))) + //TODO + override fun couldShowInLookup() = false + override fun getParametersForLookup(item: LookupElement, context: ParameterInfoContext) = emptyArray() + override fun getParametersForDocumentation(item: FunctionDescriptor, context: ParameterInfoContext) = emptyArray() - if (parameter.hasDefaultValue()) { - append(" = ") - append(parameter.renderDefaultValue(project)) - } + protected fun renderParameter(parameter: ValueParameterDescriptor, named: Boolean, project: Project): String { + return StringBuilder { + if (named) append("[") - if (named) append("]") - }.toString() - } - - private fun ValueParameterDescriptor.renderDefaultValue(project: Project): String { - val expression = OptionalParametersHelper.defaultParameterValueExpression(this, project) - if (expression != null) { - val text = expression.text - if (text.length() <= 32) { - return text - } - - if (expression is JetConstantExpression || expression is JetStringTemplateExpression) { - if (text.startsWith("\"")) { - return "\"...\"" - } - else if (text.startsWith("\'")) { - return "\'...\'" - } - } + if (parameter.varargElementType != null) { + append("vararg ") } - return "..." - } + append(parameter.name) + append(": ") + append(DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(parameterTypeToRender(parameter))) - private fun parameterTypeToRender(descriptor: ValueParameterDescriptor): JetType { - var type = descriptor.varargElementType ?: descriptor.type - if (type.containsError()) { - val original = descriptor.original - type = original.varargElementType ?: original.type - } - return type - } - - private fun isResolvedToDescriptor( - call: Call, - functionDescriptor: FunctionDescriptor, - bindingContext: BindingContext - ): Boolean { - val target = call.getResolvedCall(bindingContext)?.resultingDescriptor as? FunctionDescriptor - return target != null && descriptorsEqual(target, functionDescriptor) - } - - private data class SignatureInfo( - val substitutedDescriptor: FunctionDescriptor, - val argumentToParameter: (ValueArgument) -> ValueParameterDescriptor?, - val highlightParameterIndex: Int?, - val isGrey: Boolean - ) - - private fun matchCallWithSignature( - call: Call, - overload: FunctionDescriptor, - currentArgumentIndex: Int, - bindingContext: BindingContext, - resolutionFacade: ResolutionFacade - ): SignatureInfo? { - if (currentArgumentIndex == 0 && call.valueArguments.isEmpty() && overload.valueParameters.isEmpty()) { - return SignatureInfo(overload, { null }, null, isGrey = false) + if (parameter.hasDefaultValue()) { + append(" = ") + append(parameter.renderDefaultValue(project)) } - assert(call.valueArguments.size() >= currentArgumentIndex) + if (named) append("]") + }.toString() + } - val argumentsBeforeCurrent = call.valueArguments.subList(0, currentArgumentIndex) - - val callToUse: Call - val currentArgument: ValueArgument - if (call.valueArguments.size() > currentArgumentIndex) { - currentArgument = call.valueArguments[currentArgumentIndex] - callToUse = call + private fun ValueParameterDescriptor.renderDefaultValue(project: Project): String { + val expression = OptionalParametersHelper.defaultParameterValueExpression(this, project) + if (expression != null) { + val text = expression.text + if (text.length() <= 32) { + return text } - else { - // add dummy current argument if we don't have one - currentArgument = object : ValueArgument { - override fun getArgumentExpression(): JetExpression? = null - override fun getArgumentName(): ValueArgumentName? = null - override fun isNamed(): Boolean = false - override fun asElement(): JetElement = call.callElement // is a hack but what to do? - override fun getSpreadElement(): LeafPsiElement? = null - override fun isExternal() = false - } - callToUse = object : DelegatingCall(call) { - val arguments = call.valueArguments + currentArgument - override fun getValueArguments() = arguments - override fun getFunctionLiteralArguments() = emptyList() - override fun getValueArgumentList() = null + if (expression is JetConstantExpression || expression is JetStringTemplateExpression) { + if (text.startsWith("\"")) { + return "\"...\"" + } + else if (text.startsWith("\'")) { + return "\'...\'" } } + } + return "..." + } - val candidates = detectCandidates(callToUse, bindingContext, resolutionFacade) - val resolvedCall = candidates.singleOrNull { descriptorsEqual(it.resultingDescriptor, overload) } ?: return null - val resultingDescriptor = resolvedCall.resultingDescriptor + private fun parameterTypeToRender(descriptor: ValueParameterDescriptor): JetType { + var type = descriptor.varargElementType ?: descriptor.type + if (type.containsError()) { + val original = descriptor.original + type = original.varargElementType ?: original.type + } + return type + } - val argumentToParameter = { argument: ValueArgument -> (resolvedCall.getArgumentMapping(argument) as? ArgumentMatch)?.valueParameter } + protected fun isResolvedToDescriptor( + call: Call, + functionDescriptor: FunctionDescriptor, + bindingContext: BindingContext + ): Boolean { + val target = call.getResolvedCall(bindingContext)?.resultingDescriptor as? FunctionDescriptor + return target != null && descriptorsEqual(target, functionDescriptor) + } - val currentParameter = (resolvedCall.getArgumentMapping(currentArgument) as? ArgumentMatch)?.valueParameter - val highlightParameterIndex = currentParameter?.index + protected data class SignatureInfo( + val substitutedDescriptor: FunctionDescriptor, + val argumentToParameter: (ValueArgument) -> ValueParameterDescriptor?, + val highlightParameterIndex: Int?, + val isGrey: Boolean + ) - if (!(argumentsBeforeCurrent + currentArgument).all { argument -> resolvedCall.getArgumentMapping(argument) is ArgumentMatch }) { // some of arguments before the current one are not mapped to any of the parameters - return SignatureInfo(resultingDescriptor, argumentToParameter, highlightParameterIndex, isGrey = true) + private fun matchCallWithSignature( + call: Call, + overload: FunctionDescriptor, + currentArgumentIndex: Int, + bindingContext: BindingContext, + resolutionFacade: ResolutionFacade + ): SignatureInfo? { + if (currentArgumentIndex == 0 && call.valueArguments.isEmpty() && overload.valueParameters.isEmpty()) { + return SignatureInfo(overload, { null }, null, isGrey = false) + } + + assert(call.valueArguments.size() >= currentArgumentIndex) + + val argumentsBeforeCurrent = call.valueArguments.subList(0, currentArgumentIndex) + + val callToUse: Call + val currentArgument: ValueArgument + if (call.valueArguments.size() > currentArgumentIndex) { + currentArgument = call.valueArguments[currentArgumentIndex] + callToUse = call + } + else { + // add dummy current argument if we don't have one + currentArgument = object : ValueArgument { + override fun getArgumentExpression(): JetExpression? = null + override fun getArgumentName(): ValueArgumentName? = null + override fun isNamed(): Boolean = false + override fun asElement(): JetElement = call.callElement // is a hack but what to do? + override fun getSpreadElement(): LeafPsiElement? = null + override fun isExternal() = false } + callToUse = object : DelegatingCall(call) { + val arguments = call.valueArguments + currentArgument - // grey out if not all arguments before the current are matched - val isGrey = argumentsBeforeCurrent - .any { argument -> resolvedCall.getArgumentMapping(argument).isError() && !argument.hasError(bindingContext) /* ignore arguments that has error type */ } - return SignatureInfo(resultingDescriptor, argumentToParameter, highlightParameterIndex, isGrey) + override fun getValueArguments() = arguments + override fun getFunctionLiteralArguments() = emptyList() + override fun getValueArgumentList() = null + } } - private fun ValueArgument.hasError(bindingContext: BindingContext) - = getArgumentExpression()?.let { bindingContext.getType(it) }?.isError ?: true + val candidates = detectCandidates(callToUse, bindingContext, resolutionFacade) + val resolvedCall = candidates.singleOrNull { descriptorsEqual(it.resultingDescriptor, overload) } ?: return null + val resultingDescriptor = resolvedCall.resultingDescriptor - private fun detectCandidates(call: Call, bindingContext: BindingContext, resolutionFacade: ResolutionFacade): List> { - val callElement = call.callElement - val resolutionScope = callElement.getResolutionScope(bindingContext, resolutionFacade) - val inDescriptor = resolutionScope.ownerDescriptor - - val dataFlowInfo = bindingContext.getDataFlowInfo(call.calleeExpression) - val bindingTrace = DelegatingBindingTrace(bindingContext, "Temporary trace") - val expectedType = (callElement as? JetExpression)?.let { - bindingContext[BindingContext.EXPECTED_EXPRESSION_TYPE, it.getQualifiedExpressionForSelectorOrThis()] - } ?: TypeUtils.NO_EXPECTED_TYPE - val callResolutionContext = BasicCallResolutionContext.create( - bindingTrace, resolutionScope, call, expectedType, dataFlowInfo, - ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS, - CallChecker.DoNothing, false/*TODO?*/ - ).replaceCollectAllCandidates(true) - val callResolver = resolutionFacade.frontendService() - - val results: OverloadResolutionResults = callResolver.resolveFunctionCall(callResolutionContext) - - return results.allCandidates!! - .filter { it.status != ResolutionStatus.RECEIVER_TYPE_ERROR && it.status != ResolutionStatus.RECEIVER_PRESENCE_ERROR } - .filter { - val thisReceiver = ExpressionTypingUtils.normalizeReceiverValueForVisibility(it.dispatchReceiver, bindingContext) - Visibilities.isVisible(thisReceiver, it.resultingDescriptor, inDescriptor) - } + fun argumentToParameter(argument: ValueArgument): ValueParameterDescriptor? { + val parameter = (resolvedCall.getArgumentMapping(argument) as? ArgumentMatch)?.valueParameter ?: return null + if (call.callType == Call.CallType.ARRAY_SET_METHOD && parameter.index == resultingDescriptor.valueParameters.lastIndex) return null + return parameter } - // 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 - val declaration1 = DescriptorToSourceUtils.descriptorToDeclaration(descriptor1) ?: return false - val declaration2 = DescriptorToSourceUtils.descriptorToDeclaration(descriptor2) - return declaration1 == declaration2 + val highlightParameterIndex = argumentToParameter(currentArgument)?.index + + if (!(argumentsBeforeCurrent + currentArgument).all { argumentToParameter(it) != null }) { // some of arguments before the current one are not mapped to any of the parameters + return SignatureInfo(resultingDescriptor, ::argumentToParameter, highlightParameterIndex, isGrey = true) } + + // grey out if not all arguments before the current are matched + val isGrey = argumentsBeforeCurrent + .any { argument -> resolvedCall.getArgumentMapping(argument).isError() && !argument.hasError(bindingContext) /* ignore arguments that has error type */ } + return SignatureInfo(resultingDescriptor, ::argumentToParameter, highlightParameterIndex, isGrey) + } + + private fun ValueArgument.hasError(bindingContext: BindingContext) + = getArgumentExpression()?.let { bindingContext.getType(it) }?.isError ?: true + + private fun detectCandidates(call: Call, bindingContext: BindingContext, resolutionFacade: ResolutionFacade): List> { + val callElement = call.callElement + val resolutionScope = callElement.getResolutionScope(bindingContext, resolutionFacade) + val inDescriptor = resolutionScope.ownerDescriptor + + val dataFlowInfo = bindingContext.getDataFlowInfo(call.calleeExpression) + val bindingTrace = DelegatingBindingTrace(bindingContext, "Temporary trace") + val expectedType = (callElement as? JetExpression)?.let { + bindingContext[BindingContext.EXPECTED_EXPRESSION_TYPE, it.getQualifiedExpressionForSelectorOrThis()] + } ?: TypeUtils.NO_EXPECTED_TYPE + val callResolutionContext = BasicCallResolutionContext.create( + bindingTrace, resolutionScope, call, expectedType, dataFlowInfo, + ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS, + CallChecker.DoNothing, false/*TODO?*/ + ).replaceCollectAllCandidates(true) + val callResolver = resolutionFacade.frontendService() + + val results: OverloadResolutionResults = callResolver.resolveFunctionCall(callResolutionContext) + + return results.allCandidates!! + .filter { it.status != ResolutionStatus.RECEIVER_TYPE_ERROR && it.status != ResolutionStatus.RECEIVER_PRESENCE_ERROR } + .filter { + val thisReceiver = ExpressionTypingUtils.normalizeReceiverValueForVisibility(it.dispatchReceiver, bindingContext) + Visibilities.isVisible(thisReceiver, it.resultingDescriptor, inDescriptor) + } + .distinctBy { it.resultingDescriptor.original } + } + + // 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 + val declaration1 = DescriptorToSourceUtils.descriptorToDeclaration(descriptor1) ?: return false + val declaration2 = DescriptorToSourceUtils.descriptorToDeclaration(descriptor2) + return declaration1 == declaration2 } } diff --git a/idea/testData/parameterInfo/arrayAccess/Overloads.kt b/idea/testData/parameterInfo/arrayAccess/Overloads.kt new file mode 100644 index 00000000000..f20772c3c04 --- /dev/null +++ b/idea/testData/parameterInfo/arrayAccess/Overloads.kt @@ -0,0 +1,12 @@ +class A { + operator fun get(x: String) = 1 + operator fun get(x: Int, y: Boolean) = 2 + + fun d(x: Int) { + this[1, false] + } +} +/* +Text: (x: Int, y: Boolean), Disabled: false, Strikeout: false, Green: true +Text: (x: String), Disabled: false, Strikeout: false, Green: false +*/ \ No newline at end of file diff --git a/idea/testData/parameterInfo/arrayAccess/Overloads2.kt b/idea/testData/parameterInfo/arrayAccess/Overloads2.kt new file mode 100644 index 00000000000..cdbc50388b2 --- /dev/null +++ b/idea/testData/parameterInfo/arrayAccess/Overloads2.kt @@ -0,0 +1,14 @@ +class A { + operator fun get(x: String) = 1 + operator fun get(x: String, y: Boolean) = 2 + operator fun get(x: Int, y: Boolean) = 2 + + fun d(x: Int) { + this[1, false] + } +} +/* +Text: (x: Int, y: Boolean), Disabled: false, Strikeout: false, Green: true +Text: (x: String), Disabled: true, Strikeout: false, Green: false +Text: (x: String, y: Boolean), Disabled: true, Strikeout: false, Green: false +*/ \ No newline at end of file diff --git a/idea/testData/parameterInfo/arrayAccess/Set.kt b/idea/testData/parameterInfo/arrayAccess/Set.kt new file mode 100644 index 00000000000..0f0c09cb12e --- /dev/null +++ b/idea/testData/parameterInfo/arrayAccess/Set.kt @@ -0,0 +1,12 @@ +class A { + operator fun get(x: Int) {} + operator fun set(x: String, y: Int, value: Int) {} + + fun d(x: Int) { + this[] = 1 + } +} + +/* +Text: (x: String, y: Int), Disabled: false, Strikeout: false, Green: true +*/ diff --git a/idea/testData/parameterInfo/arrayAccess/SetTooManyArgs.kt b/idea/testData/parameterInfo/arrayAccess/SetTooManyArgs.kt new file mode 100644 index 00000000000..25391281b9a --- /dev/null +++ b/idea/testData/parameterInfo/arrayAccess/SetTooManyArgs.kt @@ -0,0 +1,12 @@ +class A { + operator fun get(x: Int) {} + operator fun set(x: String, value: Int) {} + + fun d(x: Int) { + this["", 1] = 1 + } +} + +/* +Text: (x: String), Disabled: true, Strikeout: false, Green: true +*/ diff --git a/idea/testData/parameterInfo/arrayAccess/Simple.kt b/idea/testData/parameterInfo/arrayAccess/Simple.kt new file mode 100644 index 00000000000..cff806a4626 --- /dev/null +++ b/idea/testData/parameterInfo/arrayAccess/Simple.kt @@ -0,0 +1,9 @@ +class C { + operator fun get(pInt: Int, pString: String){} +} + +fun foo(c: C) { + c[] +} + +//Text: (pInt: Int, pString: String), Disabled: false, Strikeout: false, Green: true \ No newline at end of file diff --git a/idea/testData/parameterInfo/functionParameterInfo/DefaultValuesFromLib.kt b/idea/testData/parameterInfo/functionCall/DefaultValuesFromLib.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/DefaultValuesFromLib.kt rename to idea/testData/parameterInfo/functionCall/DefaultValuesFromLib.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/Deprecated.kt b/idea/testData/parameterInfo/functionCall/Deprecated.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/Deprecated.kt rename to idea/testData/parameterInfo/functionCall/Deprecated.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/ExtensionOnClassObject.kt b/idea/testData/parameterInfo/functionCall/ExtensionOnClassObject.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/ExtensionOnClassObject.kt rename to idea/testData/parameterInfo/functionCall/ExtensionOnClassObject.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/FunctionalValue1.kt b/idea/testData/parameterInfo/functionCall/FunctionalValue1.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/FunctionalValue1.kt rename to idea/testData/parameterInfo/functionCall/FunctionalValue1.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/FunctionalValue2.kt b/idea/testData/parameterInfo/functionCall/FunctionalValue2.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/FunctionalValue2.kt rename to idea/testData/parameterInfo/functionCall/FunctionalValue2.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/InheritedFunctions.kt b/idea/testData/parameterInfo/functionCall/InheritedFunctions.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/InheritedFunctions.kt rename to idea/testData/parameterInfo/functionCall/InheritedFunctions.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/InheritedWithCurrentFunctions.kt b/idea/testData/parameterInfo/functionCall/InheritedWithCurrentFunctions.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/InheritedWithCurrentFunctions.kt rename to idea/testData/parameterInfo/functionCall/InheritedWithCurrentFunctions.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/Invoke.kt b/idea/testData/parameterInfo/functionCall/Invoke.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/Invoke.kt rename to idea/testData/parameterInfo/functionCall/Invoke.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/LocalFunctionBug.kt b/idea/testData/parameterInfo/functionCall/LocalFunctionBug.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/LocalFunctionBug.kt rename to idea/testData/parameterInfo/functionCall/LocalFunctionBug.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/NamedAndDefaultParameter.kt b/idea/testData/parameterInfo/functionCall/NamedAndDefaultParameter.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/NamedAndDefaultParameter.kt rename to idea/testData/parameterInfo/functionCall/NamedAndDefaultParameter.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/NamedParameter.kt b/idea/testData/parameterInfo/functionCall/NamedParameter.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/NamedParameter.kt rename to idea/testData/parameterInfo/functionCall/NamedParameter.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/NamedParameter2.kt b/idea/testData/parameterInfo/functionCall/NamedParameter2.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/NamedParameter2.kt rename to idea/testData/parameterInfo/functionCall/NamedParameter2.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/NoAnnotations.kt b/idea/testData/parameterInfo/functionCall/NoAnnotations.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/NoAnnotations.kt rename to idea/testData/parameterInfo/functionCall/NoAnnotations.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/NotAccessible.kt b/idea/testData/parameterInfo/functionCall/NotAccessible.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/NotAccessible.kt rename to idea/testData/parameterInfo/functionCall/NotAccessible.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/NotGreen.kt b/idea/testData/parameterInfo/functionCall/NotGreen.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/NotGreen.kt rename to idea/testData/parameterInfo/functionCall/NotGreen.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/NullableTypeCall.kt b/idea/testData/parameterInfo/functionCall/NullableTypeCall.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/NullableTypeCall.kt rename to idea/testData/parameterInfo/functionCall/NullableTypeCall.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/Println.kt b/idea/testData/parameterInfo/functionCall/Println.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/Println.kt rename to idea/testData/parameterInfo/functionCall/Println.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/Simple.kt b/idea/testData/parameterInfo/functionCall/Simple.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/Simple.kt rename to idea/testData/parameterInfo/functionCall/Simple.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/SimpleConstructor.kt b/idea/testData/parameterInfo/functionCall/SimpleConstructor.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/SimpleConstructor.kt rename to idea/testData/parameterInfo/functionCall/SimpleConstructor.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/SubstituteExpectedType.kt b/idea/testData/parameterInfo/functionCall/SubstituteExpectedType.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/SubstituteExpectedType.kt rename to idea/testData/parameterInfo/functionCall/SubstituteExpectedType.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/SubstituteExplicitTypeArgs.kt b/idea/testData/parameterInfo/functionCall/SubstituteExplicitTypeArgs.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/SubstituteExplicitTypeArgs.kt rename to idea/testData/parameterInfo/functionCall/SubstituteExplicitTypeArgs.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments1.kt b/idea/testData/parameterInfo/functionCall/SubstituteFromArguments1.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments1.kt rename to idea/testData/parameterInfo/functionCall/SubstituteFromArguments1.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments2.kt b/idea/testData/parameterInfo/functionCall/SubstituteFromArguments2.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments2.kt rename to idea/testData/parameterInfo/functionCall/SubstituteFromArguments2.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments3.kt b/idea/testData/parameterInfo/functionCall/SubstituteFromArguments3.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments3.kt rename to idea/testData/parameterInfo/functionCall/SubstituteFromArguments3.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments4.kt b/idea/testData/parameterInfo/functionCall/SubstituteFromArguments4.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments4.kt rename to idea/testData/parameterInfo/functionCall/SubstituteFromArguments4.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArgumentsOnTyping.kt b/idea/testData/parameterInfo/functionCall/SubstituteFromArgumentsOnTyping.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArgumentsOnTyping.kt rename to idea/testData/parameterInfo/functionCall/SubstituteFromArgumentsOnTyping.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/SuperConstructorCall.kt b/idea/testData/parameterInfo/functionCall/SuperConstructorCall.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/SuperConstructorCall.kt rename to idea/testData/parameterInfo/functionCall/SuperConstructorCall.kt diff --git a/idea/testData/parameterInfo/functionCall/TooManyArgs.kt b/idea/testData/parameterInfo/functionCall/TooManyArgs.kt new file mode 100644 index 00000000000..78727df3b12 --- /dev/null +++ b/idea/testData/parameterInfo/functionCall/TooManyArgs.kt @@ -0,0 +1,8 @@ +open class A(x: Int) { + fun m(x: Int, y: Boolean) = 2 + + fun d(x: Int) { + m(1, false, ) + } +} +//Text: (x: Int, y: Boolean), Disabled: true, Strikeout: false, Green: true \ No newline at end of file diff --git a/idea/testData/parameterInfo/functionParameterInfo/TwoFunctions.kt b/idea/testData/parameterInfo/functionCall/TwoFunctions.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/TwoFunctions.kt rename to idea/testData/parameterInfo/functionCall/TwoFunctions.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/TwoFunctionsGrey.kt b/idea/testData/parameterInfo/functionCall/TwoFunctionsGrey.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/TwoFunctionsGrey.kt rename to idea/testData/parameterInfo/functionCall/TwoFunctionsGrey.kt diff --git a/idea/testData/parameterInfo/functionParameterInfo/UpdateOnTyping.kt b/idea/testData/parameterInfo/functionCall/UpdateOnTyping.kt similarity index 100% rename from idea/testData/parameterInfo/functionParameterInfo/UpdateOnTyping.kt rename to idea/testData/parameterInfo/functionCall/UpdateOnTyping.kt diff --git a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/AbstractFunctionParameterInfoTest.kt b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/AbstractParameterInfoTest.kt similarity index 75% rename from idea/tests/org/jetbrains/kotlin/idea/parameterInfo/AbstractFunctionParameterInfoTest.kt rename to idea/tests/org/jetbrains/kotlin/idea/parameterInfo/AbstractParameterInfoTest.kt index 97ad6f5aef5..c98276e7a7a 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/AbstractFunctionParameterInfoTest.kt +++ b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/AbstractParameterInfoTest.kt @@ -16,10 +16,14 @@ package org.jetbrains.kotlin.idea.parameterInfo +import com.intellij.codeInsight.hint.ShowParameterInfoContext +import com.intellij.codeInsight.hint.ShowParameterInfoHandler import com.intellij.psi.PsiDocumentManager +import com.intellij.psi.PsiElement import com.intellij.psi.PsiWhiteSpace import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase import org.jetbrains.kotlin.descriptors.FunctionDescriptor +import org.jetbrains.kotlin.idea.JetLanguage import org.jetbrains.kotlin.idea.test.PluginTestCaseBase import org.jetbrains.kotlin.idea.test.ProjectDescriptorWithStdlibSources import org.jetbrains.kotlin.idea.util.application.executeWriteCommand @@ -29,12 +33,12 @@ import org.jetbrains.kotlin.psi.psiUtil.allChildren import org.jetbrains.kotlin.test.InTextDirectivesUtils import org.junit.Assert -abstract class AbstractFunctionParameterInfoTest : LightCodeInsightFixtureTestCase() { +abstract class AbstractParameterInfoTest : LightCodeInsightFixtureTestCase() { override fun getProjectDescriptor() = ProjectDescriptorWithStdlibSources.INSTANCE override fun setUp() { super.setUp() - myFixture.testDataPath = PluginTestCaseBase.getTestDataPathBase() + "/parameterInfo/functionParameterInfo" + myFixture.testDataPath = PluginTestCaseBase.getTestDataPathBase() + "/parameterInfo" } protected fun doTest(fileName: String) { @@ -49,9 +53,14 @@ abstract class AbstractFunctionParameterInfoTest : LightCodeInsightFixtureTestCa else -> error("Unexpected last file child") } - val parameterInfoHandler = KotlinFunctionParameterInfoHandler() + val context = ShowParameterInfoContext(editor, project, file, editor.caretModel.offset, -1) + + val handlers = ShowParameterInfoHandler.getHandlers(project, JetLanguage.INSTANCE)!! + val handler = handlers.firstOrNull { it.findElementForParameterInfo(context) != null } + ?: error("Could not find parameter info handler") + val mockCreateParameterInfoContext = MockCreateParameterInfoContext(file, myFixture) - val parameterOwner = parameterInfoHandler.findElementForParameterInfo(mockCreateParameterInfoContext) + val parameterOwner = handler.findElementForParameterInfo(mockCreateParameterInfoContext) as PsiElement val textToType = InTextDirectivesUtils.findStringWithPrefixes(file.text, "// TYPE:") if (textToType != null) { @@ -66,16 +75,16 @@ abstract class AbstractFunctionParameterInfoTest : LightCodeInsightFixtureTestCa //to update current parameter index val updateContext = MockUpdateParameterInfoContext(file, myFixture) - val elementForUpdating = parameterInfoHandler.findElementForUpdatingParameterInfo(updateContext) + val elementForUpdating = handler.findElementForUpdatingParameterInfo(updateContext) if (elementForUpdating != null) { - parameterInfoHandler.updateParameterInfo(elementForUpdating, updateContext) + handler.updateParameterInfo(elementForUpdating, updateContext) } val parameterInfoUIContext = MockParameterInfoUIContext(parameterOwner, updateContext.currentParameter) for (item in mockCreateParameterInfoContext.itemsToShow) { //noinspection unchecked - parameterInfoHandler.updateUI(item as FunctionDescriptor, parameterInfoUIContext) + handler.updateUI(item as FunctionDescriptor, parameterInfoUIContext) } Assert.assertEquals(expectedResultText, parameterInfoUIContext.resultText) } diff --git a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/FunctionParameterInfoTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/FunctionParameterInfoTestGenerated.java deleted file mode 100644 index 6da9c7896f6..00000000000 --- a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/FunctionParameterInfoTestGenerated.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.idea.parameterInfo; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.JetTestUtils; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("idea/testData/parameterInfo/functionParameterInfo") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class FunctionParameterInfoTestGenerated extends AbstractFunctionParameterInfoTest { - public void testAllFilesPresentInFunctionParameterInfo() throws Exception { - JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/parameterInfo/functionParameterInfo"), Pattern.compile("^(.+)\\.kt$"), true); - } - - @TestMetadata("DefaultValuesFromLib.kt") - public void testDefaultValuesFromLib() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/DefaultValuesFromLib.kt"); - doTest(fileName); - } - - @TestMetadata("Deprecated.kt") - public void testDeprecated() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/Deprecated.kt"); - doTest(fileName); - } - - @TestMetadata("ExtensionOnClassObject.kt") - public void testExtensionOnClassObject() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/ExtensionOnClassObject.kt"); - doTest(fileName); - } - - @TestMetadata("FunctionalValue1.kt") - public void testFunctionalValue1() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/FunctionalValue1.kt"); - doTest(fileName); - } - - @TestMetadata("FunctionalValue2.kt") - public void testFunctionalValue2() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/FunctionalValue2.kt"); - doTest(fileName); - } - - @TestMetadata("InheritedFunctions.kt") - public void testInheritedFunctions() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/InheritedFunctions.kt"); - doTest(fileName); - } - - @TestMetadata("InheritedWithCurrentFunctions.kt") - public void testInheritedWithCurrentFunctions() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/InheritedWithCurrentFunctions.kt"); - doTest(fileName); - } - - @TestMetadata("Invoke.kt") - public void testInvoke() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/Invoke.kt"); - doTest(fileName); - } - - @TestMetadata("LocalFunctionBug.kt") - public void testLocalFunctionBug() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/LocalFunctionBug.kt"); - doTest(fileName); - } - - @TestMetadata("NamedAndDefaultParameter.kt") - public void testNamedAndDefaultParameter() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/NamedAndDefaultParameter.kt"); - doTest(fileName); - } - - @TestMetadata("NamedParameter.kt") - public void testNamedParameter() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/NamedParameter.kt"); - doTest(fileName); - } - - @TestMetadata("NamedParameter2.kt") - public void testNamedParameter2() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/NamedParameter2.kt"); - doTest(fileName); - } - - @TestMetadata("NoAnnotations.kt") - public void testNoAnnotations() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/NoAnnotations.kt"); - doTest(fileName); - } - - @TestMetadata("NotAccessible.kt") - public void testNotAccessible() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/NotAccessible.kt"); - doTest(fileName); - } - - @TestMetadata("NotGreen.kt") - public void testNotGreen() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/NotGreen.kt"); - doTest(fileName); - } - - @TestMetadata("NullableTypeCall.kt") - public void testNullableTypeCall() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/NullableTypeCall.kt"); - doTest(fileName); - } - - @TestMetadata("Println.kt") - public void testPrintln() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/Println.kt"); - doTest(fileName); - } - - @TestMetadata("Simple.kt") - public void testSimple() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/Simple.kt"); - doTest(fileName); - } - - @TestMetadata("SimpleConstructor.kt") - public void testSimpleConstructor() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/SimpleConstructor.kt"); - doTest(fileName); - } - - @TestMetadata("SubstituteExpectedType.kt") - public void testSubstituteExpectedType() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/SubstituteExpectedType.kt"); - doTest(fileName); - } - - @TestMetadata("SubstituteExplicitTypeArgs.kt") - public void testSubstituteExplicitTypeArgs() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/SubstituteExplicitTypeArgs.kt"); - doTest(fileName); - } - - @TestMetadata("SubstituteFromArguments1.kt") - public void testSubstituteFromArguments1() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments1.kt"); - doTest(fileName); - } - - @TestMetadata("SubstituteFromArguments2.kt") - public void testSubstituteFromArguments2() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments2.kt"); - doTest(fileName); - } - - @TestMetadata("SubstituteFromArguments3.kt") - public void testSubstituteFromArguments3() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments3.kt"); - doTest(fileName); - } - - @TestMetadata("SubstituteFromArguments4.kt") - public void testSubstituteFromArguments4() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArguments4.kt"); - doTest(fileName); - } - - @TestMetadata("SubstituteFromArgumentsOnTyping.kt") - public void testSubstituteFromArgumentsOnTyping() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/SubstituteFromArgumentsOnTyping.kt"); - doTest(fileName); - } - - @TestMetadata("SuperConstructorCall.kt") - public void testSuperConstructorCall() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/SuperConstructorCall.kt"); - doTest(fileName); - } - - @TestMetadata("TwoFunctions.kt") - public void testTwoFunctions() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/TwoFunctions.kt"); - doTest(fileName); - } - - @TestMetadata("TwoFunctionsGrey.kt") - public void testTwoFunctionsGrey() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/TwoFunctionsGrey.kt"); - doTest(fileName); - } - - @TestMetadata("UpdateOnTyping.kt") - public void testUpdateOnTyping() throws Exception { - String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionParameterInfo/UpdateOnTyping.kt"); - doTest(fileName); - } -} diff --git a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/MockParameterInfoUIContext.java b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/MockParameterInfoUIContext.java index 41aca585ae2..2fdfcc6bcc1 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/MockParameterInfoUIContext.java +++ b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/MockParameterInfoUIContext.java @@ -54,7 +54,7 @@ public class MockParameterInfoUIContext implements ParameterInfoUIContext { String resultText = "Text: (" + highlightedText + "), " + "Disabled: " + isDisabled + ", " + "Strikeout: " + strikeout + ", " + - "Green: " + background.equals(KotlinFunctionParameterInfoHandler.GREEN_BACKGROUND); + "Green: " + background.equals(KotlinParameterInfoWithCallHandlerBase.GREEN_BACKGROUND); result.add(resultText); // return value not used, just return something diff --git a/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/ParameterInfoTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/ParameterInfoTestGenerated.java new file mode 100644 index 00000000000..808bb2eea54 --- /dev/null +++ b/idea/tests/org/jetbrains/kotlin/idea/parameterInfo/ParameterInfoTestGenerated.java @@ -0,0 +1,271 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.parameterInfo; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.JetTestUtils; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("idea/testData/parameterInfo") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class ParameterInfoTestGenerated extends AbstractParameterInfoTest { + public void testAllFilesPresentInParameterInfo() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/parameterInfo"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("idea/testData/parameterInfo/arrayAccess") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ArrayAccess extends AbstractParameterInfoTest { + public void testAllFilesPresentInArrayAccess() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/parameterInfo/arrayAccess"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("Overloads.kt") + public void testOverloads() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/arrayAccess/Overloads.kt"); + doTest(fileName); + } + + @TestMetadata("Overloads2.kt") + public void testOverloads2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/arrayAccess/Overloads2.kt"); + doTest(fileName); + } + + @TestMetadata("Set.kt") + public void testSet() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/arrayAccess/Set.kt"); + doTest(fileName); + } + + @TestMetadata("SetTooManyArgs.kt") + public void testSetTooManyArgs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/arrayAccess/SetTooManyArgs.kt"); + doTest(fileName); + } + + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/arrayAccess/Simple.kt"); + doTest(fileName); + } + } + + @TestMetadata("idea/testData/parameterInfo/functionCall") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class FunctionCall extends AbstractParameterInfoTest { + public void testAllFilesPresentInFunctionCall() throws Exception { + JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/parameterInfo/functionCall"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("DefaultValuesFromLib.kt") + public void testDefaultValuesFromLib() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/DefaultValuesFromLib.kt"); + doTest(fileName); + } + + @TestMetadata("Deprecated.kt") + public void testDeprecated() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/Deprecated.kt"); + doTest(fileName); + } + + @TestMetadata("ExtensionOnClassObject.kt") + public void testExtensionOnClassObject() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/ExtensionOnClassObject.kt"); + doTest(fileName); + } + + @TestMetadata("FunctionalValue1.kt") + public void testFunctionalValue1() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/FunctionalValue1.kt"); + doTest(fileName); + } + + @TestMetadata("FunctionalValue2.kt") + public void testFunctionalValue2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/FunctionalValue2.kt"); + doTest(fileName); + } + + @TestMetadata("InheritedFunctions.kt") + public void testInheritedFunctions() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/InheritedFunctions.kt"); + doTest(fileName); + } + + @TestMetadata("InheritedWithCurrentFunctions.kt") + public void testInheritedWithCurrentFunctions() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/InheritedWithCurrentFunctions.kt"); + doTest(fileName); + } + + @TestMetadata("Invoke.kt") + public void testInvoke() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/Invoke.kt"); + doTest(fileName); + } + + @TestMetadata("LocalFunctionBug.kt") + public void testLocalFunctionBug() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/LocalFunctionBug.kt"); + doTest(fileName); + } + + @TestMetadata("NamedAndDefaultParameter.kt") + public void testNamedAndDefaultParameter() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/NamedAndDefaultParameter.kt"); + doTest(fileName); + } + + @TestMetadata("NamedParameter.kt") + public void testNamedParameter() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/NamedParameter.kt"); + doTest(fileName); + } + + @TestMetadata("NamedParameter2.kt") + public void testNamedParameter2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/NamedParameter2.kt"); + doTest(fileName); + } + + @TestMetadata("NoAnnotations.kt") + public void testNoAnnotations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/NoAnnotations.kt"); + doTest(fileName); + } + + @TestMetadata("NotAccessible.kt") + public void testNotAccessible() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/NotAccessible.kt"); + doTest(fileName); + } + + @TestMetadata("NotGreen.kt") + public void testNotGreen() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/NotGreen.kt"); + doTest(fileName); + } + + @TestMetadata("NullableTypeCall.kt") + public void testNullableTypeCall() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/NullableTypeCall.kt"); + doTest(fileName); + } + + @TestMetadata("Println.kt") + public void testPrintln() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/Println.kt"); + doTest(fileName); + } + + @TestMetadata("Simple.kt") + public void testSimple() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/Simple.kt"); + doTest(fileName); + } + + @TestMetadata("SimpleConstructor.kt") + public void testSimpleConstructor() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/SimpleConstructor.kt"); + doTest(fileName); + } + + @TestMetadata("SubstituteExpectedType.kt") + public void testSubstituteExpectedType() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/SubstituteExpectedType.kt"); + doTest(fileName); + } + + @TestMetadata("SubstituteExplicitTypeArgs.kt") + public void testSubstituteExplicitTypeArgs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/SubstituteExplicitTypeArgs.kt"); + doTest(fileName); + } + + @TestMetadata("SubstituteFromArguments1.kt") + public void testSubstituteFromArguments1() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/SubstituteFromArguments1.kt"); + doTest(fileName); + } + + @TestMetadata("SubstituteFromArguments2.kt") + public void testSubstituteFromArguments2() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/SubstituteFromArguments2.kt"); + doTest(fileName); + } + + @TestMetadata("SubstituteFromArguments3.kt") + public void testSubstituteFromArguments3() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/SubstituteFromArguments3.kt"); + doTest(fileName); + } + + @TestMetadata("SubstituteFromArguments4.kt") + public void testSubstituteFromArguments4() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/SubstituteFromArguments4.kt"); + doTest(fileName); + } + + @TestMetadata("SubstituteFromArgumentsOnTyping.kt") + public void testSubstituteFromArgumentsOnTyping() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/SubstituteFromArgumentsOnTyping.kt"); + doTest(fileName); + } + + @TestMetadata("SuperConstructorCall.kt") + public void testSuperConstructorCall() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/SuperConstructorCall.kt"); + doTest(fileName); + } + + @TestMetadata("TooManyArgs.kt") + public void testTooManyArgs() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/TooManyArgs.kt"); + doTest(fileName); + } + + @TestMetadata("TwoFunctions.kt") + public void testTwoFunctions() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/TwoFunctions.kt"); + doTest(fileName); + } + + @TestMetadata("TwoFunctionsGrey.kt") + public void testTwoFunctionsGrey() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/TwoFunctionsGrey.kt"); + doTest(fileName); + } + + @TestMetadata("UpdateOnTyping.kt") + public void testUpdateOnTyping() throws Exception { + String fileName = JetTestUtils.navigationMetadata("idea/testData/parameterInfo/functionCall/UpdateOnTyping.kt"); + doTest(fileName); + } + } +}