[FIR] Use flexible type lower bound when approximating type for

IntegerLiteral.
This commit is contained in:
Mark Punzalan
2020-05-18 15:07:03 -07:00
committed by Mikhail Glukhikh
parent d5141674a3
commit 425ce8c3ab
7 changed files with 2 additions and 8 deletions
@@ -61,9 +61,9 @@ class ConeIntegerLiteralTypeImpl : ConeIntegerLiteralType {
}
override fun getApproximatedType(expectedType: ConeKotlinType?): ConeClassLikeType {
val approximatedType = when (expectedType) {
val approximatedType = when (val expectedTypeForApproximation = expectedType?.lowerBoundIfFlexible()) {
null, !in possibleTypes -> possibleTypes.first()
else -> expectedType as ConeClassLikeType
else -> expectedTypeForApproximation as ConeClassLikeType
}
return approximatedType.withNullability(nullability)
}