[NI] Avoid substituting type variables inside captured types

This fixes exception in CreateAnnotation#testAnnotationType test
This commit is contained in:
Mikhail Zarechenskiy
2019-05-06 11:44:17 +03:00
parent e8e8f6f336
commit 8446ea8a6b
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.resolve.calls.tasks.ExplicitReceiverKind
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.UnwrappedType
import org.jetbrains.kotlin.types.model.KotlinTypeMarker
import org.jetbrains.kotlin.types.typeUtil.unCapture
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
/**
@@ -190,7 +191,7 @@ sealed class CallResolutionResult(
return diagnostics.map {
if (it !is NewConstraintError) return@map it
val lowerType = it.lowerType.safeAs<KotlinType>()?.unwrap() ?: return@map it
val newLowerType = substitutor.safeSubstitute(lowerType)
val newLowerType = substitutor.safeSubstitute(lowerType.unCapture())
NewConstraintError(newLowerType, it.upperType, it.position)
}
}