Commit 6734d2117e

Ian Johnson <ian@ianjohnson.dev>
2023-10-03 05:29:29
Add behavior test for empty tuple type
Closes #16412
1 parent df4853a
Changed files (1)
test
behavior
test/behavior/tuple.zig
@@ -465,3 +465,15 @@ test "coerce anon tuple to tuple" {
     try expectEqual(x, s[0]);
     try expectEqual(y, s[1]);
 }
+
+test "empty tuple type" {
+    const S = @Type(.{ .Struct = .{
+        .layout = .Auto,
+        .fields = &.{},
+        .decls = &.{},
+        .is_tuple = true,
+    } });
+
+    const s: S = .{};
+    try expect(s.len == 0);
+}