[NI] Fix assertion error at FlexibleTypeImpl
Use KotlinTypeFactory for FlexibleType creation
This commit is contained in:
committed by
Mikhail Zarechenskiy
parent
e7cd615450
commit
6680f01cfe
+1
-1
@@ -53,7 +53,7 @@ object NewCommonSuperTypeCalculator {
|
|||||||
if (!thereIsFlexibleTypes) return lowerSuperType
|
if (!thereIsFlexibleTypes) return lowerSuperType
|
||||||
|
|
||||||
val upperSuperType = commonSuperTypeForSimpleTypes(types.map { it.upperIfFlexible() }, depth)
|
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 {
|
private fun commonSuperTypeForSimpleTypes(types: List<SimpleType>, depth: Int): SimpleType {
|
||||||
|
|||||||
+1
-1
@@ -46,7 +46,7 @@ interface NewTypeSubstitutor {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// todo discuss lowerIfFlexible and upperIfFlexible
|
// 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.
|
* 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)
|
upperResult?.upperIfFlexible() ?: type.upperBound)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user