diff --git a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/CliFe10AnalysisFacade.kt b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/CliFe10AnalysisFacade.kt index 18e2ffa66e4..011f944f455 100644 --- a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/CliFe10AnalysisFacade.kt +++ b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/CliFe10AnalysisFacade.kt @@ -18,9 +18,18 @@ import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.resolve.BindingContext import org.jetbrains.kotlin.resolve.BindingTrace +import org.jetbrains.kotlin.resolve.calls.CallResolver +import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall +import org.jetbrains.kotlin.resolve.calls.results.OverloadingConflictResolver +import org.jetbrains.kotlin.resolve.calls.results.PlatformOverloadsSpecificityComparator +import org.jetbrains.kotlin.resolve.calls.results.TypeSpecificityComparator +import org.jetbrains.kotlin.resolve.calls.results.createOverloadingConflictResolver +import org.jetbrains.kotlin.resolve.calls.tower.KotlinToResolvedCallTransformer import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver import org.jetbrains.kotlin.resolve.extensions.AnalysisHandlerExtension import org.jetbrains.kotlin.resolve.lazy.ResolveSession +import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner +import org.jetbrains.kotlin.util.CancellationChecker import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull class CliFe10AnalysisFacade(project: Project) : Fe10AnalysisFacade { @@ -34,6 +43,22 @@ class CliFe10AnalysisFacade(project: Project) : Fe10AnalysisFacade { return handler.deprecationResolver ?: error("Resolution is not performed") } + override fun getCallResolver(element: KtElement): CallResolver { + return handler.callResolver ?: error("Resolution is not performed") + } + + override fun getKotlinToResolvedCallTransformer(element: KtElement): KotlinToResolvedCallTransformer { + return handler.kotlinToResolvedCallTransformer ?: error("Resolution is not performed") + } + + override fun getOverloadingConflictResolver(element: KtElement): OverloadingConflictResolver> { + return handler.overloadingConflictResolver ?: error("Resolution is not performed") + } + + override fun getKotlinTypeRefiner(element: KtElement): KotlinTypeRefiner { + return handler.kotlinTypeRefiner ?: error("Resolution is not performed") + } + override fun analyze(element: KtElement, mode: Fe10AnalysisFacade.AnalysisMode): BindingContext { return getResolveSession(element).bindingContext } @@ -57,6 +82,18 @@ class KtFe10AnalysisHandlerExtension : AnalysisHandlerExtension { var deprecationResolver: DeprecationResolver? = null private set + var callResolver: CallResolver? = null + private set + + var kotlinToResolvedCallTransformer: KotlinToResolvedCallTransformer? = null + private set + + var overloadingConflictResolver: OverloadingConflictResolver>? = null + private set + + var kotlinTypeRefiner: KotlinTypeRefiner? = null + private set + override fun doAnalysis( project: Project, module: ModuleDescriptor, @@ -67,6 +104,22 @@ class KtFe10AnalysisHandlerExtension : AnalysisHandlerExtension { ): AnalysisResult? { resolveSession = componentProvider.get() deprecationResolver = componentProvider.get() + callResolver = componentProvider.get() + kotlinToResolvedCallTransformer = componentProvider.get() + kotlinTypeRefiner = componentProvider.get() + + val builtIns = resolveSession!!.moduleDescriptor.builtIns + val typeSpecificityComparator = componentProvider.get() + val platformOverloadsSpecificityComparator = componentProvider.get() + val cancellationChecker = componentProvider.get() + overloadingConflictResolver = createOverloadingConflictResolver( + builtIns, + module, + typeSpecificityComparator, + platformOverloadsSpecificityComparator, + cancellationChecker, + kotlinTypeRefiner!! + ) return super.doAnalysis(project, module, projectContext, files, bindingTrace, componentProvider) } } \ No newline at end of file diff --git a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/Fe10AnalysisFacade.kt b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/Fe10AnalysisFacade.kt index 52b712c90e7..a9a02008b3b 100644 --- a/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/Fe10AnalysisFacade.kt +++ b/analysis/analysis-api-fe10/src/org/jetbrains/kotlin/analysis/api/descriptors/Fe10AnalysisFacade.kt @@ -14,8 +14,13 @@ import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.resolve.BindingContext +import org.jetbrains.kotlin.resolve.calls.CallResolver +import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall +import org.jetbrains.kotlin.resolve.calls.results.OverloadingConflictResolver +import org.jetbrains.kotlin.resolve.calls.tower.KotlinToResolvedCallTransformer import org.jetbrains.kotlin.resolve.deprecation.DeprecationResolver import org.jetbrains.kotlin.resolve.lazy.ResolveSession +import org.jetbrains.kotlin.types.checker.KotlinTypeRefiner interface Fe10AnalysisFacade { companion object { @@ -26,6 +31,10 @@ interface Fe10AnalysisFacade { fun getResolveSession(element: KtElement): ResolveSession fun getDeprecationResolver(element: KtElement): DeprecationResolver + fun getCallResolver(element: KtElement): CallResolver + fun getKotlinToResolvedCallTransformer(element: KtElement): KotlinToResolvedCallTransformer + fun getOverloadingConflictResolver(element: KtElement): OverloadingConflictResolver> + fun getKotlinTypeRefiner(element: KtElement): KotlinTypeRefiner fun analyze(element: KtElement, mode: AnalysisMode = AnalysisMode.FULL): BindingContext @@ -45,6 +54,10 @@ class Fe10AnalysisContext( ) : Fe10AnalysisFacade by facade { val resolveSession: ResolveSession = getResolveSession(contextElement) val deprecationResolver: DeprecationResolver = getDeprecationResolver(contextElement) + val callResolver: CallResolver = getCallResolver(contextElement) + val kotlinToResolvedCallTransformer: KotlinToResolvedCallTransformer = getKotlinToResolvedCallTransformer(contextElement) + val overloadingConflictResolver: OverloadingConflictResolver> = getOverloadingConflictResolver(contextElement) + val kotlinTypeRefiner: KotlinTypeRefiner = getKotlinTypeRefiner(contextElement) val builtIns: KotlinBuiltIns get() = resolveSession.moduleDescriptor.builtIns 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 137c66d7276..24ca7032f78 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 @@ -1,6 +1,6 @@ /* * 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. + * 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.components @@ -11,19 +11,19 @@ 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.KtFe10DescSymbol 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.descriptors.symbols.psiBased.base.KtFe10PsiSymbol +import org.jetbrains.kotlin.analysis.api.descriptors.symbols.psiBased.base.getResolutionScope 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.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.descriptors.* import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters1 import org.jetbrains.kotlin.diagnostics.DiagnosticWithParameters2 import org.jetbrains.kotlin.diagnostics.Errors @@ -32,17 +32,30 @@ 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.DelegatingBindingTrace +import org.jetbrains.kotlin.resolve.DescriptorEquivalenceForOverrides +import org.jetbrains.kotlin.resolve.bindingContextUtil.getDataFlowInfoBefore +import org.jetbrains.kotlin.resolve.calls.CallTransformer import org.jetbrains.kotlin.resolve.calls.components.isVararg +import org.jetbrains.kotlin.resolve.calls.context.BasicCallResolutionContext +import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode +import org.jetbrains.kotlin.resolve.calls.context.ContextDependency import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall +import org.jetbrains.kotlin.resolve.calls.smartcasts.DataFlowValueFactoryImpl +import org.jetbrains.kotlin.resolve.calls.tower.NewAbstractResolvedCall +import org.jetbrains.kotlin.resolve.calls.util.getCall import org.jetbrains.kotlin.resolve.calls.util.getResolvedCall +import org.jetbrains.kotlin.resolve.diagnostics.Diagnostics 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.types.TypeUtils +import org.jetbrains.kotlin.types.expressions.OperatorConventions import org.jetbrains.kotlin.util.OperatorNameConventions +import org.jetbrains.kotlin.utils.addToStdlib.safeAs internal class KtFe10CallResolver( override val analysisSession: KtFe10AnalysisSession @@ -70,7 +83,7 @@ internal class KtFe10CallResolver( 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, + *Errors.TYPE_MISMATCH_ERRORS.toTypedArray(), ) private val resolutionFailureErrors = setOf( Errors.INVISIBLE_MEMBER, @@ -140,14 +153,118 @@ internal class KtFe10CallResolver( } is KtUnaryExpression -> { handleAsIncOrDecOperator(this, unwrappedPsi)?.let { return@with it } + handleAsCheckNotNullCall(unwrappedPsi)?.let { return@with it } handleAsFunctionCall(this, unwrappedPsi) } else -> handleAsFunctionCall(this, unwrappedPsi) ?: handleAsPropertyRead(this, unwrappedPsi) } ?: handleResolveErrors(this, psi) } - // TODO: See Call.resolveCandidates() in plugins/kotlin/core/src/org/jetbrains/kotlin/idea/core/Utils.kt - override fun collectCallCandidates(psi: KtElement): List = TODO() + override fun collectCallCandidates(psi: KtElement): List = + with(analysisContext.analyze(psi, AnalysisMode.PARTIAL_WITH_DIAGNOSTICS)) { + if (psi.isNotResolvable()) return emptyList() + + val resolvedKtCallInfo = resolveCall(psi) + val bestCandidateDescriptors = + resolvedKtCallInfo?.calls?.filterIsInstance>() + ?.mapNotNullTo(mutableSetOf()) { it.descriptor as? CallableDescriptor } + ?: emptySet() + + val unwrappedPsi = KtPsiUtil.deparenthesize(psi as? KtExpression) ?: psi + + if (unwrappedPsi is KtUnaryExpression) { + // TODO: Handle ++ or -- operator + handleAsCheckNotNullCall(unwrappedPsi)?.let { return@with it.toKtCallCandidateInfos() } + } + if (unwrappedPsi is KtBinaryExpression && + (unwrappedPsi.operationToken in OperatorConventions.COMPARISON_OPERATIONS || + unwrappedPsi.operationToken in OperatorConventions.EQUALS_OPERATIONS) + ) { + // TODO: Handle compound assignment + handleAsFunctionCall(this, unwrappedPsi)?.toKtCallCandidateInfos()?.let { return@with it } + } + + val resolutionScope = unwrappedPsi.getResolutionScope(this) ?: return emptyList() + val call = unwrappedPsi.getCall(this)?.let { + if (it is CallTransformer.CallForImplicitInvoke) it.outerCall else it + } ?: return emptyList() + val dataFlowInfo = getDataFlowInfoBefore(unwrappedPsi) + val bindingTrace = DelegatingBindingTrace(this, "Trace for all candidates", withParentDiagnostics = false) + val dataFlowValueFactory = DataFlowValueFactoryImpl(analysisContext.languageVersionSettings) + + val callResolutionContext = BasicCallResolutionContext.create( + bindingTrace, resolutionScope, call, TypeUtils.NO_EXPECTED_TYPE, dataFlowInfo, + ContextDependency.INDEPENDENT, CheckArgumentTypesMode.CHECK_VALUE_ARGUMENTS, + /* isAnnotationContext = */ false, analysisContext.languageVersionSettings, + dataFlowValueFactory + ).replaceCollectAllCandidates(true) + + val result = analysisContext.callResolver.resolveFunctionCall(callResolutionContext) + val candidates = result.allCandidates?.let { analysisContext.overloadingConflictResolver.filterOutEquivalentCalls(it) } + ?: error("allCandidates is null even when collectAllCandidates = true") + + candidates.flatMap { candidate -> + // The current BindingContext does not have the diagnostics for each individual candidate, only for the resolved call. + // If there are multiple candidates, we can get each one's diagnostics by reporting it to a new BindingTrace. + val candidateTrace = DelegatingBindingTrace(this, "Trace for candidate", withParentDiagnostics = false) + if (candidate is NewAbstractResolvedCall<*>) { + analysisContext.kotlinToResolvedCallTransformer.reportDiagnostics( + callResolutionContext, + candidateTrace, + candidate, + candidate.diagnostics + ) + } + + val candidateKtCallInfo = handleAsFunctionCall( + candidateTrace.bindingContext, + unwrappedPsi, + candidate, + candidateTrace.bindingContext.diagnostics + ) + candidateKtCallInfo.toKtCallCandidateInfos(bestCandidateDescriptors) + } + } + + private val KtFunctionCall<*>.descriptor: DeclarationDescriptor? + get() = when (val symbol = symbol) { + is KtFe10PsiSymbol<*, *> -> symbol.descriptor + is KtFe10DescSymbol<*> -> symbol.descriptor + else -> null + } + + private fun KtCallInfo?.toKtCallCandidateInfos(): List { + return when (this) { + is KtSuccessCallInfo -> listOf(KtApplicableCallCandidateInfo(call, isInBestCandidates = true)) + is KtErrorCallInfo -> candidateCalls.map { KtInapplicableCallCandidateInfo(it, isInBestCandidates = true, diagnostic) } + null -> emptyList() + } + } + + private fun KtCallInfo?.toKtCallCandidateInfos(bestCandidateDescriptors: Set): List { + // TODO: We should prefer to compare symbols instead of descriptors, but we can't do so while symbols are not cached. + fun KtCall.isInBestCandidates(): Boolean { + val descriptor = this.safeAs>()?.descriptor as? CallableDescriptor + return descriptor != null && bestCandidateDescriptors.any { it -> + DescriptorEquivalenceForOverrides.areCallableDescriptorsEquivalent( + it, + descriptor, + allowCopiesFromTheSameDeclaration = true, + kotlinTypeRefiner = analysisContext.kotlinTypeRefiner + ) + } + } + + return when (this) { + is KtSuccessCallInfo -> { + listOf(KtApplicableCallCandidateInfo(call, call.isInBestCandidates())) + } + is KtErrorCallInfo -> candidateCalls.map { + KtInapplicableCallCandidateInfo(it, it.isInBestCandidates(), diagnostic) + } + null -> emptyList() + } + } private fun handleAsCompoundAssignment(context: BindingContext, binaryExpression: KtBinaryExpression): KtCallInfo? { val left = binaryExpression.left ?: return null @@ -231,29 +348,41 @@ internal class KtFe10CallResolver( ) } - 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 + private fun handleAsCheckNotNullCall(unaryExpression: KtUnaryExpression): KtCallInfo? { + if (unaryExpression.operationToken == KtTokens.EXCLEXCL) { + val baseExpression = unaryExpression.baseExpression ?: return null return KtSuccessCallInfo(KtCheckNotNullCall(token, baseExpression)) } + return null + } + + private fun handleAsFunctionCall(context: BindingContext, element: KtElement): KtCallInfo? { + return element.getResolvedCall(context)?.let { handleAsFunctionCall(context, element, it) } + } + + private fun handleAsFunctionCall( + context: BindingContext, + element: KtElement, + resolvedCall: ResolvedCall<*>, + diagnostics: Diagnostics = context.diagnostics + ): KtCallInfo? { return if (resolvedCall is VariableAsFunctionResolvedCall) { - if (element is KtCallExpression) { + if (element is KtCallExpression || element is KtQualifiedExpression) { // 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)) } + }?.let { createCallInfo(context, element, it, listOf(resolvedCall), diagnostics) } } else { - resolvedCall?.toFunctionKtCall(context)?.let { createCallInfo(context, element, it, listOf(resolvedCall)) } + resolvedCall.toFunctionKtCall(context)?.let { createCallInfo(context, element, it, listOf(resolvedCall), diagnostics) } } } - 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 handleAsPropertyRead(context: BindingContext, element: KtElement): KtCallInfo? { + val call = element.getResolvedCall(context) ?: return null + return call.toPropertyRead(context)?.let { createCallInfo(context, element, it, listOf(call)) } } private fun ResolvedCall<*>.toPropertyRead(context: BindingContext): KtVariableAccessCall? { @@ -409,10 +538,16 @@ internal class KtFe10CallResolver( return result } - private fun createCallInfo(context: BindingContext, psi: KtElement, ktCall: KtCall, resolvedCalls: List>): KtCallInfo { + private fun createCallInfo( + context: BindingContext, + psi: KtElement, + ktCall: KtCall, + resolvedCalls: List>, + diagnostics: Diagnostics = context.diagnostics + ): KtCallInfo { val failedResolveCall = resolvedCalls.firstOrNull { !it.status.isSuccess } ?: return KtSuccessCallInfo(ktCall) - val diagnostic = getDiagnosticToReport(context, psi, ktCall)?.let { KtFe10Diagnostic(it, token) } + val diagnostic = getDiagnosticToReport(context, psi, ktCall, diagnostics)?.let { KtFe10Diagnostic(it, token) } ?: KtNonBoundToPsiErrorDiagnostic( factoryName = null, "${failedResolveCall.status} with ${failedResolveCall.resultingDescriptor.name}", @@ -443,8 +578,11 @@ internal class KtFe10CallResolver( } private fun getDiagnosticToReport( - context: BindingContext, psi: KtElement, ktCall: KtCall? - ) = context.diagnostics.firstOrNull { diagnostic -> + context: BindingContext, + psi: KtElement, + ktCall: KtCall?, + diagnostics: Diagnostics = context.diagnostics + ) = diagnostics.firstOrNull { diagnostic -> if (diagnostic.severity != Severity.ERROR) return@firstOrNull false val isResolutionError = diagnostic.factory in resolutionFailureErrors val isCallArgError = diagnostic.factory in callArgErrors @@ -461,7 +599,15 @@ internal class KtFe10CallResolver( 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 + reportedPsiParent is KtValueArgument && + (psi is KtQualifiedExpression && psi.selectorExpression?.safeAs()?.valueArguments?.contains( + reportedPsiParent + ) == true || + psi is KtCallElement && reportedPsiParent in psi.valueArguments) -> true + // errors on receiver of invoke function calls + isCallArgError && + (psi is KtQualifiedExpression && reportedPsiParent == psi.selectorExpression || + psi is KtCallElement && reportedPsiParent == psi) -> true // errors on index args for array access convention isCallArgError && reportedPsiParent is KtContainerNode && reportedPsiParent.parent is KtArrayAccessExpression -> true diff --git a/analysis/analysis-api-fe10/tests/org/jetbrains/kotlin/analysis/api/fe10/components/Fe10ResolveCandidatesTestGenerated.java b/analysis/analysis-api-fe10/tests/org/jetbrains/kotlin/analysis/api/fe10/components/Fe10ResolveCandidatesTestGenerated.java new file mode 100644 index 00000000000..7e918c9298f --- /dev/null +++ b/analysis/analysis-api-fe10/tests/org/jetbrains/kotlin/analysis/api/fe10/components/Fe10ResolveCandidatesTestGenerated.java @@ -0,0 +1,468 @@ +/* + * 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.fe10.components; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.util.KtTestUtil; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.kotlin.analysis.api.impl.barebone.test.FrontendApiTestConfiguratorService; +import org.jetbrains.kotlin.analysis.api.descriptors.test.KtFe10FrontendApiTestConfiguratorService; +import org.jetbrains.kotlin.analysis.api.impl.base.test.components.AbstractResolveCandidatesTest; +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/resolveCandidates") +@TestDataPath("$PROJECT_ROOT") +public class Fe10ResolveCandidatesTestGenerated extends AbstractResolveCandidatesTest { + @NotNull + @Override + public FrontendApiTestConfiguratorService getConfigurator() { + return KtFe10FrontendApiTestConfiguratorService.INSTANCE; + } + + @Test + public void testAllFilesPresentInResolveCandidates() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCandidates"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Nested + @TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates") + @TestDataPath("$PROJECT_ROOT") + public class MultipleCandidates { + @Test + public void testAllFilesPresentInMultipleCandidates() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("ambiguous.kt") + public void testAmbiguous() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/ambiguous.kt"); + } + + @Test + @TestMetadata("ambiguousImplicitInvoke.kt") + public void testAmbiguousImplicitInvoke() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/ambiguousImplicitInvoke.kt"); + } + + @Test + @TestMetadata("ambiguousWithExplicitTypeParameters.kt") + public void testAmbiguousWithExplicitTypeParameters() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/ambiguousWithExplicitTypeParameters.kt"); + } + + @Test + @TestMetadata("ambiguousWithInferredTypeParameters.kt") + public void testAmbiguousWithInferredTypeParameters() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/ambiguousWithInferredTypeParameters.kt"); + } + + @Test + @TestMetadata("implicitInvoke.kt") + public void testImplicitInvoke() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/implicitInvoke.kt"); + } + + @Test + @TestMetadata("implicitInvokeWithReceiver.kt") + public void testImplicitInvokeWithReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/implicitInvokeWithReceiver.kt"); + } + } + + @Nested + @TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCandidates/noCandidates") + @TestDataPath("$PROJECT_ROOT") + public class NoCandidates { + @Test + public void testAllFilesPresentInNoCandidates() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCandidates/noCandidates"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("hiddenDeprecated.kt") + public void testHiddenDeprecated() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/noCandidates/hiddenDeprecated.kt"); + } + + @Test + @TestMetadata("unresolvableOperator_elvis_1.kt") + public void testUnresolvableOperator_elvis_1() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/noCandidates/unresolvableOperator_elvis_1.kt"); + } + + @Test + @TestMetadata("unresolvableOperator_elvis_2.kt") + public void testUnresolvableOperator_elvis_2() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/noCandidates/unresolvableOperator_elvis_2.kt"); + } + + @Test + @TestMetadata("unresolvableOperator_eqeqeq_1.kt") + public void testUnresolvableOperator_eqeqeq_1() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/noCandidates/unresolvableOperator_eqeqeq_1.kt"); + } + + @Test + @TestMetadata("unresolvableOperator_eqeqeq_2.kt") + public void testUnresolvableOperator_eqeqeq_2() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/noCandidates/unresolvableOperator_eqeqeq_2.kt"); + } + + @Test + @TestMetadata("unresolvableOperator_excleqeq_1.kt") + public void testUnresolvableOperator_excleqeq_1() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/noCandidates/unresolvableOperator_excleqeq_1.kt"); + } + + @Test + @TestMetadata("unresolvableOperator_excleqeq_2.kt") + public void testUnresolvableOperator_excleqeq_2() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/noCandidates/unresolvableOperator_excleqeq_2.kt"); + } + + @Test + @TestMetadata("unresolvedReference.kt") + public void testUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/noCandidates/unresolvedReference.kt"); + } + } + + @Nested + @TestMetadata("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate") + @TestDataPath("$PROJECT_ROOT") + public class SingleCandidate { + @Test + public void testAllFilesPresentInSingleCandidate() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("arrayOfInAnnotation.kt") + public void testArrayOfInAnnotation() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/arrayOfInAnnotation.kt"); + } + + @Test + @TestMetadata("builderInference.kt") + public void testBuilderInference() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/builderInference.kt"); + } + + @Test + @TestMetadata("checkNotNullCall.kt") + public void testCheckNotNullCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/checkNotNullCall.kt"); + } + + @Test + @TestMetadata("checkNotNullCallAsCallee.kt") + public void testCheckNotNullCallAsCallee() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/checkNotNullCallAsCallee.kt"); + } + + @Test + @TestMetadata("comparisonCall.kt") + public void testComparisonCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/comparisonCall.kt"); + } + + @Test + @TestMetadata("consecutiveImplicitInvoke1.kt") + public void testConsecutiveImplicitInvoke1() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke1.kt"); + } + + @Test + @TestMetadata("consecutiveImplicitInvoke2.kt") + public void testConsecutiveImplicitInvoke2() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke2.kt"); + } + + @Test + @TestMetadata("consecutiveImplicitInvoke3.kt") + public void testConsecutiveImplicitInvoke3() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke3.kt"); + } + + @Test + @TestMetadata("eqEqCall_fromAny.kt") + public void testEqEqCall_fromAny() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/eqEqCall_fromAny.kt"); + } + + @Test + @TestMetadata("eqEqCall_fromSuperType.kt") + public void testEqEqCall_fromSuperType() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/eqEqCall_fromSuperType.kt"); + } + + @Test + @TestMetadata("eqEqCall_overridden.kt") + public void testEqEqCall_overridden() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/eqEqCall_overridden.kt"); + } + + @Test + @TestMetadata("functionCallInTheSameFile.kt") + public void testFunctionCallInTheSameFile() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionCallInTheSameFile.kt"); + } + + @Test + @TestMetadata("functionCallWithExtensionReceiverAndTypeArgument.kt") + public void testFunctionCallWithExtensionReceiverAndTypeArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionCallWithExtensionReceiverAndTypeArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithLambdaArgument.kt") + public void testFunctionCallWithLambdaArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionCallWithLambdaArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithNamedArgument.kt") + public void testFunctionCallWithNamedArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionCallWithNamedArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithNonTrailingLambdaArgument.kt") + public void testFunctionCallWithNonTrailingLambdaArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionCallWithNonTrailingLambdaArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithSpreadArgument.kt") + public void testFunctionCallWithSpreadArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionCallWithSpreadArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithTypeArgument.kt") + public void testFunctionCallWithTypeArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionCallWithTypeArgument.kt"); + } + + @Test + @TestMetadata("functionCallWithVarargArgument.kt") + public void testFunctionCallWithVarargArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionCallWithVarargArgument.kt"); + } + + @Test + @TestMetadata("functionTypeVariableCall_dispatchReceiver.kt") + public void testFunctionTypeVariableCall_dispatchReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionTypeVariableCall_dispatchReceiver.kt"); + } + + @Test + @TestMetadata("functionTypeVariableCall_extensionReceiver.kt") + public void testFunctionTypeVariableCall_extensionReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionTypeVariableCall_extensionReceiver.kt"); + } + + @Test + @TestMetadata("functionWithReceiverCall.kt") + public void testFunctionWithReceiverCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionWithReceiverCall.kt"); + } + + @Test + @TestMetadata("functionWithReceiverSafeCall.kt") + public void testFunctionWithReceiverSafeCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionWithReceiverSafeCall.kt"); + } + + @Test + @TestMetadata("hiddenConstructor.kt") + public void testHiddenConstructor() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/hiddenConstructor.kt"); + } + + @Test + @TestMetadata("implicitConstructorDelegationCall.kt") + public void testImplicitConstructorDelegationCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/implicitConstructorDelegationCall.kt"); + } + + @Test + @TestMetadata("implicitConstuctorCall.kt") + public void testImplicitConstuctorCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/implicitConstuctorCall.kt"); + } + + @Test + @TestMetadata("implicitJavaConstuctorCall.kt") + public void testImplicitJavaConstuctorCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/implicitJavaConstuctorCall.kt"); + } + + @Test + @TestMetadata("indexedGet.kt") + public void testIndexedGet() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedGet.kt"); + } + + @Test + @TestMetadata("indexedGetWithNotEnoughArgs.kt") + public void testIndexedGetWithNotEnoughArgs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedGetWithNotEnoughArgs.kt"); + } + + @Test + @TestMetadata("indexedGetWithTooManyArgs.kt") + public void testIndexedGetWithTooManyArgs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedGetWithTooManyArgs.kt"); + } + + @Test + @TestMetadata("indexedSet.kt") + public void testIndexedSet() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedSet.kt"); + } + + @Test + @TestMetadata("indexedSetWithNotEnoughArgs.kt") + public void testIndexedSetWithNotEnoughArgs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedSetWithNotEnoughArgs.kt"); + } + + @Test + @TestMetadata("indexedSetWithTooManyArgs.kt") + public void testIndexedSetWithTooManyArgs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedSetWithTooManyArgs.kt"); + } + + @Test + @TestMetadata("intArrayOfInAnnotation.kt") + public void testIntArrayOfInAnnotation() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/intArrayOfInAnnotation.kt"); + } + + @Test + @TestMetadata("javaFunctionCall.kt") + public void testJavaFunctionCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/javaFunctionCall.kt"); + } + + @Test + @TestMetadata("memberFunctionCallWithTypeArgument.kt") + public void testMemberFunctionCallWithTypeArgument() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/memberFunctionCallWithTypeArgument.kt"); + } + + @Test + @TestMetadata("privateMember.kt") + public void testPrivateMember() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/privateMember.kt"); + } + + @Test + @TestMetadata("resolveCallInSuperConstructorParam.kt") + public void testResolveCallInSuperConstructorParam() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/resolveCallInSuperConstructorParam.kt"); + } + + @Test + @TestMetadata("samConstructorCall.kt") + public void testSamConstructorCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/samConstructorCall.kt"); + } + + @Test + @TestMetadata("simpleCallWithNonMatchingArgs.kt") + public void testSimpleCallWithNonMatchingArgs() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/simpleCallWithNonMatchingArgs.kt"); + } + + @Test + @TestMetadata("smartCastExplicitExtensionReceiver.kt") + public void testSmartCastExplicitExtensionReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/smartCastExplicitExtensionReceiver.kt"); + } + + @Test + @TestMetadata("variableAsFunction.kt") + public void testVariableAsFunction() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunction.kt"); + } + + @Test + @TestMetadata("variableAsFunctionLikeCall.kt") + public void testVariableAsFunctionLikeCall() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunctionLikeCall.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterName.kt") + public void testVariableAsFunctionWithParameterName() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunctionWithParameterName.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterNameAnnotation.kt") + public void testVariableAsFunctionWithParameterNameAnnotation() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunctionWithParameterNameAnnotation.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterNameAnnotationConflict.kt") + public void testVariableAsFunctionWithParameterNameAnnotationConflict() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunctionWithParameterNameAnnotationConflict.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterNameGeneric.kt") + public void testVariableAsFunctionWithParameterNameGeneric() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunctionWithParameterNameGeneric.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterNameInNonFunctionType.kt") + public void testVariableAsFunctionWithParameterNameInNonFunctionType() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunctionWithParameterNameInNonFunctionType.kt"); + } + + @Test + @TestMetadata("variableAsFunctionWithParameterNameMixed.kt") + public void testVariableAsFunctionWithParameterNameMixed() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunctionWithParameterNameMixed.kt"); + } + + @Test + @TestMetadata("variableWithExtensionInvoke.kt") + public void testVariableWithExtensionInvoke() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableWithExtensionInvoke.kt"); + } + + @Test + @TestMetadata("variableWithInvokeFunctionCall_dispatchReceiver.kt") + public void testVariableWithInvokeFunctionCall_dispatchReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableWithInvokeFunctionCall_dispatchReceiver.kt"); + } + + @Test + @TestMetadata("variableWithInvokeFunctionCall_extensionReceiver.kt") + public void testVariableWithInvokeFunctionCall_extensionReceiver() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableWithInvokeFunctionCall_extensionReceiver.kt"); + } + + @Test + @TestMetadata("variableWithMemberInvoke.kt") + public void testVariableWithMemberInvoke() throws Exception { + runTest("analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableWithMemberInvoke.kt"); + } + } +} 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 4b8fff95ee5..35c81b414bf 100644 --- a/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithTooManyArgs.descriptors.txt +++ b/analysis/analysis-api/testData/components/callResolver/resolveCall/indexedSetWithTooManyArgs.descriptors.txt @@ -46,4 +46,4 @@ KtErrorCallInfo: symbol = value: kotlin.Boolean) } ] - diagnostic = ERROR \ No newline at end of file + diagnostic = ERROR \ No newline at end of file diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/ambiguous.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/ambiguous.descriptors.txt new file mode 100644 index 00000000000..6f547211827 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/ambiguous.descriptors.txt @@ -0,0 +1,80 @@ +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /function(a: kotlin.Char): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = a + receiverType = null + returnType = kotlin.Char + symbol = a: kotlin.Char + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = a + receiverType = null + returnType = kotlin.Char + symbol = a: kotlin.Char) + } + isInBestCandidates = true + +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /function(b: kotlin.Boolean): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.Boolean + symbol = b: kotlin.Boolean + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.Boolean + symbol = b: kotlin.Boolean) + } + isInBestCandidates = true + +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /function(c: kotlin.String): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = c + receiverType = null + returnType = kotlin.String + symbol = c: kotlin.String + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = c + receiverType = null + returnType = kotlin.String + symbol = c: kotlin.String) + } + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/ambiguousWithInferredTypeParameters.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/ambiguousWithInferredTypeParameters.descriptors.txt new file mode 100644 index 00000000000..e39863b9689 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/ambiguousWithInferredTypeParameters.descriptors.txt @@ -0,0 +1,95 @@ +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /function(t: T, a: kotlin.Char): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = t + receiverType = null + returnType = kotlin.Int + symbol = t: T, + KtVariableLikeSignature: + name = a + receiverType = null + returnType = kotlin.Char + symbol = a: kotlin.Char + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = t + receiverType = null + returnType = kotlin.Int + symbol = t: T) + } + isInBestCandidates = true + +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /function(u: U, b: kotlin.Boolean): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = u + receiverType = null + returnType = kotlin.Int + symbol = u: U, + KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.Boolean + symbol = b: kotlin.Boolean + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = u + receiverType = null + returnType = kotlin.Int + symbol = u: U) + } + isInBestCandidates = true + +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /function(v: V, c: kotlin.String): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = v + receiverType = null + returnType = kotlin.Int + symbol = v: V, + KtVariableLikeSignature: + name = c + receiverType = null + returnType = kotlin.String + symbol = c: kotlin.String + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = v + receiverType = null + returnType = kotlin.Int + symbol = v: V) + } + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/implicitInvoke.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/implicitInvoke.descriptors.txt new file mode 100644 index 00000000000..4397c145f3e --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/implicitInvoke.descriptors.txt @@ -0,0 +1,81 @@ +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = x + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Int + returnType = kotlin.Unit + symbol = /invoke(: kotlin.Int, i: kotlin.Int): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = i + receiverType = null + returnType = kotlin.Int + symbol = i: kotlin.Int + ] + argumentMapping = { + true -> (KtVariableLikeSignature: + name = i + receiverType = null + returnType = kotlin.Int + symbol = i: kotlin.Int) + } + isInBestCandidates = false + +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /x(c: kotlin.Char): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = c + receiverType = null + returnType = kotlin.Char + symbol = c: kotlin.Char + ] + argumentMapping = { + true -> (KtVariableLikeSignature: + name = c + receiverType = null + returnType = kotlin.Char + symbol = c: kotlin.Char) + } + isInBestCandidates = false + +KtApplicableCallCandidateInfo: + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = x(b: kotlin.Boolean): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.Boolean + symbol = b: kotlin.Boolean + ] + argumentMapping = { + true -> (KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.Boolean + symbol = b: kotlin.Boolean) + } + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/implicitInvokeWithReceiver.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/implicitInvokeWithReceiver.descriptors.txt new file mode 100644 index 00000000000..45e1142dbb9 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/multipleCandidates/implicitInvokeWithReceiver.descriptors.txt @@ -0,0 +1,56 @@ +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtExplicitReceiverValue: + expression = a + isSafeNavigation = false + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /A.x(: A, b: kotlin.Boolean): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.Boolean + symbol = b: kotlin.Boolean + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.Boolean + symbol = b: kotlin.Boolean) + } + isInBestCandidates = false + +KtApplicableCallCandidateInfo: + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = x + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Int + returnType = kotlin.Unit + symbol = /invoke(: kotlin.Int, i: kotlin.Int): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = i + receiverType = null + returnType = kotlin.Int + symbol = i: kotlin.Int + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = i + receiverType = null + returnType = kotlin.Int + symbol = i: kotlin.Int) + } + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/builderInference.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/builderInference.descriptors.txt new file mode 100644 index 00000000000..2e05101534c --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/builderInference.descriptors.txt @@ -0,0 +1,28 @@ +KtApplicableCallCandidateInfo: + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = KtImplicitReceiverValue: + symbol = KtReceiverParameterSymbol: + origin: SOURCE + type: test/Target + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = test/Target.add(: test.Target, t: T): kotlin.Unit + valueParameters = [ + KtVariableLikeSignature: + name = t + receiverType = null + returnType = kotlin.String + symbol = t: T + ] + argumentMapping = { + s -> (KtVariableLikeSignature: + name = t + receiverType = null + returnType = kotlin.String + symbol = t: T) + } + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke1.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke1.descriptors.txt new file mode 100644 index 00000000000..508208c388c --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke1.descriptors.txt @@ -0,0 +1,49 @@ +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = i + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Double + returnType = kotlin.Unit + symbol = /invoke(: kotlin.Double): kotlin.Unit + valueParameters = [] + argumentMapping = {} + isInBestCandidates = false + +KtApplicableCallCandidateInfo: + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = i + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Int + returnType = kotlin.Long + symbol = /invoke(: kotlin.Int): kotlin.Long + valueParameters = [] + argumentMapping = {} + isInBestCandidates = true + +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = i + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Long + returnType = kotlin.Double + symbol = /invoke(: kotlin.Long): kotlin.Double + valueParameters = [] + argumentMapping = {} + isInBestCandidates = false diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke2.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke2.descriptors.txt new file mode 100644 index 00000000000..e0eb7191fc3 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke2.descriptors.txt @@ -0,0 +1,49 @@ +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = i() + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Double + returnType = kotlin.Unit + symbol = /invoke(: kotlin.Double): kotlin.Unit + valueParameters = [] + argumentMapping = {} + isInBestCandidates = false + +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = i() + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Int + returnType = kotlin.Long + symbol = /invoke(: kotlin.Int): kotlin.Long + valueParameters = [] + argumentMapping = {} + isInBestCandidates = false + +KtApplicableCallCandidateInfo: + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = i() + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Long + returnType = kotlin.Double + symbol = /invoke(: kotlin.Long): kotlin.Double + valueParameters = [] + argumentMapping = {} + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke3.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke3.descriptors.txt new file mode 100644 index 00000000000..7699c9b82be --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/consecutiveImplicitInvoke3.descriptors.txt @@ -0,0 +1,49 @@ +KtApplicableCallCandidateInfo: + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = i()() + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Double + returnType = kotlin.Unit + symbol = /invoke(: kotlin.Double): kotlin.Unit + valueParameters = [] + argumentMapping = {} + isInBestCandidates = true + +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = i()() + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Int + returnType = kotlin.Long + symbol = /invoke(: kotlin.Int): kotlin.Long + valueParameters = [] + argumentMapping = {} + isInBestCandidates = false + +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = true + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = KtExplicitReceiverValue: + expression = i()() + isSafeNavigation = false + signature = KtFunctionLikeSignature: + receiverType = kotlin.Long + returnType = kotlin.Double + symbol = /invoke(: kotlin.Long): kotlin.Double + valueParameters = [] + argumentMapping = {} + isInBestCandidates = false diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionTypeVariableCall_dispatchReceiver.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionTypeVariableCall_dispatchReceiver.descriptors.txt new file mode 100644 index 00000000000..58f16cead16 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionTypeVariableCall_dispatchReceiver.descriptors.txt @@ -0,0 +1,17 @@ +KtApplicableCallCandidateInfo: + candidate = 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 = {} + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionTypeVariableCall_extensionReceiver.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionTypeVariableCall_extensionReceiver.descriptors.txt new file mode 100644 index 00000000000..58f16cead16 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/functionTypeVariableCall_extensionReceiver.descriptors.txt @@ -0,0 +1,17 @@ +KtApplicableCallCandidateInfo: + candidate = 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 = {} + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/hiddenConstructor.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/hiddenConstructor.descriptors.txt new file mode 100644 index 00000000000..0656468e3ff --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/hiddenConstructor.descriptors.txt @@ -0,0 +1 @@ +NO_CANDIDATES diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedGetWithTooManyArgs.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedGetWithTooManyArgs.descriptors.txt new file mode 100644 index 00000000000..0fa15b2dd8e --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedGetWithTooManyArgs.descriptors.txt @@ -0,0 +1,38 @@ +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = 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: + name = a + receiverType = null + returnType = kotlin.Int + symbol = a: kotlin.Int, + KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.String + symbol = b: kotlin.String + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = a + receiverType = null + returnType = kotlin.Int + symbol = a: kotlin.Int), + "foo" -> (KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.String + symbol = b: kotlin.String) + } + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedSetWithTooManyArgs.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedSetWithTooManyArgs.descriptors.txt new file mode 100644 index 00000000000..54379f65e86 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/indexedSetWithTooManyArgs.descriptors.txt @@ -0,0 +1,48 @@ +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = 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: + name = a + receiverType = null + returnType = kotlin.Int + symbol = a: kotlin.Int, + KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.String + symbol = b: kotlin.String, + KtVariableLikeSignature: + name = value + receiverType = null + returnType = kotlin.Boolean + symbol = value: kotlin.Boolean + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = a + receiverType = null + returnType = kotlin.Int + symbol = a: kotlin.Int), + "foo" -> (KtVariableLikeSignature: + name = b + receiverType = null + returnType = kotlin.String + symbol = b: kotlin.String), + 3.14 -> (KtVariableLikeSignature: + name = value + receiverType = null + returnType = kotlin.Boolean + symbol = value: kotlin.Boolean) + } + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/privateMember.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/privateMember.descriptors.txt new file mode 100644 index 00000000000..d35e81ddeda --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/privateMember.descriptors.txt @@ -0,0 +1,16 @@ +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = 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 = {} + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/simpleCallWithNonMatchingArgs.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/simpleCallWithNonMatchingArgs.descriptors.txt new file mode 100644 index 00000000000..b6b278a0f09 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/simpleCallWithNonMatchingArgs.descriptors.txt @@ -0,0 +1,14 @@ +KtInapplicableCallCandidateInfo: + diagnostic = ERROR + candidate = KtSimpleFunctionCall: + isImplicitInvoke = false + partiallyAppliedSymbol = KtPartiallyAppliedSymbol: + dispatchReceiver = null + extensionReceiver = null + signature = KtFunctionLikeSignature: + receiverType = null + returnType = kotlin.Unit + symbol = /foo(): kotlin.Unit + valueParameters = [] + argumentMapping = {} + isInBestCandidates = true diff --git a/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunctionWithParameterNameAnnotationConflict.descriptors.txt b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunctionWithParameterNameAnnotationConflict.descriptors.txt new file mode 100644 index 00000000000..6a5793da0d0 --- /dev/null +++ b/analysis/analysis-api/testData/components/callResolver/resolveCandidates/singleCandidate/variableAsFunctionWithParameterNameAnnotationConflict.descriptors.txt @@ -0,0 +1,37 @@ +KtApplicableCallCandidateInfo: + candidate = 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: + name = a + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(a)) @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int + symbol = p1: P1, + KtVariableLikeSignature: + name = b + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(b)) @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String + symbol = p2: P2 + ] + argumentMapping = { + 1 -> (KtVariableLikeSignature: + name = a + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(a)) @R|kotlin.ParameterName|(name = String(notMe)) kotlin.Int + symbol = p1: P1), + "" -> (KtVariableLikeSignature: + name = b + receiverType = null + returnType = @R|kotlin.ParameterName|(name = String(b)) @R|kotlin.ParameterName|(name = String(meNeither)) kotlin.String + symbol = p2: P2) + } + isInBestCandidates = true diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/FlatSignatureForResolvedCall.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/FlatSignatureForResolvedCall.kt index ecbe0c273f6..09dee923bcb 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/FlatSignatureForResolvedCall.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/FlatSignatureForResolvedCall.kt @@ -65,9 +65,9 @@ fun createOverloadingConflictResolver( specificityComparator, platformOverloadsSpecificityComparator, cancellationChecker, - MutableResolvedCall<*>::getResultingDescriptor, + ResolvedCall<*>::getResultingDescriptor, ConstraintSystemBuilderImpl.Companion::forSpecificity, - MutableResolvedCall<*>::createFlatSignature, + ResolvedCall<*>::createFlatSignature, { (it as? VariableAsFunctionResolvedCallImpl)?.variableCall }, { DescriptorToSourceUtils.descriptorToDeclaration(it) != null }, null, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/ResolutionResultsHandler.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/ResolutionResultsHandler.java index 6c8b3752924..c7d2d31d71b 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/ResolutionResultsHandler.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/results/ResolutionResultsHandler.java @@ -23,6 +23,7 @@ import org.jetbrains.kotlin.config.LanguageVersionSettings; import org.jetbrains.kotlin.descriptors.CallableDescriptor; import org.jetbrains.kotlin.descriptors.ModuleDescriptor; import org.jetbrains.kotlin.resolve.BindingTrace; +import org.jetbrains.kotlin.resolve.calls.model.ResolvedCall; import org.jetbrains.kotlin.resolve.calls.util.CallUtilKt; import org.jetbrains.kotlin.resolve.calls.context.CallResolutionContext; import org.jetbrains.kotlin.resolve.calls.context.CheckArgumentTypesMode; @@ -40,7 +41,7 @@ import static org.jetbrains.kotlin.resolve.calls.results.ResolutionStatus.*; public class ResolutionResultsHandler { - private final OverloadingConflictResolver> overloadingConflictResolver; + private final OverloadingConflictResolver> overloadingConflictResolver; public ResolutionResultsHandler( @NotNull KotlinBuiltIns builtIns, diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewAbstractResolvedCall.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewAbstractResolvedCall.kt index 095c226e2f7..4c0dec843cc 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewAbstractResolvedCall.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewAbstractResolvedCall.kt @@ -36,6 +36,7 @@ sealed class NewAbstractResolvedCall : ResolvedCall { abstract val psiKotlinCall: PSIKotlinCall abstract val typeApproximator: TypeApproximator abstract val freshSubstitutor: FreshVariableNewTypeSubstitutor? + abstract val diagnostics: Collection protected open val positionDependentApproximation = false diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallableReferenceResolvedCall.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallableReferenceResolvedCall.kt index bb457d0a224..971ee8ba790 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallableReferenceResolvedCall.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewCallableReferenceResolvedCall.kt @@ -25,6 +25,7 @@ class NewCallableReferenceResolvedCall( ) : NewAbstractResolvedCall() { override val positionDependentApproximation: Boolean = true override val argumentMappingByOriginal: Map = emptyMap() + override val diagnostics: Collection = emptyList() override val resolvedCallAtom: ResolvedCallableReferenceCallAtom? get() = when (resolvedAtom) { diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolvedCallImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolvedCallImpl.kt index 0ef0f8eee6a..1243943eae0 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolvedCallImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewResolvedCallImpl.kt @@ -26,7 +26,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs class NewResolvedCallImpl( override val resolvedCallAtom: ResolvedCallAtom, substitutor: NewTypeSubstitutor?, - private var diagnostics: Collection, + diagnostics: Collection, override val typeApproximator: TypeApproximator, override val languageVersionSettings: LanguageVersionSettings, ) : NewAbstractResolvedCall() { @@ -39,6 +39,9 @@ class NewResolvedCallImpl( override val argumentMappingByOriginal: Map get() = resolvedCallAtom.argumentMappingByOriginal + override var diagnostics: Collection = diagnostics + private set + private lateinit var resultingDescriptor: D private lateinit var typeArguments: List private var smartCastDispatchReceiverType: KotlinType? = null diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewVariableAsFunctionResolvedCallImpl.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewVariableAsFunctionResolvedCallImpl.kt index 3c1f7a773af..f19290fdf7e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewVariableAsFunctionResolvedCallImpl.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/calls/tower/NewVariableAsFunctionResolvedCallImpl.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.resolve.calls.tower import org.jetbrains.kotlin.descriptors.* import org.jetbrains.kotlin.resolve.calls.inference.components.FreshVariableNewTypeSubstitutor import org.jetbrains.kotlin.resolve.calls.inference.components.NewTypeSubstitutor +import org.jetbrains.kotlin.resolve.calls.model.KotlinCallDiagnostic import org.jetbrains.kotlin.resolve.calls.model.ResolvedCallAtom import org.jetbrains.kotlin.resolve.calls.model.ResolvedValueArgument import org.jetbrains.kotlin.resolve.calls.model.VariableAsFunctionResolvedCall @@ -28,6 +29,7 @@ class NewVariableAsFunctionResolvedCallImpl( override val argumentMappingByOriginal = functionCall.argumentMappingByOriginal override val kotlinCall = functionCall.kotlinCall override val languageVersionSettings = functionCall.languageVersionSettings + override val diagnostics: Collection = functionCall.diagnostics override fun getStatus() = functionCall.status override fun getCandidateDescriptor() = functionCall.candidateDescriptor 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 6b287dddfa3..6dbf59254f2 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 @@ -136,8 +136,7 @@ private fun TestGroupSuite.generateAnalysisApiComponentsTests() { model("resolveCall") } test( - AbstractResolveCandidatesTest::class, - generateFe10 = false // TODO: Not yet implemented + AbstractResolveCandidatesTest::class ) { model("resolveCandidates") }