[FIR] Cleanup ConeIntegerLiteralTypeImpl

This commit is contained in:
Mikhail Glukhikh
2020-11-11 09:53:26 +03:00
parent 0d03e5f235
commit 744918fb47
@@ -17,7 +17,11 @@ class ConeIntegerLiteralTypeImpl : ConeIntegerLiteralType {
override val attributes: ConeAttributes
get() = ConeAttributes.Empty
constructor(value: Long, isUnsigned: Boolean, nullability: ConeNullability = ConeNullability.NOT_NULL) : super(value, isUnsigned, nullability) {
constructor(
value: Long,
isUnsigned: Boolean,
nullability: ConeNullability = ConeNullability.NOT_NULL
) : super(value, isUnsigned, nullability) {
possibleTypes = mutableListOf()
fun checkBoundsAndAddPossibleType(classId: ClassId, range: LongRange) {
@@ -75,7 +79,7 @@ class ConeIntegerLiteralTypeImpl : ConeIntegerLiteralType {
@OptIn(ExperimentalUnsignedTypes::class)
companion object {
fun createType(classId: ClassId): ConeClassLikeType {
private fun createType(classId: ClassId): ConeClassLikeType {
return ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(classId), emptyArray(), false)
}
@@ -130,7 +134,7 @@ class ConeIntegerLiteralTypeImpl : ConeIntegerLiteralType {
}
}
private fun fold(left: ConeIntegerLiteralType, right: ConeIntegerLiteralType, mode: Mode): ConeIntegerLiteralType? {
private fun fold(left: ConeIntegerLiteralType, right: ConeIntegerLiteralType, mode: Mode): ConeIntegerLiteralType {
val possibleTypes = when (mode) {
Mode.COMMON_SUPER_TYPE -> left.possibleTypes intersect right.possibleTypes
Mode.INTERSECTION_TYPE -> left.possibleTypes union right.possibleTypes