IrTypes: approximate only non-denotable Kotlin types

This commit is contained in:
Dmitry Petrov
2018-05-30 11:49:09 +03:00
parent 93f4a4da10
commit 2d9ae6e93e
@@ -45,7 +45,12 @@ class TypeTranslator(
private fun translateType(ktType0: KotlinType, variance: Variance): IrTypeProjection {
// TODO "old" JVM BE does this for reified type arguments. Is it ok for arbitrary subexpressions?
val ktTypeUpper = approximateCapturedTypes(ktType0).upper
val ktTypeUpper =
if (ktType0.constructor.isDenotable)
ktType0
else
approximateCapturedTypes(ktType0).upper
when {
ktTypeUpper.isError -> return IrErrorTypeImpl(ktTypeUpper, translateTypeAnnotations(ktTypeUpper.annotations), variance)