aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2024-03-12 20:25:54 +0000
committermlugg <mlugg@mlugg.co.uk>2024-03-14 07:40:08 +0000
commit347196f905c083047fdc0a3b72656f1867973a13 (patch)
tree70f7ba3c98fc67589bf26decc445e308b041adcc /src/Module.zig
parent075c103332effdac80d2c00e59f06ee0fea95b49 (diff)
downloadzig-347196f905c083047fdc0a3b72656f1867973a13.tar.gz
zig-347196f905c083047fdc0a3b72656f1867973a13.zip
Zcu: perform orphan checks against uncoerced function
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 8d0a8fe328..95b96b3605 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -3113,13 +3113,18 @@ pub fn ensureDeclAnalyzed(mod: *Module, decl_index: Decl.Index) SemaError!void {
}
}
-pub fn ensureFuncBodyAnalyzed(zcu: *Zcu, func_index: InternPool.Index) SemaError!void {
+pub fn ensureFuncBodyAnalyzed(zcu: *Zcu, maybe_coerced_func_index: InternPool.Index) SemaError!void {
const tracy = trace(@src());
defer tracy.end();
const gpa = zcu.gpa;
const ip = &zcu.intern_pool;
- const func = zcu.funcInfo(func_index);
+
+ // We only care about the uncoerced function.
+ // We need to do this for the "orphaned function" check below to be valid.
+ const func_index = ip.unwrapCoercedFunc(maybe_coerced_func_index);
+
+ const func = zcu.funcInfo(maybe_coerced_func_index);
const decl_index = func.owner_decl;
const decl = zcu.declPtr(decl_index);