FIR: fix memory leak from ConeIntegerLiteralTypeImpl via static NUMBER_TYPE

ConeClassLikeType has a cachedExpanded type which has a strong ref to FirSession
This commit is contained in:
Ilya Kirillov
2021-02-07 20:53:35 +01:00
parent ede5fef39c
commit c54354f348
@@ -62,7 +62,7 @@ class ConeIntegerLiteralTypeImpl : ConeIntegerLiteralType {
override val supertypes: List<ConeClassLikeType> by lazy { override val supertypes: List<ConeClassLikeType> by lazy {
listOf( listOf(
NUMBER_TYPE, createType(StandardClassIds.Number),
ConeClassLikeTypeImpl(COMPARABLE_TAG, arrayOf(ConeKotlinTypeProjectionIn(this)), false) ConeClassLikeTypeImpl(COMPARABLE_TAG, arrayOf(ConeKotlinTypeProjectionIn(this)), false)
) )
} }
@@ -83,8 +83,6 @@ class ConeIntegerLiteralTypeImpl : ConeIntegerLiteralType {
return ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(classId), emptyArray(), false) return ConeClassLikeTypeImpl(ConeClassLikeLookupTagImpl(classId), emptyArray(), false)
} }
private val NUMBER_TYPE = createType(StandardClassIds.Number)
private val INT_RANGE = Int.MIN_VALUE.toLong()..Int.MAX_VALUE.toLong() private val INT_RANGE = Int.MIN_VALUE.toLong()..Int.MAX_VALUE.toLong()
private val BYTE_RANGE = Byte.MIN_VALUE.toLong()..Byte.MAX_VALUE.toLong() private val BYTE_RANGE = Byte.MIN_VALUE.toLong()..Byte.MAX_VALUE.toLong()
private val SHORT_RANGE = Short.MIN_VALUE.toLong()..Short.MAX_VALUE.toLong() private val SHORT_RANGE = Short.MIN_VALUE.toLong()..Short.MAX_VALUE.toLong()