stage2: add test for fixed issue

This commit is contained in:
Veikka Tuominen 2022-05-26 15:50:50 +03:00
parent 8bf3e1f8d0
commit 989c0f55e8
2 changed files with 19 additions and 0 deletions

View File

@ -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");

View File

@ -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,
};
}