master
1#target=x86_64-linux-selfhosted
2#target=x86_64-windows-selfhosted
3#target=x86_64-linux-cbe
4#target=x86_64-windows-cbe
5#target=wasm32-wasi-selfhosted
6#update=initial version
7#file=main.zig
8pub fn main() !void {
9 try foo(false);
10}
11fn foo(recurse: bool) !void {
12 const stdout = std.fs.File.stdout();
13 if (recurse) return foo(true);
14 try stdout.writeAll("non-recursive path\n");
15}
16const std = @import("std");
17#expect_stdout="non-recursive path\n"
18
19#update=eliminate recursion and change argument
20#file=main.zig
21pub fn main() !void {
22 try foo(true);
23}
24fn foo(recurse: bool) !void {
25 const stdout = std.fs.File.stdout();
26 if (recurse) return stdout.writeAll("x==1\n");
27 try stdout.writeAll("non-recursive path\n");
28}
29const std = @import("std");
30#expect_stdout="x==1\n"