aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-01 15:26:31 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-01 15:26:31 -0700
commit8878f085dccaf9efe89a04b458205fddc215e095 (patch)
treebe49e3d222c1e58d4f962f155d24a197c8bd4778 /src/Sema.zig
parentf6aaab9406807305c2b48fcd742449c9e91f1851 (diff)
downloadzig-8878f085dccaf9efe89a04b458205fddc215e095.tar.gz
zig-8878f085dccaf9efe89a04b458205fddc215e095.zip
Sema: correct implementation of comptimeOnly for tuples
This makes formatted printing work when mixing comptime and runtime fields.
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 5bceb60aa0..e58fdef4a7 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -19585,8 +19585,9 @@ fn typeRequiresComptime(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) C
.tuple => {
const tuple = ty.castTag(.tuple).?.data;
- for (tuple.types) |field_ty| {
- if (try sema.typeRequiresComptime(block, src, field_ty)) {
+ for (tuple.types) |field_ty, i| {
+ const have_comptime_val = tuple.values[i].tag() != .unreachable_value;
+ if (!have_comptime_val and try sema.typeRequiresComptime(block, src, field_ty)) {
return true;
}
}