| 1 | struct Foo { |
| 2 | expr SumType |
| 3 | } |
| 4 | |
| 5 | struct Bar { |
| 6 | expr SumType |
| 7 | } |
| 8 | |
| 9 | type SumType = Foo | string | Bar |
| 10 | type SumType2 = SumType | int |
| 11 | |
| 12 | struct Gen {} |
| 13 | |
| 14 | fn (g Gen) t(arg SumType2) { |
| 15 | } |
| 16 | |
| 17 | fn test_main() { |
| 18 | gen := Gen{} |
| 19 | s := Bar{ |
| 20 | expr: Foo{ |
| 21 | expr: 'foobar' |
| 22 | } |
| 23 | } |
| 24 | gen.t((s.expr as Foo).expr) |
| 25 | assert true |
| 26 | } |
| 27 |