aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-05-29 01:27:37 +0100
committermlugg <mlugg@mlugg.co.uk>2025-06-12 13:55:40 +0100
commit66d15d9d0974e1b493b717cf02deb435ebd13858 (patch)
treee5110141a14ba06fd626b8fc98ef59808724579a /src/Compilation.zig
parent2fb6f5c1adcd764372ad28ed4014fdaf558da778 (diff)
downloadzig-66d15d9d0974e1b493b717cf02deb435ebd13858.tar.gz
zig-66d15d9d0974e1b493b717cf02deb435ebd13858.zip
link: make checking for failed types the responsibility of Compilation
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index f51020c0ff..e51b3de1ad 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -4553,12 +4553,33 @@ fn processOneJob(tid: usize, comp: *Compilation, job: Job) JobError!void {
}
}
assert(nav.status == .fully_resolved);
+ if (!Air.valFullyResolved(zcu.navValue(nav_index), zcu)) {
+ // Type resolution failed in a way which affects this `Nav`. This is a transitive
+ // failure, but it doesn't need recording, because this `Nav` semantically depends
+ // on the failed type, so when it is changed the `Nav` will be updated.
+ return;
+ }
comp.dispatchLinkTask(tid, .{ .link_nav = nav_index });
},
.link_func => |func| {
+ const zcu = comp.zcu.?;
+ if (!func.air.typesFullyResolved(zcu)) {
+ // Type resolution failed in a way which affects this function. This is a transitive
+ // failure, but it doesn't need recording, because this function semantically depends
+ // on the failed type, so when it is changed the function is updated.
+ return;
+ }
comp.dispatchLinkTask(tid, .{ .link_func = func });
},
.link_type => |ty| {
+ const zcu = comp.zcu.?;
+ if (zcu.failed_types.fetchSwapRemove(ty)) |*entry| entry.value.deinit(zcu.gpa);
+ if (!Air.typeFullyResolved(.fromInterned(ty), zcu)) {
+ // Type resolution failed in a way which affects this type. This is a transitive
+ // failure, but it doesn't need recording, because this type semantically depends
+ // on the failed type, so when that is changed, this type will be updated.
+ return;
+ }
comp.dispatchLinkTask(tid, .{ .link_type = ty });
},
.update_line_number => |ti| {