[FIR] Properly support smartcasts on stable when subjects in when conditions
^KT-49860 Fixed
This commit is contained in:
committed by
teamcityserver
parent
20425fb458
commit
330574cab6
Vendored
+3
-2
@@ -75,8 +75,9 @@ FILE fqName:<root> fileName:/whenByFloatingPoint.kt
|
||||
GET_VAR 'val tmp_3: kotlin.Any [val] declared in <root>.testSmartCastInWhenConditionInBranch' type=kotlin.Any origin=null
|
||||
then: CONST Int type=kotlin.Int value=-1
|
||||
BRANCH
|
||||
if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: GET_VAR 'val tmp_3: kotlin.Any [val] declared in <root>.testSmartCastInWhenConditionInBranch' type=kotlin.Any origin=null
|
||||
if: CALL 'public final fun ieee754equals (arg0: kotlin.Double?, arg1: kotlin.Double?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ
|
||||
arg0: TYPE_OP type=kotlin.Double origin=IMPLICIT_CAST typeOperand=kotlin.Double
|
||||
GET_VAR 'val tmp_3: kotlin.Any [val] declared in <root>.testSmartCastInWhenConditionInBranch' type=kotlin.Any origin=null
|
||||
arg1: CONST Double type=kotlin.Double value=0.0
|
||||
then: CONST Int type=kotlin.Int value=0
|
||||
BRANCH
|
||||
|
||||
Vendored
+2
-1
@@ -39,7 +39,7 @@ fun testSmartCastInWhenConditionInBranch(x: Any): Int {
|
||||
val tmp3_subject: Any = x
|
||||
when {
|
||||
tmp3_subject !is Double -> -1
|
||||
EQEQ(arg0 = tmp3_subject, arg1 = 0.0) -> 0
|
||||
ieee754equals(arg0 = tmp3_subject /*as Double */, arg1 = 0.0) -> 0
|
||||
else -> 1
|
||||
}
|
||||
}
|
||||
@@ -77,3 +77,4 @@ fun testWithPrematureExitInConditionSubexpression(x: Any): Int {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user