Skip to content

Commit

Permalink
std.testing.refAllDecls: force decl to be analyzed with just @field
Browse files Browse the repository at this point in the history
Co-authored-by: Veikka Tuominen <git@vexu.eu>
  • Loading branch information
leecannon and Vexu authored Feb 18, 2022
1 parent 2c24bf2 commit dee96e2
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/std/testing.zig
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,6 @@ test {
pub fn refAllDecls(comptime T: type) void {
if (!builtin.is_test) return;
inline for (comptime std.meta.declarations(T)) |decl| {
if (decl.is_pub and @typeInfo(@TypeOf(@field(T, decl.name))) == .Struct)
_ = @hasDecl(@field(T, decl.name), "foo");
_ = decl;
if (decl.is_pub) _ = @field(T, decl.name);
}
}

0 comments on commit dee96e2

Please sign in to comment.