| 1 | pub type MyCallback = fn () | fn (ctx voidptr) |
| 2 | |
| 3 | fn my_lower_level_func(func fn (ctx voidptr), ctx voidptr) { |
| 4 | println('Bar') |
| 5 | } |
| 6 | |
| 7 | fn my_func(cb MyCallback, ctx voidptr) { |
| 8 | my_lower_level_func(fn [cb] (ctx voidptr) { |
| 9 | match cb { |
| 10 | fn () { |
| 11 | cb() |
| 12 | } |
| 13 | fn (ctx voidptr) { |
| 14 | cb(ctx) |
| 15 | } |
| 16 | } |
| 17 | }, ctx) |
| 18 | } |
| 19 | |
| 20 | fn test_closure_variable_in_smartcast() { |
| 21 | my_func(fn () { |
| 22 | println('Foo') |
| 23 | }, unsafe { nil }) |
| 24 | assert true |
| 25 | } |
| 26 |