| ... | ... | @@ -5308,16 +5308,16 @@ fn zirEnumToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A |
| 5308 | 5308 | |
| 5309 | 5309 | const enum_tag: Air.Inst.Ref = switch (operand_ty.zigTypeTag()) { |
| 5310 | 5310 | .Enum => operand, |
| 5311 | | .Union => { |
| 5312 | | //if (!operand_ty.unionHasTag()) { |
| 5313 | | // return sema.fail( |
| 5314 | | // block, |
| 5315 | | // operand_src, |
| 5316 | | // "untagged union '{}' cannot be converted to integer", |
| 5317 | | // .{dest_ty_src}, |
| 5318 | | // ); |
| 5319 | | //} |
| 5320 | | return sema.fail(block, operand_src, "TODO zirEnumToInt for tagged unions", .{}); |
| 5311 | .Union => blk: { |
| 5312 | const tag_ty = operand_ty.unionTagType() orelse { |
| 5313 | return sema.fail( |
| 5314 | block, |
| 5315 | operand_src, |
| 5316 | "untagged union '{}' cannot be converted to integer", |
| 5317 | .{src}, |
| 5318 | ); |
| 5319 | }; |
| 5320 | break :blk try sema.unionToTag(block, tag_ty, operand, operand_src); |
| 5321 | 5321 | }, |
| 5322 | 5322 | else => { |
| 5323 | 5323 | return sema.fail(block, operand_src, "expected enum or tagged union, found {}", .{ |