aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-05-26 15:50:50 +0300
committerVeikka Tuominen <git@vexu.eu>2022-05-27 10:29:24 +0300
commit989c0f55e8bbc790dcdd742ddea3d18c1194eab5 (patch)
treedfa2d80de02c92e587fe513cbad8fefd009ddb0a /test/behavior
parent8bf3e1f8d0902abd4133e2729b3625c25011c3ff (diff)
downloadzig-989c0f55e8bbc790dcdd742ddea3d18c1194eab5.tar.gz
zig-989c0f55e8bbc790dcdd742ddea3d18c1194eab5.zip
stage2: add test for fixed issue
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/bugs/11179.zig18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/behavior/bugs/11179.zig b/test/behavior/bugs/11179.zig
new file mode 100644
index 0000000000..84fa6183f3
--- /dev/null
+++ b/test/behavior/bugs/11179.zig
@@ -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,
+ };
+}