mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
Reorganize how the binOp and genBinOp functions work. I've spent quite a while here reading exactly through the spec and so many tests are enabled because of several critical issues the old design had. There are some regressions that will take a long time to figure out individually so I will ignore them for now, and pray they get fixed by themselves. When we're closer to 100% passing is when I will start diving into them one-by-one.
31 lines
640 B
Zig
31 lines
640 B
Zig
const std = @import("std");
|
|
const builtin = @import("builtin");
|
|
|
|
var result: []const u8 = "wrong";
|
|
|
|
test "pass string literal byvalue to a generic var param" {
|
|
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
|
|
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
|
|
|
|
start();
|
|
blowUpStack(10);
|
|
|
|
try std.testing.expect(std.mem.eql(u8, result, "string literal"));
|
|
}
|
|
|
|
fn start() void {
|
|
foo("string literal");
|
|
}
|
|
|
|
fn foo(x: anytype) void {
|
|
bar(x);
|
|
}
|
|
|
|
fn bar(x: anytype) void {
|
|
result = x;
|
|
}
|
|
|
|
fn blowUpStack(x: u32) void {
|
|
if (x == 0) return;
|
|
blowUpStack(x - 1);
|
|
}
|