From 66d15d9d0974e1b493b717cf02deb435ebd13858 Mon Sep 17 00:00:00 2001 From: mlugg Date: Thu, 29 May 2025 01:27:37 +0100 Subject: link: make checking for failed types the responsibility of Compilation --- src/Compilation.zig | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/Compilation.zig') 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| { -- cgit v1.2.3