| author | |
| committer | |
| log | 5a7d257bf4ea983f504fbdd32b236a93aacff715 |
| tree | 06bba0f7a79f0b4a2d45d98c14d320c4a309e002 |
| parent | db70f7e35558c0df34cce0497ec0eea8e984d30d |
| signature |
ran the tests this time7 files changed, 11 insertions(+), 10 deletions(-)
src/FieldUnion.zig+3-3| ... | @@ -5,9 +5,9 @@ const expectSimilarType = extras.expectSimilarType; | ... | @@ -5,9 +5,9 @@ const expectSimilarType = extras.expectSimilarType; |
| 5 | 5 | ||
| 6 | pub fn FieldUnion(comptime T: type) type { | 6 | pub fn FieldUnion(comptime T: type) type { |
| 7 | const fields = std.meta.fields(T); | 7 | const fields = std.meta.fields(T); |
| 8 | var names: [fields.fields.len][]const u8 = undefined; | 8 | var names: [fields.len][]const u8 = undefined; |
| 9 | var types: [fields.fields.len]type = undefined; | 9 | var types: [fields.len]type = undefined; |
| 10 | var attrs: [fields.fields.len]std.builtin.Type.UnionField.Attributes = undefined; | 10 | var attrs: [fields.len]std.builtin.Type.UnionField.Attributes = undefined; |
| 11 | 11 | ||
| 12 | inline for (fields, 0..) |field, i| { | 12 | inline for (fields, 0..) |field, i| { |
| 13 | names[i] = field.name; | 13 | names[i] = field.name; |
src/FlippedInt.zig+1-1| ... | @@ -9,7 +9,7 @@ pub fn FlippedInt(comptime T: type) type { | ... | @@ -9,7 +9,7 @@ pub fn FlippedInt(comptime T: type) type { |
| 9 | .signed => .unsigned, | 9 | .signed => .unsigned, |
| 10 | .unsigned => .signed, | 10 | .unsigned => .signed, |
| 11 | }, | 11 | }, |
| 12 | info.signedness, | 12 | info.bits, |
| 13 | ); | 13 | ); |
| 14 | } | 14 | } |
| 15 | 15 |
src/ManyArrayList.zig+2-2| ... | @@ -10,8 +10,8 @@ pub fn ManyArrayList(T: type) type { | ... | @@ -10,8 +10,8 @@ pub fn ManyArrayList(T: type) type { |
| 10 | pub fn init(allocator: std.mem.Allocator) @This() { | 10 | pub fn init(allocator: std.mem.Allocator) @This() { |
| 11 | return .{ | 11 | return .{ |
| 12 | .allocator = allocator, | 12 | .allocator = allocator, |
| 13 | .list = .{}, | 13 | .list = .empty, |
| 14 | .lengths = .{}, | 14 | .lengths = .empty, |
| 15 | }; | 15 | }; |
| 16 | } | 16 | } |
| 17 | 17 |
src/StructOfArrays.zig+1| ... | @@ -12,6 +12,7 @@ pub fn StructOfArrays(len: usize, T: type) type { | ... | @@ -12,6 +12,7 @@ pub fn StructOfArrays(len: usize, T: type) type { |
| 12 | names[i] = item.name; | 12 | names[i] = item.name; |
| 13 | types[i] = [len]item.type; | 13 | types[i] = [len]item.type; |
| 14 | } | 14 | } |
| 15 | if (info.is_tuple) return @Tuple(&types); | ||
| 15 | return @Struct(.auto, null, &names, &types, &@splat(.{})); | 16 | return @Struct(.auto, null, &names, &types, &@splat(.{})); |
| 16 | } | 17 | } |
| 17 | 18 |
src/StructOfSlices.zig+1| ... | @@ -12,6 +12,7 @@ pub fn StructOfSlices(T: type) type { | ... | @@ -12,6 +12,7 @@ pub fn StructOfSlices(T: type) type { |
| 12 | names[i] = item.name; | 12 | names[i] = item.name; |
| 13 | types[i] = []const item.type; | 13 | types[i] = []const item.type; |
| 14 | } | 14 | } |
| 15 | if (info.is_tuple) return @Tuple(&types); | ||
| 15 | return @Struct(.auto, null, &names, &types, &@splat(.{})); | 16 | return @Struct(.auto, null, &names, &types, &@splat(.{})); |
| 16 | } | 17 | } |
| 17 | 18 |
src/join.zig+3-3| ... | @@ -14,13 +14,13 @@ pub fn join(input: anytype) Join(@TypeOf(input)) { | ... | @@ -14,13 +14,13 @@ pub fn join(input: anytype) Join(@TypeOf(input)) { |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | pub fn Join(comptime T: type) type { | 16 | pub fn Join(comptime T: type) type { |
| 17 | var names: [][]const u8 = &.{}; | 17 | var names: []const []const u8 = &.{}; |
| 18 | var types: []type = &.{}; | 18 | var types: []const type = &.{}; |
| 19 | inline for (std.meta.fields(T)) |item| { | 19 | inline for (std.meta.fields(T)) |item| { |
| 20 | inline for (std.meta.fields(item.type)) |f| { | 20 | inline for (std.meta.fields(item.type)) |f| { |
| 21 | names = names ++ &[_][]const u8{f.name}; | 21 | names = names ++ &[_][]const u8{f.name}; |
| 22 | types = types ++ &[_]type{f.type}; | 22 | types = types ++ &[_]type{f.type}; |
| 23 | } | 23 | } |
| 24 | } | 24 | } |
| 25 | return @Struct(.auto, null, &names, &types, &@splat(.{})); | 25 | return @Struct(.auto, null, names, types[0..], &@splat(.{})); |
| 26 | } | 26 | } |
src/omit.zig-1| ... | @@ -31,5 +31,4 @@ pub fn Omit(T: type, field_name: []const u8) type { | ... | @@ -31,5 +31,4 @@ pub fn Omit(T: type, field_name: []const u8) type { |
| 31 | i += 1; | 31 | i += 1; |
| 32 | } | 32 | } |
| 33 | return @Struct(.auto, null, &names, &types, &attrs); | 33 | return @Struct(.auto, null, &names, &types, &attrs); |
| 34 | // return @Type(.{ .@"struct" = .{ .layout = .auto, .fields = &fields, .decls = &.{}, .is_tuple = false } }); | ||
| 35 | } | 34 | } |