authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-12-30 23:09:18+11:00
committergravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2019-12-30 23:09:18+11:00
log51943ff432f3e73c2dc21015fae4bdcd8f81ae61
tree9e6a4abc8ab6657a9d9c977229140c845346b636
parent17cc511ea431c872e4312843f90297b2d552fb3d
signaturelock-open Commit is signed but in an unrecognized format.

std: meta.TagPayloadType takes the tag type of the union


1 files changed, 1 insertions(+), 3 deletions(-)

lib/std/meta.zig+1-3
......@@ -364,10 +364,8 @@ test "std.meta.activeTag" {
364364
365365///Given a tagged union type, and an enum, return the type of the union
366366/// field corresponding to the enum tag.
367pub fn TagPayloadType(comptime U: type, tag: var) type {
368 const Tag = @TypeOf(tag);
367pub fn TagPayloadType(comptime U: type, tag: @TagType(U)) type {
369368 testing.expect(trait.is(builtin.TypeId.Union)(U));
370 testing.expect(trait.is(builtin.TypeId.Enum)(Tag));
371369
372370 const info = @typeInfo(U).Union;
373371