mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-26 13:01:34 +03:00
behavior: update for type resolution changes
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user