diff --git a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KtFe10CallResolver.kt b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KtFe10CallResolver.kt index a6440c27f37..f7b75f64c51 100644 --- a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KtFe10CallResolver.kt +++ b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KtFe10CallResolver.kt @@ -5,224 +5,464 @@ package org.jetbrains.kotlin.analysis.api.descriptors.components -import org.jetbrains.kotlin.analysis.api.calls.KtCallInfo +import org.jetbrains.kotlin.analysis.api.calls.* +import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession import org.jetbrains.kotlin.analysis.api.descriptors.components.base.Fe10KtAnalysisSessionComponent +import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.KtFe10DescValueParameterSymbol +import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.KtFe10ReceiverParameterSymbol +import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtCallableSymbol +import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtSymbol +import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtType +import org.jetbrains.kotlin.analysis.api.diagnostics.KtNonBoundToPsiErrorDiagnostic +import org.jetbrains.kotlin.analysis.api.impl.barebone.parentOfType import org.jetbrains.kotlin.analysis.api.impl.base.components.AbstractKtCallResolver +import org.jetbrains.kotlin.analysis.api.symbols.* import org.jetbrains.kotlin.analysis.api.tokens.ValidityToken -import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.builtins.KotlinBuiltIns +import org.jetbrains.kotlin.descriptors.CallableDescriptor +import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor +import org.jetbrains.kotlin.descriptors.PropertyDescriptor +import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor +import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters1 +import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters2 +import org.jetbrains.kotlin.diagnostics.Errors +import org.jetbrains.kotlin.diagnostics.Severity +import org.jetbrains.kotlin.lexer.KtTokens +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.parentsWithSelf +import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.calls.components.isVararg +import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall +import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall +import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall +import org.jetbrains.kotlin.resolve.scopes.receivers.ExpressionReceiver +import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver +import org.jetbrains.kotlin.resolve.scopes.receivers.ImplicitReceiver +import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue +import org.jetbrains.kotlin.types.KotlinType +import org.jetbrains.kotlin.types.expressions.ControlStructureTypingUtils +import org.jetbrains.kotlin.util.OperatorNameConventions internal class KtFe10CallResolver( override val analysisSession: KtFe10AnalysisSession ) : AbstractKtCallResolver(), Fe10KtAnalysisSessionComponent { private companion object { - private const val UNRESOLVED_CALL_MESSAGE = "Unresolved call" + private val operatorWithAssignmentVariant = setOf( + OperatorNameConventions.PLUS, + OperatorNameConventions.MINUS, + OperatorNameConventions.TIMES, + OperatorNameConventions.DIV, + OperatorNameConventions.REM, + OperatorNameConventions.MOD, + ) + + private val callArgErrors = setOf( + Errors.ARGUMENT_PASSED_TWICE, + Errors.MIXING_NAMED_AND_POSITIONED_ARGUMENTS, + Errors.NAMED_PARAMETER_NOT_FOUND, + Errors.NAMED_ARGUMENTS_NOT_ALLOWED, + Errors.VARARG_OUTSIDE_PARENTHESES, + Errors.SPREAD_OF_NULLABLE, + Errors.SPREAD_OF_LAMBDA_OR_CALLABLE_REFERENCE, + Errors.MANY_LAMBDA_EXPRESSION_ARGUMENTS, + Errors.UNEXPECTED_TRAILING_LAMBDA_ON_A_NEW_LINE, + Errors.TOO_MANY_ARGUMENTS, + Errors.REDUNDANT_SPREAD_OPERATOR_IN_NAMED_FORM_IN_FUNCTION, + Errors.REDUNDANT_SPREAD_OPERATOR_IN_NAMED_FORM_IN_ANNOTATION, + Errors.TYPE_MISMATCH, + ) + private val resolutionFailureErrors = setOf( + Errors.INVISIBLE_MEMBER, + Errors.NO_VALUE_FOR_PARAMETER, + Errors.MISSING_RECEIVER, + Errors.NO_RECEIVER_ALLOWED, + Errors.ILLEGAL_SELECTOR, + Errors.FUNCTION_EXPECTED, + Errors.FUNCTION_CALL_EXPECTED, + Errors.NO_CONSTRUCTOR, + Errors.OVERLOAD_RESOLUTION_AMBIGUITY, + Errors.NONE_APPLICABLE, + Errors.CANNOT_COMPLETE_RESOLVE, + Errors.UNRESOLVED_REFERENCE_WRONG_RECEIVER, + Errors.CALLABLE_REFERENCE_RESOLUTION_AMBIGUITY, + Errors.TYPE_PARAMETER_AS_REIFIED, + Errors.DEFINITELY_NON_NULLABLE_AS_REIFIED, + Errors.REIFIED_TYPE_FORBIDDEN_SUBSTITUTION, + Errors.REIFIED_TYPE_UNSAFE_SUBSTITUTION, + Errors.CANDIDATE_CHOSEN_USING_OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION, + Errors.RESOLUTION_TO_CLASSIFIER, + Errors.RESERVED_SYNTAX_IN_CALLABLE_REFERENCE_LHS, + Errors.PARENTHESIZED_COMPANION_LHS_DEPRECATION, + Errors.RESOLUTION_TO_PRIVATE_CONSTRUCTOR_OF_SEALED_CLASS, + Errors.UNRESOLVED_REFERENCE, + ) + + val diagnosticWithResolvedCallsAtPosition1 = setOf( + Errors.OVERLOAD_RESOLUTION_AMBIGUITY, + Errors.NONE_APPLICABLE, + Errors.CANNOT_COMPLETE_RESOLVE, + Errors.UNRESOLVED_REFERENCE_WRONG_RECEIVER, + Errors.ASSIGN_OPERATOR_AMBIGUITY, + Errors.ITERATOR_AMBIGUITY, + ) + + val diagnosticWithResolvedCallsAtPosition2 = setOf( + Errors.COMPONENT_FUNCTION_AMBIGUITY, + Errors.DELEGATE_SPECIAL_FUNCTION_AMBIGUITY, + Errors.DELEGATE_SPECIAL_FUNCTION_NONE_APPLICABLE, + Errors.DELEGATE_PD_METHOD_NONE_APPLICABLE, + ) } override val token: ValidityToken get() = analysisSession.token - override fun resolveCall(psi: KtElement): KtCallInfo? { - return null + override fun resolveCall(psi: KtElement): KtCallInfo? = with(analysisContext.analyze(psi, AnalysisMode.PARTIAL_WITH_DIAGNOSTICS)) { + val parentBinaryExpression = psi.parentOfType() + val lhs = KtPsiUtil.deparenthesize(parentBinaryExpression?.left) + val unwrappedPsi = KtPsiUtil.deparenthesize(psi as? KtExpression) ?: psi + if (parentBinaryExpression != null && + parentBinaryExpression.operationToken == KtTokens.EQ && + (lhs == unwrappedPsi || (lhs as? KtQualifiedExpression)?.selectorExpression == unwrappedPsi) && + unwrappedPsi !is KtArrayAccessExpression + ) { + // Specially handle property assignment because FE1.0 resolves LHS of assignment to just the property, which would then be + // treated as a property read. + return resolveCall(parentBinaryExpression) + } + when (unwrappedPsi) { + is KtBinaryExpression -> { + handleAsCompoundAssignment(this, unwrappedPsi)?.let { return@with it } + handleAsFunctionCall(this, unwrappedPsi) + } + is KtUnaryExpression -> { + handleAsIncOrDecOperator(this, unwrappedPsi)?.let { return@with it } + handleAsFunctionCall(this, unwrappedPsi) + } + else -> handleAsFunctionCall(this, unwrappedPsi) ?: handleAsPropertyRead(this, unwrappedPsi) + } ?: handleResolveErrors(this, psi) } -// override fun resolveAccessorCall(call: KtSimpleNameExpression): KtCall? { -// val bindingContext = analysisContext.analyze(call, AnalysisMode.PARTIAL_WITH_DIAGNOSTICS) -// val resolvedCall = call.getResolvedCall(bindingContext) ?: return null -// val targetDescriptor = resolvedCall.candidateDescriptor -// -// if (targetDescriptor is PropertyDescriptor) { -// @Suppress("DEPRECATION") -// val access = call.readWriteAccessWithFullExpressionWithPossibleResolve( -// readWriteAccessWithFullExpressionByResolve = { null } -// ).first -// -// val setterValue = findAssignment(call)?.right -// val accessorSymbol = when (targetDescriptor) { -// is SyntheticJavaPropertyDescriptor -> { -// when { -// access.isWrite -> targetDescriptor.setMethod?.let { KtFe10DescFunctionSymbol.build(it, analysisContext) } -// access.isRead -> KtFe10DescFunctionSymbol.build(targetDescriptor.getMethod, analysisContext) -// else -> null -// } -// } -// else -> { -// when { -// access.isWrite -> targetDescriptor.setter?.let { KtFe10DescPropertySetterSymbol(it, analysisContext) } -// access.isRead -> targetDescriptor.getter?.let { KtFe10DescPropertyGetterSymbol(it, analysisContext) } -// else -> null -// } -// } -// } -// -// if (accessorSymbol != null) { -// val target = when { -// !access.isWrite || setterValue != null -> KtSuccessCallTarget(accessorSymbol, token) -// else -> { -// val diagnostic = KtNonBoundToPsiErrorDiagnostic(factoryName = null, "Setter value is missing", token) -// KtErrorCallTarget(listOf(accessorSymbol), diagnostic, token) -// } -// } -// -// val argumentMapping = LinkedHashMap() -// if (access.isWrite && setterValue != null) { -// val setterParameterSymbol = accessorSymbol.valueParameters.single() -// argumentMapping[setterValue] = setterParameterSymbol -// } -// -// return KtFunctionCall(argumentMapping, target, getSubstitutor(resolvedCall), token) -// } -// } -// -// return null -// } -// -// override fun resolveCall(call: KtCallElement): KtCall? = withValidityAssertion { -// return resolveCall(call, isUsualCall = true) -// } -// -// override fun resolveCall(call: KtBinaryExpression): KtCall? = withValidityAssertion { -// return resolveCall(call, isUsualCall = false) -// } -// -// override fun resolveCall(call: KtUnaryExpression): KtCall? = withValidityAssertion { -// return resolveCall(call, isUsualCall = false) -// } -// -// override fun resolveCall(call: KtArrayAccessExpression): KtCall? = withValidityAssertion { -// return resolveCall(call, isUsualCall = false) -// } -// -// private fun getSubstitutor(vararg resolvedCall: ResolvedCall<*>): KtSubstitutor { -// val typeArguments = if (resolvedCall.size == 1) { -// resolvedCall[0].typeArguments -// } else { -// buildMap { -// resolvedCall.forEach { putAll(it.typeArguments) } -// } -// } -// -// if (typeArguments.isEmpty()) { -// return KtSubstitutor.Empty(analysisContext.token) -// } -// -// val typeSubstitution = object : TypeConstructorSubstitution() { -// override fun get(key: TypeConstructor): TypeProjection? { -// val type = typeArguments[key.declarationDescriptor] ?: return null -// return TypeProjectionImpl(Variance.INVARIANT, type) -// } -// -// override fun isEmpty() = typeArguments.isEmpty() -// } -// -// val typeSubstitutor = TypeSubstitutor.create(typeSubstitution) -// -// return object : KtMapBackedSubstitutor { -// override val token: ValidityToken -// get() = analysisContext.token -// -// val map: Map by cached { -// val symbolicMap = LinkedHashMap(typeArguments.size) -// for ((typeParameter, type) in typeArguments) { -// val typeParameterSymbol = KtFe10DescTypeParameterSymbol(typeParameter, analysisContext) -// symbolicMap[typeParameterSymbol] = type.toKtType(analysisContext) -// } -// return@cached symbolicMap -// } -// -// override fun getAsMap(): Map { -// return map -// } -// -// override fun substituteOrNull(type: KtType): KtType { -// require(type is KtFe10Type) -// return typeSubstitutor.substitute(type.type).toKtType(analysisContext) -// } -// } -// } -// -// /** -// * Analyze the given call element (a function call, unary/binary operator call, or convention call). -// * -// * @param call the call element to analyze. -// * @param isUsualCall `true` if the call is a usual function call (`foo()` or `foo {}`). -// */ -// private fun resolveCall(call: KtElement, isUsualCall: Boolean): KtCall? { -// val bindingContext = analysisContext.analyze(call, AnalysisMode.PARTIAL_WITH_DIAGNOSTICS) -// val resolvedCall = call.getResolvedCall(bindingContext) ?: return getUnresolvedCall(call) -// -// val argumentMapping = createArgumentMapping(resolvedCall) -// -// fun getTarget(targetSymbol: KtFunctionLikeSymbol): KtCallTarget { -// if (resolvedCall.status == ResolutionStatus.SUCCESS) { -// return KtSuccessCallTarget(targetSymbol, token) -// } -// -// val diagnostic = KtNonBoundToPsiErrorDiagnostic(factoryName = null, UNRESOLVED_CALL_MESSAGE, token) -// return KtErrorCallTarget(listOf(targetSymbol), diagnostic, token) -// } -// -// val targetDescriptor = resolvedCall.candidateDescriptor -// -// val callableSymbol = targetDescriptor.toKtCallableSymbol(analysisContext) as? KtFunctionLikeSymbol ?: return null -// -// if (resolvedCall is VariableAsFunctionResolvedCall) { -// val variableDescriptor = resolvedCall.variableCall.candidateDescriptor -// val variableSymbol = variableDescriptor.toKtCallableSymbol(analysisContext) as? KtVariableLikeSymbol ?: return null -// -// val substitutor = getSubstitutor(resolvedCall.functionCall, resolvedCall.variableCall) -// return if (resolvedCall.functionCall.candidateDescriptor.callableIdIfNotLocal in kotlinFunctionInvokeCallableIds) { -// KtFunctionalTypeVariableCall(variableSymbol, argumentMapping, getTarget(callableSymbol), substitutor, token) -// } else { -// KtVariableWithInvokeFunctionCall(variableSymbol, argumentMapping, getTarget(callableSymbol), substitutor, token) -// } -// } -// -// if (call is KtConstructorDelegationCall) { -// return KtDelegatedConstructorCall(argumentMapping, getTarget(callableSymbol), call.kind, token) -// } -// -// if (isUsualCall) { -// if (targetDescriptor.isAnnotationConstructor() && (call is KtAnnotationEntry || call.parent is KtAnnotationEntry)) { -// return KtAnnotationCall(argumentMapping, getTarget(callableSymbol), token) -// } -// } -// -// return KtFunctionCall(argumentMapping, getTarget(callableSymbol), getSubstitutor(resolvedCall), token) -// } -// -// private fun getUnresolvedCall(call: KtElement): KtCall? { -// return when (call) { -// is KtSuperTypeCallEntry -> { -// val diagnostic = KtNonBoundToPsiErrorDiagnostic(factoryName = null, UNRESOLVED_CALL_MESSAGE, token) -// val target = KtErrorCallTarget(emptyList(), diagnostic, token) -// KtDelegatedConstructorCall(LinkedHashMap(), target, KtDelegatedConstructorCallKind.SUPER_CALL, token) -// } -// is KtConstructorDelegationCall -> { -// val diagnostic = KtNonBoundToPsiErrorDiagnostic(factoryName = null, UNRESOLVED_CALL_MESSAGE, token) -// val target = KtErrorCallTarget(emptyList(), diagnostic, token) -// return KtDelegatedConstructorCall(LinkedHashMap(), target, call.kind, token) -// } -// else -> null -// } -// } -// -// private val KtConstructorDelegationCall.kind: KtDelegatedConstructorCallKind -// get() = when { -// isCallToThis -> KtDelegatedConstructorCallKind.THIS_CALL -// else -> KtDelegatedConstructorCallKind.SUPER_CALL -// } -// -// private fun createArgumentMapping(resolvedCall: ResolvedCall<*>): LinkedHashMap { -// val result = LinkedHashMap() -// for ((parameter, arguments) in resolvedCall.valueArguments) { -// val parameterSymbol = KtFe10DescValueParameterSymbol(parameter, analysisContext) -// -// for (argument in arguments.arguments) { -// val expression = argument.getArgumentExpression() ?: continue -// result[expression] = parameterSymbol -// } -// } -// return result -// } + private fun handleAsCompoundAssignment(context: BindingContext, binaryExpression: KtBinaryExpression): KtCallInfo? { + val left = binaryExpression.left ?: return null + val right = binaryExpression.right + val resolvedCalls = mutableListOf>() + return when (binaryExpression.operationToken) { + KtTokens.EQ -> { + val resolvedCall = left.getResolvedCall(context) ?: return null + resolvedCalls += resolvedCall + val partiallyAppliedSymbol = + resolvedCall.toPartiallyAppliedVariableSymbol(context) ?: return null + KtSimpleVariableAccessCall(partiallyAppliedSymbol, KtSimpleVariableAccess.Write(right)) + } + in KtTokens.AUGMENTED_ASSIGNMENTS -> { + if (right == null) return null + val operatorCall = binaryExpression.getResolvedCall(context) ?: return null + resolvedCalls += operatorCall + // This method only handles compound assignment. Other cases like `plusAssign`, `rangeTo`, `contains` are handled by plain + // `handleAsFunctionCall` + if (operatorCall.resultingDescriptor.name !in operatorWithAssignmentVariant) return null + val operatorPartiallyAppliedSymbol = + operatorCall.toPartiallyAppliedFunctionSymbol(context) ?: return null + + val compoundAccess = KtCompoundAccess.CompoundAssign( + operatorPartiallyAppliedSymbol, + binaryExpression.getCompoundAssignKind(), + right + ) + + if (left is KtArrayAccessExpression) { + createCompoundArrayAccessCall(context, left, compoundAccess, resolvedCalls) + } else { + val resolvedCall = left.getResolvedCall(context) ?: return null + resolvedCalls += resolvedCall + val variableAppliedSymbol = resolvedCall.toPartiallyAppliedVariableSymbol(context) ?: return null + KtCompoundVariableAccessCall(variableAppliedSymbol, compoundAccess) + } + } + else -> null + }?.let { createCallInfo(context, binaryExpression, it, resolvedCalls) } + } + + private fun handleAsIncOrDecOperator(context: BindingContext, unaryExpression: KtUnaryExpression): KtCallInfo? { + if (unaryExpression.operationToken !in KtTokens.INCREMENT_AND_DECREMENT) return null + val operatorCall = unaryExpression.getResolvedCall(context) ?: return null + val resolvedCalls = mutableListOf(operatorCall) + val operatorPartiallyAppliedSymbol = operatorCall.toPartiallyAppliedFunctionSymbol(context) ?: return null + val baseExpression = unaryExpression.baseExpression + val kind = unaryExpression.getInOrDecOperationKind() + val precedence = when (unaryExpression) { + is KtPostfixExpression -> KtCompoundAccess.IncOrDecOperation.Precedence.POSTFIX + is KtPrefixExpression -> KtCompoundAccess.IncOrDecOperation.Precedence.PREFIX + else -> error("unexpected KtUnaryExpression $unaryExpression") + } + val compoundAccess = KtCompoundAccess.IncOrDecOperation(operatorPartiallyAppliedSymbol, kind, precedence) + return if (baseExpression is KtArrayAccessExpression) { + createCompoundArrayAccessCall(context, baseExpression, compoundAccess, resolvedCalls) + } else { + val variableAppliedSymbol = baseExpression.getResolvedCall(context)?.toPartiallyAppliedVariableSymbol(context) ?: return null + KtCompoundVariableAccessCall(variableAppliedSymbol, compoundAccess) + }?.let { createCallInfo(context, unaryExpression, it, resolvedCalls) } + } + + private fun createCompoundArrayAccessCall( + context: BindingContext, + arrayAccessExpression: KtArrayAccessExpression, + compoundAccess: KtCompoundAccess, + resolvedCalls: MutableList> + ): KtCompoundArrayAccessCall? { + val resolvedGetCall = context[BindingContext.INDEXED_LVALUE_GET, arrayAccessExpression] ?: return null + resolvedCalls += resolvedGetCall + val getPartiallyAppliedSymbol = resolvedGetCall.toPartiallyAppliedFunctionSymbol(context) ?: return null + val resolvedSetCall = context[BindingContext.INDEXED_LVALUE_SET, arrayAccessExpression] ?: return null + resolvedCalls += resolvedSetCall + val setPartiallyAppliedSymbol = resolvedSetCall.toPartiallyAppliedFunctionSymbol(context) ?: return null + return KtCompoundArrayAccessCall( + compoundAccess, + arrayAccessExpression.indexExpressions, + getPartiallyAppliedSymbol, + setPartiallyAppliedSymbol + ) + } + + private fun handleAsFunctionCall(context: BindingContext, element: KtElement): KtCallInfo? { + val resolvedCall = element.getResolvedCall(context) + if (element is KtUnaryExpression && resolvedCall?.candidateDescriptor?.name == ControlStructureTypingUtils.ResolveConstruct.EXCL_EXCL.specialFunctionName) { + val baseExpression = element.baseExpression ?: return null + return KtSuccessCallInfo(KtCheckNotNullCall(token, baseExpression)) + } + return if (resolvedCall is VariableAsFunctionResolvedCall) { + if (element is KtCallExpression) { + // TODO: consider demoting extension receiver to the first argument to align with FIR behavior. See test case + // analysis/analysis-api/testData/components/callResolver/resolveCall/functionTypeVariableCall_dispatchReceiver.kt:5 where + // FIR and FE1.0 behaves differently because FIR unifies extension receiver of functional type as the first argument + resolvedCall.functionCall.toFunctionKtCall(context) + } else { + resolvedCall.variableCall.toPropertyRead(context) + }?.let { createCallInfo(context, element, it, listOf(resolvedCall)) } + } else { + resolvedCall?.toFunctionKtCall(context)?.let { createCallInfo(context, element, it, listOf(resolvedCall)) } + } + } + + private fun handleAsPropertyRead(contexe: BindingContext, element: KtElement): KtCallInfo? { + val call = element.getResolvedCall(contexe) ?: return null + return call.toPropertyRead(contexe)?.let { createCallInfo(contexe, element, it, listOf(call)) } + } + + private fun ResolvedCall<*>.toPropertyRead(context: BindingContext): KtVariableAccessCall? { + val partiallyAppliedSymbol = toPartiallyAppliedVariableSymbol(context) ?: return null + return KtSimpleVariableAccessCall(partiallyAppliedSymbol, KtSimpleVariableAccess.Read) + } + + private fun ResolvedCall<*>.toFunctionKtCall(context: BindingContext): KtFunctionCall<*>? { + val partiallyAppliedSymbol = toPartiallyAppliedFunctionSymbol(context) ?: return null + val argumentMapping = createArgumentMapping(partiallyAppliedSymbol.signature) + if (partiallyAppliedSymbol.signature.symbol is KtConstructorSymbol) { + @Suppress("UNCHECKED_CAST") + val partiallyAppliedConstructorSymbol = partiallyAppliedSymbol as KtPartiallyAppliedFunctionSymbol + when (val callElement = call.callElement) { + is KtAnnotationEntry -> return KtAnnotationCall(partiallyAppliedSymbol, argumentMapping) + is KtConstructorDelegationCall -> return KtDelegatedConstructorCall( + partiallyAppliedConstructorSymbol, + if (callElement.isCallToThis) KtDelegatedConstructorCall.Kind.THIS_CALL else KtDelegatedConstructorCall.Kind.SUPER_CALL, + argumentMapping + ) + } + } + @Suppress("UNCHECKED_CAST") + return KtSimpleFunctionCall(partiallyAppliedSymbol, argumentMapping, call.callType == Call.CallType.INVOKE) + } + + private fun ResolvedCall<*>.toPartiallyAppliedVariableSymbol(context: BindingContext): KtPartiallyAppliedVariableSymbol? { + val partiallyAppliedSymbol = toPartiallyAppliedSymbol(context) ?: return null + if (partiallyAppliedSymbol.signature !is KtVariableLikeSignature<*>) return null + @Suppress("UNCHECKED_CAST") + return partiallyAppliedSymbol as KtPartiallyAppliedVariableSymbol + } + + + private inline fun ResolvedCall<*>.toPartiallyAppliedFunctionSymbol(context: BindingContext): KtPartiallyAppliedFunctionSymbol? { + val partiallyAppliedSymbol = toPartiallyAppliedSymbol(context) ?: return null + if (partiallyAppliedSymbol.symbol !is S) return null + @Suppress("UNCHECKED_CAST") + return partiallyAppliedSymbol as KtPartiallyAppliedFunctionSymbol + } + + private fun ResolvedCall<*>.toPartiallyAppliedSymbol(context: BindingContext): KtPartiallyAppliedSymbol<*, *>? { + val targetDescriptor = candidateDescriptor + val symbol = targetDescriptor.toKtCallableSymbol(analysisContext) ?: return null + val signature = createSignature(symbol, resultingDescriptor) ?: return null + if (targetDescriptor.isSynthesizedPropertyFromJavaAccessors()) { + // FE1.0 represents synthesized properties as an extension property of the Java class. Hence we use the extension receiver as + // the dispatch receiver and always pass null for extension receiver (because in Java there is no way to specify an extension + // receiver) + return KtPartiallyAppliedSymbol( + signature, + extensionReceiver?.toKtReceiverValue(context, this), + null + ) + } else { + return KtPartiallyAppliedSymbol( + signature, + dispatchReceiver?.toKtReceiverValue(context, this, smartCastDispatchReceiverType), + extensionReceiver?.toKtReceiverValue(context, this), + ) + } + } + + private fun ReceiverValue.toKtReceiverValue( + context: BindingContext, + resolvedCall: ResolvedCall<*>, + smartCastType: KotlinType? = null + ): KtReceiverValue? { + val result = when (this) { + is ExpressionReceiver -> expression.toExplicitReceiverValue() + is ExtensionReceiver -> { + val extensionReceiverParameter = this.declarationDescriptor.extensionReceiverParameter ?: return null + KtImplicitReceiverValue(KtFe10ReceiverParameterSymbol(extensionReceiverParameter, analysisContext)) + } + is ImplicitReceiver -> { + val symbol = this.declarationDescriptor.toKtSymbol(analysisContext) ?: return null + KtImplicitReceiverValue(symbol) + } + else -> null + } + var smartCastTypeToUse = smartCastType + if (smartCastTypeToUse == null) { + when (result) { + is KtExplicitReceiverValue -> { + smartCastTypeToUse = context[BindingContext.SMARTCAST, result.expression]?.type(resolvedCall.call) + } + is KtImplicitReceiverValue -> { + smartCastTypeToUse = + context[BindingContext.IMPLICIT_RECEIVER_SMARTCAST, resolvedCall.call.calleeExpression]?.receiverTypes?.get(this) + } + else -> {} + } + } + return if (smartCastTypeToUse != null && result != null) { + KtSmartCastedReceiverValue(result, smartCastTypeToUse.toKtType(analysisContext)) + } else { + result + } + } + + private fun createSignature(symbol: KtSymbol, resultingDescriptor: CallableDescriptor): KtSignature<*>? { + val returnType = if (resultingDescriptor is ValueParameterDescriptor && resultingDescriptor.isVararg) { + val arrayType = resultingDescriptor.returnType ?: return null + val primitiveArrayElementType = KotlinBuiltIns.getPrimitiveArrayElementType(arrayType) + if (primitiveArrayElementType == null) { + arrayType.arguments.singleOrNull()?.type + } else { + analysisContext.builtIns.getPrimitiveKotlinType(primitiveArrayElementType) + } + } else { + resultingDescriptor.returnType + } + val ktReturnType = returnType?.toKtType(analysisContext) ?: return null + val receiverType = if (resultingDescriptor.isSynthesizedPropertyFromJavaAccessors()) { + // FE1.0 represents synthesized properties as an extension property of the Java class. Hence the extension receiver type should + // always be null + null + } else { + resultingDescriptor.extensionReceiverParameter?.returnType?.toKtType(analysisContext) + } + return when (symbol) { + is KtVariableLikeSymbol -> KtVariableLikeSignature(symbol, ktReturnType, receiverType) + is KtFunctionLikeSymbol -> KtFunctionLikeSignature( + symbol, + ktReturnType, + receiverType, + @Suppress("UNCHECKED_CAST") + symbol.valueParameters.zip(resultingDescriptor.valueParameters).map { (symbol, resultingDescriptor) -> + createSignature(symbol, resultingDescriptor) as KtVariableLikeSignature + }) + else -> error("unexpected callable symbol $this") + } + } + + private fun CallableDescriptor?.isSynthesizedPropertyFromJavaAccessors() = + this is PropertyDescriptor && kind == CallableMemberDescriptor.Kind.SYNTHESIZED + + private fun ResolvedCall<*>.createArgumentMapping(signature: KtFunctionLikeSignature<*>): LinkedHashMap> { + val parameterSignatureByName = signature.valueParameters.associateBy { it.symbol.name } + val result = LinkedHashMap>() + for ((parameter, arguments) in valueArguments) { + val parameterSymbol = KtFe10DescValueParameterSymbol(parameter, analysisContext) + + for (argument in arguments.arguments) { + val expression = argument.getArgumentExpression() ?: continue + result[expression] = parameterSignatureByName[parameterSymbol.name] ?: continue + } + } + return result + } + + private fun createCallInfo(context: BindingContext, psi: KtElement, ktCall: KtCall, resolvedCalls: List>): KtCallInfo { + val failedResolveCall = resolvedCalls.firstOrNull { !it.status.isSuccess } ?: return KtSuccessCallInfo(ktCall) + + val diagnostic = getDiagnosticToReport(context, psi, ktCall)?.let { KtFe10Diagnostic(it, token) } + ?: KtNonBoundToPsiErrorDiagnostic( + factoryName = null, + "${failedResolveCall.status} with ${failedResolveCall.resultingDescriptor.name}", + token + ) + return KtErrorCallInfo(listOf(ktCall), diagnostic, token) + } + + private fun handleResolveErrors(context: BindingContext, psi: KtElement): KtErrorCallInfo? { + val diagnostic = getDiagnosticToReport(context, psi, null) ?: return null + val ktDiagnostic = diagnostic.let { KtFe10Diagnostic(it, token) } + val calls = when (diagnostic.factory) { + in diagnosticWithResolvedCallsAtPosition1 -> { + require(diagnostic is DiagnosticWithParameters1<*, *>) + @Suppress("UNCHECKED_CAST") + diagnostic.a as Collection> + } + in diagnosticWithResolvedCallsAtPosition2 -> { + require(diagnostic is DiagnosticWithParameters2<*, *, *>) + @Suppress("UNCHECKED_CAST") + diagnostic.b as Collection> + } + else -> { + emptyList() + } + } + return KtErrorCallInfo(calls.mapNotNull { it.toFunctionKtCall(context) ?: it.toPropertyRead(context) }, ktDiagnostic, token) + } + + private fun getDiagnosticToReport( + context: BindingContext, psi: KtElement, ktCall: KtCall? + ) = context.diagnostics.firstOrNull { diagnostic -> + if (diagnostic.severity != Severity.ERROR) return@firstOrNull false + val isResolutionError = diagnostic.factory in resolutionFailureErrors + val isCallArgError = diagnostic.factory in callArgErrors + val reportedPsi = diagnostic.psiElement + val reportedPsiParent = reportedPsi.parent + when { + // Errors reported on the querying element or the `selectorExpression`/`calleeExpression` of the querying element + isResolutionError && + (reportedPsi == psi || + psi is KtQualifiedExpression && reportedPsi == psi.selectorExpression || + psi is KtCallElement && reportedPsi.parentsWithSelf.any { it == psi.calleeExpression }) -> true + // Errors reported on the value argument list or the right most parentheses (not enough argument, for example) + isResolutionError && + reportedPsi is KtValueArgumentList || reportedPsiParent is KtValueArgumentList && reportedPsi == reportedPsiParent.rightParenthesis -> true + // errors on call args for normal function calls + isCallArgError && + reportedPsiParent is KtValueArgument && psi is KtCallElement && reportedPsiParent in psi.valueArguments -> true + // errors on index args for array access convention + isCallArgError && + reportedPsiParent is KtContainerNode && reportedPsiParent.parent is KtArrayAccessExpression -> true + // errors on lambda args + isCallArgError && + reportedPsi is KtLambdaExpression || reportedPsi is KtLambdaArgument -> true + // errors on value to set using array access convention + isCallArgError && + ktCall is KtSimpleFunctionCall && (reportedPsiParent as? KtBinaryExpression)?.right == reportedPsi -> true + else -> false + } + } } \ No newline at end of file diff --git a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KtFe10DiagnosticProvider.kt b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KtFe10DiagnosticProvider.kt index 101d3b799fd..0bbe99b5852 100644 --- a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KtFe10DiagnosticProvider.kt +++ b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/components/KtFe10DiagnosticProvider.kt @@ -9,8 +9,8 @@ import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement import org.jetbrains.kotlin.analysis.api.components.KtDiagnosticCheckerFilter import org.jetbrains.kotlin.analysis.api.components.KtDiagnosticProvider -import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisFacade.AnalysisMode +import org.jetbrains.kotlin.analysis.api.descriptors.KtFe10AnalysisSession import org.jetbrains.kotlin.analysis.api.descriptors.components.base.Fe10KtAnalysisSessionComponent import org.jetbrains.kotlin.analysis.api.diagnostics.KtDiagnosticWithPsi import org.jetbrains.kotlin.analysis.api.tokens.ValidityToken @@ -19,6 +19,7 @@ import org.jetbrains.kotlin.diagnostics.Diagnostic import org.jetbrains.kotlin.diagnostics.DiagnosticFactory import org.jetbrains.kotlin.diagnostics.Severity import org.jetbrains.kotlin.diagnostics.UnboundDiagnostic +import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile import kotlin.reflect.KClass @@ -51,7 +52,7 @@ internal class KtFe10DiagnosticProvider( } } -private class KtFe10Diagnostic(private val diagnostic: Diagnostic, override val token: ValidityToken) : KtDiagnosticWithPsi { +internal class KtFe10Diagnostic(private val diagnostic: Diagnostic, override val token: ValidityToken) : KtDiagnosticWithPsi { override val severity: Severity get() = diagnostic.severity @@ -62,7 +63,9 @@ private class KtFe10Diagnostic(private val diagnostic: Diagnostic, override val get() { @Suppress("UNCHECKED_CAST") val factory = diagnostic.factory as DiagnosticFactory? - return factory?.defaultRenderer?.render(diagnostic) ?: "" + return factory?.defaultRenderer?.render(diagnostic) + ?: DefaultErrorMessages.getRendererForDiagnostic(diagnostic)?.render(diagnostic) + ?: "" } override val psi: PsiElement diff --git a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/symbols/descriptorBased/KtFe10ReceiverParameterSymbol.kt b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/symbols/descriptorBased/KtFe10ReceiverParameterSymbol.kt new file mode 100644 index 00000000000..ebe38e23567 --- /dev/null +++ b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/symbols/descriptorBased/KtFe10ReceiverParameterSymbol.kt @@ -0,0 +1,31 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased + +import org.jetbrains.kotlin.analysis.api.descriptors.Fe10AnalysisContext +import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.KtFe10DescSymbol +import org.jetbrains.kotlin.analysis.api.descriptors.symbols.descriptorBased.base.toKtType +import org.jetbrains.kotlin.analysis.api.symbols.KtReceiverParameterSymbol +import org.jetbrains.kotlin.analysis.api.symbols.KtSymbol +import org.jetbrains.kotlin.analysis.api.symbols.pointers.KtSymbolPointer +import org.jetbrains.kotlin.analysis.api.types.KtType +import org.jetbrains.kotlin.analysis.api.withValidityAssertion +import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor + +class KtFe10ReceiverParameterSymbol( + private val _descriptor: ReceiverParameterDescriptor, + override val analysisContext: Fe10AnalysisContext +) : KtReceiverParameterSymbol(), KtFe10DescSymbol { + + override val type: KtType + get() = withValidityAssertion { _descriptor.returnType?.toKtType(analysisContext) ?: error("expect return type for $_descriptor") } + override val descriptor: ReceiverParameterDescriptor + get() = withValidityAssertion { _descriptor } + + override fun createPointer(): KtSymbolPointer { + TODO("Not yet implemented") + } +} \ No newline at end of file diff --git a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/symbols/descriptorBased/base/Kt1DescUtils.kt b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/symbols/descriptorBased/base/Kt1DescUtils.kt index 998af7ef6e3..2932254c9d7 100644 --- a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/symbols/descriptorBased/base/Kt1DescUtils.kt +++ b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/symbols/descriptorBased/base/Kt1DescUtils.kt @@ -202,8 +202,11 @@ private fun KotlinType.hasReferenceOtherThan(allowedTypeParameterDescriptors: Se */ @Suppress("UNCHECKED_CAST") private fun T.unwrapUseSiteSubstitutionOverride(): T { - if (original == this) return this - return original.unwrapUseSiteSubstitutionOverride() as T + var current: CallableDescriptor = this + while (original != current) { + current = current.original + } + return current as T } internal fun KotlinType.toKtType(analysisContext: Fe10AnalysisContext): KtType { diff --git a/analysis/analysis-api-fe10/tests/org/jetbrains/kotlin/analysis/api/descriptors/test/components/callResolver/KtFe10ResolveCallTestGenerated.java b/analysis/analysis-api-fe10/tests/org/jetbrains/kotlin/analysis/api/descriptors/test/components/callResolver/KtFe10ResolveCallTestGenerated.java new file mode 100644 index 00000000000..bffc2936d1e --- /dev/null +++ b/analysis/analysis-api-fe10/tests/org/jetbrains/kotlin/analysis/api/descriptors/test/components/callResolver/KtFe10ResolveCallTestGenerated.java @@ -0,0 +1,728 @@ +/* + * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.api.descriptors.test.components.callResolver; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCall") +@TestDataPath("$PROJECT_ROOT") +public class KtFe10ResolveCallTestGenerated extends AbstractKtFe10ResolveCallTest { + @Test + public void testAllFilesPresentInResolveCall() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCall"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("annotationEntry.kt") + public void testAnnotationEntry() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationEntry.kt"); + } + + @Test + @TestMetadata("annotationInAnnotation_arrayOf.kt") + public void testAnnotationInAnnotation_arrayOf() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationInAnnotation_arrayOf.kt"); + } + + @Test + @TestMetadata("annotationInAnnotation_collectionLiteral.kt") + public void testAnnotationInAnnotation_collectionLiteral() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationInAnnotation_collectionLiteral.kt"); + } + + @Test + @TestMetadata("annotationInAnnotation_multipleAnnotations_arrayOf.kt") + public void testAnnotationInAnnotation_multipleAnnotations_arrayOf() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationInAnnotation_multipleAnnotations_arrayOf.kt"); + } + + @Test + @TestMetadata("annotationInAnnotation_multipleAnnotations_collectionLiteral.kt") + public void testAnnotationInAnnotation_multipleAnnotations_collectionLiteral() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationInAnnotation_multipleAnnotations_collectionLiteral.kt"); + } + + @Test + @TestMetadata("annotationInAnnotation_noarg.kt") + public void testAnnotationInAnnotation_noarg() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationInAnnotation_noarg.kt"); + } + + @Test + @TestMetadata("annotationInAnnotation_vararg.kt") + public void testAnnotationInAnnotation_vararg() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationInAnnotation_vararg.kt"); + } + + @Test + @TestMetadata("annotationOnDelegate.kt") + public void testAnnotationOnDelegate() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnDelegate.kt"); + } + + @Test + @TestMetadata("annotationOnExpression_asT.kt") + public void testAnnotationOnExpression_asT() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnExpression_asT.kt"); + } + + @Test + @TestMetadata("annotationOnExpression_destructuring.kt") + public void testAnnotationOnExpression_destructuring() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnExpression_destructuring.kt"); + } + + @Test + @TestMetadata("annotationOnExpression_if.kt") + public void testAnnotationOnExpression_if() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnExpression_if.kt"); + } + + @Test + @TestMetadata("annotationOnExpression_whenBranch.kt") + public void testAnnotationOnExpression_whenBranch() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnExpression_whenBranch.kt"); + } + + @Test + @TestMetadata("annotationOnFile.kt") + public void testAnnotationOnFile() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnFile.kt"); + } + + @Test + @TestMetadata("annotationOnParameter_param.kt") + public void testAnnotationOnParameter_param() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnParameter_param.kt"); + } + + @Test + @TestMetadata("annotationOnParameter_parameterProperty.kt") + public void testAnnotationOnParameter_parameterProperty() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnParameter_parameterProperty.kt"); + } + + @Test + @TestMetadata("annotationOnParameter_reified.kt") + public void testAnnotationOnParameter_reified() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnParameter_reified.kt"); + } + + @Test + @TestMetadata("annotationOnParameter_setparam.kt") + public void testAnnotationOnParameter_setparam() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnParameter_setparam.kt"); + } + + @Test + @TestMetadata("annotationOnProperty_field.kt") + public void testAnnotationOnProperty_field() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnProperty_field.kt"); + } + + @Test + @TestMetadata("annotationOnProperty_get.kt") + public void testAnnotationOnProperty_get() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnProperty_get.kt"); + } + + @Test + @TestMetadata("annotationOnProperty_property.kt") + public void testAnnotationOnProperty_property() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnProperty_property.kt"); + } + + @Test + @TestMetadata("annotationOnProperty_set.kt") + public void testAnnotationOnProperty_set() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnProperty_set.kt"); + } + + @Test + @TestMetadata("annotationOnReceiver.kt") + public void testAnnotationOnReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/annotationOnReceiver.kt"); + } + + @Test + @TestMetadata("arrayOfInAnnotation.kt") + public void testArrayOfInAnnotation() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/arrayOfInAnnotation.kt"); + } + + @Test + @TestMetadata("calleeExpressionOfImplicitInvoke.kt") + public void testCalleeExpressionOfImplicitInvoke() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/calleeExpressionOfImplicitInvoke.kt"); + } + + @Test + @TestMetadata("checkNotNullCall.kt") + public void testCheckNotNullCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/checkNotNullCall.kt"); + } + + @Test + @TestMetadata("checkNotNullCallAsCallee.kt") + public void testCheckNotNullCallAsCallee() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/checkNotNullCallAsCallee.kt"); + } + + @Test + @TestMetadata("comparisonCall.kt") + public void testComparisonCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/comparisonCall.kt"); + } + + @Test + @TestMetadata("compoundAssignOnVal.kt") + public void testCompoundAssignOnVal() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignOnVal.kt"); + } + + @Test + @TestMetadata("compoundAssignOnVal_lhs.kt") + public void testCompoundAssignOnVal_lhs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignOnVal_lhs.kt"); + } + + @Test + @TestMetadata("compoundAssignOnVar.kt") + public void testCompoundAssignOnVar() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignOnVar.kt"); + } + + @Test + @TestMetadata("compoundAssignOnVar_lhs.kt") + public void testCompoundAssignOnVar_lhs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignOnVar_lhs.kt"); + } + + @Test + @TestMetadata("compoundAssignWithArrayAccessConvention.kt") + public void testCompoundAssignWithArrayAccessConvention() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention.kt"); + } + + @Test + @TestMetadata("compoundAssignWithArrayAccessConvention_complexReceivers.kt") + public void testCompoundAssignWithArrayAccessConvention_complexReceivers() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention_complexReceivers.kt"); + } + + @Test + @TestMetadata("compoundAssignWithArrayAccessConvention_lhs.kt") + public void testCompoundAssignWithArrayAccessConvention_lhs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention_lhs.kt"); + } + + @Test + @TestMetadata("compoundAssignWithArrayGetConvention.kt") + public void testCompoundAssignWithArrayGetConvention() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayGetConvention.kt"); + } + + @Test + @TestMetadata("compoundAssignWithArrayGetConvention_lhs.kt") + public void testCompoundAssignWithArrayGetConvention_lhs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayGetConvention_lhs.kt"); + } + + @Test + @TestMetadata("consecutiveImplicitInvoke1.kt") + public void testConsecutiveImplicitInvoke1() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/consecutiveImplicitInvoke1.kt"); + } + + @Test + @TestMetadata("consecutiveImplicitInvoke2.kt") + public void testConsecutiveImplicitInvoke2() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/consecutiveImplicitInvoke2.kt"); + } + + @Test + @TestMetadata("consecutiveImplicitInvoke3.kt") + public void testConsecutiveImplicitInvoke3() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/consecutiveImplicitInvoke3.kt"); + } + + @Test + @TestMetadata("consecutiveImplicitInvoke_callee.kt") + public void testConsecutiveImplicitInvoke_callee() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/consecutiveImplicitInvoke_callee.kt"); + } + + @Test + @TestMetadata("delegatedConstructorCall_super.kt") + public void testDelegatedConstructorCall_super() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_super.kt"); + } + + @Test + @TestMetadata("delegatedConstructorCall_super_unresolved.kt") + public void testDelegatedConstructorCall_super_unresolved() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_super_unresolved.kt"); + } + + @Test + @TestMetadata("delegatedConstructorCall_this.kt") + public void testDelegatedConstructorCall_this() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_this.kt"); + } + + @Test + @TestMetadata("delegatedConstructorCall_this_unresolved.kt") + public void testDelegatedConstructorCall_this_unresolved() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_this_unresolved.kt"); + } + + @Test + @TestMetadata("enumAsAnnotationValue.kt") + public void testEnumAsAnnotationValue() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/enumAsAnnotationValue.kt"); + } + + @Test + @TestMetadata("eqEqCall_fromAny.kt") + public void testEqEqCall_fromAny() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/eqEqCall_fromAny.kt"); + } + + @Test + @TestMetadata("eqEqCall_fromSuperType.kt") + public void testEqEqCall_fromSuperType() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/eqEqCall_fromSuperType.kt"); + } + + @Test + @TestMetadata("eqEqCall_overridden.kt") + public void testEqEqCall_overridden() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/eqEqCall_overridden.kt"); + } + + @Test + @TestMetadata("functionCallInTheSameFile.kt") + public void testFunctionCallInTheSameFile() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionCallInTheSameFile.kt"); + } + + @Test + @TestMetadata("functionCallWithExtensionReceiverAndTypeArgument.kt") + public void testFunctionCallWithExtensionReceiverAndTypeArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionCallWithExtensionReceiverAndTypeArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithLambdaArgument.kt") + public void testFunctionCallWithLambdaArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionCallWithLambdaArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithNamedArgument.kt") + public void testFunctionCallWithNamedArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionCallWithNamedArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithNonTrailingLambdaArgument.kt") + public void testFunctionCallWithNonTrailingLambdaArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionCallWithNonTrailingLambdaArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithSpreadArgument.kt") + public void testFunctionCallWithSpreadArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionCallWithSpreadArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithTypeArgument.kt") + public void testFunctionCallWithTypeArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionCallWithTypeArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithVarargArgument.kt") + public void testFunctionCallWithVarargArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionCallWithVarargArgument.kt"); + } + + @Test + @TestMetadata("functionTypeVariableCall_dispatchReceiver.kt") + public void testFunctionTypeVariableCall_dispatchReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionTypeVariableCall_dispatchReceiver.kt"); + } + + @Test + @TestMetadata("functionTypeVariableCall_extensionReceiver.kt") + public void testFunctionTypeVariableCall_extensionReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionTypeVariableCall_extensionReceiver.kt"); + } + + @Test + @TestMetadata("functionWithReceiverCall.kt") + public void testFunctionWithReceiverCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionWithReceiverCall.kt"); + } + + @Test + @TestMetadata("functionWithReceiverSafeCall.kt") + public void testFunctionWithReceiverSafeCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/functionWithReceiverSafeCall.kt"); + } + + @Test + @TestMetadata("hiddenConstructor.kt") + public void testHiddenConstructor() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/hiddenConstructor.kt"); + } + + @Test + @TestMetadata("hiddenDeprecated.kt") + public void testHiddenDeprecated() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/hiddenDeprecated.kt"); + } + + @Test + @TestMetadata("implicitConstructorDelegationCall.kt") + public void testImplicitConstructorDelegationCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/implicitConstructorDelegationCall.kt"); + } + + @Test + @TestMetadata("implicitConstuctorCall.kt") + public void testImplicitConstuctorCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/implicitConstuctorCall.kt"); + } + + @Test + @TestMetadata("implicitJavaConstuctorCall.kt") + public void testImplicitJavaConstuctorCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/implicitJavaConstuctorCall.kt"); + } + + @Test + @TestMetadata("indexedGet.kt") + public void testIndexedGet() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/indexedGet.kt"); + } + + @Test + @TestMetadata("indexedGetWithNotEnoughArgs.kt") + public void testIndexedGetWithNotEnoughArgs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/indexedGetWithNotEnoughArgs.kt"); + } + + @Test + @TestMetadata("indexedGetWithTooManyArgs.kt") + public void testIndexedGetWithTooManyArgs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/indexedGetWithTooManyArgs.kt"); + } + + @Test + @TestMetadata("indexedSet.kt") + public void testIndexedSet() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSet.kt"); + } + + @Test + @TestMetadata("indexedSetWithNotEnoughArgs.kt") + public void testIndexedSetWithNotEnoughArgs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithNotEnoughArgs.kt"); + } + + @Test + @TestMetadata("indexedSetWithTooManyArgs.kt") + public void testIndexedSetWithTooManyArgs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithTooManyArgs.kt"); + } + + @Test + @TestMetadata("intArrayOfInAnnotation.kt") + public void testIntArrayOfInAnnotation() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/intArrayOfInAnnotation.kt"); + } + + @Test + @TestMetadata("javaFunctionCall.kt") + public void testJavaFunctionCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/javaFunctionCall.kt"); + } + + @Test + @TestMetadata("javaPropertyGetter.kt") + public void testJavaPropertyGetter() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/javaPropertyGetter.kt"); + } + + @Test + @TestMetadata("javaPropertyGetter_unqualified.kt") + public void testJavaPropertyGetter_unqualified() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/javaPropertyGetter_unqualified.kt"); + } + + @Test + @TestMetadata("javaPropertyNestedGetter.kt") + public void testJavaPropertyNestedGetter() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/javaPropertyNestedGetter.kt"); + } + + @Test + @TestMetadata("javaPropertySetter.kt") + public void testJavaPropertySetter() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/javaPropertySetter.kt"); + } + + @Test + @TestMetadata("javaPropertySetterIncomplete.kt") + public void testJavaPropertySetterIncomplete() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/javaPropertySetterIncomplete.kt"); + } + + @Test + @TestMetadata("javaPropertySetter_unqualified.kt") + public void testJavaPropertySetter_unqualified() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/javaPropertySetter_unqualified.kt"); + } + + @Test + @TestMetadata("kotlinPropertyGetter.kt") + public void testKotlinPropertyGetter() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/kotlinPropertyGetter.kt"); + } + + @Test + @TestMetadata("kotlinPropertyGetter_unqualified.kt") + public void testKotlinPropertyGetter_unqualified() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/kotlinPropertyGetter_unqualified.kt"); + } + + @Test + @TestMetadata("kotlinPropertyNestedGetter.kt") + public void testKotlinPropertyNestedGetter() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/kotlinPropertyNestedGetter.kt"); + } + + @Test + @TestMetadata("kotlinPropertySetter.kt") + public void testKotlinPropertySetter() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/kotlinPropertySetter.kt"); + } + + @Test + @TestMetadata("kotlinPropertySetter_unqualified.kt") + public void testKotlinPropertySetter_unqualified() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/kotlinPropertySetter_unqualified.kt"); + } + + @Test + @TestMetadata("memberFunctionCallWithTypeArgument.kt") + public void testMemberFunctionCallWithTypeArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/memberFunctionCallWithTypeArgument.kt"); + } + + @Test + @TestMetadata("postfixUnaryOperatorOnVar.kt") + public void testPostfixUnaryOperatorOnVar() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorOnVar.kt"); + } + + @Test + @TestMetadata("postfixUnaryOperatorOnVar_base.kt") + public void testPostfixUnaryOperatorOnVar_base() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorOnVar_base.kt"); + } + + @Test + @TestMetadata("postfixUnaryOperatorWithArrayAccessConvention.kt") + public void testPostfixUnaryOperatorWithArrayAccessConvention() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention.kt"); + } + + @Test + @TestMetadata("postfixUnaryOperatorWithArrayAccessConvention_base.kt") + public void testPostfixUnaryOperatorWithArrayAccessConvention_base() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention_base.kt"); + } + + @Test + @TestMetadata("postfixUnaryOperatorWithArrayAccessConvention_complexDispatcher.kt") + public void testPostfixUnaryOperatorWithArrayAccessConvention_complexDispatcher() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention_complexDispatcher.kt"); + } + + @Test + @TestMetadata("prefixUnaryOperatorOnVar.kt") + public void testPrefixUnaryOperatorOnVar() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorOnVar.kt"); + } + + @Test + @TestMetadata("prefixUnaryOperatorOnVar_base.kt") + public void testPrefixUnaryOperatorOnVar_base() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorOnVar_base.kt"); + } + + @Test + @TestMetadata("prefixUnaryOperatorWithArrayAccessConvention.kt") + public void testPrefixUnaryOperatorWithArrayAccessConvention() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention.kt"); + } + + @Test + @TestMetadata("prefixUnaryOperatorWithArrayAccessConvention_base.kt") + public void testPrefixUnaryOperatorWithArrayAccessConvention_base() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention_base.kt"); + } + + @Test + @TestMetadata("prefixUnaryOperatorWithArrayAccessConvention_complexDispatcher.kt") + public void testPrefixUnaryOperatorWithArrayAccessConvention_complexDispatcher() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention_complexDispatcher.kt"); + } + + @Test + @TestMetadata("privateMember.kt") + public void testPrivateMember() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/privateMember.kt"); + } + + @Test + @TestMetadata("qualifiedCalleeExpressionOfImplicitInvoke.kt") + public void testQualifiedCalleeExpressionOfImplicitInvoke() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/qualifiedCalleeExpressionOfImplicitInvoke.kt"); + } + + @Test + @TestMetadata("resolveCallInSuperConstructorParam.kt") + public void testResolveCallInSuperConstructorParam() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/resolveCallInSuperConstructorParam.kt"); + } + + @Test + @TestMetadata("samConstructorCall.kt") + public void testSamConstructorCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/samConstructorCall.kt"); + } + + @Test + @TestMetadata("simpleCallWithNonMatchingArgs.kt") + public void testSimpleCallWithNonMatchingArgs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/simpleCallWithNonMatchingArgs.kt"); + } + + @Test + @TestMetadata("smartCastExplicitDispatchReceiver.kt") + public void testSmartCastExplicitDispatchReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/smartCastExplicitDispatchReceiver.kt"); + } + + @Test + @TestMetadata("smartCastExplicitExtensionReceiver.kt") + public void testSmartCastExplicitExtensionReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/smartCastExplicitExtensionReceiver.kt"); + } + + @Test + @TestMetadata("smartCastImplicitDispatchReceiver.kt") + public void testSmartCastImplicitDispatchReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/smartCastImplicitDispatchReceiver.kt"); + } + + @Test + @TestMetadata("smartCastImplicitExtensionReceiver.kt") + public void testSmartCastImplicitExtensionReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/smartCastImplicitExtensionReceiver.kt"); + } + + @Test + @TestMetadata("unresolvedSuperReference.kt") + public void testUnresolvedSuperReference() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/unresolvedSuperReference.kt"); + } + + @Test + @TestMetadata("variableAsFunction.kt") + public void testVariableAsFunction() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunction.kt"); + } + + @Test + @TestMetadata("variableAsFunctionLikeCall.kt") + public void testVariableAsFunctionLikeCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionLikeCall.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterName.kt") + public void testVariableAsFunctionWithParameterName() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterName.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterNameAnnotation.kt") + public void testVariableAsFunctionWithParameterNameAnnotation() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameAnnotation.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterNameAnnotationConflict.kt") + public void testVariableAsFunctionWithParameterNameAnnotationConflict() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameAnnotationConflict.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterNameGeneric.kt") + public void testVariableAsFunctionWithParameterNameGeneric() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameGeneric.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterNameInNonFunctionType.kt") + public void testVariableAsFunctionWithParameterNameInNonFunctionType() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameInNonFunctionType.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterNameMixed.kt") + public void testVariableAsFunctionWithParameterNameMixed() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameMixed.kt"); + } + + @Test + @TestMetadata("variableWithExtensionInvoke.kt") + public void testVariableWithExtensionInvoke() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableWithExtensionInvoke.kt"); + } + + @Test + @TestMetadata("variableWithInvokeFunctionCall_dispatchReceiver.kt") + public void testVariableWithInvokeFunctionCall_dispatchReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableWithInvokeFunctionCall_dispatchReceiver.kt"); + } + + @Test + @TestMetadata("variableWithInvokeFunctionCall_extensionReceiver.kt") + public void testVariableWithInvokeFunctionCall_extensionReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableWithInvokeFunctionCall_extensionReceiver.kt"); + } + + @Test + @TestMetadata("variableWithMemberInvoke.kt") + public void testVariableWithMemberInvoke() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCall/variableWithMemberInvoke.kt"); + } +} diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention.descriptors.txt new file mode 100644 index 00000000000..6a02d4aad28 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention.descriptors.txt @@ -0,0 +1,57 @@ +KtSuccessCallInfo: + call = KtCompoundArrayAccessCall: + compoundAccess = CompoundAssign: + kind = PLUS_ASSIGN + operand = 1 + operationPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m["a"] + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Int.plus(: kotlin.Int, other: kotlin.Int): kotlin.Int + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = other: kotlin.Int + ] + getPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = /MyMap.get(: MyMap, k: K): V + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K + ] + indexArguments = [ + "a" + ] + setPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /MyMap.set(: MyMap, k: K, v: V): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = v: V + ] \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention_complexReceivers.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention_complexReceivers.descriptors.txt new file mode 100644 index 00000000000..153e6958dd8 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention_complexReceivers.descriptors.txt @@ -0,0 +1,76 @@ +KtSuccessCallInfo: + call = KtCompoundArrayAccessCall: + compoundAccess = CompoundAssign: + kind = PLUS_ASSIGN + operand = 1 + operationPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m["a"] + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Int.plus(: kotlin.Int, other: kotlin.Int): kotlin.Int + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = other: kotlin.Int + ] + getPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = /MyMap.get(: MyMap, k: K1): V1 + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K1 + ] + indexArguments = [ + "a" + ] + setPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtImplicitReceiverValue: + symbol = KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: Foo + classKind: INTERFACE + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: ABSTRACT + name: Foo + origin: LIBRARY + superTypes: [ + kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + extensionReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = MyMap + returnType = kotlin.Unit + symbol = /Foo.set(: MyMap, : Foo, k: K2, v: V2): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K2, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = v: V2 + ] \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention_lhs.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention_lhs.descriptors.txt new file mode 100644 index 00000000000..a1efefad5b2 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayAccessConvention_lhs.descriptors.txt @@ -0,0 +1,24 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = /MyMap.get(: MyMap, k: K): V + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K + ] + argumentMapping = { + "a" -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K) + } \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayGetConvention_lhs.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayGetConvention_lhs.descriptors.txt new file mode 100644 index 00000000000..d63ed9c8fe2 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/compoundAssignWithArrayGetConvention_lhs.descriptors.txt @@ -0,0 +1,24 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = A + symbol = /MyMap.get(: MyMap, k: K): V + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K + ] + argumentMapping = { + "a" -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K) + } \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_super_unresolved.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_super_unresolved.descriptors.txt index 75b65a7cb6a..3707e0f9c03 100644 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_super_unresolved.descriptors.txt +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_super_unresolved.descriptors.txt @@ -1,4 +1,25 @@ -KtDelegatedConstructorCall: -argumentMapping = { s -> (p1: kotlin.Int) } -targetFunction = ERR(p1: kotlin.Int): Base]> -kind = SUPER_CALL +KtErrorCallInfo: + candidateCalls = [ + KtDelegatedConstructorCall: + kind = SUPER_CALL + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = Base + symbol = (p1: kotlin.Int): Base + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = p1: kotlin.Int + ] + argumentMapping = { + s -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = p1: kotlin.Int) + } + ] + diagnostic = ERROR \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_this_unresolved.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_this_unresolved.descriptors.txt index dc8759f2c2f..cea8bd1781a 100644 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_this_unresolved.descriptors.txt +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/delegatedConstructorCall_this_unresolved.descriptors.txt @@ -1,4 +1,56 @@ -KtDelegatedConstructorCall: -argumentMapping = { } -targetFunction = ERR -kind = THIS_CALL +KtErrorCallInfo: + candidateCalls = [ + KtDelegatedConstructorCall: + kind = THIS_CALL + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = Sub + symbol = (i: kotlin.Int, j: kotlin.Int): Sub + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = i: kotlin.Int, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = j: kotlin.Int + ] + argumentMapping = { + i -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = i: kotlin.Int), + j -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = j: kotlin.Int) + }, + KtDelegatedConstructorCall: + kind = THIS_CALL + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = Sub + symbol = (p: kotlin.Int): Sub + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = p: kotlin.Int + ] + argumentMapping = { + i -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = p: kotlin.Int) + } + ] + diagnostic = ERROR \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/functionTypeVariableCall_dispatchReceiver.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/functionTypeVariableCall_dispatchReceiver.descriptors.txt new file mode 100644 index 00000000000..a405cdf198d --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/functionTypeVariableCall_dispatchReceiver.descriptors.txt @@ -0,0 +1,16 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = f + isSafeNavigation = false + extensionReceiver = KtExplicitReceiverValue: + expression = "" + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.String + returnType = kotlin.Unit + symbol = kotlin/Function1.invoke(: P1: kotlin.Function1): R + valueParameters = [] + argumentMapping = {} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/functionTypeVariableCall_extensionReceiver.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/functionTypeVariableCall_extensionReceiver.descriptors.txt new file mode 100644 index 00000000000..a405cdf198d --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/functionTypeVariableCall_extensionReceiver.descriptors.txt @@ -0,0 +1,16 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = f + isSafeNavigation = false + extensionReceiver = KtExplicitReceiverValue: + expression = "" + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.String + returnType = kotlin.Unit + symbol = kotlin/Function1.invoke(: P1: kotlin.Function1): R + valueParameters = [] + argumentMapping = {} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/hiddenConstructor.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/hiddenConstructor.descriptors.txt new file mode 100644 index 00000000000..e48169cf98c --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/hiddenConstructor.descriptors.txt @@ -0,0 +1,3 @@ +KtErrorCallInfo: + candidateCalls = [] + diagnostic = ERROR \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedGetWithNotEnoughArgs.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedGetWithNotEnoughArgs.descriptors.txt deleted file mode 100644 index ba40818edb9..00000000000 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedGetWithNotEnoughArgs.descriptors.txt +++ /dev/null @@ -1,4 +0,0 @@ -KtFunctionCall: -argumentMapping = { 1 -> (a: kotlin.Int) } -targetFunction = ERR: C, a: kotlin.Int, b: kotlin.String): kotlin.Boolean]> -substitutor = \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedGetWithTooManyArgs.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedGetWithTooManyArgs.descriptors.txt index d4daa8cec0f..924bfa4a302 100644 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedGetWithTooManyArgs.descriptors.txt +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedGetWithTooManyArgs.descriptors.txt @@ -1,4 +1,35 @@ -KtFunctionCall: -argumentMapping = { 1 -> (a: kotlin.Int), "foo" -> (b: kotlin.String) } -targetFunction = ERR: C, a: kotlin.Int, b: kotlin.String): kotlin.Boolean]> -substitutor = \ No newline at end of file +KtErrorCallInfo: + candidateCalls = [ + KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = c + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = /C.get(: C, a: kotlin.Int, b: kotlin.String): kotlin.Boolean + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = a: kotlin.Int, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = b: kotlin.String + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = a: kotlin.Int), + "foo" -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = b: kotlin.String) + } + ] + diagnostic = ERROR \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithNotEnoughArgs.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithNotEnoughArgs.descriptors.txt deleted file mode 100644 index d3e2fa33727..00000000000 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithNotEnoughArgs.descriptors.txt +++ /dev/null @@ -1,4 +0,0 @@ -KtFunctionCall: -argumentMapping = { 1 -> (a: kotlin.Int), false -> (value: kotlin.Boolean) } -targetFunction = ERR: C, a: kotlin.Int, b: kotlin.String, value: kotlin.Boolean): kotlin.Unit]> -substitutor = \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithTooManyArgs.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithTooManyArgs.descriptors.txt index 6ed0efbd0d3..01e8bb813dd 100644 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithTooManyArgs.descriptors.txt +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithTooManyArgs.descriptors.txt @@ -1,4 +1,43 @@ -KtFunctionCall: -argumentMapping = { 1 -> (a: kotlin.Int), "foo" -> (b: kotlin.String), 3.14 -> (value: kotlin.Boolean) } -targetFunction = ERR: C, a: kotlin.Int, b: kotlin.String, value: kotlin.Boolean): kotlin.Unit]> -substitutor = \ No newline at end of file +KtErrorCallInfo: + candidateCalls = [ + KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = c + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /C.set(: C, a: kotlin.Int, b: kotlin.String, value: kotlin.Boolean): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = a: kotlin.Int, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = b: kotlin.String, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = value: kotlin.Boolean + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = a: kotlin.Int), + "foo" -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = b: kotlin.String), + 3.14 -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Boolean + symbol = value: kotlin.Boolean) + } + ] + diagnostic = ERROR \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/kotlinPropertyGetter.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/kotlinPropertyGetter.descriptors.txt deleted file mode 100644 index 30236aa030d..00000000000 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/kotlinPropertyGetter.descriptors.txt +++ /dev/null @@ -1,4 +0,0 @@ -KtFunctionCall: -argumentMapping = { } -targetFunction = (: KtClass): kotlin.Int -substitutor = \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/memberFunctionCallWithTypeArgument.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/memberFunctionCallWithTypeArgument.descriptors.txt deleted file mode 100644 index 87158fe0e86..00000000000 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/memberFunctionCallWithTypeArgument.descriptors.txt +++ /dev/null @@ -1,4 +0,0 @@ -KtFunctionCall: -argumentMapping = { 1 -> (r: kotlin.Int) } -targetFunction = /A.foo(: A, r: kotlin.Int): kotlin.Unit -substitutor = \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention.descriptors.txt new file mode 100644 index 00000000000..fba953257d3 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention.descriptors.txt @@ -0,0 +1,52 @@ +KtSuccessCallInfo: + call = KtCompoundArrayAccessCall: + compoundAccess = IncOrDecOperation: + kind = INC + precedence = POSTFIX + operationPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m["a"] + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Int.inc(: kotlin.Int): kotlin.Int + valueParameters = [] + getPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = /MyMap.get(: MyMap, k: K): V + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K + ] + indexArguments = [ + "a" + ] + setPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /MyMap.set(: MyMap, k: K, v: V): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = v: V + ] \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention_base.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention_base.descriptors.txt new file mode 100644 index 00000000000..a1efefad5b2 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention_base.descriptors.txt @@ -0,0 +1,24 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = /MyMap.get(: MyMap, k: K): V + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K + ] + argumentMapping = { + "a" -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K) + } \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention_complexDispatcher.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention_complexDispatcher.descriptors.txt new file mode 100644 index 00000000000..efd041d671b --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/postfixUnaryOperatorWithArrayAccessConvention_complexDispatcher.descriptors.txt @@ -0,0 +1,71 @@ +KtSuccessCallInfo: + call = KtCompoundArrayAccessCall: + compoundAccess = IncOrDecOperation: + kind = INC + precedence = POSTFIX + operationPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m["a"] + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Int.inc(: kotlin.Int): kotlin.Int + valueParameters = [] + getPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = /MyMap.get(: MyMap, k: K1): V1 + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K1 + ] + indexArguments = [ + "a" + ] + setPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtImplicitReceiverValue: + symbol = KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: Foo + classKind: INTERFACE + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: ABSTRACT + name: Foo + origin: LIBRARY + superTypes: [ + kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + extensionReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = MyMap + returnType = kotlin.Unit + symbol = /Foo.set(: MyMap, : Foo, k: K2, v: V2): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K2, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = v: V2 + ] \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention.descriptors.txt new file mode 100644 index 00000000000..a165ca83351 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention.descriptors.txt @@ -0,0 +1,52 @@ +KtSuccessCallInfo: + call = KtCompoundArrayAccessCall: + compoundAccess = IncOrDecOperation: + kind = INC + precedence = PREFIX + operationPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m["a"] + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Int.inc(: kotlin.Int): kotlin.Int + valueParameters = [] + getPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = /MyMap.get(: MyMap, k: K): V + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K + ] + indexArguments = [ + "a" + ] + setPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /MyMap.set(: MyMap, k: K, v: V): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = v: V + ] \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention_base.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention_base.descriptors.txt new file mode 100644 index 00000000000..a1efefad5b2 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention_base.descriptors.txt @@ -0,0 +1,24 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = /MyMap.get(: MyMap, k: K): V + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K + ] + argumentMapping = { + "a" -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K) + } \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention_complexDispatcher.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention_complexDispatcher.descriptors.txt new file mode 100644 index 00000000000..a2ef3be3ae7 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/prefixUnaryOperatorWithArrayAccessConvention_complexDispatcher.descriptors.txt @@ -0,0 +1,71 @@ +KtSuccessCallInfo: + call = KtCompoundArrayAccessCall: + compoundAccess = IncOrDecOperation: + kind = INC + precedence = PREFIX + operationPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m["a"] + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = kotlin/Int.inc(: kotlin.Int): kotlin.Int + valueParameters = [] + getPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = /MyMap.get(: MyMap, k: K1): V1 + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K1 + ] + indexArguments = [ + "a" + ] + setPartiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtImplicitReceiverValue: + symbol = KtNamedClassOrObjectSymbol: + annotationsList: [] + classIdIfNonLocal: Foo + classKind: INTERFACE + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: ABSTRACT + name: Foo + origin: LIBRARY + superTypes: [ + kotlin/Any + ] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + extensionReceiver = KtExplicitReceiverValue: + expression = m + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = MyMap + returnType = kotlin.Unit + symbol = /Foo.set(: MyMap, : Foo, k: K2, v: V2): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = k: K2, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = v: V2 + ] \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/privateMember.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/privateMember.descriptors.txt new file mode 100644 index 00000000000..eaa0347eba8 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/privateMember.descriptors.txt @@ -0,0 +1,17 @@ +KtErrorCallInfo: + candidateCalls = [ + KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = a + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /A.foo(: A): kotlin.Unit + valueParameters = [] + argumentMapping = {} + ] + diagnostic = ERROR \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/simpleCallWithNonMatchingArgs.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/simpleCallWithNonMatchingArgs.descriptors.txt index 2b2e304a990..18e5ac15641 100644 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/simpleCallWithNonMatchingArgs.descriptors.txt +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/simpleCallWithNonMatchingArgs.descriptors.txt @@ -1,4 +1,15 @@ -KtFunctionCall: -argumentMapping = { } -targetFunction = ERR -substitutor = \ No newline at end of file +KtErrorCallInfo: + candidateCalls = [ + KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /foo(): kotlin.Unit + valueParameters = [] + argumentMapping = {} + ] + diagnostic = ERROR \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/unresolvedSuperReference.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/unresolvedSuperReference.descriptors.txt deleted file mode 100644 index 17aedc15518..00000000000 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/unresolvedSuperReference.descriptors.txt +++ /dev/null @@ -1,4 +0,0 @@ -KtDelegatedConstructorCall: -argumentMapping = { } -targetFunction = ERR -kind = SUPER_CALL diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunction.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunction.descriptors.txt new file mode 100644 index 00000000000..4e0e4d31a1b --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunction.descriptors.txt @@ -0,0 +1,24 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = x + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = kotlin/Function1.invoke(: kotlin.Function1, p1: P1): R + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = p1: P1 + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.Int + symbol = p1: P1) + } \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterName.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterName.descriptors.txt new file mode 100644 index 00000000000..6f4f3c26b17 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterName.descriptors.txt @@ -0,0 +1,23 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = x + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = kotlin/Function2.invoke(: kotlin.Function2, p1: P1, p2: P2): R + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int + symbol = p1: P1, + KtVariableLikeSignature: + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(b)) kotlin.String + symbol = p2: P2 + ] + argumentMapping = {} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameAnnotation.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameAnnotation.descriptors.txt new file mode 100644 index 00000000000..6f4f3c26b17 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameAnnotation.descriptors.txt @@ -0,0 +1,23 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = x + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = kotlin/Function2.invoke(: kotlin.Function2, p1: P1, p2: P2): R + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int + symbol = p1: P1, + KtVariableLikeSignature: + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(b)) kotlin.String + symbol = p2: P2 + ] + argumentMapping = {} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameAnnotationConflict.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameAnnotationConflict.descriptors.txt index 8d63e1b22f7..f52a154e1de 100644 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameAnnotationConflict.descriptors.txt +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameAnnotationConflict.descriptors.txt @@ -1,5 +1,23 @@ -KtFunctionalTypeVariableCall: -target = x: kotlin.Function2<@R|kotlin.ParameterName|(name = String(a)) @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int, @R|kotlin.ParameterName|(name = String(b)) @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String, kotlin.Unit> -argumentMapping = { 1 -> (a: @R|kotlin.ParameterName|(name = String(a)) @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int), "" -> (b: @R|kotlin.ParameterName|(name = String(b)) @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String) } -targetFunction = kotlin/Function2.invoke(: kotlin.Function2<@R|kotlin.ParameterName|(name = String(a)) @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int, @R|kotlin.ParameterName|(name = String(b)) @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String, kotlin.Unit>, a: @R|kotlin.ParameterName|(name = String(a)) @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int, b: @R|kotlin.ParameterName|(name = String(b)) @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String): kotlin.Unit -substitutor = +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = x + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = kotlin/Function2.invoke(: kotlin.Function2, p1: P1, p2: P2): R + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(a)) @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int + symbol = p1: P1, + KtVariableLikeSignature: + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(b)) @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String + symbol = p2: P2 + ] + argumentMapping = {} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameGeneric.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameGeneric.descriptors.txt new file mode 100644 index 00000000000..6774664290d --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameGeneric.descriptors.txt @@ -0,0 +1,19 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = x + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = kotlin/Function1.invoke(: kotlin.Function1, p1: P1): R + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int + symbol = p1: P1 + ] + argumentMapping = {} \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameMixed.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameMixed.descriptors.txt new file mode 100644 index 00000000000..aafb870651c --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/variableAsFunctionWithParameterNameMixed.descriptors.txt @@ -0,0 +1,28 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = x + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = kotlin/Function2.invoke(: kotlin.Function2, p1: P1, p2: P2): R + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int + symbol = p1: P1, + KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = p2: P2 + ] + argumentMapping = { + "" -> (KtVariableLikeSignature: + receiverType = null + returnType = kotlin.String + symbol = p2: P2) + } \ No newline at end of file diff --git a/analysis/analysis-api/testData/scopes/substitutionOverridesUnwrapping/variableAsFunctionWithParameterNameGeneric.descriptors.txt b/analysis/analysis-api/testData/scopes/substitutionOverridesUnwrapping/variableAsFunctionWithParameterNameGeneric.descriptors.txt new file mode 100644 index 00000000000..6774664290d --- /dev/null +++ b/analysis/analysis-api/testData/scopes/substitutionOverridesUnwrapping/variableAsFunctionWithParameterNameGeneric.descriptors.txt @@ -0,0 +1,19 @@ +KtSuccessCallInfo: + call = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = x + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = kotlin/Function1.invoke(: kotlin.Function1, p1: P1): R + valueParameters = [ + KtVariableLikeSignature: + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(a)) kotlin.Int + symbol = p1: P1 + ] + argumentMapping = {} \ No newline at end of file diff --git a/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/analysisApi.kt b/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/analysisApi.kt index 0d8d8c6635e..840f6e6e3c1 100644 --- a/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/analysisApi.kt +++ b/generators/analysis-api-generator/tests/org/jetbrains/kotlin/generators/tests/analysis/api/analysisApi.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.generators.tests.analysis.api import org.jetbrains.kotlin.analysis.api.descriptors.test.annotations.AbstractAnalysisApiFe10AnnotationsOnDeclarationsTest import org.jetbrains.kotlin.analysis.api.descriptors.test.annotations.AbstractAnalysisApiFe10AnnotationsOnTypesTest +import org.jetbrains.kotlin.analysis.api.descriptors.test.components.callResolver.AbstractKtFe10ResolveCallTest import org.jetbrains.kotlin.analysis.api.descriptors.test.components.compileTimeConstantProvider.AbstractKtFe10CompileTimeConstantEvaluatorTest import org.jetbrains.kotlin.analysis.api.descriptors.test.components.expressionInfoProvider.AbstractKtFe10ReturnTargetSymbolTest import org.jetbrains.kotlin.analysis.api.descriptors.test.components.expressionInfoProvider.AbstractKtFe10WhenMissingCasesTest @@ -148,8 +149,7 @@ private fun TestGroupSuite.generateAnalysisApiComponentsTests() { component("callResolver") { test( fir = AbstractFirResolveCallTest::class, - // TODO: re-enable after KtFe10CallResolver is properly implemented - fe10 = null // AbstractKtFe10ResolveCallTest::class, + fe10 = AbstractKtFe10ResolveCallTest::class, ) { model("resolveCall") }