| ... | @@ -364,10 +364,8 @@ test "std.meta.activeTag" { | ... | @@ -364,10 +364,8 @@ test "std.meta.activeTag" { |
| 364 | | 364 | |
| 365 | ///Given a tagged union type, and an enum, return the type of the union | 365 | ///Given a tagged union type, and an enum, return the type of the union |
| 366 | /// field corresponding to the enum tag. | 366 | /// field corresponding to the enum tag. |
| 367 | pub fn TagPayloadType(comptime U: type, tag: var) type { | 367 | pub fn TagPayloadType(comptime U: type, tag: @TagType(U)) type { |
| 368 | const Tag = @TypeOf(tag); | | |
| 369 | testing.expect(trait.is(builtin.TypeId.Union)(U)); | 368 | testing.expect(trait.is(builtin.TypeId.Union)(U)); |
| 370 | testing.expect(trait.is(builtin.TypeId.Enum)(Tag)); | | |
| 371 | | 369 | |
| 372 | const info = @typeInfo(U).Union; | 370 | const info = @typeInfo(U).Union; |
| 373 | | 371 | |