From cbb193154b831c2e56e0fce17f51c739c40278c1 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Wed, 15 Apr 2026 16:05:49 -0700 Subject: [PATCH] support enums vs ints in ifequal and ifnotequal --- src/lib.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib.zig b/src/lib.zig index c87b82d47a866b63a4710736ca94a66ab7de2146..1db929b4099162df941dd405697248162e7a191a 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -236,6 +236,9 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val if (@typeInfo(@TypeOf(x)) == .@"enum" and comptime extras.isZigString(@TypeOf(y))) { return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, @tagName(x), y)); } + if (TI == .@"enum" and @typeInfo(@TypeOf(y)) == .int) { + return doif(alloc, writer, body, bottom, data, ctx, opts, @intFromEnum(x) == y); + } if (comptime extras.isSlice(@TypeOf(x, y))) { return try doif(alloc, writer, body, bottom, data, ctx, opts, std.mem.eql(u8, x, y)); } @@ -250,6 +253,9 @@ fn doInner(alloc: std.mem.Allocator, writer: anytype, comptime value: astgen.Val if (@typeInfo(@TypeOf(x)) == .@"enum" and comptime extras.isZigString(@TypeOf(y))) { return try doif(alloc, writer, body, bottom, data, ctx, opts, !std.mem.eql(u8, @tagName(x), y)); } + if (TI == .@"enum" and @typeInfo(@TypeOf(y)) == .int) { + return doif(alloc, writer, body, bottom, data, ctx, opts, @intFromEnum(x) != y); + } if (comptime extras.isSlice(@TypeOf(x, y))) { return try doif(alloc, writer, body, bottom, data, ctx, opts, !std.mem.eql(u8, x, y)); } -- 2.54.0