aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorMatthew Lugg <mlugg@mlugg.co.uk>2025-01-22 16:47:45 +0000
committerGitHub <noreply@github.com>2025-01-22 16:47:45 +0000
commit61fe307d0f05eea901577900f4ab2bdaf0ffb35f (patch)
tree540a47aad6da00421777f121c6b9e568f541918f /src/Sema.zig
parent941677e08318c2baaabc9d0fc87892d1b63487ae (diff)
parente864c38cc38095a1496229803465fdd0d079f9c3 (diff)
downloadzig-61fe307d0f05eea901577900f4ab2bdaf0ffb35f.tar.gz
zig-61fe307d0f05eea901577900f4ab2bdaf0ffb35f.zip
Merge pull request #22571 from mlugg/various-fixes-again
compiler: a few fixes
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 978396e371..fb9b27a8cd 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -1824,7 +1824,14 @@ fn analyzeBodyInner(
);
const uncasted_cond = try sema.resolveInst(extra.data.condition);
const cond = try sema.coerce(block, Type.bool, uncasted_cond, cond_src);
- const cond_val = try sema.resolveConstDefinedValue(block, cond_src, cond, null);
+ const cond_val = try sema.resolveConstDefinedValue(
+ block,
+ cond_src,
+ cond,
+ // If this block is comptime, it's more helpful to just give the outer message.
+ // This is particularly true if this came from a comptime `condbr` above.
+ if (block.isComptime()) null else .{ .simple = .inline_loop_operand },
+ );
const inline_body = if (cond_val.toBool()) then_body else else_body;
try sema.maybeErrorUnwrapCondbr(block, inline_body, extra.data.condition, cond_src);