From 3f2a4720b1ef057215c8240b3a377c523ee63e94 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 17 Jul 2023 17:47:59 -0700 Subject: compiler: fix branch regressions * getOwnedFunctionIndex no longer checks if the value is actually a function. * The callsites to `intern` that I added want to avoid the `getCoerced` call, so I added `intern2`. * Adding to inferred error sets should not happen if the destination error set is not the inferred error set of the current Sema instance. * adhoc_inferred_error_set_type can be seen by the backend. Treat it like anyerror. --- src/Module.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index 45536547d8..d9ee3a57ad 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -751,6 +751,7 @@ pub const Decl = struct { }; } + /// This returns an InternPool.Index even when the value is not a function. pub fn getOwnedFunctionIndex(decl: Decl) InternPool.Index { return if (decl.owns_tv) decl.val.toIntern() else .none; } @@ -4978,7 +4979,7 @@ fn scanDecl(iter: *ScanDeclIter, decl_sub_index: usize, flags: u4) Allocator.Err decl.has_align = has_align; decl.has_linksection_or_addrspace = has_linksection_or_addrspace; decl.zir_decl_index = @as(u32, @intCast(decl_sub_index)); - if (decl.getOwnedFunctionIndex() != .none) { + if (decl.getOwnedFunction(mod) != null) { switch (comp.bin_file.tag) { .coff, .elf, .macho, .plan9 => { // TODO Look into detecting when this would be unnecessary by storing enough state -- cgit v1.2.3