| ... | @@ -693,8 +693,10 @@ test activeTag { | ... | @@ -693,8 +693,10 @@ test activeTag { |
| 693 | try testing.expect(activeTag(u) == UE.Float); | 693 | try testing.expect(activeTag(u) == UE.Float); |
| 694 | } | 694 | } |
| 695 | | 695 | |
| | 696 | /// Deprecated: Use @FieldType(U, tag_name) |
| 696 | const TagPayloadType = TagPayload; | 697 | const TagPayloadType = TagPayload; |
| 697 | | 698 | |
| | 699 | /// Deprecated: Use @FieldType(U, tag_name) |
| 698 | pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type { | 700 | pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type { |
| 699 | const info = @typeInfo(U).@"union"; | 701 | const info = @typeInfo(U).@"union"; |
| 700 | | 702 | |
| ... | @@ -706,8 +708,7 @@ pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type { | ... | @@ -706,8 +708,7 @@ pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type { |
| 706 | @compileError("no field '" ++ tag_name ++ "' in union '" ++ @typeName(U) ++ "'"); | 708 | @compileError("no field '" ++ tag_name ++ "' in union '" ++ @typeName(U) ++ "'"); |
| 707 | } | 709 | } |
| 708 | | 710 | |
| 709 | /// Given a tagged union type, and an enum, return the type of the union field | 711 | /// Deprecated: Use @FieldType(U, @tagName(tag)) |
| 710 | /// corresponding to the enum tag. | | |
| 711 | pub fn TagPayload(comptime U: type, comptime tag: Tag(U)) type { | 712 | pub fn TagPayload(comptime U: type, comptime tag: Tag(U)) type { |
| 712 | return TagPayloadByName(U, @tagName(tag)); | 713 | return TagPayloadByName(U, @tagName(tag)); |
| 713 | } | 714 | } |