FE: don't run overload-by-lambda-return-type with unsuccessful candidates
Related to KT-52927
This commit is contained in:
committed by
teamcity
parent
046f0ad95d
commit
393e99fa44
+1
@@ -95,6 +95,7 @@ class FirOverloadByLambdaReturnTypeResolver(
|
|||||||
call: T,
|
call: T,
|
||||||
candidates: Set<Candidate>,
|
candidates: Set<Candidate>,
|
||||||
): Set<Candidate>? where T : FirResolvable, T : FirStatement {
|
): Set<Candidate>? where T : FirResolvable, T : FirStatement {
|
||||||
|
if (candidates.any { !it.isSuccessful }) return candidates
|
||||||
val lambdas = candidates.flatMap { candidate ->
|
val lambdas = candidates.flatMap { candidate ->
|
||||||
candidate.postponedAtoms
|
candidate.postponedAtoms
|
||||||
.filter { it is ResolvedLambdaAtom && !it.analyzed }
|
.filter { it is ResolvedLambdaAtom && !it.analyzed }
|
||||||
|
|||||||
@@ -244,8 +244,9 @@ class KotlinCallResolver(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (callComponents.languageVersionSettings.supportsFeature(LanguageFeature.OverloadResolutionByLambdaReturnType) &&
|
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 {
|
val candidatesWithAnnotation = candidates.filter {
|
||||||
it.resolvedCall.candidateDescriptor.annotations.hasAnnotation(OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION_FQ_NAME)
|
it.resolvedCall.candidateDescriptor.annotations.hasAnnotation(OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION_FQ_NAME)
|
||||||
|
|||||||
Reference in New Issue
Block a user