Sema: fix inline/comptime function calls with inferred errors

This commit is contained in:
Andrew Kelley
2022-03-11 20:44:10 -07:00
parent 55ba335e0f
commit 60d6037f23
2 changed files with 26 additions and 13 deletions

View File

@@ -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 {