[FE 1.0] Don't try to report specialized resolution ambiguity error for builder inference if the corresponding substitutor is empty

^KT-50989 Fixed
This commit is contained in:
Victor Petukhov
2022-01-27 11:33:31 +03:00
committed by teamcity
parent eeadd8588d
commit 1a23cd8c45
8 changed files with 43 additions and 2 deletions
@@ -76,8 +76,8 @@ class ResolutionWithStubTypesChecker(private val kotlinCallResolver: KotlinCallR
val builderInferenceSession = lambda.builderInferenceSession as BuilderInferenceSession
val stubVariablesSubstitutor = builderInferenceSession.getNotFixedToInferredTypesSubstitutor()
val variablesForUsedStubTypes = builderInferenceSession.getUsedStubTypes().map { it.originalTypeVariable }
val typeVariablesSubstitutionMap = (builderInferenceSession.getCurrentSubstitutor() as NewTypeSubstitutorByConstructorMap).map
.filterKeys { it in variablesForUsedStubTypes }
val substitutor = builderInferenceSession.getCurrentSubstitutor() as? NewTypeSubstitutorByConstructorMap ?: return
val typeVariablesSubstitutionMap = substitutor.map.filterKeys { it in variablesForUsedStubTypes }
val newReceiverArgument = receiverValue?.buildSubstitutedReceiverArgument(stubVariablesSubstitutor, context)
val newArguments = valueArguments.replaceTypes(context, resolutionCallbacks) { _, type ->