fun foo(x: Double): Double { return x } fun testSimple(x: Double): Int { return { // BLOCK val tmp_0: Double = x when { ieee754equals(arg0 = tmp_0, arg1 = 0.0) -> 0 else -> 1 } } } fun testSmartCastInWhenCondition(x: Double, y: Any): Int { when { y !is Double -> return -1 } return { // BLOCK val tmp_1: Double = x when { ieee754equals(arg0 = tmp_1, arg1 = y /*as Double */) -> 0 else -> 1 } } } fun testSmartCastInWhenConditionInBranch(x: Any): Int { return { // BLOCK val tmp_2: Any = x when { tmp_2 is Double.not() -> -1 ieee754equals(arg0 = tmp_2 /*as Double */, arg1 = 0.0) -> 0 else -> 1 } } } fun testSmartCastInWhenSubject(x: Any): Int { when { x !is Double -> return -1 } return { // BLOCK val tmp_3: Any = x when { ieee754equals(arg0 = tmp_3 /*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 tmp_4: Any = x when { ieee754equals(arg0 = tmp_4 /*as Double */, arg1 = y /*as Float */.toDouble()) -> 0 else -> 1 } } } fun testWithPrematureExitInConditionSubexpression(x: Any): Int { return { // BLOCK val tmp_5: Any = x when { EQEQ(arg0 = tmp_5, arg1 = foo(x = when { x !is Double -> return 42 else -> x /*as Double */ })) -> 0 else -> 1 } } }