Skip to content

Commit

Permalink
stage2: add test for fixed issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexu committed May 26, 2022
1 parent c864056 commit caa9a65
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/behavior.zig
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ test {
_ = @import("behavior/bugs/11159.zig");
_ = @import("behavior/bugs/11162.zig");
_ = @import("behavior/bugs/11165.zig");
_ = @import("behavior/bugs/11179.zig");
_ = @import("behavior/bugs/11181.zig");
_ = @import("behavior/bugs/11182.zig");
_ = @import("behavior/bugs/11213.zig");
Expand Down
18 changes: 18 additions & 0 deletions test/behavior/bugs/11179.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const std = @import("std");
const Type = std.builtin.Type;

test "Tuple" {
const fields_list = fields(@TypeOf(.{}));
if (fields_list.len != 0)
@compileError("Argument count mismatch");
}

pub fn fields(comptime T: type) switch (@typeInfo(T)) {
.Struct => []const Type.StructField,
else => unreachable,
} {
return switch (@typeInfo(T)) {
.Struct => |info| info.fields,
else => unreachable,
};
}

0 comments on commit caa9a65

Please sign in to comment.