[IR] add testdata for dumpKotlinLike

This commit is contained in:
Zalim Bashorov
2020-11-05 02:47:53 +03:00
committed by teamcityserver
parent d2022ab115
commit 8d5facb15f
365 changed files with 15516 additions and 0 deletions
@@ -0,0 +1,80 @@
fun testSimple(x: Double): Int {
return { //BLOCK
val tmp0_subject: Double = x
when {
ieee754equals(arg0 = tmp0_subject, arg1 = 0.0D) -> 0
true -> 1
}
}
}
fun testSmartCastInWhenSubject(x: Any): Int {
when {
x !is Double -> return -1
}
return { //BLOCK
val tmp0_subject: Any = x
when {
ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0
true -> 1
}
}
}
fun testSmartCastInWhenCondition(x: Double, y: Any): Int {
when {
y !is Double -> return -1
}
return { //BLOCK
val tmp0_subject: Double = x
when {
ieee754equals(arg0 = tmp0_subject, arg1 = y /*as Double */) -> 0
true -> 1
}
}
}
fun testSmartCastInWhenConditionInBranch(x: Any): Int {
return { //BLOCK
val tmp0_subject: Any = x
when {
tmp0_subject is Double.not() -> -1
ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = 0.0D) -> 0
true -> 1
}
}
}
fun testSmartCastToDifferentTypes(x: Any, y: Any): Int {
when {
x !is Double -> return -1
}
when {
y !is Float -> return -1
}
return { //BLOCK
val tmp0_subject: Any = x
when {
ieee754equals(arg0 = tmp0_subject /*as Double */, arg1 = y /*as Float */.toDouble()) -> 0
true -> 1
}
}
}
fun foo(x: Double): Double {
return x
}
fun testWithPrematureExitInConditionSubexpression(x: Any): Int {
return { //BLOCK
val tmp0_subject: Any = x
when {
EQEQ(arg0 = tmp0_subject, arg1 = foo(x = when {
x !is Double -> return 42
true -> x /*as Double */
})) -> 0
true -> 1
}
}
}