| ... | ... | @@ -8183,13 +8183,6 @@ static IrInstruction *ir_gen_switch_expr(IrBuilder *irb, Scope *scope, AstNode * |
| 8183 | 8183 | return irb->codegen->invalid_instruction; |
| 8184 | 8184 | } |
| 8185 | 8185 | else_prong = prong_node; |
| 8186 | | if (underscore_prong) { |
| 8187 | | ErrorMsg *msg = add_node_error(irb->codegen, prong_node, |
| 8188 | | buf_sprintf("else and '_' prong in switch expression")); |
| 8189 | | add_error_note(irb->codegen, msg, underscore_prong, |
| 8190 | | buf_sprintf("'_' prong is here")); |
| 8191 | | return irb->codegen->invalid_instruction; |
| 8192 | | } |
| 8193 | 8186 | } else if (prong_item_count == 1 && |
| 8194 | 8187 | prong_node->data.switch_prong.items.at(0)->type == NodeTypeSymbol && |
| 8195 | 8188 | buf_eql_str(prong_node->data.switch_prong.items.at(0)->data.symbol_expr.symbol, "_")) { |
| ... | ... | @@ -8201,16 +8194,20 @@ static IrInstruction *ir_gen_switch_expr(IrBuilder *irb, Scope *scope, AstNode * |
| 8201 | 8194 | return irb->codegen->invalid_instruction; |
| 8202 | 8195 | } |
| 8203 | 8196 | underscore_prong = prong_node; |
| 8204 | | if (else_prong) { |
| 8205 | | ErrorMsg *msg = add_node_error(irb->codegen, prong_node, |
| 8206 | | buf_sprintf("else and '_' prong in switch expression")); |
| 8207 | | add_error_note(irb->codegen, msg, else_prong, |
| 8208 | | buf_sprintf("else prong is here")); |
| 8209 | | return irb->codegen->invalid_instruction; |
| 8210 | | } |
| 8211 | 8197 | } else { |
| 8212 | 8198 | continue; |
| 8213 | 8199 | } |
| 8200 | if (underscore_prong && else_prong) { |
| 8201 | ErrorMsg *msg = add_node_error(irb->codegen, prong_node, |
| 8202 | buf_sprintf("else and '_' prong in switch expression")); |
| 8203 | if (underscore_prong == prong_node) |
| 8204 | add_error_note(irb->codegen, msg, else_prong, |
| 8205 | buf_sprintf("else prong is here")); |
| 8206 | else |
| 8207 | add_error_note(irb->codegen, msg, underscore_prong, |
| 8208 | buf_sprintf("'_' prong is here")); |
| 8209 | return irb->codegen->invalid_instruction; |
| 8210 | } |
| 8214 | 8211 | ResultLocPeer *this_peer_result_loc = create_peer_result(peer_parent); |
| 8215 | 8212 | |
| 8216 | 8213 | IrBasicBlock *prev_block = irb->current_basic_block; |
| ... | ... | @@ -22357,8 +22354,11 @@ static IrInstruction *ir_analyze_instruction_enum_tag_name(IrAnalyze *ira, IrIns |
| 22357 | 22354 | if (instr_is_comptime(target)) { |
| 22358 | 22355 | if ((err = type_resolve(ira->codegen, target->value->type, ResolveStatusZeroBitsKnown))) |
| 22359 | 22356 | return ira->codegen->invalid_instruction; |
| 22360 | | if (target->value->type->data.enumeration.non_exhaustive) |
| 22361 | | zig_panic("TODO @tagName on non-exhaustive enum"); |
| 22357 | if (target->value->type->data.enumeration.non_exhaustive) { |
| 22358 | add_node_error(ira->codegen, instruction->base.source_node, |
| 22359 | buf_sprintf("TODO @tagName on non-exhaustive enum https://github.com/ziglang/zig/issues/3991")); |
| 22360 | return ira->codegen->invalid_instruction; |
| 22361 | } |
| 22362 | 22362 | TypeEnumField *field = find_enum_field_by_tag(target->value->type, &target->value->data.x_bigint); |
| 22363 | 22363 | ZigValue *array_val = create_const_str_lit(ira->codegen, field->name)->data.x_ptr.data.ref.pointee; |
| 22364 | 22364 | IrInstruction *result = ir_const(ira, &instruction->base, nullptr); |