aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/type.zig b/src/type.zig
index feea1fe2c1..5bcf310fc4 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -2868,7 +2868,11 @@ pub const Type = extern union {
/// Otherwise, returns `null`.
pub fn unionTagType(ty: Type) ?Type {
return switch (ty.tag()) {
- .union_tagged => ty.castTag(.union_tagged).?.data.tag_ty,
+ .union_tagged => {
+ const union_obj = ty.castTag(.union_tagged).?.data;
+ assert(union_obj.haveFieldTypes());
+ return union_obj.tag_ty;
+ },
.atomic_order,
.atomic_rmw_op,