From 60d6037f236379e521ccb7a8e1b7d24ed469ac3f Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 11 Mar 2022 20:44:10 -0700 Subject: Sema: fix inline/comptime function calls with inferred errors --- src/Module.zig | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index b3e0344d77..868ce578eb 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -1542,6 +1542,21 @@ pub const Fn = struct { // const zir = func.owner_decl.getFileScope().zir; return func.param_names[index]; } + + pub fn hasInferredErrorSet(func: Fn) bool { + const zir = func.owner_decl.getFileScope().zir; + const zir_tags = zir.instructions.items(.tag); + switch (zir_tags[func.zir_body_inst]) { + .func => return false, + .func_inferred => return true, + .extended => { + const extended = zir.instructions.items(.data)[func.zir_body_inst].extended; + const small = @bitCast(Zir.Inst.ExtendedFunc.Small, extended.small); + return small.is_inferred_error; + }, + else => unreachable, + } + } }; pub const Var = struct { -- cgit v1.2.3