File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 8181 _ = @import ("behavior/bugs/11159.zig" );
8282 _ = @import ("behavior/bugs/11162.zig" );
8383 _ = @import ("behavior/bugs/11165.zig" );
84+ _ = @import ("behavior/bugs/11179.zig" );
8485 _ = @import ("behavior/bugs/11181.zig" );
8586 _ = @import ("behavior/bugs/11182.zig" );
8687 _ = @import ("behavior/bugs/11213.zig" );
Original file line number Diff line number Diff line change 1+ const std = @import ("std" );
2+ const Type = std .builtin .Type ;
3+
4+ test "Tuple" {
5+ const fields_list = fields (@TypeOf (.{}));
6+ if (fields_list .len != 0 )
7+ @compileError ("Argument count mismatch" );
8+ }
9+
10+ pub fn fields (comptime T : type ) switch (@typeInfo (T )) {
11+ .Struct = > []const Type .StructField ,
12+ else = > unreachable ,
13+ } {
14+ return switch (@typeInfo (T )) {
15+ .Struct = > | info | info .fields ,
16+ else = > unreachable ,
17+ };
18+ }
You can’t perform that action at this time.
0 commit comments