[NI] Fix assertion error at FlexibleTypeImpl

Use KotlinTypeFactory for FlexibleType creation
This commit is contained in:
Stanislav Erokhin
2017-07-08 23:25:08 +03:00
committed by Mikhail Zarechenskiy
parent e7cd615450
commit 6680f01cfe
3 changed files with 3 additions and 3 deletions
@@ -53,7 +53,7 @@ object NewCommonSuperTypeCalculator {
if (!thereIsFlexibleTypes) return lowerSuperType
val upperSuperType = commonSuperTypeForSimpleTypes(types.map { it.upperIfFlexible() }, depth)
return FlexibleTypeImpl(lowerSuperType, upperSuperType)
return KotlinTypeFactory.flexibleType(lowerSuperType, upperSuperType)
}
private fun commonSuperTypeForSimpleTypes(types: List<SimpleType>, depth: Int): SimpleType {
@@ -46,7 +46,7 @@ interface NewTypeSubstitutor {
}
else {
// todo discuss lowerIfFlexible and upperIfFlexible
FlexibleTypeImpl(lowerBound?.lowerIfFlexible() ?: type.lowerBound, upperBound?.upperIfFlexible() ?: type.upperBound)
KotlinTypeFactory.flexibleType(lowerBound?.lowerIfFlexible() ?: type.lowerBound, upperBound?.upperIfFlexible() ?: type.upperBound)
}
}
}
@@ -152,7 +152,7 @@ class TypeApproximator {
*
* If U_1 <: U_2.lower .. U_2.upper, then we know only that U_1 <: U_2.upper.
*/
return FlexibleTypeImpl(lowerResult?.lowerIfFlexible() ?: type.lowerBound,
return KotlinTypeFactory.flexibleType(lowerResult?.lowerIfFlexible() ?: type.lowerBound,
upperResult?.upperIfFlexible() ?: type.upperBound)
}
else {