diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt b/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt index 81ad0a3eb57..6a5d9effce7 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/types/CapturedTypeApproximation.kt @@ -18,6 +18,8 @@ package org.jetbrains.kotlin.types.typesApproximation import org.jetbrains.kotlin.builtins.KotlinBuiltIns import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor +import org.jetbrains.kotlin.renderer.ClassifierNamePolicy +import org.jetbrains.kotlin.renderer.DescriptorRenderer import org.jetbrains.kotlin.resolve.calls.inference.CapturedTypeConstructor import org.jetbrains.kotlin.resolve.calls.inference.isCaptured import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns @@ -41,7 +43,14 @@ private class TypeArgument( } private fun TypeArgument.toTypeProjection(): TypeProjection { - assert(isConsistent) { "Only consistent enhanced type propection can be converted to type projection" } + assert(isConsistent) { + val descriptorRenderer = DescriptorRenderer.withOptions { + classifierNamePolicy = ClassifierNamePolicy.FULLY_QUALIFIED + } + "Only consistent enhanced type projection can be converted to type projection, but " + + "[${descriptorRenderer.render(typeParameter)}: <${descriptorRenderer.renderType(inProjection)}, ${descriptorRenderer.renderType(outProjection)}>]" + + " was found" + } fun removeProjectionIfRedundant(variance: Variance) = if (variance == typeParameter.variance) Variance.INVARIANT else variance return when { inProjection == outProjection -> TypeProjectionImpl(inProjection)