diff options
| author | daurnimator <quae@daurnimator.com> | 2019-12-30 23:09:18 +1100 |
|---|---|---|
| committer | daurnimator <quae@daurnimator.com> | 2019-12-30 23:09:18 +1100 |
| commit | 51943ff432f3e73c2dc21015fae4bdcd8f81ae61 (patch) | |
| tree | 9e6a4abc8ab6657a9d9c977229140c845346b636 /lib/std/meta.zig | |
| parent | 17cc511ea431c872e4312843f90297b2d552fb3d (diff) | |
| download | zig-51943ff432f3e73c2dc21015fae4bdcd8f81ae61.tar.gz zig-51943ff432f3e73c2dc21015fae4bdcd8f81ae61.zip | |
std: meta.TagPayloadType takes the tag type of the union
Diffstat (limited to 'lib/std/meta.zig')
| -rw-r--r-- | lib/std/meta.zig | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/std/meta.zig b/lib/std/meta.zig index e0ddbed274..5e5850e393 100644 --- a/lib/std/meta.zig +++ b/lib/std/meta.zig @@ -364,10 +364,8 @@ test "std.meta.activeTag" { ///Given a tagged union type, and an enum, return the type of the union /// field corresponding to the enum tag. -pub fn TagPayloadType(comptime U: type, tag: var) type { - const Tag = @TypeOf(tag); +pub fn TagPayloadType(comptime U: type, tag: @TagType(U)) type { testing.expect(trait.is(builtin.TypeId.Union)(U)); - testing.expect(trait.is(builtin.TypeId.Enum)(Tag)); const info = @typeInfo(U).Union; |
