FIR types: relax requirements around flexible types

This commit is contained in:
Simon Ogorodnik
2019-04-23 04:17:40 +03:00
committed by Mikhail Glukhikh
parent 0ae2f992fa
commit 6f9f9fc087
2 changed files with 9 additions and 2 deletions
@@ -109,6 +109,13 @@ abstract class ConeTypeParameterType : ConeLookupTagBasedType() {
class ConeFlexibleType(val lowerBound: ConeKotlinType, val upperBound: ConeKotlinType) : ConeKotlinType(),
FlexibleTypeMarker {
init {
val message = { "Bounds violation: $lowerBound, $upperBound" }
require(lowerBound is SimpleTypeMarker, message)
require(upperBound is SimpleTypeMarker, message)
}
override val typeArguments: Array<out ConeKotlinTypeProjection>
get() = emptyArray()
@@ -41,8 +41,8 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext,
}
override fun createFlexibleType(lowerBound: SimpleTypeMarker, upperBound: SimpleTypeMarker): KotlinTypeMarker {
require(lowerBound is ConeLookupTagBasedType)
require(upperBound is ConeLookupTagBasedType)
require(lowerBound is ConeKotlinType)
require(upperBound is ConeKotlinType)
return ConeFlexibleType(lowerBound, upperBound)
}