[FIR] Use flexible type lower bound when approximating type for
IntegerLiteral.
This commit is contained in:
committed by
Mikhail Glukhikh
parent
d5141674a3
commit
425ce8c3ab
@@ -61,9 +61,9 @@ class ConeIntegerLiteralTypeImpl : ConeIntegerLiteralType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getApproximatedType(expectedType: ConeKotlinType?): ConeClassLikeType {
|
override fun getApproximatedType(expectedType: ConeKotlinType?): ConeClassLikeType {
|
||||||
val approximatedType = when (expectedType) {
|
val approximatedType = when (val expectedTypeForApproximation = expectedType?.lowerBoundIfFlexible()) {
|
||||||
null, !in possibleTypes -> possibleTypes.first()
|
null, !in possibleTypes -> possibleTypes.first()
|
||||||
else -> expectedType as ConeClassLikeType
|
else -> expectedTypeForApproximation as ConeClassLikeType
|
||||||
}
|
}
|
||||||
return approximatedType.withNullability(nullability)
|
return approximatedType.withNullability(nullability)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
fun for_int_range(): Int {
|
fun for_int_range(): Int {
|
||||||
var c = 0
|
var c = 0
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
fun for_int_range(): Int {
|
fun for_int_range(): Int {
|
||||||
var c = 0
|
var c = 0
|
||||||
|
|||||||
Vendored
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
operator fun Long.component1() = this + 1
|
operator fun Long.component1() = this + 1
|
||||||
operator fun Long.component2() = this + 2
|
operator fun Long.component2() = this + 2
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
operator fun Long.component1() = this + 1
|
operator fun Long.component1() = this + 1
|
||||||
operator fun Long.component2() = this + 2
|
operator fun Long.component2() = this + 2
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
class M {
|
class M {
|
||||||
operator fun Long.component1() = this + 1
|
operator fun Long.component1() = this + 1
|
||||||
|
|||||||
-1
@@ -1,4 +1,3 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
|
||||||
// KJS_WITH_FULL_RUNTIME
|
// KJS_WITH_FULL_RUNTIME
|
||||||
class M {
|
class M {
|
||||||
operator fun Long.component1() = this + 1
|
operator fun Long.component1() = this + 1
|
||||||
|
|||||||
Reference in New Issue
Block a user