| ... | @@ -17877,6 +17877,13 @@ fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air | ... | @@ -17877,6 +17877,13 @@ fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air |
| 17877 | operand_ty.fmt(mod), | 17877 | operand_ty.fmt(mod), |
| 17878 | }), | 17878 | }), |
| 17879 | }; | 17879 | }; |
| | 17880 | if (enum_ty.enumFieldCount() == 0) { |
| | 17881 | // TODO I don't think this is the correct way to handle this but |
| | 17882 | // it prevents a crash. |
| | 17883 | return sema.fail(block, operand_src, "cannot get @tagName of empty enum '{}'", .{ |
| | 17884 | enum_ty.fmt(mod), |
| | 17885 | }); |
| | 17886 | } |
| 17880 | const enum_decl_index = enum_ty.getOwnerDecl(); | 17887 | const enum_decl_index = enum_ty.getOwnerDecl(); |
| 17881 | const casted_operand = try sema.coerce(block, enum_ty, operand, operand_src); | 17888 | const casted_operand = try sema.coerce(block, enum_ty, operand, operand_src); |
| 17882 | if (try sema.resolveDefinedValue(block, operand_src, casted_operand)) |val| { | 17889 | if (try sema.resolveDefinedValue(block, operand_src, casted_operand)) |val| { |