zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 1364cba90d41cb2f33380b23d534aaddbd6ceff2 (tree)
parent be4c4ce2787537f860c8578eb9e497f66c2e9baf
Author: Matthew Lugg <mlugg@mlugg.co.uk>
Date:   Sun,  8 Feb 2026 15:52:12 +0000

behavior: update for type resolution changes

Diffstat:
Mtest/behavior/array.zig | 22----------------------
Mtest/behavior/sizeof_and_typeof.zig | 15---------------
Mtest/behavior/struct_contains_slice_of_itself.zig | 2+-
3 files changed, 1 insertion(+), 38 deletions(-)

diff --git a/test/behavior/array.zig b/test/behavior/array.zig @@ -539,28 +539,6 @@ test "sentinel element count towards the ABI size calculation" { try comptime S.doTheTest(); } -test "zero-sized array with recursive type definition" { - if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO - if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; - - const U = struct { - fn foo(comptime T: type, comptime n: usize) type { - return struct { - s: [n]T, - x: usize = n, - }; - } - }; - - const S = struct { - list: U.foo(@This(), 0), - }; - - var t: S = .{ .list = .{ .s = undefined } }; - _ = &t; - try expect(@as(usize, 0) == t.list.x); -} - test "type coercion of anon struct literal to array" { if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; diff --git a/test/behavior/sizeof_and_typeof.zig b/test/behavior/sizeof_and_typeof.zig @@ -120,21 +120,6 @@ test "@bitOffsetOf" { try expect(@offsetOf(A, "g") * 8 == @bitOffsetOf(A, "g")); } -test "@sizeOf(T) == 0 doesn't force resolving struct size" { - const S = struct { - const Foo = struct { - y: if (@sizeOf(Foo) == 0) u64 else u32, - }; - const Bar = struct { - x: i32, - y: if (0 == @sizeOf(Bar)) u64 else u32, - }; - }; - - try expect(@sizeOf(S.Foo) == 4); - try expect(@sizeOf(S.Bar) == 8); -} - test "@TypeOf() has no runtime side effects" { const S = struct { fn foo(comptime T: type, ptr: *T) T { diff --git a/test/behavior/struct_contains_slice_of_itself.zig b/test/behavior/struct_contains_slice_of_itself.zig @@ -8,7 +8,7 @@ const Node = struct { const NodeAligned = struct { payload: i32, - children: []align(@alignOf(NodeAligned)) NodeAligned, + children: []align(1) NodeAligned, }; test "struct contains slice of itself" {