diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-01 15:26:31 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-01 15:26:31 -0700 |
| commit | 8878f085dccaf9efe89a04b458205fddc215e095 (patch) | |
| tree | be49e3d222c1e58d4f962f155d24a197c8bd4778 /src/Sema.zig | |
| parent | f6aaab9406807305c2b48fcd742449c9e91f1851 (diff) | |
| download | zig-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.zig | 5 |
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; } } |
