FE: don't run overload-by-lambda-return-type with unsuccessful candidates

Related to KT-52927
This commit is contained in:
Mikhail Glukhikh
2022-09-09 16:16:22 +02:00
committed by teamcity
parent 046f0ad95d
commit 393e99fa44
2 changed files with 4 additions and 2 deletions
@@ -244,8 +244,9 @@ class KotlinCallResolver(
}
}
if (callComponents.languageVersionSettings.supportsFeature(LanguageFeature.OverloadResolutionByLambdaReturnType) &&
candidates.all { resolutionCallbacks.inferenceSession.shouldRunCompletion(it) } &&
kotlinCall.callKind != KotlinCallKind.CALLABLE_REFERENCE
kotlinCall.callKind != KotlinCallKind.CALLABLE_REFERENCE &&
candidates.all { it.isSuccessful } &&
candidates.all { resolutionCallbacks.inferenceSession.shouldRunCompletion(it) }
) {
val candidatesWithAnnotation = candidates.filter {
it.resolvedCall.candidateDescriptor.annotations.hasAnnotation(OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION_FQ_NAME)