[IR] Extend test coverage for smart cast handling.

This commit is contained in:
Mads Ager
2021-01-07 13:56:02 +01:00
committed by Dmitry Petrov
parent 6fc0de39c2
commit dfc86feecd
28 changed files with 732 additions and 18 deletions
@@ -0,0 +1,56 @@
enum class En : Enum<En> {
private constructor() /* primary */ {
super/*Enum*/<En>()
/* <init>() */
}
A = En()
B = En()
C = En()
fun values(): Array<En> /* Synthetic body for ENUM_VALUES */
fun valueOf(value: String): En /* Synthetic body for ENUM_VALUEOF */
}
fun test() {
var r: String = ""
val x: Any? = En.A
when {
x is En -> { // BLOCK
{ // BLOCK
val tmp0_subject: En = x /*as En */
when {
EQEQ(arg0 = tmp0_subject, arg1 = En.A) -> { // BLOCK
r = "when1"
}
EQEQ(arg0 = tmp0_subject, arg1 = En.B) -> { // BLOCK
}
EQEQ(arg0 = tmp0_subject, arg1 = En.C) -> { // BLOCK
}
}
}
}
}
val y: Any = En.A
when {
y is En -> { // BLOCK
{ // BLOCK
val tmp1_subject: En = y /*as En */
when {
EQEQ(arg0 = tmp1_subject, arg1 = En.A) -> { // BLOCK
r = "when2"
}
EQEQ(arg0 = tmp1_subject, arg1 = En.B) -> { // BLOCK
}
EQEQ(arg0 = tmp1_subject, arg1 = En.C) -> { // BLOCK
}
}
}
}
}
}