| 1 | inline fn foo(x: i32) i32 { |
| 2 | if (x <= 0) { |
| 3 | return 0; |
| 4 | } else { |
| 5 | return x * 2 + foo(x - 1); |
| 6 | } |
| 7 | } |
| 8 | |
| 9 | pub export fn entry() void { |
| 10 | var x: i32 = 4; |
| 11 | _ = &x; |
| 12 | _ = foo(x) == 20; |
| 13 | } |
| 14 | |
| 15 | inline fn first() void { |
| 16 | second(); |
| 17 | } |
| 18 | |
| 19 | inline fn second() void { |
| 20 | third(); |
| 21 | } |
| 22 | |
| 23 | inline fn third() void { |
| 24 | first(); |
| 25 | } |
| 26 | |
| 27 | pub export fn entry2() void { |
| 28 | first(); |
| 29 | } |
| 30 | |
| 31 | // error |
| 32 | // |
| 33 | // :5:27: error: inline call is recursive |
| 34 | // :12:12: note: called inline here |
| 35 | // :24:10: error: inline call is recursive |
| 36 | // :20:10: note: called inline here |
| 37 | // :16:11: note: called inline here |
| 38 | // :28:10: note: called inline here |