aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorr00ster91 <r00ster91@proton.me>2022-12-13 22:30:06 +0100
committerr00ster91 <r00ster91@proton.me>2022-12-17 14:11:33 +0100
commitaac2d6b56f32134ea32fb3d984e3fcdfddd8aaf6 (patch)
tree941528727d4d0a5b92f58c0b862f0d5f372b89e0 /test/behavior
parent7350ea3e2da4d4e6ef5092cd9f0832beef0291d5 (diff)
downloadzig-aac2d6b56f32134ea32fb3d984e3fcdfddd8aaf6.tar.gz
zig-aac2d6b56f32134ea32fb3d984e3fcdfddd8aaf6.zip
std.builtin: rename Type.UnionField and Type.StructField's field_type to type
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/bitcast.zig2
-rw-r--r--test/behavior/bugs/12786.zig2
-rw-r--r--test/behavior/bugs/12794.zig2
-rw-r--r--test/behavior/bugs/13435.zig2
-rw-r--r--test/behavior/bugs/6456.zig2
-rw-r--r--test/behavior/tuple.zig6
-rw-r--r--test/behavior/tuple_declarations.zig10
-rw-r--r--test/behavior/type.zig38
-rw-r--r--test/behavior/type_info.zig8
-rw-r--r--test/behavior/union.zig2
10 files changed, 37 insertions, 37 deletions
diff --git a/test/behavior/bitcast.zig b/test/behavior/bitcast.zig
index 73b20f3568..8e0bf4ec32 100644
--- a/test/behavior/bitcast.zig
+++ b/test/behavior/bitcast.zig
@@ -358,7 +358,7 @@ test "comptime @bitCast packed struct to int and back" {
const rt_cast = @bitCast(S, i);
const ct_cast = comptime @bitCast(S, @as(Int, 0));
inline for (@typeInfo(S).Struct.fields) |field| {
- if (@typeInfo(field.field_type) == .Vector)
+ if (@typeInfo(field.type) == .Vector)
continue; //TODO: https://github.com/ziglang/zig/issues/13201
try expectEqual(@field(rt_cast, field.name), @field(ct_cast, field.name));
diff --git a/test/behavior/bugs/12786.zig b/test/behavior/bugs/12786.zig
index e8c1a2333f..958b1ebf86 100644
--- a/test/behavior/bugs/12786.zig
+++ b/test/behavior/bugs/12786.zig
@@ -8,7 +8,7 @@ fn NamespacedGlobals(comptime modules: anytype) type {
.fields = &.{
.{
.name = "globals",
- .field_type = modules.mach.globals,
+ .type = modules.mach.globals,
.default_value = null,
.is_comptime = false,
.alignment = @alignOf(modules.mach.globals),
diff --git a/test/behavior/bugs/12794.zig b/test/behavior/bugs/12794.zig
index 530f81cff2..2d4f8bafd9 100644
--- a/test/behavior/bugs/12794.zig
+++ b/test/behavior/bugs/12794.zig
@@ -7,7 +7,7 @@ fn NamespacedComponents(comptime modules: anytype) type {
.is_tuple = false,
.fields = &.{.{
.name = "components",
- .field_type = @TypeOf(modules.components),
+ .type = @TypeOf(modules.components),
.default_value = null,
.is_comptime = false,
.alignment = @alignOf(@TypeOf(modules.components)),
diff --git a/test/behavior/bugs/13435.zig b/test/behavior/bugs/13435.zig
index a23735f2f4..86a43afa0c 100644
--- a/test/behavior/bugs/13435.zig
+++ b/test/behavior/bugs/13435.zig
@@ -8,7 +8,7 @@ fn CreateUnion(comptime T: type) type {
.fields = &[_]std.builtin.Type.UnionField{
.{
.name = "field",
- .field_type = T,
+ .type = T,
.alignment = @alignOf(T),
},
},
diff --git a/test/behavior/bugs/6456.zig b/test/behavior/bugs/6456.zig
index a47f0c0d6c..03c687232f 100644
--- a/test/behavior/bugs/6456.zig
+++ b/test/behavior/bugs/6456.zig
@@ -23,7 +23,7 @@ test "issue 6456" {
fields = fields ++ &[_]StructField{StructField{
.alignment = 0,
.name = name,
- .field_type = usize,
+ .type = usize,
.default_value = &@as(?usize, null),
.is_comptime = false,
}};
diff --git a/test/behavior/tuple.zig b/test/behavior/tuple.zig
index 9738d4e75b..da51127412 100644
--- a/test/behavior/tuple.zig
+++ b/test/behavior/tuple.zig
@@ -136,14 +136,14 @@ test "array-like initializer for tuple types" {
.fields = &.{
.{
.name = "0",
- .field_type = i32,
+ .type = i32,
.default_value = null,
.is_comptime = false,
.alignment = @alignOf(i32),
},
.{
.name = "1",
- .field_type = u8,
+ .type = u8,
.default_value = null,
.is_comptime = false,
.alignment = @alignOf(i32),
@@ -314,7 +314,7 @@ test "zero sized struct in tuple handled correctly" {
.decls = &.{},
.fields = &.{.{
.name = "0",
- .field_type = struct {},
+ .type = struct {},
.default_value = null,
.is_comptime = false,
.alignment = 0,
diff --git a/test/behavior/tuple_declarations.zig b/test/behavior/tuple_declarations.zig
index 7beab1ca8f..87d4997c8b 100644
--- a/test/behavior/tuple_declarations.zig
+++ b/test/behavior/tuple_declarations.zig
@@ -20,13 +20,13 @@ test "tuple declaration type info" {
try expect(info.is_tuple);
try expectEqualStrings(info.fields[0].name, "0");
- try expect(info.fields[0].field_type == u32);
+ try expect(info.fields[0].type == u32);
try expect(@ptrCast(*const u32, @alignCast(@alignOf(u32), info.fields[0].default_value)).* == 1);
try expect(info.fields[0].is_comptime);
try expect(info.fields[0].alignment == 2);
try expectEqualStrings(info.fields[1].name, "1");
- try expect(info.fields[1].field_type == []const u8);
+ try expect(info.fields[1].type == []const u8);
try expect(info.fields[1].default_value == null);
try expect(!info.fields[1].is_comptime);
try expect(info.fields[1].alignment == @alignOf([]const u8));
@@ -44,13 +44,13 @@ test "tuple declaration type info" {
try expect(info.is_tuple);
try expectEqualStrings(info.fields[0].name, "0");
- try expect(info.fields[0].field_type == u1);
+ try expect(info.fields[0].type == u1);
try expectEqualStrings(info.fields[1].name, "1");
- try expect(info.fields[1].field_type == u30);
+ try expect(info.fields[1].type == u30);
try expectEqualStrings(info.fields[2].name, "2");
- try expect(info.fields[2].field_type == u1);
+ try expect(info.fields[2].type == u1);
}
}
diff --git a/test/behavior/type.zig b/test/behavior/type.zig
index 66ad7f55fd..157eff81e8 100644
--- a/test/behavior/type.zig
+++ b/test/behavior/type.zig
@@ -268,10 +268,10 @@ test "Type.Struct" {
const infoA = @typeInfo(A).Struct;
try testing.expectEqual(Type.ContainerLayout.Auto, infoA.layout);
try testing.expectEqualSlices(u8, "x", infoA.fields[0].name);
- try testing.expectEqual(u8, infoA.fields[0].field_type);
+ try testing.expectEqual(u8, infoA.fields[0].type);
try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[0].default_value);
try testing.expectEqualSlices(u8, "y", infoA.fields[1].name);
- try testing.expectEqual(u32, infoA.fields[1].field_type);
+ try testing.expectEqual(u32, infoA.fields[1].type);
try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[1].default_value);
try testing.expectEqualSlices(Type.Declaration, &.{}, infoA.decls);
try testing.expectEqual(@as(bool, false), infoA.is_tuple);
@@ -286,10 +286,10 @@ test "Type.Struct" {
const infoB = @typeInfo(B).Struct;
try testing.expectEqual(Type.ContainerLayout.Extern, infoB.layout);
try testing.expectEqualSlices(u8, "x", infoB.fields[0].name);
- try testing.expectEqual(u8, infoB.fields[0].field_type);
+ try testing.expectEqual(u8, infoB.fields[0].type);
try testing.expectEqual(@as(?*const anyopaque, null), infoB.fields[0].default_value);
try testing.expectEqualSlices(u8, "y", infoB.fields[1].name);
- try testing.expectEqual(u32, infoB.fields[1].field_type);
+ try testing.expectEqual(u32, infoB.fields[1].type);
try testing.expectEqual(@as(u32, 5), @ptrCast(*align(1) const u32, infoB.fields[1].default_value.?).*);
try testing.expectEqual(@as(usize, 0), infoB.decls.len);
try testing.expectEqual(@as(bool, false), infoB.is_tuple);
@@ -298,10 +298,10 @@ test "Type.Struct" {
const infoC = @typeInfo(C).Struct;
try testing.expectEqual(Type.ContainerLayout.Packed, infoC.layout);
try testing.expectEqualSlices(u8, "x", infoC.fields[0].name);
- try testing.expectEqual(u8, infoC.fields[0].field_type);
+ try testing.expectEqual(u8, infoC.fields[0].type);
try testing.expectEqual(@as(u8, 3), @ptrCast(*const u8, infoC.fields[0].default_value.?).*);
try testing.expectEqualSlices(u8, "y", infoC.fields[1].name);
- try testing.expectEqual(u32, infoC.fields[1].field_type);
+ try testing.expectEqual(u32, infoC.fields[1].type);
try testing.expectEqual(@as(u32, 5), @ptrCast(*align(1) const u32, infoC.fields[1].default_value.?).*);
try testing.expectEqual(@as(usize, 0), infoC.decls.len);
try testing.expectEqual(@as(bool, false), infoC.is_tuple);
@@ -311,10 +311,10 @@ test "Type.Struct" {
const infoD = @typeInfo(D).Struct;
try testing.expectEqual(Type.ContainerLayout.Auto, infoD.layout);
try testing.expectEqualSlices(u8, "x", infoD.fields[0].name);
- try testing.expectEqual(comptime_int, infoD.fields[0].field_type);
+ try testing.expectEqual(comptime_int, infoD.fields[0].type);
try testing.expectEqual(@as(comptime_int, 3), @ptrCast(*const comptime_int, infoD.fields[0].default_value.?).*);
try testing.expectEqualSlices(u8, "y", infoD.fields[1].name);
- try testing.expectEqual(comptime_int, infoD.fields[1].field_type);
+ try testing.expectEqual(comptime_int, infoD.fields[1].type);
try testing.expectEqual(@as(comptime_int, 5), @ptrCast(*const comptime_int, infoD.fields[1].default_value.?).*);
try testing.expectEqual(@as(usize, 0), infoD.decls.len);
try testing.expectEqual(@as(bool, false), infoD.is_tuple);
@@ -324,10 +324,10 @@ test "Type.Struct" {
const infoE = @typeInfo(E).Struct;
try testing.expectEqual(Type.ContainerLayout.Auto, infoE.layout);
try testing.expectEqualSlices(u8, "0", infoE.fields[0].name);
- try testing.expectEqual(comptime_int, infoE.fields[0].field_type);
+ try testing.expectEqual(comptime_int, infoE.fields[0].type);
try testing.expectEqual(@as(comptime_int, 1), @ptrCast(*const comptime_int, infoE.fields[0].default_value.?).*);
try testing.expectEqualSlices(u8, "1", infoE.fields[1].name);
- try testing.expectEqual(comptime_int, infoE.fields[1].field_type);
+ try testing.expectEqual(comptime_int, infoE.fields[1].type);
try testing.expectEqual(@as(comptime_int, 2), @ptrCast(*const comptime_int, infoE.fields[1].default_value.?).*);
try testing.expectEqual(@as(usize, 0), infoE.decls.len);
try testing.expectEqual(@as(bool, true), infoE.is_tuple);
@@ -396,8 +396,8 @@ test "Type.Union" {
.layout = .Extern,
.tag_type = null,
.fields = &.{
- .{ .name = "int", .field_type = i32, .alignment = @alignOf(f32) },
- .{ .name = "float", .field_type = f32, .alignment = @alignOf(f32) },
+ .{ .name = "int", .type = i32, .alignment = @alignOf(f32) },
+ .{ .name = "float", .type = f32, .alignment = @alignOf(f32) },
},
.decls = &.{},
},
@@ -412,8 +412,8 @@ test "Type.Union" {
.layout = .Packed,
.tag_type = null,
.fields = &.{
- .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
- .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
+ .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
+ .{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
},
.decls = &.{},
},
@@ -439,8 +439,8 @@ test "Type.Union" {
.layout = .Auto,
.tag_type = Tag,
.fields = &.{
- .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
- .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
+ .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
+ .{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
},
.decls = &.{},
},
@@ -470,7 +470,7 @@ test "Type.Union from Type.Enum" {
.layout = .Auto,
.tag_type = Tag,
.fields = &.{
- .{ .name = "working_as_expected", .field_type = u32, .alignment = @alignOf(u32) },
+ .{ .name = "working_as_expected", .type = u32, .alignment = @alignOf(u32) },
},
.decls = &.{},
},
@@ -487,7 +487,7 @@ test "Type.Union from regular enum" {
.layout = .Auto,
.tag_type = E,
.fields = &.{
- .{ .name = "working_as_expected", .field_type = u32, .alignment = @alignOf(u32) },
+ .{ .name = "working_as_expected", .type = u32, .alignment = @alignOf(u32) },
},
.decls = &.{},
},
@@ -537,7 +537,7 @@ test "reified struct field name from optional payload" {
.layout = .Auto,
.fields = &.{.{
.name = name,
- .field_type = u8,
+ .type = u8,
.default_value = null,
.is_comptime = false,
.alignment = 1,
diff --git a/test/behavior/type_info.zig b/test/behavior/type_info.zig
index fa9f21f6eb..04656a2034 100644
--- a/test/behavior/type_info.zig
+++ b/test/behavior/type_info.zig
@@ -257,7 +257,7 @@ fn testUnion() !void {
try expect(typeinfo_info.Union.layout == .Auto);
try expect(typeinfo_info.Union.tag_type.? == TypeId);
try expect(typeinfo_info.Union.fields.len == 24);
- try expect(typeinfo_info.Union.fields[4].field_type == @TypeOf(@typeInfo(u8).Int));
+ try expect(typeinfo_info.Union.fields[4].type == @TypeOf(@typeInfo(u8).Int));
try expect(typeinfo_info.Union.decls.len == 22);
const TestNoTagUnion = union {
@@ -271,7 +271,7 @@ fn testUnion() !void {
try expect(notag_union_info.Union.layout == .Auto);
try expect(notag_union_info.Union.fields.len == 2);
try expect(notag_union_info.Union.fields[0].alignment == @alignOf(void));
- try expect(notag_union_info.Union.fields[1].field_type == u32);
+ try expect(notag_union_info.Union.fields[1].type == u32);
try expect(notag_union_info.Union.fields[1].alignment == @alignOf(u32));
const TestExternUnion = extern union {
@@ -281,7 +281,7 @@ fn testUnion() !void {
const extern_union_info = @typeInfo(TestExternUnion);
try expect(extern_union_info.Union.layout == .Extern);
try expect(extern_union_info.Union.tag_type == null);
- try expect(extern_union_info.Union.fields[0].field_type == *anyopaque);
+ try expect(extern_union_info.Union.fields[0].type == *anyopaque);
}
test "type info: struct info" {
@@ -319,7 +319,7 @@ fn testPackedStruct() !void {
try expect(struct_info.Struct.backing_integer == u128);
try expect(struct_info.Struct.fields.len == 4);
try expect(struct_info.Struct.fields[0].alignment == 0);
- try expect(struct_info.Struct.fields[2].field_type == f32);
+ try expect(struct_info.Struct.fields[2].type == f32);
try expect(struct_info.Struct.fields[2].default_value == null);
try expect(@ptrCast(*align(1) const u32, struct_info.Struct.fields[3].default_value.?).* == 4);
try expect(struct_info.Struct.fields[3].alignment == 0);
diff --git a/test/behavior/union.zig b/test/behavior/union.zig
index b6ec305eac..4200311e2c 100644
--- a/test/behavior/union.zig
+++ b/test/behavior/union.zig
@@ -454,7 +454,7 @@ test "global union with single field is correctly initialized" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
glbl = Foo1{
- .f = @typeInfo(Foo1).Union.fields[0].field_type{ .x = 123 },
+ .f = @typeInfo(Foo1).Union.fields[0].type{ .x = 123 },
};
try expect(glbl.f.x == 123);
}