Remove restrictions for builder inference internal calls

This commit is contained in:
Victor Petukhov
2021-04-27 13:59:49 +03:00
parent 26b8e86fe1
commit 5d0461c722
3 changed files with 0 additions and 25 deletions
@@ -126,23 +126,6 @@ class BuilderInferenceSession(
if (skipCall(callInfo.callResolutionResult)) return
commonCalls.add(callInfo)
val resultingDescriptor = callInfo.resolvedCall.resultingDescriptor
// This check is similar to one for old inference, see getCoroutineInferenceData() function
val checkCall = resultingDescriptor is LocalVariableDescriptor || anyReceiverContainStubType(resultingDescriptor)
if (!checkCall) return
val isApplicableCall =
callComponents.statelessCallbacks.isApplicableCallForBuilderInference(
resultingDescriptor,
callComponents.languageVersionSettings
)
if (!isApplicableCall) {
hasInapplicableCall = true
}
}
private fun anyReceiverContainStubType(descriptor: CallableDescriptor): Boolean {
@@ -95,13 +95,6 @@ class KotlinResolutionStatelessCallbacksImpl(
override fun isCoroutineCall(argument: KotlinCallArgument, parameter: ValueParameterDescriptor): Boolean =
isCoroutineCallWithAdditionalInference(parameter, argument.psiCallArgument.valueArgument, languageVersionSettings)
override fun isApplicableCallForBuilderInference(
descriptor: CallableDescriptor,
languageVersionSettings: LanguageVersionSettings,
): Boolean {
return org.jetbrains.kotlin.resolve.calls.inference.isApplicableCallForBuilderInference(descriptor, languageVersionSettings)
}
override fun isOldIntersectionIsEmpty(types: Collection<KotlinType>): Boolean {
return TypeIntersector.intersectTypes(types) == null
}
@@ -39,7 +39,6 @@ interface KotlinResolutionStatelessCallbacks {
fun getScopeTowerForCallableReferenceArgument(argument: CallableReferenceKotlinCallArgument): ImplicitScopeTower
fun getVariableCandidateIfInvoke(functionCall: KotlinCall): KotlinResolutionCandidate?
fun isCoroutineCall(argument: KotlinCallArgument, parameter: ValueParameterDescriptor): Boolean
fun isApplicableCallForBuilderInference(descriptor: CallableDescriptor, languageVersionSettings: LanguageVersionSettings): Boolean
fun isOldIntersectionIsEmpty(types: Collection<KotlinType>): Boolean