authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-14 14:14:49 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2021-08-14 14:14:49 -07:00
log72a83bf2a6767a7c87d74b26fc0b411cf86baee6
tree53e5955d8e137c2ba7b3d37316d7b8f2484cbd21
parent9e04713bcdbd77b837c80867fde78b9a898f9a27

add compile error for using an unusable type in a if and ifnot block


1 files changed, 2 insertions(+), 0 deletions(-)

src/lib.zig+2
...@@ -109,6 +109,7 @@ fn do(alloc: *std.mem.Allocator, writer: anytype, comptime value: astgen.Value,...@@ -109,6 +109,7 @@ fn do(alloc: *std.mem.Allocator, writer: anytype, comptime value: astgen.Value,
109 switch (comptime TI) {109 switch (comptime TI) {
110 .Bool => try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, x),110 .Bool => try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, x),
111 .Optional => try docap(alloc, writer, body, bottom, data, ctx, indent, flag1, x),111 .Optional => try docap(alloc, writer, body, bottom, data, ctx, indent, flag1, x),
112 else => @compileError(comptime std.fmt.comptimePrint("pek: unable to use '{s}' in an #if block", .{@typeName(T)})),
112 }113 }
113 },114 },
114 .ifnot => {115 .ifnot => {
...@@ -116,6 +117,7 @@ fn do(alloc: *std.mem.Allocator, writer: anytype, comptime value: astgen.Value,...@@ -116,6 +117,7 @@ fn do(alloc: *std.mem.Allocator, writer: anytype, comptime value: astgen.Value,
116 switch (comptime TI) {117 switch (comptime TI) {
117 .Bool => try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, !x),118 .Bool => try doif(alloc, writer, body, bottom, data, ctx, indent, flag1, !x),
118 .Optional => try docap(alloc, writer, body, bottom, data, ctx, indent, flag1, !x),119 .Optional => try docap(alloc, writer, body, bottom, data, ctx, indent, flag1, !x),
120 else => @compileError(comptime std.fmt.comptimePrint("pek: unable to use '{s}' in an #ifnot block", .{@typeName(T)})),
119 }121 }
120 },122 },
121 .ifequal => {123 .ifequal => {