Discriminate OverloadResolutionByLambdaReturnType annotated overloads...

instead of preferring them in case of unsolvable ambiguity.
This commit is contained in:
Ilya Gorbunov
2020-05-13 20:08:28 +03:00
committed by Dmitriy Novozhilov
parent e1418a5540
commit e9ef6dbc28
@@ -144,7 +144,7 @@ class KotlinCallResolver(
candidates.all { resolutionCallbacks.inferenceSession.shouldRunCompletion(it) }
) {
val candidatesWithAnnotation =
candidates.filterTo(mutableSetOf()) { it.resolvedCall.candidateDescriptor.annotations.hasAnnotation(OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION) }
candidates.filter { it.resolvedCall.candidateDescriptor.annotations.hasAnnotation(OVERLOAD_RESOLUTION_BY_LAMBDA_ANNOTATION) }
if (candidatesWithAnnotation.isNotEmpty()) {
val newCandidates = kotlinCallCompleter.chooseCandidateRegardingFactoryPatternResolution(maximallySpecificCandidates, resolutionCallbacks)
maximallySpecificCandidates = overloadingConflictResolver.chooseMaximallySpecificCandidates(
@@ -154,7 +154,7 @@ class KotlinCallResolver(
)
if (maximallySpecificCandidates.size > 1) {
maximallySpecificCandidates = candidatesWithAnnotation
maximallySpecificCandidates = candidates.toMutableSet().apply { removeAll(candidatesWithAnnotation) }
}
}
}