Avoid substitution and type approximation for simple calls

#KT-37392 fixed
This commit is contained in:
Ilya Chernikov
2020-03-16 14:30:43 +01:00
parent e1ae81e0a1
commit 950ab01596
2 changed files with 25 additions and 20 deletions
@@ -80,14 +80,14 @@ fun CallableDescriptor.substitute(substitutor: NewTypeSubstitutor): CallableDesc
fun CallableDescriptor.substituteAndApproximateTypes(
substitutor: NewTypeSubstitutor,
typeApproximator: TypeApproximator
typeApproximator: TypeApproximator?
): CallableDescriptor {
val wrappedSubstitution = object : TypeSubstitution() {
override fun get(key: KotlinType): TypeProjection? = null
override fun prepareTopLevelType(topLevelType: KotlinType, position: Variance) =
substitutor.safeSubstitute(topLevelType.unwrap()).let { substitutedType ->
typeApproximator.approximateToSuperType(
typeApproximator?.approximateToSuperType(
substitutedType,
TypeApproximatorConfiguration.FinalApproximationAfterResolutionAndInference
) ?: substitutedType