| ... | ... | @@ -3155,30 +3155,29 @@ static Error resolve_union_zero_bits(CodeGen *g, ZigType *union_type) { |
| 3155 | 3155 | tag_type->data.enumeration.fields_by_name.init(field_count); |
| 3156 | 3156 | tag_type->data.enumeration.decls_scope = union_type->data.unionation.decls_scope; |
| 3157 | 3157 | } else if (enum_type_node != nullptr) { |
| 3158 | | ZigType *enum_type = analyze_type_expr(g, scope, enum_type_node); |
| 3159 | | if (type_is_invalid(enum_type)) { |
| 3158 | tag_type = analyze_type_expr(g, scope, enum_type_node); |
| 3159 | } else { |
| 3160 | if (decl_node->type == NodeTypeContainerDecl) { |
| 3161 | tag_type = nullptr; |
| 3162 | } else { |
| 3163 | tag_type = union_type->data.unionation.tag_type; |
| 3164 | } |
| 3165 | } |
| 3166 | if (tag_type != nullptr) { |
| 3167 | if (type_is_invalid(tag_type)) { |
| 3160 | 3168 | union_type->data.unionation.resolve_status = ResolveStatusInvalid; |
| 3161 | 3169 | return ErrorSemanticAnalyzeFail; |
| 3162 | 3170 | } |
| 3163 | | if (enum_type->id != ZigTypeIdEnum) { |
| 3171 | if (tag_type->id != ZigTypeIdEnum) { |
| 3164 | 3172 | union_type->data.unionation.resolve_status = ResolveStatusInvalid; |
| 3165 | | add_node_error(g, enum_type_node, |
| 3166 | | buf_sprintf("expected enum tag type, found '%s'", buf_ptr(&enum_type->name))); |
| 3173 | add_node_error(g, enum_type_node != nullptr ? enum_type_node : decl_node, |
| 3174 | buf_sprintf("expected enum tag type, found '%s'", buf_ptr(&tag_type->name))); |
| 3167 | 3175 | return ErrorSemanticAnalyzeFail; |
| 3168 | 3176 | } |
| 3169 | | if ((err = type_resolve(g, enum_type, ResolveStatusAlignmentKnown))) { |
| 3177 | if ((err = type_resolve(g, tag_type, ResolveStatusAlignmentKnown))) { |
| 3170 | 3178 | assert(g->errors.length != 0); |
| 3171 | 3179 | return err; |
| 3172 | 3180 | } |
| 3173 | | tag_type = enum_type; |
| 3174 | | } else { |
| 3175 | | if (decl_node->type == NodeTypeContainerDecl) { |
| 3176 | | tag_type = nullptr; |
| 3177 | | } else { |
| 3178 | | tag_type = union_type->data.unionation.tag_type; |
| 3179 | | } |
| 3180 | | } |
| 3181 | | if (tag_type != nullptr) { |
| 3182 | 3181 | covered_enum_fields = heap::c_allocator.allocate<bool>(tag_type->data.enumeration.src_field_count); |
| 3183 | 3182 | } |
| 3184 | 3183 | union_type->data.unionation.tag_type = tag_type; |