| 1 | interface Something { |
| 2 | i int |
| 3 | } |
| 4 | |
| 5 | struct Some { |
| 6 | i int |
| 7 | } |
| 8 | |
| 9 | struct App[M] { |
| 10 | f M |
| 11 | } |
| 12 | |
| 13 | fn (mut self App[M]) next[M, T](_input T) f64 { |
| 14 | $if M is Something { |
| 15 | return 0 |
| 16 | } $else { |
| 17 | panic('${typeof(M.typ).name} is not supported') |
| 18 | return 1 |
| 19 | } |
| 20 | return 1 |
| 21 | } |
| 22 | |
| 23 | fn main() { |
| 24 | mut app := App[Some]{ |
| 25 | f: Some{ |
| 26 | i: 10 |
| 27 | } |
| 28 | } |
| 29 | assert app.next(1) == 0 |
| 30 | println(app.next(1)) |
| 31 | } |
| 32 |