fun testSimple(x: Double): Int { return { // BLOCK val tmp0_subject: Double = x when { ieee754equals(arg0 = tmp0_subject, arg1 = 0.0) -> 0 else -> 1 } } } fun testSmartCastInWhenSubject(x: Any): Int { when { x !is Double -> return -1 } return { // BLOCK val tmp1_subject: Double = x /*as Double */ when { ieee754equals(arg0 = tmp1_subject, arg1 = 0.0) -> 0 else -> 1 } } } fun testSmartCastInWhenCondition(x: Double, y: Any): Int { when { y !is Double -> return -1 } return { // BLOCK val tmp2_subject: Double = x when { ieee754equals(arg0 = tmp2_subject, arg1 = y /*as Double */) -> 0 else -> 1 } } } fun testSmartCastInWhenConditionInBranch(x: Any): Int { return { // BLOCK val tmp3_subject: Any = x when { tmp3_subject !is Double -> -1 ieee754equals(arg0 = tmp3_subject /*as Double */, arg1 = 0.0) -> 0 else -> 1 } } } fun testSmartCastToDifferentTypes(x: Any, y: Any): Int { when { x !is Double -> return -1 } when { y !is Float -> return -1 } return { // BLOCK val tmp4_subject: Double = x /*as Double */ when { ieee754equals(arg0 = tmp4_subject, arg1 = y /*as Float */.toDouble()) -> 0 else -> 1 } } } fun foo(x: Double): Double { return x } fun testWithPrematureExitInConditionSubexpression(x: Any): Int { return { // BLOCK val tmp5_subject: Any = x when { EQEQ(arg0 = tmp5_subject, arg1 = foo(x = when { x !is Double -> return 42 else -> x /*as Double */ })) -> 0 else -> 1 } } }