| 1 | type MySumType = S1 | S2 |
| 2 | |
| 3 | struct S1 { |
| 4 | is_name bool |
| 5 | name string |
| 6 | } |
| 7 | |
| 8 | struct S2 { |
| 9 | field2 bool |
| 10 | } |
| 11 | |
| 12 | fn test_autocast_in_if_conds() { |
| 13 | s := MySumType(S1{ |
| 14 | is_name: true |
| 15 | name: 'bob' |
| 16 | }) |
| 17 | |
| 18 | if s is S1 && s.is_name && s.name == 'bob' { |
| 19 | println('ok') |
| 20 | assert true |
| 21 | } else { |
| 22 | assert false |
| 23 | } |
| 24 | } |
| 25 |