Analysis API: Implement KtCallResolver.collectAllCandidates for FE 1.0.
This commit is contained in:
committed by
Ilya Kirillov
parent
81a66258fa
commit
afb34d3193
+53
@@ -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)
|
||||
}
|
||||
}
|
||||
+13
@@ -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
|
||||
|
||||
+170
-24
@@ -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
|
||||
|
||||
+468
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -46,4 +46,4 @@ KtErrorCallInfo:
|
||||
symbol = value: kotlin.Boolean)
|
||||
}
|
||||
]
|
||||
diagnostic = ERROR<TOO_MANY_ARGUMENTS: Too many arguments for public final operator fun set(a: Int, b: String, value: Boolean): Unit defined in C>
|
||||
diagnostic = ERROR<CONSTANT_EXPECTED_TYPE_MISMATCH: The floating-point literal does not conform to the expected type Boolean>
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<CONSTANT_EXPECTED_TYPE_MISMATCH: The integer literal does not conform to the expected type Char>
|
||||
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<CONSTANT_EXPECTED_TYPE_MISMATCH: The integer literal does not conform to the expected type Boolean>
|
||||
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<CONSTANT_EXPECTED_TYPE_MISMATCH: The integer literal does not conform to the expected type String>
|
||||
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
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'a'>
|
||||
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<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'b'>
|
||||
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<NO_VALUE_FOR_PARAMETER: No value passed for parameter 'c'>
|
||||
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
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<CONSTANT_EXPECTED_TYPE_MISMATCH: The boolean literal does not conform to the expected type Int>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = KtExplicitReceiverValue:
|
||||
expression = x
|
||||
isSafeNavigation = false
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = kotlin.Int
|
||||
returnType = kotlin.Unit
|
||||
symbol = /invoke(<extension receiver>: 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<CONSTANT_EXPECTED_TYPE_MISMATCH: The boolean literal does not conform to the expected type Char>
|
||||
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
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<CONSTANT_EXPECTED_TYPE_MISMATCH: The integer literal does not conform to the expected type Boolean>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtExplicitReceiverValue:
|
||||
expression = a
|
||||
isSafeNavigation = false
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /A.x(<dispatch receiver>: 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(<extension receiver>: 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
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
KtApplicableCallCandidateInfo:
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtImplicitReceiverValue:
|
||||
symbol = KtReceiverParameterSymbol:
|
||||
origin: SOURCE
|
||||
type: test/Target<kotlin/String>
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = test/Target.add(<dispatch receiver>: test.Target<T>, 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
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Int but Double was expected>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = KtExplicitReceiverValue:
|
||||
expression = i
|
||||
isSafeNavigation = false
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = kotlin.Double
|
||||
returnType = kotlin.Unit
|
||||
symbol = /invoke(<extension receiver>: 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(<extension receiver>: kotlin.Int): kotlin.Long
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
isInBestCandidates = true
|
||||
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Int but Long was expected>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = KtExplicitReceiverValue:
|
||||
expression = i
|
||||
isSafeNavigation = false
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = kotlin.Long
|
||||
returnType = kotlin.Double
|
||||
symbol = /invoke(<extension receiver>: kotlin.Long): kotlin.Double
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
isInBestCandidates = false
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Long but Double was expected>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = KtExplicitReceiverValue:
|
||||
expression = i()
|
||||
isSafeNavigation = false
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = kotlin.Double
|
||||
returnType = kotlin.Unit
|
||||
symbol = /invoke(<extension receiver>: kotlin.Double): kotlin.Unit
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
isInBestCandidates = false
|
||||
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Long but Int was expected>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = KtExplicitReceiverValue:
|
||||
expression = i()
|
||||
isSafeNavigation = false
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = kotlin.Int
|
||||
returnType = kotlin.Long
|
||||
symbol = /invoke(<extension receiver>: 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(<extension receiver>: kotlin.Long): kotlin.Double
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
isInBestCandidates = true
|
||||
+49
@@ -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(<extension receiver>: kotlin.Double): kotlin.Unit
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
isInBestCandidates = true
|
||||
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Double but Int was expected>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = KtExplicitReceiverValue:
|
||||
expression = i()()
|
||||
isSafeNavigation = false
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = kotlin.Int
|
||||
returnType = kotlin.Long
|
||||
symbol = /invoke(<extension receiver>: kotlin.Int): kotlin.Long
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
isInBestCandidates = false
|
||||
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<TYPE_MISMATCH: Type mismatch: inferred type is Double but Long was expected>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = true
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = null
|
||||
extensionReceiver = KtExplicitReceiverValue:
|
||||
expression = i()()
|
||||
isSafeNavigation = false
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = kotlin.Long
|
||||
returnType = kotlin.Double
|
||||
symbol = /invoke(<extension receiver>: kotlin.Long): kotlin.Double
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
isInBestCandidates = false
|
||||
+17
@@ -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(<extension receiver>: P1<dispatch receiver>: kotlin.Function1<P1, R>): R
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
isInBestCandidates = true
|
||||
+17
@@ -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(<extension receiver>: P1<dispatch receiver>: kotlin.Function1<P1, R>): R
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
isInBestCandidates = true
|
||||
+1
@@ -0,0 +1 @@
|
||||
NO_CANDIDATES
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<TOO_MANY_ARGUMENTS: Too many arguments for public final operator fun get(a: Int, b: String): Boolean defined in C>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtExplicitReceiverValue:
|
||||
expression = c
|
||||
isSafeNavigation = false
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Boolean
|
||||
symbol = /C.get(<dispatch receiver>: 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
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<CONSTANT_EXPECTED_TYPE_MISMATCH: The floating-point literal does not conform to the expected type Boolean>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtExplicitReceiverValue:
|
||||
expression = c
|
||||
isSafeNavigation = false
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /C.set(<dispatch receiver>: 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
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<INVISIBLE_MEMBER: Cannot access 'foo': it is private in 'A'>
|
||||
candidate = KtSimpleFunctionCall:
|
||||
isImplicitInvoke = false
|
||||
partiallyAppliedSymbol = KtPartiallyAppliedSymbol:
|
||||
dispatchReceiver = KtExplicitReceiverValue:
|
||||
expression = a
|
||||
isSafeNavigation = false
|
||||
extensionReceiver = null
|
||||
signature = KtFunctionLikeSignature:
|
||||
receiverType = null
|
||||
returnType = kotlin.Unit
|
||||
symbol = /A.foo(<dispatch receiver>: A): kotlin.Unit
|
||||
valueParameters = []
|
||||
argumentMapping = {}
|
||||
isInBestCandidates = true
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
KtInapplicableCallCandidateInfo:
|
||||
diagnostic = ERROR<TOO_MANY_ARGUMENTS: Too many arguments for public fun foo(): Unit defined in root package in file simpleCallWithNonMatchingArgs.kt>
|
||||
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
|
||||
+37
@@ -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(<dispatch receiver>: kotlin.Function2<P1, P2, R>, 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
|
||||
+2
-2
@@ -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,
|
||||
|
||||
+2
-1
@@ -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<MutableResolvedCall<?>> overloadingConflictResolver;
|
||||
private final OverloadingConflictResolver<ResolvedCall<?>> overloadingConflictResolver;
|
||||
|
||||
public ResolutionResultsHandler(
|
||||
@NotNull KotlinBuiltIns builtIns,
|
||||
|
||||
+1
@@ -36,6 +36,7 @@ sealed class NewAbstractResolvedCall<D : CallableDescriptor> : ResolvedCall<D> {
|
||||
abstract val psiKotlinCall: PSIKotlinCall
|
||||
abstract val typeApproximator: TypeApproximator
|
||||
abstract val freshSubstitutor: FreshVariableNewTypeSubstitutor?
|
||||
abstract val diagnostics: Collection<KotlinCallDiagnostic>
|
||||
|
||||
protected open val positionDependentApproximation = false
|
||||
|
||||
|
||||
+1
@@ -25,6 +25,7 @@ class NewCallableReferenceResolvedCall<D : CallableDescriptor>(
|
||||
) : NewAbstractResolvedCall<D>() {
|
||||
override val positionDependentApproximation: Boolean = true
|
||||
override val argumentMappingByOriginal: Map<ValueParameterDescriptor, ResolvedCallArgument> = emptyMap()
|
||||
override val diagnostics: Collection<KotlinCallDiagnostic> = emptyList()
|
||||
|
||||
override val resolvedCallAtom: ResolvedCallableReferenceCallAtom?
|
||||
get() = when (resolvedAtom) {
|
||||
|
||||
+4
-1
@@ -26,7 +26,7 @@ import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
class NewResolvedCallImpl<D : CallableDescriptor>(
|
||||
override val resolvedCallAtom: ResolvedCallAtom,
|
||||
substitutor: NewTypeSubstitutor?,
|
||||
private var diagnostics: Collection<KotlinCallDiagnostic>,
|
||||
diagnostics: Collection<KotlinCallDiagnostic>,
|
||||
override val typeApproximator: TypeApproximator,
|
||||
override val languageVersionSettings: LanguageVersionSettings,
|
||||
) : NewAbstractResolvedCall<D>() {
|
||||
@@ -39,6 +39,9 @@ class NewResolvedCallImpl<D : CallableDescriptor>(
|
||||
override val argumentMappingByOriginal: Map<ValueParameterDescriptor, ResolvedCallArgument>
|
||||
get() = resolvedCallAtom.argumentMappingByOriginal
|
||||
|
||||
override var diagnostics: Collection<KotlinCallDiagnostic> = diagnostics
|
||||
private set
|
||||
|
||||
private lateinit var resultingDescriptor: D
|
||||
private lateinit var typeArguments: List<UnwrappedType>
|
||||
private var smartCastDispatchReceiverType: KotlinType? = null
|
||||
|
||||
+2
@@ -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<KotlinCallDiagnostic> = functionCall.diagnostics
|
||||
|
||||
override fun getStatus() = functionCall.status
|
||||
override fun getCandidateDescriptor() = functionCall.candidateDescriptor
|
||||
|
||||
+1
-2
@@ -136,8 +136,7 @@ private fun TestGroupSuite.generateAnalysisApiComponentsTests() {
|
||||
model("resolveCall")
|
||||
}
|
||||
test(
|
||||
AbstractResolveCandidatesTest::class,
|
||||
generateFe10 = false // TODO: Not yet implemented
|
||||
AbstractResolveCandidatesTest::class
|
||||
) {
|
||||
model("resolveCandidates")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user