[NI] Approximate flexible types with enhancement as usual ones

This is temporary and should be fixed later
This commit is contained in:
Mikhail Zarechenskiy
2017-10-31 03:48:05 +03:00
parent 82d43c23b6
commit fe2499b47f
@@ -127,7 +127,8 @@ class TypeApproximator {
return if (conf.rawType) null else type.bound() 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" "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. * 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, return KotlinTypeFactory.flexibleType(lowerResult?.lowerIfFlexible() ?: type.lowerBound,
upperResult?.upperIfFlexible() ?: type.upperBound) upperResult?.upperIfFlexible() ?: type.upperBound)
} }
else { else {
return type.bound().let { approximateTo(it, conf, depth) ?: it } return type.bound().let { approximateTo(it, conf, depth) ?: it }