From 6734d2117e3520c1ef011609d0e2b2dd131a80aa Mon Sep 17 00:00:00 2001 From: Ian Johnson Date: Mon, 2 Oct 2023 23:29:29 -0400 Subject: [PATCH] Add behavior test for empty tuple type Closes #16412 --- test/behavior/tuple.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/behavior/tuple.zig b/test/behavior/tuple.zig index 57c1c920e7..48c24f26d6 100644 --- a/test/behavior/tuple.zig +++ b/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); +}