Analysis API: Implement KtCallResolver.collectAllCandidates for FE 1.0.

This commit is contained in:
Mark Punzalan
2022-02-14 07:11:56 +00:00
committed by Ilya Kirillov
parent 81a66258fa
commit afb34d3193
28 changed files with 1393 additions and 31 deletions
@@ -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<ResolvedCall<*>> {
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<ResolvedCall<*>>? = 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<TypeSpecificityComparator>()
val platformOverloadsSpecificityComparator = componentProvider.get<PlatformOverloadsSpecificityComparator>()
val cancellationChecker = componentProvider.get<CancellationChecker>()
overloadingConflictResolver = createOverloadingConflictResolver(
builtIns,
module,
typeSpecificityComparator,
platformOverloadsSpecificityComparator,
cancellationChecker,
kotlinTypeRefiner!!
)
return super.doAnalysis(project, module, projectContext, files, bindingTrace, componentProvider)
}
}
@@ -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<ResolvedCall<*>>
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<ResolvedCall<*>> = getOverloadingConflictResolver(contextElement)
val kotlinTypeRefiner: KotlinTypeRefiner = getKotlinTypeRefiner(contextElement)
val builtIns: KotlinBuiltIns
get() = resolveSession.moduleDescriptor.builtIns
@@ -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<KtCallCandidateInfo> = TODO()
override fun collectCallCandidates(psi: KtElement): List<KtCallCandidateInfo> =
with(analysisContext.analyze(psi, AnalysisMode.PARTIAL_WITH_DIAGNOSTICS)) {
if (psi.isNotResolvable()) return emptyList()
val resolvedKtCallInfo = resolveCall(psi)
val bestCandidateDescriptors =
resolvedKtCallInfo?.calls?.filterIsInstance<KtFunctionCall<*>>()
?.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<KtCallCandidateInfo> {
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<CallableDescriptor>): List<KtCallCandidateInfo> {
// 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<KtFunctionCall<*>>()?.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<ResolvedCall<*>>): KtCallInfo {
private fun createCallInfo(
context: BindingContext,
psi: KtElement,
ktCall: KtCall,
resolvedCalls: List<ResolvedCall<*>>,
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<KtCallExpression>()?.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
@@ -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");
}
}
}