| 1 | struct Struct { |
| 2 | f fn (f64) f64 = unsafe { nil } |
| 3 | } |
| 4 | |
| 5 | struct App {} |
| 6 | |
| 7 | pub fn (mut a App) frame(dt f64) f64 { |
| 8 | dump(voidptr(a)) |
| 9 | dump(dt) |
| 10 | return dt |
| 11 | } |
| 12 | |
| 13 | fn generic_f[T](mut ctx T) ! { |
| 14 | s := Struct{ |
| 15 | f: unsafe { ctx.frame } |
| 16 | } |
| 17 | assert s.f(1.2) == 1.2 |
| 18 | } |
| 19 | |
| 20 | fn test_main() { |
| 21 | mut app := &App{} |
| 22 | generic_f(mut app)! |
| 23 | assert true |
| 24 | } |
| 25 |