From dee96e2e2f464c3b8edc8ec3a63cd3b1860e3a9d Mon Sep 17 00:00:00 2001 From: Lee Cannon Date: Fri, 18 Feb 2022 19:21:21 +0000 Subject: [PATCH] std.testing.refAllDecls: force decl to be analyzed with just `@field` Co-authored-by: Veikka Tuominen --- lib/std/testing.zig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/std/testing.zig b/lib/std/testing.zig index 1134717c020c..8d0879280173 100644 --- a/lib/std/testing.zig +++ b/lib/std/testing.zig @@ -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); } }