From c54354f3480bae9daaa76eb96fab4cc0ee0727e8 Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Sun, 7 Feb 2021 20:53:35 +0100 Subject: [PATCH] FIR: fix memory leak from ConeIntegerLiteralTypeImpl via static NUMBER_TYPE ConeClassLikeType has a cachedExpanded type which has a strong ref to FirSession --- .../jetbrains/kotlin/fir/types/ConeIntegerLiteralTypeImpl.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeIntegerLiteralTypeImpl.kt b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeIntegerLiteralTypeImpl.kt index 5a49bb42ab0..6c6d17ae232 100644 --- a/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeIntegerLiteralTypeImpl.kt +++ b/compiler/fir/tree/src/org/jetbrains/kotlin/fir/types/ConeIntegerLiteralTypeImpl.kt @@ -62,7 +62,7 @@ class ConeIntegerLiteralTypeImpl : ConeIntegerLiteralType { override val supertypes: List by lazy { listOf( - NUMBER_TYPE, + createType(StandardClassIds.Number), ConeClassLikeTypeImpl(COMPARABLE_TAG, arrayOf(ConeKotlinTypeProjectionIn(this)), false) ) } @@ -83,8 +83,6 @@ class ConeIntegerLiteralTypeImpl : ConeIntegerLiteralType { 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 BYTE_RANGE = Byte.MIN_VALUE.toLong()..Byte.MAX_VALUE.toLong() private val SHORT_RANGE = Short.MIN_VALUE.toLong()..Short.MAX_VALUE.toLong()