[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)
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
fun for_int_range(): Int {
var c = 0
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
fun for_int_range(): Int {
var c = 0
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
operator fun Long.component1() = this + 1
operator fun Long.component2() = this + 2
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
operator fun Long.component1() = this + 1
operator fun Long.component2() = this + 2
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
class M {
operator fun Long.component1() = this + 1
@@ -1,4 +1,3 @@
// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
class M {
operator fun Long.component1() = this + 1