Files
kotlin-fork/compiler/testData/ir/irText/expressions/whenSmartCastToEnum.fir.kt.txt
T
Nikolay Lunyak bcfafc601e Add EnumEntries to minimal-stdlib-for-tests
This change allows to revert adding `WITH_STDLIB` directive
to tests which happened at `a9343aeb`.

Co-authored-by: Alexander Udalov <Alexander.Udalov@jetbrains.com>
2023-03-02 10:23:38 +00:00

58 lines
1.2 KiB
Kotlin
Vendored

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 */
val entries: EnumEntries<En>
get(): EnumEntries<En> /* Synthetic body for ENUM_ENTRIES */
}
fun test() {
var r: String = ""
val x: Any? = En.A
when {
x is En -> { // 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
}
else -> noWhenBranchMatchedException()
}
}
}
val y: Any = En.A
when {
y is En -> { // 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
}
else -> noWhenBranchMatchedException()
}
}
}
}