test1: ---
assert(
    when (x) {
          |
          2

        b -> true
        |
        3

        a -> false
        |
        2

        else -> true
    }
)
---
test2: ---
assert(
    when (a) {
          |
          ONE

        A.ONE -> false
          |
          ONE

        A.TWO -> true
    }
)
---
test3: ---
assert(
    when (a) {
          |
          ONE

        A.ONE, A.TWO -> false
          |
          ONE

    }
)
---
test4: ---
assert(
    when (x) {
          |
          2

        a.toInt() -> false
        | |
        | 2
        2

        else -> true
    }
)
---
test5: ---
assert(
    when (x) {
          |
          2

        in 1..10 -> x == 3
        |   |       | |
        |   |       | false
        |   |       2
        |   1..10
        true

        else -> true
    }
)
---
test6: ---
assert(
    when (x) {
          |
          2

        is Int -> x == 3
        |         | |
        |         | false
        |         2
        true

        else -> true
    }
)
---
test7: ---
assert(
    when (val x = 2) {
        in 1..10 -> x == 3
        |   |
        |   1..10
        true

        else -> true
    }
)
---
test8: ---
assert(
    when (x) {
          |
          2

        is Int if x == 1 -> true
        |         | |
        |         | false
        |         2
        true

        is Int if x == 2 -> false
        |         | |
        |         | true
        |         2
        true

        else -> true
    }
)
---
test9: ---
assert(
    when (val a = x + x + x) {
                  | | | | |
                  | | | | 2
                  | | | 6
                  | | 2
                  | 4
                  2

        x -> true
        |
        2

        x + x -> true
        | | |
        | | 2
        | 4
        2

        else -> false
    }
)
---
