| ... | @@ -22357,6 +22357,8 @@ static IrInstruction *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrIns | ... | @@ -22357,6 +22357,8 @@ static IrInstruction *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrIns |
| 22357 | if (instr_is_comptime(target)) { | 22357 | if (instr_is_comptime(target)) { |
| 22358 | if ((err = type_resolve(ira->codegen, target->value->type, ResolveStatusZeroBitsKnown))) | 22358 | if ((err = type_resolve(ira->codegen, target->value->type, ResolveStatusZeroBitsKnown))) |
| 22359 | return ira->codegen->invalid_instruction; | 22359 | return ira->codegen->invalid_instruction; |
| | 22360 | if (target->value->type->data.enumeration.non_exhaustive) |
| | 22361 | zig_panic("TODO @tagName on non-exhaustive enum"); |
| 22360 | TypeEnumField *field = find_enum_field_by_tag(target->value->type, &target->value->data.x_bigint); | 22362 | TypeEnumField *field = find_enum_field_by_tag(target->value->type, &target->value->data.x_bigint); |
| 22361 | ZigValue *array_val = create_const_str_lit(ira->codegen, field->name)->data.x_ptr.data.ref.pointee; | 22363 | ZigValue *array_val = create_const_str_lit(ira->codegen, field->name)->data.x_ptr.data.ref.pointee; |
| 22362 | IrInstruction *result = ir_const(ira, &instruction->base, nullptr); | 22364 | IrInstruction *result = ir_const(ira, &instruction->base, nullptr); |
| ... | @@ -26471,7 +26473,11 @@ static IrInstruction *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, | ... | @@ -26471,7 +26473,11 @@ static IrInstruction *ir_analyze_instruction_check_switch_prongs(IrAnalyze *ira, |
| 26471 | bigint_incr(&field_index); | 26473 | bigint_incr(&field_index); |
| 26472 | } | 26474 | } |
| 26473 | } | 26475 | } |
| 26474 | if (switch_type->data.enumeration.non_exhaustive && instruction->have_underscore_prong) { | 26476 | if (instruction->have_underscore_prong) { |
| | 26477 | if (!switch_type->data.enumeration.non_exhaustive){ |
| | 26478 | ir_add_error(ira, &instruction->base, |
| | 26479 | buf_sprintf("switch on non-exhaustive enum has `_` prong")); |
| | 26480 | } |
| 26475 | for (uint32_t i = 0; i < switch_type->data.enumeration.src_field_count; i += 1) { | 26481 | for (uint32_t i = 0; i < switch_type->data.enumeration.src_field_count; i += 1) { |
| 26476 | TypeEnumField *enum_field = &switch_type->data.enumeration.fields[i]; | 26482 | TypeEnumField *enum_field = &switch_type->data.enumeration.fields[i]; |
| 26477 | if (buf_eql_str(enum_field->name, "_")) | 26483 | if (buf_eql_str(enum_field->name, "_")) |