[NI] Split substitution of inferred type parametes into two steps
Substituting inferred type parameters with single substitutor leads to incorrect behaviour in cases, when class' type parameters are used in constructor. As a side effect of two-step substitution, intermediate descriptor is created, which prevents incorrect substitution. To preserve this side effect, single resulting substitutor was split into two substitutors: one for substituting fresh variables and another for substituting inferred variables and known parameters. ^KT-32415 Fixed
This commit is contained in:
+3
-5
@@ -730,12 +730,10 @@ class NewResolvedCallImpl<D : CallableDescriptor>(
|
||||
|
||||
private fun CallableDescriptor.substituteInferredVariablesAndApproximate(substitutor: NewTypeSubstitutor?): CallableDescriptor {
|
||||
val inferredTypeVariablesSubstitutor = substitutor ?: FreshVariableNewTypeSubstitutor.Empty
|
||||
val compositeSubstitutor = inferredTypeVariablesSubstitutor.composeWith(resolvedCallAtom.knownParametersSubstitutor)
|
||||
|
||||
val compositeSubstitutor = resolvedCallAtom.freshVariablesSubstitutor
|
||||
.composeWith(resolvedCallAtom.knownParametersSubstitutor)
|
||||
.composeWith(inferredTypeVariablesSubstitutor)
|
||||
|
||||
return substituteAndApproximateTypes(compositeSubstitutor, typeApproximator)
|
||||
return substitute(resolvedCallAtom.freshVariablesSubstitutor)
|
||||
.substituteAndApproximateTypes(compositeSubstitutor, typeApproximator)
|
||||
}
|
||||
|
||||
fun getExpectedTypeForSamConvertedArgument(valueArgument: ValueArgument): UnwrappedType? =
|
||||
|
||||
Reference in New Issue
Block a user