| ... | @@ -3251,8 +3251,20 @@ pub const Type = extern union { | ... | @@ -3251,8 +3251,20 @@ pub const Type = extern union { |
| 3251 | const int_tag_ty = ty.intTagType(&buffer); | 3251 | const int_tag_ty = ty.intTagType(&buffer); |
| 3252 | return int_tag_ty.bitSize(target); | 3252 | return int_tag_ty.bitSize(target); |
| 3253 | }, | 3253 | }, |
| | 3254 | |
| 3254 | .@"union", .union_tagged => { | 3255 | .@"union", .union_tagged => { |
| 3255 | @panic("TODO bitSize unions"); | 3256 | const union_obj = ty.cast(Payload.Union).?.data; |
| | 3257 | |
| | 3258 | const fields = union_obj.fields; |
| | 3259 | if (fields.count() == 0) return 0; |
| | 3260 | |
| | 3261 | assert(union_obj.haveFieldTypes()); |
| | 3262 | |
| | 3263 | var size: u64 = 0; |
| | 3264 | for (fields.values()) |field| { |
| | 3265 | size = @maximum(size, field.ty.bitSize(target)); |
| | 3266 | } |
| | 3267 | return size; |
| 3256 | }, | 3268 | }, |
| 3257 | | 3269 | |
| 3258 | .vector => { | 3270 | .vector => { |