Merge pull request #4007 from daurnimator/json-cleanup

std.json: cleanups
This commit is contained in:
Andrew Kelley
2019-12-30 18:13:20 -05:00
committed by GitHub
2 changed files with 466 additions and 369 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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;