From 17cdbcca0314bf0af623686ddcf67cf6caf35790 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Fri, 9 Jun 2017 16:36:24 +0300 Subject: [PATCH] [NI] Approximate substituted type arguments for non-members --- .../kotlin/resolve/calls/components/KotlinCallCompleter.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt index fcc29d5d65e..4a6c0149f62 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/resolve/calls/components/KotlinCallCompleter.kt @@ -34,6 +34,8 @@ import org.jetbrains.kotlin.resolve.calls.inference.substituteAndApproximateCapt import org.jetbrains.kotlin.resolve.calls.model.* import org.jetbrains.kotlin.resolve.calls.tower.ResolutionCandidateApplicability import org.jetbrains.kotlin.resolve.calls.tower.ResolutionCandidateStatus +import org.jetbrains.kotlin.types.TypeApproximator +import org.jetbrains.kotlin.types.TypeApproximatorConfiguration import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.UnwrappedType import org.jetbrains.kotlin.types.checker.KotlinTypeChecker @@ -153,7 +155,8 @@ class KotlinCallCompleter( } val typeArguments = descriptorWithFreshTypes.typeParameters.map { - substitutor.safeSubstitute(typeVariablesForFreshTypeParameters[it.index].defaultType) + val substituted = substitutor.safeSubstitute(typeVariablesForFreshTypeParameters[it.index].defaultType) + TypeApproximator().approximateToSuperType(substituted, TypeApproximatorConfiguration.CapturedTypesApproximation) ?: substituted } val status = computeStatus(this, resultingDescriptor)