| 1 | struct Abc {} |
| 2 | |
| 3 | type Test = Abc | bool | int |
| 4 | |
| 5 | fn test(a Test) Test { |
| 6 | return match a { |
| 7 | Abc { |
| 8 | 20 |
| 9 | } |
| 10 | int { |
| 11 | match a { |
| 12 | 1 { true } |
| 13 | 2 { false } |
| 14 | else { -1 } |
| 15 | } |
| 16 | } |
| 17 | bool { |
| 18 | 1 |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | fn test_nested_match_expr() { |
| 24 | println(test(1)) |
| 25 | assert test(1) == Test(true) |
| 26 | |
| 27 | println(test(2)) |
| 28 | assert test(2) == Test(false) |
| 29 | |
| 30 | println(test(3)) |
| 31 | assert test(3) == Test(-1) |
| 32 | |
| 33 | println(test(true)) |
| 34 | assert test(true) == Test(1) |
| 35 | } |
| 36 |