aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-07-15 23:07:32 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-07-18 19:02:06 -0700
commit7c66bd39be82c09cf004843da058a48769066c3f (patch)
treea677f98d777eda36ef2326fa48ad75c3aab214aa /src
parent45a8c6c1f4efae49effdcecd541572872fa69582 (diff)
downloadzig-7c66bd39be82c09cf004843da058a48769066c3f.tar.gz
zig-7c66bd39be82c09cf004843da058a48769066c3f.zip
Sema: fix analyzeIsNonErrComptimeOnly false positive
The logic here was not properly ported from master branch which broke errdefers.
Diffstat (limited to 'src')
-rw-r--r--src/Sema.zig10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 68080ee27b..805de066ca 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -30613,12 +30613,20 @@ fn analyzeIsNonErrComptimeOnly(
ies.func == func_index)
{
// Try to avoid resolving inferred error set if possible.
+ if (ies.errors.count() != 0) break :blk;
+ switch (ies.resolved) {
+ .anyerror_type => break :blk,
+ .none => {},
+ else => if (ip.indexToKey(ies.resolved).error_set_type.names.len != 0) {
+ break :blk;
+ },
+ }
for (ies.inferred_error_sets.keys()) |other_ies_index| {
if (set_ty == other_ies_index) continue;
const other_resolved =
try sema.resolveInferredErrorSet(block, src, other_ies_index);
if (other_resolved == .anyerror_type) {
- ip.funcIesResolved(func_index).* = .anyerror_type;
+ ies.resolved = .anyerror_type;
break :blk;
}
if (ip.indexToKey(other_resolved).error_set_type.names.len != 0)