diff options
| author | Evin Yulo <yujiri@disroot.org> | 2022-10-16 05:31:29 +0000 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-10-16 11:35:27 -0400 |
| commit | b346d48572c99f809913cced8910a04d6699701d (patch) | |
| tree | 3b53bc659f01cba47fc1661737fc85f1c0daed11 /lib/std/meta.zig | |
| parent | c37b40248ca16a181323cca56616adf7617ca1a6 (diff) | |
| download | zig-b346d48572c99f809913cced8910a04d6699701d.tar.gz zig-b346d48572c99f809913cced8910a04d6699701d.zip | |
Simplify code in std.meta.isTag
Diffstat (limited to 'lib/std/meta.zig')
| -rw-r--r-- | lib/std/meta.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig index 2644752db7..67de0cd63d 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -68,7 +68,7 @@ pub fn isTag(tagged_value: anytype, comptime tag_name: []const u8) bool { const type_name = @typeName(T); // select the Enum type out of the type (in the case of the tagged union, extract it) - const E = if (.Enum == type_info) T else if (.Union == type_info) (if (type_info.Union.tag_type) |TT| TT else { + const E = if (.Enum == type_info) T else if (.Union == type_info) (type_info.Union.tag_type orelse { @compileError("attempted to use isTag on the untagged union " ++ type_name); }) else { @compileError("attempted to use isTag on a value of type (" ++ type_name ++ ") that isn't an enum or a union."); |
