Sema: remove generic function from monomorphed_funcs on any error

This commit is contained in:
Veikka Tuominen
2023-01-05 14:26:33 +02:00
parent 3e084d8de3
commit 8c4727f9ab
3 changed files with 31 additions and 8 deletions

View File

@@ -3519,14 +3519,6 @@ pub fn deinit(mod: *Module) void {
pub fn destroyDecl(mod: *Module, decl_index: Decl.Index) void {
const gpa = mod.gpa;
{
if (mod.failed_decls.contains(decl_index)) {
blk: {
const errs = mod.comp.getAllErrorsAlloc() catch break :blk;
for (errs.list) |err| Compilation.AllErrors.Message.renderToStdErr(err, .no_color);
}
// TODO restore test case triggering this panic
@panic("Zig compiler bug: attempted to destroy declaration with an attached error");
}
const decl = mod.declPtr(decl_index);
log.debug("destroy {*} ({s})", .{ decl, decl.name });
_ = mod.test_functions.swapRemove(decl_index);