[IR] dumpKotlinLike: add testdata for FIR tests

This commit is contained in:
Zalim Bashorov
2020-11-20 18:18:14 +03:00
committed by teamcityserver
parent d7bd4240e1
commit c68040753d
298 changed files with 12186 additions and 0 deletions
@@ -0,0 +1,79 @@
fun testSimple(x: Double): Int {
return { // BLOCK
val tmp0_subject: Double = x
when {
ieee754equals(arg0 = tmp0_subject, arg1 = 0.0D) -> 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.0D) -> 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
EQEQ(arg0 = tmp3_subject, arg1 = 0.0D) -> 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
}
}
}