Files
kotlin-fork/compiler/testData/ir/irText/expressions/exhaustiveWhenElseBranch.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

123 lines
2.5 KiB
Kotlin
Vendored

enum class A : Enum<A> {
private constructor() /* primary */ {
super/*Enum*/<A>()
/* <init>() */
}
V1 = A()
fun values(): Array<A> /* Synthetic body for ENUM_VALUES */
fun valueOf(value: String): A /* Synthetic body for ENUM_VALUEOF */
val entries: EnumEntries<A>
get(): EnumEntries<A> /* Synthetic body for ENUM_ENTRIES */
}
fun testVariableAssignment_throws(a: A) {
val x: Int
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> { // BLOCK
x = 11
}
else -> noWhenBranchMatchedException()
}
}
}
fun testStatement_empty(a: A) {
{ // BLOCK
val tmp1_subject: A = a
when {
EQEQ(arg0 = tmp1_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
} /*~> Unit */
}
fun testParenthesized_throwsJvm(a: A) {
{ // BLOCK
val tmp2_subject: A = a
when {
EQEQ(arg0 = tmp2_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
} /*~> Unit */
}
fun testAnnotated_throwsJvm(a: A) {
{ // BLOCK
val tmp3_subject: A = a
when {
EQEQ(arg0 = tmp3_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
} /*~> Unit */
}
fun testExpression_throws(a: A): Int {
return { // BLOCK
val tmp4_subject: A = a
when {
EQEQ(arg0 = tmp4_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
}
}
fun testIfTheElseStatement_empty(a: A, flag: Boolean) {
when {
flag -> 0
else -> { // BLOCK
val tmp5_subject: A = a
when {
EQEQ(arg0 = tmp5_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
}
} /*~> Unit */
}
fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) {
when {
flag -> 0
else -> { // BLOCK
val tmp6_subject: A = a
when {
EQEQ(arg0 = tmp6_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
}
} /*~> Unit */
}
fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) {
when {
flag -> 0
else -> { // BLOCK
val tmp7_subject: A = a
when {
EQEQ(arg0 = tmp7_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
}
} /*~> Unit */
}
fun testLambdaResultExpression_throws(a: A) {
local fun <anonymous>(): Int {
return { // BLOCK
val tmp8_subject: A = a
when {
EQEQ(arg0 = tmp8_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
}
}
.invoke() /*~> Unit */
}