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

121 lines
2.3 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) -> x = 11
else -> noWhenBranchMatchedException()
}
}
}
fun testStatement_empty(a: A) {
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
fun testParenthesized_throwsJvm(a: A) {
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
fun testAnnotated_throwsJvm(a: A) {
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
fun testExpression_throws(a: A): Int {
return { // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
}
}
fun testIfTheElseStatement_empty(a: A, flag: Boolean) {
when {
flag -> 0 /*~> Unit */
else -> { // BLOCK
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
}
}
fun testIfTheElseParenthesized_throwsJvm(a: A, flag: Boolean) {
when {
flag -> 0 /*~> Unit */
else -> { // BLOCK
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
}
}
fun testIfTheElseAnnotated_throwsJvm(a: A, flag: Boolean) {
when {
flag -> 0 /*~> Unit */
else -> { // BLOCK
{ // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1 /*~> Unit */
}
}
}
}
}
fun testLambdaResultExpression_throws(a: A) {
local fun <anonymous>(): Int {
return { // BLOCK
val tmp0_subject: A = a
when {
EQEQ(arg0 = tmp0_subject, arg1 = A.V1) -> 1
else -> noWhenBranchMatchedException()
}
}
}
.invoke() /*~> Unit */
}