| author | |
| committer | |
| log | eb4439f1e4e617247bffff13478a9fa57160c507 |
| tree | 8b177497e3f129933dfc49078346c10539c51dd1 |
| parent | df6319418a08b611bae23307ace6688f95bedea2 |
| signature |
Followup to d42d31f72f38165f70c2850e9cc63da44b3b470c.
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>8 files changed, 17 insertions(+), 28 deletions(-)
lib/std/hash/auto_hash.zig+4-4| ... | @@ -408,13 +408,13 @@ test "testHash union" { | ... | @@ -408,13 +408,13 @@ test "testHash union" { |
| 408 | } | 408 | } |
| 409 | 409 | ||
| 410 | test "testHash vector" { | 410 | test "testHash vector" { |
| 411 | const a: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 4 }; | 411 | const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 }; |
| 412 | const b: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 5 }; | 412 | const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 }; |
| 413 | try testing.expect(testHash(a) == testHash(a)); | 413 | try testing.expect(testHash(a) == testHash(a)); |
| 414 | try testing.expect(testHash(a) != testHash(b)); | 414 | try testing.expect(testHash(a) != testHash(b)); |
| 415 | 415 | ||
| 416 | const c: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 4 }; | 416 | const c: @Vector(4, u31) = [_]u31{ 1, 2, 3, 4 }; |
| 417 | const d: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 5 }; | 417 | const d: @Vector(4, u31) = [_]u31{ 1, 2, 3, 5 }; |
| 418 | try testing.expect(testHash(c) == testHash(c)); | 418 | try testing.expect(testHash(c) == testHash(c)); |
| 419 | try testing.expect(testHash(c) != testHash(d)); | 419 | try testing.expect(testHash(c) != testHash(d)); |
| 420 | } | 420 | } |
lib/std/meta.zig+3-13| ... | @@ -146,7 +146,7 @@ test "std.meta.Child" { | ... | @@ -146,7 +146,7 @@ test "std.meta.Child" { |
| 146 | try testing.expect(Child(*u8) == u8); | 146 | try testing.expect(Child(*u8) == u8); |
| 147 | try testing.expect(Child([]u8) == u8); | 147 | try testing.expect(Child([]u8) == u8); |
| 148 | try testing.expect(Child(?u8) == u8); | 148 | try testing.expect(Child(?u8) == u8); |
| 149 | try testing.expect(Child(Vector(2, u8)) == u8); | 149 | try testing.expect(Child(@Vector(2, u8)) == u8); |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | /// Given a "memory span" type (array, slice, vector, or pointer to such), returns the "element type". | 152 | /// Given a "memory span" type (array, slice, vector, or pointer to such), returns the "element type". |
| ... | @@ -173,8 +173,8 @@ test "std.meta.Elem" { | ... | @@ -173,8 +173,8 @@ test "std.meta.Elem" { |
| 173 | try testing.expect(Elem([*]u8) == u8); | 173 | try testing.expect(Elem([*]u8) == u8); |
| 174 | try testing.expect(Elem([]u8) == u8); | 174 | try testing.expect(Elem([]u8) == u8); |
| 175 | try testing.expect(Elem(*[10]u8) == u8); | 175 | try testing.expect(Elem(*[10]u8) == u8); |
| 176 | try testing.expect(Elem(Vector(2, u8)) == u8); | 176 | try testing.expect(Elem(@Vector(2, u8)) == u8); |
| 177 | try testing.expect(Elem(*Vector(2, u8)) == u8); | 177 | try testing.expect(Elem(*@Vector(2, u8)) == u8); |
| 178 | try testing.expect(Elem(?[*]u8) == u8); | 178 | try testing.expect(Elem(?[*]u8) == u8); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| ... | @@ -1014,16 +1014,6 @@ test "std.meta.Float" { | ... | @@ -1014,16 +1014,6 @@ test "std.meta.Float" { |
| 1014 | try testing.expectEqual(f128, Float(128)); | 1014 | try testing.expectEqual(f128, Float(128)); |
| 1015 | } | 1015 | } |
| 1016 | 1016 | ||
| 1017 | /// Deprecated. Use `@Vector`. | ||
| 1018 | pub fn Vector(comptime len: u32, comptime child: type) type { | ||
| 1019 | return @Type(.{ | ||
| 1020 | .Vector = .{ | ||
| 1021 | .len = len, | ||
| 1022 | .child = child, | ||
| 1023 | }, | ||
| 1024 | }); | ||
| 1025 | } | ||
| 1026 | |||
| 1027 | /// For a given function type, returns a tuple type which fields will | 1017 | /// For a given function type, returns a tuple type which fields will |
| 1028 | /// correspond to the argument types. | 1018 | /// correspond to the argument types. |
| 1029 | /// | 1019 | /// |
lib/std/meta/trait.zig+1-1| ... | @@ -271,7 +271,7 @@ pub fn isIndexable(comptime T: type) bool { | ... | @@ -271,7 +271,7 @@ pub fn isIndexable(comptime T: type) bool { |
| 271 | test "isIndexable" { | 271 | test "isIndexable" { |
| 272 | const array = [_]u8{0} ** 10; | 272 | const array = [_]u8{0} ** 10; |
| 273 | const slice = @as([]const u8, &array); | 273 | const slice = @as([]const u8, &array); |
| 274 | const vector: meta.Vector(2, u32) = [_]u32{0} ** 2; | 274 | const vector: @Vector(2, u32) = [_]u32{0} ** 2; |
| 275 | const tuple = .{ 1, 2, 3 }; | 275 | const tuple = .{ 1, 2, 3 }; |
| 276 | 276 | ||
| 277 | try testing.expect(isIndexable(@TypeOf(array))); | 277 | try testing.expect(isIndexable(@TypeOf(array))); |
test/cases/compile_errors/Issue_5586_Make_unary_minus_for_unsigned_types_a_compile_error.zig+2-3| ... | @@ -2,8 +2,7 @@ export fn f1(x: u32) u32 { | ... | @@ -2,8 +2,7 @@ export fn f1(x: u32) u32 { |
| 2 | const y = -%x; | 2 | const y = -%x; |
| 3 | return -y; | 3 | return -y; |
| 4 | } | 4 | } |
| 5 | const V = @import("std").meta.Vector; | 5 | export fn f2(x: @Vector(4, u32)) @Vector(4, u32) { |
| 6 | export fn f2(x: V(4, u32)) V(4, u32) { | ||
| 7 | const y = -%x; | 6 | const y = -%x; |
| 8 | return -y; | 7 | return -y; |
| 9 | } | 8 | } |
| ... | @@ -13,4 +12,4 @@ export fn f2(x: V(4, u32)) V(4, u32) { | ... | @@ -13,4 +12,4 @@ export fn f2(x: V(4, u32)) V(4, u32) { |
| 13 | // target=native | 12 | // target=native |
| 14 | // | 13 | // |
| 15 | // :3:12: error: negation of type 'u32' | 14 | // :3:12: error: negation of type 'u32' |
| 16 | // :8:12: error: negation of type '@Vector(4, u32)' | 15 | // :7:12: error: negation of type '@Vector(4, u32)' |
test/cases/compile_errors/comptime_vector_overflow_shows_the_index.zig+2-2| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | comptime { | 1 | comptime { |
| 2 | var a: @import("std").meta.Vector(4, u8) = [_]u8{ 1, 2, 255, 4 }; | 2 | var a: @Vector(4, u8) = [_]u8{ 1, 2, 255, 4 }; |
| 3 | var b: @import("std").meta.Vector(4, u8) = [_]u8{ 5, 6, 1, 8 }; | 3 | var b: @Vector(4, u8) = [_]u8{ 5, 6, 1, 8 }; |
| 4 | var x = a + b; | 4 | var x = a + b; |
| 5 | _ = x; | 5 | _ = x; |
| 6 | } | 6 | } |
test/cases/compile_errors/nested_vectors.zig+1-1| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | const V1 = @import("std").meta.Vector(4, u8); | 2 | const V1 = @Vector(4, u8); |
| 3 | const V2 = @Type(.{ .Vector = .{ .len = 4, .child = V1 } }); | 3 | const V2 = @Type(.{ .Vector = .{ .len = 4, .child = V1 } }); |
| 4 | var v: V2 = undefined; | 4 | var v: V2 = undefined; |
| 5 | _ = v; | 5 | _ = v; |
test/cases/compile_errors/shuffle_with_selected_index_past_first_vector_length.zig+2-2| ... | @@ -1,6 +1,6 @@ | ... | @@ -1,6 +1,6 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | const v: @import("std").meta.Vector(4, u32) = [4]u32{ 10, 11, 12, 13 }; | 2 | const v: @Vector(4, u32) = [4]u32{ 10, 11, 12, 13 }; |
| 3 | const x: @import("std").meta.Vector(4, u32) = [4]u32{ 14, 15, 16, 17 }; | 3 | const x: @Vector(4, u32) = [4]u32{ 14, 15, 16, 17 }; |
| 4 | var z = @shuffle(u32, v, x, [8]i32{ 0, 1, 2, 3, 7, 6, 5, 4 }); | 4 | var z = @shuffle(u32, v, x, [8]i32{ 0, 1, 2, 3, 7, 6, 5, 4 }); |
| 5 | _ = z; | 5 | _ = z; |
| 6 | } | 6 | } |
test/cases/compile_errors/vector_index_out_of_bounds.zig+2-2| ... | @@ -1,5 +1,5 @@ | ... | @@ -1,5 +1,5 @@ |
| 1 | export fn entry() void { | 1 | export fn entry() void { |
| 2 | const x = @import("std").meta.Vector(3, f32){ 25, 75, 5, 0 }; | 2 | const x = @Vector(3, f32){ 25, 75, 5, 0 }; |
| 3 | _ = x; | 3 | _ = x; |
| 4 | } | 4 | } |
| 5 | 5 | ||
| ... | @@ -7,4 +7,4 @@ export fn entry() void { | ... | @@ -7,4 +7,4 @@ export fn entry() void { |
| 7 | // backend=stage2 | 7 | // backend=stage2 |
| 8 | // target=native | 8 | // target=native |
| 9 | // | 9 | // |
| 10 | // :2:49: error: expected 3 vector elements; found 4 | 10 | // :2:30: error: expected 3 vector elements; found 4 |