From d38b56047812d06af569a167c5b0783ecd8bb3ee Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Mon, 15 May 2023 19:53:09 -0700 Subject: [PATCH] add more warnings to describe the custom function transition --- src/lib.zig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib.zig b/src/lib.zig index 4aeed22acda29b33f56d062de2e87b5d2367bd9a..76d6cbc691d1f328006af40e74b1bba43d92e180 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -198,6 +198,12 @@ inline fn do(comptime Ctx: type, alloc: std.mem.Allocator, writer: anytype, comp try do(Ctx, alloc, writer, repvalue, try list.toOwnedSlice(), ctx, opts); return; } + if (v.raw and @hasDecl(Ctx, "pek_" ++ v.name)) { + @compileError("pek: attempted to call safe custom function: '" ++ v.name ++ "' but did not use '{" ++ v.name ++ "}'"); + } + if (!v.raw and @hasDecl(Ctx, "pek__" ++ v.name)) { + @compileError("pek: attempted to call raw custom function: '_" ++ v.name ++ "' but did not use '{#" ++ v.name ++ "}'"); + } @compileError("pek: unknown custom function: " ++ v.name); }, else => unreachable, -- 2.54.0