aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2023-09-23 13:03:03 -0400
committerkcbanner <kcbanner@gmail.com>2023-09-23 13:05:04 -0400
commitf2a24b48e1221a8954ddf16e9070e1470ee13e8d (patch)
tree65443a1d67bb03be28927643462f92568fedbbc0 /src/codegen.zig
parent2fddd767ba20374e7677003c101e60f470c3804c (diff)
downloadzig-f2a24b48e1221a8954ddf16e9070e1470ee13e8d.tar.gz
zig-f2a24b48e1221a8954ddf16e9070e1470ee13e8d.zip
sema: rework the comptime representation of comptime unions
When the tag is not known, it's set to `.none`. In this case, the value is either an array of bytes (for extern unions) or an integer (for packed unions).
Diffstat (limited to 'src/codegen.zig')
-rw-r--r--src/codegen.zig5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/codegen.zig b/src/codegen.zig
index f34c97e6e5..13aefaa8e5 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -583,10 +583,7 @@ pub fn generateSymbol(
}
const union_obj = mod.typeToUnion(typed_value.ty).?;
- const field_index = typed_value.ty.unionTagFieldIndex(un.tag.toValue(), mod) orelse f: {
- assert(union_obj.getLayout(ip) == .Extern);
- break :f mod.unionLargestField(union_obj).index;
- };
+ const field_index = typed_value.ty.unionTagFieldIndex(un.tag.toValue(), mod).?;
const field_ty = union_obj.field_types.get(ip)[field_index].toType();
if (!field_ty.hasRuntimeBits(mod)) {