authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-15 23:07:32-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-18 19:02:06-07:00
log7c66bd39be82c09cf004843da058a48769066c3f
treea677f98d777eda36ef2326fa48ad75c3aab214aa
parent45a8c6c1f4efae49effdcecd541572872fa69582

Sema: fix analyzeIsNonErrComptimeOnly false positive

The logic here was not properly ported from master branch which broke errdefers.

1 files changed, 9 insertions(+), 1 deletions(-)

src/Sema.zig+9-1
...@@ -30613,12 +30613,20 @@ fn analyzeIsNonErrComptimeOnly(...@@ -30613,12 +30613,20 @@ fn analyzeIsNonErrComptimeOnly(
30613 ies.func == func_index)30613 ies.func == func_index)
30614 {30614 {
30615 // Try to avoid resolving inferred error set if possible.30615 // Try to avoid resolving inferred error set if possible.
30616 if (ies.errors.count() != 0) break :blk;
30617 switch (ies.resolved) {
30618 .anyerror_type => break :blk,
30619 .none => {},
30620 else => if (ip.indexToKey(ies.resolved).error_set_type.names.len != 0) {
30621 break :blk;
30622 },
30623 }
30616 for (ies.inferred_error_sets.keys()) |other_ies_index| {30624 for (ies.inferred_error_sets.keys()) |other_ies_index| {
30617 if (set_ty == other_ies_index) continue;30625 if (set_ty == other_ies_index) continue;
30618 const other_resolved =30626 const other_resolved =
30619 try sema.resolveInferredErrorSet(block, src, other_ies_index);30627 try sema.resolveInferredErrorSet(block, src, other_ies_index);
30620 if (other_resolved == .anyerror_type) {30628 if (other_resolved == .anyerror_type) {
30621 ip.funcIesResolved(func_index).* = .anyerror_type;30629 ies.resolved = .anyerror_type;
30622 break :blk;30630 break :blk;
30623 }30631 }
30624 if (ip.indexToKey(other_resolved).error_set_type.names.len != 0)30632 if (ip.indexToKey(other_resolved).error_set_type.names.len != 0)