From fe2499b47f985b036d1eff078d3bd03462066b13 Mon Sep 17 00:00:00 2001 From: Mikhail Zarechenskiy Date: Tue, 31 Oct 2017 03:48:05 +0300 Subject: [PATCH] [NI] Approximate flexible types with enhancement as usual ones This is temporary and should be fixed later --- .../src/org/jetbrains/kotlin/types/TypeApproximator.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt index c3402ab9f33..6b1e9ffd88e 100644 --- a/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt +++ b/compiler/resolution/src/org/jetbrains/kotlin/types/TypeApproximator.kt @@ -127,7 +127,8 @@ class TypeApproximator { return if (conf.rawType) null else type.bound() } - assert(type is FlexibleTypeImpl) { + // TODO: currently we can lose information about enhancement, should be fixed later + assert(type is FlexibleTypeImpl || type is FlexibleTypeWithEnhancement) { "Unexpected subclass of FlexibleType: ${type::class.java.canonicalName}, type = $type" } @@ -154,7 +155,7 @@ class TypeApproximator { * If U_1 <: U_2.lower .. U_2.upper, then we know only that U_1 <: U_2.upper. */ return KotlinTypeFactory.flexibleType(lowerResult?.lowerIfFlexible() ?: type.lowerBound, - upperResult?.upperIfFlexible() ?: type.upperBound) + upperResult?.upperIfFlexible() ?: type.upperBound) } else { return type.bound().let { approximateTo(it, conf, depth) ?: it }