diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-11-25 02:40:06 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-11-26 18:05:27 +0200 |
| commit | 587ef60a28ae7c1c780e02ecf60b331ead53bc7f (patch) | |
| tree | b9a13a178108717bc40a5bb042beb79f95bf2a91 /src/Sema.zig | |
| parent | bf62cb453bb1e91cd0ed448de70bd4f076b81906 (diff) | |
| download | zig-587ef60a28ae7c1c780e02ecf60b331ead53bc7f.tar.gz zig-587ef60a28ae7c1c780e02ecf60b331ead53bc7f.zip | |
Sema: resolve union fields before using getTagType
Closes #13649
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 65bdf7e1e0..d6a563bd36 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -7580,7 +7580,8 @@ fn zirEnumToInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A const enum_tag: Air.Inst.Ref = switch (operand_ty.zigTypeTag()) { .Enum => operand, .Union => blk: { - const tag_ty = operand_ty.unionTagType() orelse { + const union_ty = try sema.resolveTypeFields(operand_ty); + const tag_ty = union_ty.unionTagType() orelse { return sema.fail( block, operand_src, @@ -22713,7 +22714,8 @@ fn fieldPtr( return inst; } } - if (child_type.unionTagType()) |enum_ty| { + const union_ty = try sema.resolveTypeFields(child_type); + if (union_ty.unionTagType()) |enum_ty| { if (enum_ty.enumFieldIndex(field_name)) |field_index| { const field_index_u32 = @intCast(u32, field_index); var anon_decl = try block.startAnonDecl(); |
