authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-12-18 19:33:15+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-12-18 19:33:15+02:00
log40ed6ae8469fd599f0524d294f38365c3bb8a825
tree6e37bbb58fef1ca3aae06e65e179dfa017cb7929
parente9e804edc899d8392c9f93a19b92be603c26df79
parent2a5e1426aa9469fadb78e837d0100d689213b034
signature Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #13930 from r00ster91/renamings

std.builtin: renamings

76 files changed, 236 insertions(+), 280 deletions(-)

doc/langref.html.in+2-2
......@@ -4253,7 +4253,7 @@ fn isFieldOptional(comptime T: type, field_index: usize) !bool {
42534253 return switch (field_index) {
42544254 // This prong is analyzed `fields.len - 1` times with `idx` being an
42554255 // unique comptime-known value each time.
4256 inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].field_type) == .Optional,
4256 inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].type) == .Optional,
42574257 else => return error.IndexOutOfBounds,
42584258 };
42594259}
......@@ -5242,7 +5242,7 @@ const math = std.math;
52425242const testing = std.testing;
52435243
52445244test "fn reflection" {
5245 try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.args[0].arg_type.? == bool);
5245 try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.params[0].type.? == bool);
52465246 try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).Fn.return_type.? == testing.TmpDir);
52475247
52485248 try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).Fn.is_generic);
lib/std/array_hash_map.zig+4-4
......@@ -2270,13 +2270,13 @@ test "reIndex" {
22702270test "auto store_hash" {
22712271 const HasCheapEql = AutoArrayHashMap(i32, i32);
22722272 const HasExpensiveEql = AutoArrayHashMap([32]i32, i32);
2273 try testing.expect(meta.fieldInfo(HasCheapEql.Data, .hash).field_type == void);
2274 try testing.expect(meta.fieldInfo(HasExpensiveEql.Data, .hash).field_type != void);
2273 try testing.expect(meta.fieldInfo(HasCheapEql.Data, .hash).type == void);
2274 try testing.expect(meta.fieldInfo(HasExpensiveEql.Data, .hash).type != void);
22752275
22762276 const HasCheapEqlUn = AutoArrayHashMapUnmanaged(i32, i32);
22772277 const HasExpensiveEqlUn = AutoArrayHashMapUnmanaged([32]i32, i32);
2278 try testing.expect(meta.fieldInfo(HasCheapEqlUn.Data, .hash).field_type == void);
2279 try testing.expect(meta.fieldInfo(HasExpensiveEqlUn.Data, .hash).field_type != void);
2278 try testing.expect(meta.fieldInfo(HasCheapEqlUn.Data, .hash).type == void);
2279 try testing.expect(meta.fieldInfo(HasExpensiveEqlUn.Data, .hash).type != void);
22802280}
22812281
22822282test "sort" {
lib/std/builtin.zig+4-7
......@@ -280,8 +280,7 @@ pub const Type = union(enum) {
280280 /// therefore must be kept in sync with the compiler implementation.
281281 pub const StructField = struct {
282282 name: []const u8,
283 /// TODO rename to `type`
284 field_type: type,
283 type: type,
285284 default_value: ?*const anyopaque,
286285 is_comptime: bool,
287286 alignment: comptime_int,
......@@ -331,8 +330,6 @@ pub const Type = union(enum) {
331330 /// This data structure is used by the Zig language code generation and
332331 /// therefore must be kept in sync with the compiler implementation.
333332 pub const Enum = struct {
334 /// TODO enums should no longer have this field in type info.
335 layout: ContainerLayout,
336333 tag_type: type,
337334 fields: []const EnumField,
338335 decls: []const Declaration,
......@@ -343,7 +340,7 @@ pub const Type = union(enum) {
343340 /// therefore must be kept in sync with the compiler implementation.
344341 pub const UnionField = struct {
345342 name: []const u8,
346 field_type: type,
343 type: type,
347344 alignment: comptime_int,
348345 };
349346
......@@ -367,14 +364,14 @@ pub const Type = union(enum) {
367364 is_var_args: bool,
368365 /// TODO change the language spec to make this not optional.
369366 return_type: ?type,
370 args: []const Param,
367 params: []const Param,
371368
372369 /// This data structure is used by the Zig language code generation and
373370 /// therefore must be kept in sync with the compiler implementation.
374371 pub const Param = struct {
375372 is_generic: bool,
376373 is_noalias: bool,
377 arg_type: ?type,
374 type: ?type,
378375 };
379376 };
380377
lib/std/crypto/phc_encoding.zig+4-4
......@@ -110,9 +110,9 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
110110 var found = false;
111111 inline for (comptime meta.fields(HashResult)) |p| {
112112 if (mem.eql(u8, p.name, param.key)) {
113 switch (@typeInfo(p.field_type)) {
113 switch (@typeInfo(p.type)) {
114114 .Int => @field(out, p.name) = fmt.parseUnsigned(
115 p.field_type,
115 p.type,
116116 param.value,
117117 10,
118118 ) catch return Error.InvalidEncoding,
......@@ -161,7 +161,7 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
161161 // with default values
162162 var expected_fields: usize = 0;
163163 inline for (comptime meta.fields(HashResult)) |p| {
164 if (@typeInfo(p.field_type) != .Optional and p.default_value == null) {
164 if (@typeInfo(p.type) != .Optional and p.default_value == null) {
165165 expected_fields += 1;
166166 }
167167 }
......@@ -223,7 +223,7 @@ fn serializeTo(params: anytype, out: anytype) !void {
223223 {
224224 const value = @field(params, p.name);
225225 try out.writeAll(if (has_params) params_delimiter else fields_delimiter);
226 if (@typeInfo(p.field_type) == .Struct) {
226 if (@typeInfo(p.type) == .Struct) {
227227 var buf: [@TypeOf(value).max_encoded_length]u8 = undefined;
228228 try out.print("{s}{s}{s}", .{ p.name, kv_delimiter, try value.toB64(&buf) });
229229 } else {
lib/std/enums.zig+1-1
......@@ -15,7 +15,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def
1515 for (std.meta.fields(E)) |field| {
1616 fields = fields ++ &[_]StructField{.{
1717 .name = field.name,
18 .field_type = Data,
18 .type = Data,
1919 .default_value = if (field_default) |d| @ptrCast(?*const anyopaque, &d) else null,
2020 .is_comptime = false,
2121 .alignment = if (@sizeOf(Data) > 0) @alignOf(Data) else 0,
lib/std/fmt.zig+1-1
......@@ -1724,7 +1724,7 @@ pub const ParseIntError = error{
17241724/// ) !void;
17251725///
17261726pub fn Formatter(comptime format_fn: anytype) type {
1727 const Data = @typeInfo(@TypeOf(format_fn)).Fn.args[0].arg_type.?;
1727 const Data = @typeInfo(@TypeOf(format_fn)).Fn.params[0].type.?;
17281728 return struct {
17291729 data: Data,
17301730 pub fn format(
lib/std/hash/auto_hash.zig+3-3
......@@ -134,7 +134,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
134134 hash(hasher, tag, strat);
135135 inline for (info.fields) |field| {
136136 if (@field(tag_type, field.name) == tag) {
137 if (field.field_type != void) {
137 if (field.type != void) {
138138 hash(hasher, @field(key, field.name), strat);
139139 }
140140 // TODO use a labelled break when it does not crash the compiler. cf #2908
......@@ -163,14 +163,14 @@ fn typeContainsSlice(comptime K: type) bool {
163163 }
164164 if (meta.trait.is(.Struct)(K)) {
165165 inline for (@typeInfo(K).Struct.fields) |field| {
166 if (typeContainsSlice(field.field_type)) {
166 if (typeContainsSlice(field.type)) {
167167 return true;
168168 }
169169 }
170170 }
171171 if (meta.trait.is(.Union)(K)) {
172172 inline for (@typeInfo(K).Union.fields) |field| {
173 if (typeContainsSlice(field.field_type)) {
173 if (typeContainsSlice(field.type)) {
174174 return true;
175175 }
176176 }
lib/std/hash_map.zig+10-10
......@@ -186,11 +186,11 @@ pub fn verifyContext(
186186 const info = @typeInfo(@TypeOf(hash));
187187 if (info == .Fn) {
188188 const func = info.Fn;
189 if (func.args.len != 2) {
189 if (func.params.len != 2) {
190190 errors = errors ++ lazy.err_invalid_hash_signature;
191191 } else {
192192 var emitted_signature = false;
193 if (func.args[0].arg_type) |Self| {
193 if (func.params[0].type) |Self| {
194194 if (Self == Context) {
195195 // pass, this is always fine.
196196 } else if (Self == *const Context) {
......@@ -231,12 +231,12 @@ pub fn verifyContext(
231231 errors = errors ++ ", but is " ++ @typeName(Self);
232232 }
233233 }
234 if (func.args[1].arg_type != null and func.args[1].arg_type.? != PseudoKey) {
234 if (func.params[1].type != null and func.params[1].type.? != PseudoKey) {
235235 if (!emitted_signature) {
236236 errors = errors ++ lazy.err_invalid_hash_signature;
237237 emitted_signature = true;
238238 }
239 errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.args[1].arg_type.?);
239 errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.params[1].type.?);
240240 }
241241 if (func.return_type != null and func.return_type.? != Hash) {
242242 if (!emitted_signature) {
......@@ -263,11 +263,11 @@ pub fn verifyContext(
263263 if (info == .Fn) {
264264 const func = info.Fn;
265265 const args_len = if (is_array) 4 else 3;
266 if (func.args.len != args_len) {
266 if (func.params.len != args_len) {
267267 errors = errors ++ lazy.err_invalid_eql_signature;
268268 } else {
269269 var emitted_signature = false;
270 if (func.args[0].arg_type) |Self| {
270 if (func.params[0].type) |Self| {
271271 if (Self == Context) {
272272 // pass, this is always fine.
273273 } else if (Self == *const Context) {
......@@ -308,19 +308,19 @@ pub fn verifyContext(
308308 errors = errors ++ ", but is " ++ @typeName(Self);
309309 }
310310 }
311 if (func.args[1].arg_type.? != PseudoKey) {
311 if (func.params[1].type.? != PseudoKey) {
312312 if (!emitted_signature) {
313313 errors = errors ++ lazy.err_invalid_eql_signature;
314314 emitted_signature = true;
315315 }
316 errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.args[1].arg_type.?);
316 errors = errors ++ lazy.deep_prefix ++ "Second parameter must be " ++ @typeName(PseudoKey) ++ ", but is " ++ @typeName(func.params[1].type.?);
317317 }
318 if (func.args[2].arg_type.? != Key) {
318 if (func.params[2].type.? != Key) {
319319 if (!emitted_signature) {
320320 errors = errors ++ lazy.err_invalid_eql_signature;
321321 emitted_signature = true;
322322 }
323 errors = errors ++ lazy.deep_prefix ++ "Third parameter must be " ++ @typeName(Key) ++ ", but is " ++ @typeName(func.args[2].arg_type.?);
323 errors = errors ++ lazy.deep_prefix ++ "Third parameter must be " ++ @typeName(Key) ++ ", but is " ++ @typeName(func.params[2].type.?);
324324 }
325325 if (func.return_type.? != bool) {
326326 if (!emitted_signature) {
lib/std/io/multi_writer.zig+1-1
......@@ -6,7 +6,7 @@ const testing = std.testing;
66pub fn MultiWriter(comptime Writers: type) type {
77 comptime var ErrSet = error{};
88 inline for (@typeInfo(Writers).Struct.fields) |field| {
9 const StreamType = field.field_type;
9 const StreamType = field.type;
1010 ErrSet = ErrSet || StreamType.Error;
1111 }
1212
lib/std/json.zig+13-13
......@@ -1362,7 +1362,7 @@ fn ParseInternalErrorImpl(comptime T: type, comptime inferred_types: []const typ
13621362 if (unionInfo.tag_type) |_| {
13631363 var errors = error{NoUnionMembersMatched};
13641364 for (unionInfo.fields) |u_field| {
1365 errors = errors || ParseInternalErrorImpl(u_field.field_type, inferred_types ++ [_]type{T});
1365 errors = errors || ParseInternalErrorImpl(u_field.type, inferred_types ++ [_]type{T});
13661366 }
13671367 return errors;
13681368 } else {
......@@ -1379,7 +1379,7 @@ fn ParseInternalErrorImpl(comptime T: type, comptime inferred_types: []const typ
13791379 MissingField,
13801380 } || SkipValueError || TokenStream.Error;
13811381 for (structInfo.fields) |field| {
1382 errors = errors || ParseInternalErrorImpl(field.field_type, inferred_types ++ [_]type{T});
1382 errors = errors || ParseInternalErrorImpl(field.type, inferred_types ++ [_]type{T});
13831383 }
13841384 return errors;
13851385 },
......@@ -1491,7 +1491,7 @@ fn parseInternal(
14911491 inline for (unionInfo.fields) |u_field| {
14921492 // take a copy of tokens so we can withhold mutations until success
14931493 var tokens_copy = tokens.*;
1494 if (parseInternal(u_field.field_type, token, &tokens_copy, options)) |value| {
1494 if (parseInternal(u_field.type, token, &tokens_copy, options)) |value| {
14951495 tokens.* = tokens_copy;
14961496 return @unionInit(T, u_field.name, value);
14971497 } else |err| {
......@@ -1519,7 +1519,7 @@ fn parseInternal(
15191519 errdefer {
15201520 inline for (structInfo.fields) |field, i| {
15211521 if (fields_seen[i] and !field.is_comptime) {
1522 parseFree(field.field_type, @field(r, field.name), options);
1522 parseFree(field.type, @field(r, field.name), options);
15231523 }
15241524 }
15251525 }
......@@ -1547,24 +1547,24 @@ fn parseInternal(
15471547 // }
15481548 if (options.duplicate_field_behavior == .UseFirst) {
15491549 // unconditonally ignore value. for comptime fields, this skips check against default_value
1550 parseFree(field.field_type, try parse(field.field_type, tokens, child_options), child_options);
1550 parseFree(field.type, try parse(field.type, tokens, child_options), child_options);
15511551 found = true;
15521552 break;
15531553 } else if (options.duplicate_field_behavior == .Error) {
15541554 return error.DuplicateJSONField;
15551555 } else if (options.duplicate_field_behavior == .UseLast) {
15561556 if (!field.is_comptime) {
1557 parseFree(field.field_type, @field(r, field.name), child_options);
1557 parseFree(field.type, @field(r, field.name), child_options);
15581558 }
15591559 fields_seen[i] = false;
15601560 }
15611561 }
15621562 if (field.is_comptime) {
1563 if (!try parsesTo(field.field_type, @ptrCast(*align(1) const field.field_type, field.default_value.?).*, tokens, child_options)) {
1563 if (!try parsesTo(field.type, @ptrCast(*align(1) const field.type, field.default_value.?).*, tokens, child_options)) {
15641564 return error.UnexpectedValue;
15651565 }
15661566 } else {
1567 @field(r, field.name) = try parse(field.field_type, tokens, child_options);
1567 @field(r, field.name) = try parse(field.type, tokens, child_options);
15681568 }
15691569 fields_seen[i] = true;
15701570 found = true;
......@@ -1587,7 +1587,7 @@ fn parseInternal(
15871587 if (!fields_seen[i]) {
15881588 if (field.default_value) |default_ptr| {
15891589 if (!field.is_comptime) {
1590 const default = @ptrCast(*align(1) const field.field_type, default_ptr).*;
1590 const default = @ptrCast(*align(1) const field.type, default_ptr).*;
15911591 @field(r, field.name) = default;
15921592 }
15931593 } else {
......@@ -1732,7 +1732,7 @@ pub fn parseFree(comptime T: type, value: T, options: ParseOptions) void {
17321732 if (unionInfo.tag_type) |UnionTagType| {
17331733 inline for (unionInfo.fields) |u_field| {
17341734 if (value == @field(UnionTagType, u_field.name)) {
1735 parseFree(u_field.field_type, @field(value, u_field.name), options);
1735 parseFree(u_field.type, @field(value, u_field.name), options);
17361736 break;
17371737 }
17381738 }
......@@ -1743,7 +1743,7 @@ pub fn parseFree(comptime T: type, value: T, options: ParseOptions) void {
17431743 .Struct => |structInfo| {
17441744 inline for (structInfo.fields) |field| {
17451745 if (!field.is_comptime) {
1746 parseFree(field.field_type, @field(value, field.name), options);
1746 parseFree(field.type, @field(value, field.name), options);
17471747 }
17481748 }
17491749 },
......@@ -2270,12 +2270,12 @@ pub fn stringify(
22702270 }
22712271 inline for (S.fields) |Field| {
22722272 // don't include void fields
2273 if (Field.field_type == void) continue;
2273 if (Field.type == void) continue;
22742274
22752275 var emit_field = true;
22762276
22772277 // don't include optional fields that are null when emit_null_optional_fields is set to false
2278 if (@typeInfo(Field.field_type) == .Optional) {
2278 if (@typeInfo(Field.type) == .Optional) {
22792279 if (options.emit_null_optional_fields == false) {
22802280 if (@field(value, Field.name) == null) {
22812281 emit_field = false;
lib/std/mem.zig+4-4
......@@ -300,7 +300,7 @@ pub fn zeroes(comptime T: type) T {
300300 if (comptime meta.containerLayout(T) == .Extern) {
301301 // The C language specification states that (global) unions
302302 // should be zero initialized to the first named member.
303 return @unionInit(T, info.fields[0].name, zeroes(info.fields[0].field_type));
303 return @unionInit(T, info.fields[0].name, zeroes(info.fields[0].type));
304304 }
305305
306306 @compileError("Can't set a " ++ @typeName(T) ++ " to zero.");
......@@ -435,7 +435,7 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
435435
436436 inline for (struct_info.fields) |field| {
437437 if (field.default_value) |default_value_ptr| {
438 const default_value = @ptrCast(*align(1) const field.field_type, default_value_ptr).*;
438 const default_value = @ptrCast(*align(1) const field.type, default_value_ptr).*;
439439 @field(value, field.name) = default_value;
440440 }
441441 }
......@@ -452,9 +452,9 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
452452 @compileError("Encountered an initializer for `" ++ field.name ++ "`, but it is not a field of " ++ @typeName(T));
453453 }
454454
455 switch (@typeInfo(field.field_type)) {
455 switch (@typeInfo(field.type)) {
456456 .Struct => {
457 @field(value, field.name) = zeroInit(field.field_type, @field(init, field.name));
457 @field(value, field.name) = zeroInit(field.type, @field(init, field.name));
458458 },
459459 else => {
460460 @field(value, field.name) = @field(init, field.name);
lib/std/meta.zig+12-24
......@@ -371,16 +371,12 @@ test "std.meta.assumeSentinel" {
371371pub fn containerLayout(comptime T: type) Type.ContainerLayout {
372372 return switch (@typeInfo(T)) {
373373 .Struct => |info| info.layout,
374 .Enum => |info| info.layout,
375374 .Union => |info| info.layout,
376 else => @compileError("Expected struct, enum or union type, found '" ++ @typeName(T) ++ "'"),
375 else => @compileError("expected struct or union type, found '" ++ @typeName(T) ++ "'"),
377376 };
378377}
379378
380379test "std.meta.containerLayout" {
381 const E1 = enum {
382 A,
383 };
384380 const S1 = struct {};
385381 const S2 = packed struct {};
386382 const S3 = extern struct {};
......@@ -394,7 +390,6 @@ test "std.meta.containerLayout" {
394390 a: u8,
395391 };
396392
397 try testing.expect(containerLayout(E1) == .Auto);
398393 try testing.expect(containerLayout(S1) == .Auto);
399394 try testing.expect(containerLayout(S2) == .Packed);
400395 try testing.expect(containerLayout(S3) == .Extern);
......@@ -522,8 +517,8 @@ test "std.meta.fields" {
522517 try testing.expect(mem.eql(u8, e2f[0].name, "A"));
523518 try testing.expect(mem.eql(u8, sf[0].name, "a"));
524519 try testing.expect(mem.eql(u8, uf[0].name, "a"));
525 try testing.expect(comptime sf[0].field_type == u8);
526 try testing.expect(comptime uf[0].field_type == u8);
520 try testing.expect(comptime sf[0].type == u8);
521 try testing.expect(comptime uf[0].type == u8);
527522}
528523
529524pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeInfo(T)) {
......@@ -557,8 +552,8 @@ test "std.meta.fieldInfo" {
557552 try testing.expect(mem.eql(u8, e2f.name, "A"));
558553 try testing.expect(mem.eql(u8, sf.name, "a"));
559554 try testing.expect(mem.eql(u8, uf.name, "a"));
560 try testing.expect(comptime sf.field_type == u8);
561 try testing.expect(comptime uf.field_type == u8);
555 try testing.expect(comptime sf.type == u8);
556 try testing.expect(comptime uf.type == u8);
562557}
563558
564559pub fn fieldNames(comptime T: type) *const [fields(T).len][]const u8 {
......@@ -634,7 +629,6 @@ pub fn FieldEnum(comptime T: type) type {
634629 if (field_infos.len == 0) {
635630 return @Type(.{
636631 .Enum = .{
637 .layout = .Auto,
638632 .tag_type = u0,
639633 .fields = &.{},
640634 .decls = &.{},
......@@ -664,7 +658,6 @@ pub fn FieldEnum(comptime T: type) type {
664658 }
665659 return @Type(.{
666660 .Enum = .{
667 .layout = .Auto,
668661 .tag_type = std.math.IntFittingRange(0, field_infos.len - 1),
669662 .fields = &enumFields,
670663 .decls = &decls,
......@@ -676,10 +669,6 @@ pub fn FieldEnum(comptime T: type) type {
676669fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
677670 // TODO: https://github.com/ziglang/zig/issues/7419
678671 // testing.expectEqual(@typeInfo(expected).Enum, @typeInfo(actual).Enum);
679 try testing.expectEqual(
680 @typeInfo(expected).Enum.layout,
681 @typeInfo(actual).Enum.layout,
682 );
683672 try testing.expectEqual(
684673 @typeInfo(expected).Enum.tag_type,
685674 @typeInfo(actual).Enum.tag_type,
......@@ -740,7 +729,6 @@ pub fn DeclEnum(comptime T: type) type {
740729 }
741730 return @Type(.{
742731 .Enum = .{
743 .layout = .Auto,
744732 .tag_type = std.math.IntFittingRange(0, fieldInfos.len - 1),
745733 .fields = &enumDecls,
746734 .decls = &decls,
......@@ -831,7 +819,7 @@ pub fn TagPayload(comptime U: type, comptime tag: Tag(U)) type {
831819
832820 inline for (info.fields) |field_info| {
833821 if (comptime mem.eql(u8, field_info.name, @tagName(tag)))
834 return field_info.field_type;
822 return field_info.type;
835823 }
836824
837825 unreachable;
......@@ -1084,9 +1072,9 @@ pub fn ArgsTuple(comptime Function: type) type {
10841072 if (function_info.is_var_args)
10851073 @compileError("Cannot create ArgsTuple for variadic function");
10861074
1087 var argument_field_list: [function_info.args.len]type = undefined;
1088 inline for (function_info.args) |arg, i| {
1089 const T = arg.arg_type.?;
1075 var argument_field_list: [function_info.params.len]type = undefined;
1076 inline for (function_info.params) |arg, i| {
1077 const T = arg.type.?;
10901078 argument_field_list[i] = T;
10911079 }
10921080
......@@ -1111,7 +1099,7 @@ fn CreateUniqueTuple(comptime N: comptime_int, comptime types: [N]type) type {
11111099 var num_buf: [128]u8 = undefined;
11121100 tuple_fields[i] = .{
11131101 .name = std.fmt.bufPrint(&num_buf, "{d}", .{i}) catch unreachable,
1114 .field_type = T,
1102 .type = T,
11151103 .default_value = null,
11161104 .is_comptime = false,
11171105 .alignment = if (@sizeOf(T) > 0) @alignOf(T) else 0,
......@@ -1146,8 +1134,8 @@ const TupleTester = struct {
11461134 @compileError("Argument count mismatch");
11471135
11481136 inline for (fields_list) |fld, i| {
1149 if (expected[i] != fld.field_type) {
1150 @compileError("Field " ++ fld.name ++ " expected to be type " ++ @typeName(expected[i]) ++ ", but was type " ++ @typeName(fld.field_type));
1137 if (expected[i] != fld.type) {
1138 @compileError("Field " ++ fld.name ++ " expected to be type " ++ @typeName(expected[i]) ++ ", but was type " ++ @typeName(fld.type));
11511139 }
11521140 }
11531141 }
lib/std/meta/trailer_flags.zig+10-10
......@@ -24,10 +24,10 @@ pub fn TrailerFlags(comptime Fields: type) type {
2424 inline for (@typeInfo(Fields).Struct.fields) |struct_field, i| {
2525 fields[i] = Type.StructField{
2626 .name = struct_field.name,
27 .field_type = ?struct_field.field_type,
28 .default_value = &@as(?struct_field.field_type, null),
27 .type = ?struct_field.type,
28 .default_value = &@as(?struct_field.type, null),
2929 .is_comptime = false,
30 .alignment = @alignOf(?struct_field.field_type),
30 .alignment = @alignOf(?struct_field.type),
3131 };
3232 }
3333 break :blk @Type(.{
......@@ -105,26 +105,26 @@ pub fn TrailerFlags(comptime Fields: type) type {
105105 const active = (self.bits & (1 << i)) != 0;
106106 if (i == @enumToInt(field)) {
107107 assert(active);
108 return mem.alignForwardGeneric(usize, off, @alignOf(field_info.field_type));
108 return mem.alignForwardGeneric(usize, off, @alignOf(field_info.type));
109109 } else if (active) {
110 off = mem.alignForwardGeneric(usize, off, @alignOf(field_info.field_type));
111 off += @sizeOf(field_info.field_type);
110 off = mem.alignForwardGeneric(usize, off, @alignOf(field_info.type));
111 off += @sizeOf(field_info.type);
112112 }
113113 }
114114 }
115115
116116 pub fn Field(comptime field: FieldEnum) type {
117 return @typeInfo(Fields).Struct.fields[@enumToInt(field)].field_type;
117 return @typeInfo(Fields).Struct.fields[@enumToInt(field)].type;
118118 }
119119
120120 pub fn sizeInBytes(self: Self) usize {
121121 var off: usize = 0;
122122 inline for (@typeInfo(Fields).Struct.fields) |field, i| {
123 if (@sizeOf(field.field_type) == 0)
123 if (@sizeOf(field.type) == 0)
124124 continue;
125125 if ((self.bits & (1 << i)) != 0) {
126 off = mem.alignForwardGeneric(usize, off, @alignOf(field.field_type));
127 off += @sizeOf(field.field_type);
126 off = mem.alignForwardGeneric(usize, off, @alignOf(field.type));
127 off += @sizeOf(field.type);
128128 }
129129 }
130130 return off;
lib/std/meta/trait.zig+1-3
......@@ -154,7 +154,6 @@ pub fn isExtern(comptime T: type) bool {
154154 return switch (@typeInfo(T)) {
155155 .Struct => |s| s.layout == .Extern,
156156 .Union => |u| u.layout == .Extern,
157 .Enum => |e| e.layout == .Extern,
158157 else => false,
159158 };
160159}
......@@ -172,7 +171,6 @@ pub fn isPacked(comptime T: type) bool {
172171 return switch (@typeInfo(T)) {
173172 .Struct => |s| s.layout == .Packed,
174173 .Union => |u| u.layout == .Packed,
175 .Enum => |e| e.layout == .Packed,
176174 else => false,
177175 };
178176}
......@@ -566,7 +564,7 @@ pub fn hasUniqueRepresentation(comptime T: type) bool {
566564 var sum_size = @as(usize, 0);
567565
568566 inline for (info.fields) |field| {
569 const FieldType = field.field_type;
567 const FieldType = field.type;
570568 if (comptime !hasUniqueRepresentation(FieldType)) return false;
571569 sum_size += @sizeOf(FieldType);
572570 }
lib/std/multi_array_list.zig+13-13
......@@ -84,9 +84,9 @@ pub fn MultiArrayList(comptime S: type) type {
8484 var data: [fields.len]Data = undefined;
8585 for (fields) |field_info, i| {
8686 data[i] = .{
87 .size = @sizeOf(field_info.field_type),
87 .size = @sizeOf(field_info.type),
8888 .size_index = i,
89 .alignment = if (@sizeOf(field_info.field_type) == 0) 1 else field_info.alignment,
89 .alignment = if (@sizeOf(field_info.type) == 0) 1 else field_info.alignment,
9090 };
9191 }
9292 const Sort = struct {
......@@ -294,10 +294,10 @@ pub fn MultiArrayList(comptime S: type) type {
294294 ) catch {
295295 const self_slice = self.slice();
296296 inline for (fields) |field_info, i| {
297 if (@sizeOf(field_info.field_type) != 0) {
297 if (@sizeOf(field_info.type) != 0) {
298298 const field = @intToEnum(Field, i);
299299 const dest_slice = self_slice.items(field)[new_len..];
300 const byte_count = dest_slice.len * @sizeOf(field_info.field_type);
300 const byte_count = dest_slice.len * @sizeOf(field_info.type);
301301 // We use memset here for more efficient codegen in safety-checked,
302302 // valgrind-enabled builds. Otherwise the valgrind client request
303303 // will be repeated for every element.
......@@ -316,9 +316,9 @@ pub fn MultiArrayList(comptime S: type) type {
316316 const self_slice = self.slice();
317317 const other_slice = other.slice();
318318 inline for (fields) |field_info, i| {
319 if (@sizeOf(field_info.field_type) != 0) {
319 if (@sizeOf(field_info.type) != 0) {
320320 const field = @intToEnum(Field, i);
321 mem.copy(field_info.field_type, other_slice.items(field), self_slice.items(field));
321 mem.copy(field_info.type, other_slice.items(field), self_slice.items(field));
322322 }
323323 }
324324 gpa.free(self.allocatedBytes());
......@@ -377,9 +377,9 @@ pub fn MultiArrayList(comptime S: type) type {
377377 const self_slice = self.slice();
378378 const other_slice = other.slice();
379379 inline for (fields) |field_info, i| {
380 if (@sizeOf(field_info.field_type) != 0) {
380 if (@sizeOf(field_info.type) != 0) {
381381 const field = @intToEnum(Field, i);
382 mem.copy(field_info.field_type, other_slice.items(field), self_slice.items(field));
382 mem.copy(field_info.type, other_slice.items(field), self_slice.items(field));
383383 }
384384 }
385385 gpa.free(self.allocatedBytes());
......@@ -396,9 +396,9 @@ pub fn MultiArrayList(comptime S: type) type {
396396 const self_slice = self.slice();
397397 const result_slice = result.slice();
398398 inline for (fields) |field_info, i| {
399 if (@sizeOf(field_info.field_type) != 0) {
399 if (@sizeOf(field_info.type) != 0) {
400400 const field = @intToEnum(Field, i);
401 mem.copy(field_info.field_type, result_slice.items(field), self_slice.items(field));
401 mem.copy(field_info.type, result_slice.items(field), self_slice.items(field));
402402 }
403403 }
404404 return result;
......@@ -413,10 +413,10 @@ pub fn MultiArrayList(comptime S: type) type {
413413
414414 pub fn swap(sc: @This(), a_index: usize, b_index: usize) void {
415415 inline for (fields) |field_info, i| {
416 if (@sizeOf(field_info.field_type) != 0) {
416 if (@sizeOf(field_info.type) != 0) {
417417 const field = @intToEnum(Field, i);
418418 const ptr = sc.slice.items(field);
419 mem.swap(field_info.field_type, &ptr[a_index], &ptr[b_index]);
419 mem.swap(field_info.type, &ptr[a_index], &ptr[b_index]);
420420 }
421421 }
422422 }
......@@ -449,7 +449,7 @@ pub fn MultiArrayList(comptime S: type) type {
449449 }
450450
451451 fn FieldType(comptime field: Field) type {
452 return meta.fieldInfo(S, field).field_type;
452 return meta.fieldInfo(S, field).type;
453453 }
454454
455455 /// This function is used in tools/zig-gdb.py to fetch the child type to facilitate
lib/std/os/uefi/protocols/device_path_protocol.zig+2-2
......@@ -81,7 +81,7 @@ pub const DevicePathProtocol = extern struct {
8181 // Got the associated union type for self.type, now
8282 // we need to initialize it and its subtype
8383 if (self.type == enum_value) {
84 var subtype = self.initSubtype(ufield.field_type);
84 var subtype = self.initSubtype(ufield.type);
8585
8686 if (subtype) |sb| {
8787 // e.g. return .{ .Hardware = .{ .Pci = @ptrCast(...) } }
......@@ -103,7 +103,7 @@ pub const DevicePathProtocol = extern struct {
103103
104104 if (self.subtype == tag_val) {
105105 // e.g. expr = .{ .Pci = @ptrCast(...) }
106 return @unionInit(TUnion, subtype.name, @ptrCast(subtype.field_type, self));
106 return @unionInit(TUnion, subtype.name, @ptrCast(subtype.type, self));
107107 }
108108 }
109109
lib/std/start.zig+1-1
......@@ -634,7 +634,7 @@ pub fn callMain() u8 {
634634}
635635
636636pub fn call_wWinMain() std.os.windows.INT {
637 const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).Fn.args[0].arg_type.?;
637 const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).Fn.params[0].type.?;
638638 const hInstance = @ptrCast(MAIN_HINSTANCE, std.os.windows.kernel32.GetModuleHandleW(null).?);
639639 const lpCmdLine = std.os.windows.kernel32.GetCommandLineW();
640640
lib/std/testing.zig+1-1
......@@ -802,7 +802,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
802802
803803 const ArgsTuple = std.meta.ArgsTuple(@TypeOf(test_fn));
804804 const fn_args_fields = @typeInfo(ArgsTuple).Struct.fields;
805 if (fn_args_fields.len == 0 or fn_args_fields[0].field_type != std.mem.Allocator) {
805 if (fn_args_fields.len == 0 or fn_args_fields[0].type != std.mem.Allocator) {
806806 @compileError("The provided function must have an " ++ @typeName(std.mem.Allocator) ++ " as its first argument");
807807 }
808808 const expected_args_tuple_len = fn_args_fields.len - 1;
lib/std/x/os/socket.zig+4-4
......@@ -230,12 +230,12 @@ pub const Socket = struct {
230230
231231 pub fn setName(self: *Self, name: []const u8) void {
232232 self.name = @ptrToInt(name.ptr);
233 self.name_len = @intCast(meta.fieldInfo(Self, .name_len).field_type, name.len);
233 self.name_len = @intCast(meta.fieldInfo(Self, .name_len).type, name.len);
234234 }
235235
236236 pub fn setBuffers(self: *Self, buffers: []const Buffer) void {
237237 self.buffers = @ptrToInt(buffers.ptr);
238 self.buffers_len = @intCast(meta.fieldInfo(Self, .buffers_len).field_type, buffers.len);
238 self.buffers_len = @intCast(meta.fieldInfo(Self, .buffers_len).type, buffers.len);
239239 }
240240
241241 pub fn setControl(self: *Self, control: []const u8) void {
......@@ -243,12 +243,12 @@ pub const Socket = struct {
243243 self.control = Buffer.from(control);
244244 } else {
245245 self.control = @ptrToInt(control.ptr);
246 self.control_len = @intCast(meta.fieldInfo(Self, .control_len).field_type, control.len);
246 self.control_len = @intCast(meta.fieldInfo(Self, .control_len).type, control.len);
247247 }
248248 }
249249
250250 pub fn setFlags(self: *Self, flags: u32) void {
251 self.flags = @intCast(meta.fieldInfo(Self, .flags).field_type, flags);
251 self.flags = @intCast(meta.fieldInfo(Self, .flags).type, flags);
252252 }
253253
254254 pub fn getName(self: Self) []const u8 {
lib/std/zig/Ast.zig+1-1
......@@ -125,7 +125,7 @@ pub fn extraData(tree: Ast, index: usize, comptime T: type) T {
125125 const fields = std.meta.fields(T);
126126 var result: T = undefined;
127127 inline for (fields) |field, i| {
128 comptime assert(field.field_type == Node.Index);
128 comptime assert(field.type == Node.Index);
129129 @field(result, field.name) = tree.extra_data[index + i];
130130 }
131131 return result;
lib/std/zig/c_translation.zig+1-1
......@@ -50,7 +50,7 @@ pub fn cast(comptime DestType: type, target: anytype) DestType {
5050 },
5151 .Union => |info| {
5252 inline for (info.fields) |field| {
53 if (field.field_type == SourceType) return @unionInit(DestType, field.name, target);
53 if (field.type == SourceType) return @unionInit(DestType, field.name, target);
5454 }
5555 @compileError("cast to union type '" ++ @typeName(DestType) ++ "' from type '" ++ @typeName(SourceType) ++ "' which is not present in union");
5656 },
lib/std/zig/parse.zig+1-1
......@@ -153,7 +153,7 @@ const Parser = struct {
153153 try p.extra_data.ensureUnusedCapacity(p.gpa, fields.len);
154154 const result = @intCast(u32, p.extra_data.items.len);
155155 inline for (fields) |field| {
156 comptime assert(field.field_type == Node.Index);
156 comptime assert(field.type == Node.Index);
157157 p.extra_data.appendAssumeCapacity(@field(extra, field.name));
158158 }
159159 return result;
src/Air.zig+1-1
......@@ -1260,7 +1260,7 @@ pub fn extraData(air: Air, comptime T: type, index: usize) struct { data: T, end
12601260 var i: usize = index;
12611261 var result: T = undefined;
12621262 inline for (fields) |field| {
1263 @field(result, field.name) = switch (field.field_type) {
1263 @field(result, field.name) = switch (field.type) {
12641264 u32 => air.extra[i],
12651265 Inst.Ref => @intToEnum(Inst.Ref, air.extra[i]),
12661266 i32 => @bitCast(i32, air.extra[i]),
src/AstGen.zig+1-1
......@@ -79,7 +79,7 @@ fn setExtra(astgen: *AstGen, index: usize, extra: anytype) void {
7979 const fields = std.meta.fields(@TypeOf(extra));
8080 var i = index;
8181 inline for (fields) |field| {
82 astgen.extra.items[i] = switch (field.field_type) {
82 astgen.extra.items[i] = switch (field.type) {
8383 u32 => @field(extra, field.name),
8484 Zir.Inst.Ref => @enumToInt(@field(extra, field.name)),
8585 i32 => @bitCast(u32, @field(extra, field.name)),
src/Autodoc.zig+2-2
......@@ -637,9 +637,9 @@ const DocData = struct {
637637 inline for (comptime std.meta.fields(Type)) |case| {
638638 if (@field(Type, case.name) == active_tag) {
639639 const current_value = @field(self, case.name);
640 inline for (comptime std.meta.fields(case.field_type)) |f| {
640 inline for (comptime std.meta.fields(case.type)) |f| {
641641 try jsw.arrayElem();
642 if (f.field_type == std.builtin.Type.Pointer.Size) {
642 if (f.type == std.builtin.Type.Pointer.Size) {
643643 try jsw.emitNumber(@enumToInt(@field(current_value, f.name)));
644644 } else {
645645 try std.json.stringify(@field(current_value, f.name), opts, w);
src/InternPool.zig+2-2
......@@ -259,7 +259,7 @@ fn addExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 {
259259 const fields = std.meta.fields(@TypeOf(extra));
260260 const result = @intCast(u32, ip.extra.items.len);
261261 inline for (fields) |field| {
262 ip.extra.appendAssumeCapacity(switch (field.field_type) {
262 ip.extra.appendAssumeCapacity(switch (field.type) {
263263 u32 => @field(extra, field.name),
264264 Index => @enumToInt(@field(extra, field.name)),
265265 i32 => @bitCast(u32, @field(extra, field.name)),
......@@ -274,7 +274,7 @@ fn extraData(ip: InternPool, comptime T: type, index: usize) T {
274274 var i: usize = index;
275275 var result: T = undefined;
276276 inline for (fields) |field| {
277 @field(result, field.name) = switch (field.field_type) {
277 @field(result, field.name) = switch (field.type) {
278278 u32 => ip.extra.items[i],
279279 Index => @intToEnum(Index, ip.extra.items[i]),
280280 i32 => @bitCast(i32, ip.extra.items[i]),
src/Liveness.zig+1-1
......@@ -718,7 +718,7 @@ const Analysis = struct {
718718 const fields = std.meta.fields(@TypeOf(extra));
719719 const result = @intCast(u32, a.extra.items.len);
720720 inline for (fields) |field| {
721 a.extra.appendAssumeCapacity(switch (field.field_type) {
721 a.extra.appendAssumeCapacity(switch (field.type) {
722722 u32 => @field(extra, field.name),
723723 else => @compileError("bad field type"),
724724 });
src/Sema.zig+18-32
......@@ -15319,7 +15319,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1531915319 Value.makeBool(is_generic),
1532015320 // is_noalias: bool,
1532115321 Value.makeBool(is_noalias),
15322 // arg_type: ?type,
15322 // type: ?type,
1532315323 param_ty_val,
1532415324 };
1532515325 param_val.* = try Value.Tag.aggregate.create(params_anon_decl.arena(), param_fields);
......@@ -15693,14 +15693,8 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1569315693
1569415694 const decls_val = try sema.typeInfoDecls(block, src, type_info_ty, ty.getNamespace());
1569515695
15696 const field_values = try sema.arena.create([5]Value);
15696 const field_values = try sema.arena.create([4]Value);
1569715697 field_values.* = .{
15698 // layout: ContainerLayout,
15699 try Value.Tag.enum_field_index.create(
15700 sema.arena,
15701 @enumToInt(std.builtin.Type.ContainerLayout.Auto),
15702 ),
15703
1570415698 // tag_type: type,
1570515699 try Value.Tag.ty.create(sema.arena, int_tag_ty),
1570615700 // fields: []const EnumField,
......@@ -15770,7 +15764,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1577015764 union_field_fields.* = .{
1577115765 // name: []const u8,
1577215766 name_val,
15773 // field_type: type,
15767 // type: type,
1577415768 try Value.Tag.ty.create(fields_anon_decl.arena(), field.ty),
1577515769 // alignment: comptime_int,
1577615770 try Value.Tag.int_u64.create(fields_anon_decl.arena(), alignment),
......@@ -15883,7 +15877,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1588315877 struct_field_fields.* = .{
1588415878 // name: []const u8,
1588515879 name_val,
15886 // field_type: type,
15880 // type: type,
1588715881 try Value.Tag.ty.create(fields_anon_decl.arena(), field_ty),
1588815882 // default_value: ?*const anyopaque,
1588915883 try default_val_ptr.copy(fields_anon_decl.arena()),
......@@ -15928,7 +15922,7 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1592815922 struct_field_fields.* = .{
1592915923 // name: []const u8,
1593015924 name_val,
15931 // field_type: type,
15925 // type: type,
1593215926 try Value.Tag.ty.create(fields_anon_decl.arena(), field.ty),
1593315927 // default_value: ?*const anyopaque,
1593415928 try default_val_ptr.copy(fields_anon_decl.arena()),
......@@ -18315,22 +18309,14 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
1831518309 .Enum => {
1831618310 const struct_val: []const Value = union_val.val.castTag(.aggregate).?.data;
1831718311 // TODO use reflection instead of magic numbers here
18318 // layout: ContainerLayout,
18319 const layout_val = struct_val[0];
1832018312 // tag_type: type,
18321 const tag_type_val = struct_val[1];
18313 const tag_type_val = struct_val[0];
1832218314 // fields: []const EnumField,
18323 const fields_val = struct_val[2];
18315 const fields_val = struct_val[1];
1832418316 // decls: []const Declaration,
18325 const decls_val = struct_val[3];
18317 const decls_val = struct_val[2];
1832618318 // is_exhaustive: bool,
18327 const is_exhaustive_val = struct_val[4];
18328
18329 // enum layout is always auto
18330 const layout = layout_val.toEnum(std.builtin.Type.ContainerLayout);
18331 if (layout != .Auto) {
18332 return sema.fail(block, src, "reified enums must have a layout .Auto", .{});
18333 }
18319 const is_exhaustive_val = struct_val[3];
1833418320
1833518321 // Decls
1833618322 if (decls_val.sliceLen(mod) > 0) {
......@@ -18577,8 +18563,8 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
1857718563 // TODO use reflection instead of magic numbers here
1857818564 // name: []const u8
1857918565 const name_val = field_struct_val[0];
18580 // field_type: type,
18581 const field_type_val = field_struct_val[1];
18566 // type: type,
18567 const type_val = field_struct_val[1];
1858218568 // alignment: comptime_int,
1858318569 const alignment_val = field_struct_val[2];
1858418570
......@@ -18612,7 +18598,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
1861218598 }
1861318599
1861418600 var buffer: Value.ToTypeBuffer = undefined;
18615 const field_ty = try field_type_val.toType(&buffer).copy(new_decl_arena_allocator);
18601 const field_ty = try type_val.toType(&buffer).copy(new_decl_arena_allocator);
1861618602 gop.value_ptr.* = .{
1861718603 .ty = field_ty,
1861818604 .abi_align = @intCast(u32, (try alignment_val.getUnsignedIntAdvanced(target, sema)).?),
......@@ -18733,7 +18719,7 @@ fn zirReify(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData, in
1873318719 const arg_is_generic = arg_val[0].toBool();
1873418720 // is_noalias: bool,
1873518721 const arg_is_noalias = arg_val[1].toBool();
18736 // arg_type: ?type,
18722 // type: ?type,
1873718723 const param_type_opt_val = arg_val[2];
1873818724
1873918725 if (arg_is_generic) {
......@@ -18831,9 +18817,9 @@ fn reifyStruct(
1883118817 // TODO use reflection instead of magic numbers here
1883218818 // name: []const u8
1883318819 const name_val = field_struct_val[0];
18834 // field_type: type,
18835 const field_type_val = field_struct_val[1];
18836 //default_value: ?*const anyopaque,
18820 // type: type,
18821 const type_val = field_struct_val[1];
18822 // default_value: ?*const anyopaque,
1883718823 const default_value_val = field_struct_val[2];
1883818824 // is_comptime: bool,
1883918825 const is_comptime_val = field_struct_val[3];
......@@ -18896,7 +18882,7 @@ fn reifyStruct(
1889618882 }
1889718883
1889818884 var buffer: Value.ToTypeBuffer = undefined;
18899 const field_ty = try field_type_val.toType(&buffer).copy(new_decl_arena_allocator);
18885 const field_ty = try type_val.toType(&buffer).copy(new_decl_arena_allocator);
1890018886 gop.value_ptr.* = .{
1890118887 .ty = field_ty,
1890218888 .abi_align = abi_align,
......@@ -31572,7 +31558,7 @@ pub fn addExtraAssumeCapacity(sema: *Sema, extra: anytype) u32 {
3157231558 const fields = std.meta.fields(@TypeOf(extra));
3157331559 const result = @intCast(u32, sema.air_extra.items.len);
3157431560 inline for (fields) |field| {
31575 sema.air_extra.appendAssumeCapacity(switch (field.field_type) {
31561 sema.air_extra.appendAssumeCapacity(switch (field.type) {
3157631562 u32 => @field(extra, field.name),
3157731563 Air.Inst.Ref => @enumToInt(@field(extra, field.name)),
3157831564 i32 => @bitCast(u32, @field(extra, field.name)),
src/Zir.zig+1-1
......@@ -71,7 +71,7 @@ pub fn extraData(code: Zir, comptime T: type, index: usize) struct { data: T, en
7171 var i: usize = index;
7272 var result: T = undefined;
7373 inline for (fields) |field| {
74 @field(result, field.name) = switch (field.field_type) {
74 @field(result, field.name) = switch (field.type) {
7575 u32 => code.extra[i],
7676 Inst.Ref => @intToEnum(Inst.Ref, code.extra[i]),
7777 i32 => @bitCast(i32, code.extra[i]),
src/arch/aarch64/CodeGen.zig+1-1
......@@ -477,7 +477,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
477477 const fields = std.meta.fields(@TypeOf(extra));
478478 const result = @intCast(u32, self.mir_extra.items.len);
479479 inline for (fields) |field| {
480 self.mir_extra.appendAssumeCapacity(switch (field.field_type) {
480 self.mir_extra.appendAssumeCapacity(switch (field.type) {
481481 u32 => @field(extra, field.name),
482482 i32 => @bitCast(u32, @field(extra, field.name)),
483483 else => @compileError("bad field type"),
src/arch/aarch64/Mir.zig+1-1
......@@ -505,7 +505,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end
505505 var i: usize = index;
506506 var result: T = undefined;
507507 inline for (fields) |field| {
508 @field(result, field.name) = switch (field.field_type) {
508 @field(result, field.name) = switch (field.type) {
509509 u32 => mir.extra[i],
510510 i32 => @bitCast(i32, mir.extra[i]),
511511 else => @compileError("bad field type"),
src/arch/arm/CodeGen.zig+1-1
......@@ -386,7 +386,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
386386 const fields = std.meta.fields(@TypeOf(extra));
387387 const result = @intCast(u32, self.mir_extra.items.len);
388388 inline for (fields) |field| {
389 self.mir_extra.appendAssumeCapacity(switch (field.field_type) {
389 self.mir_extra.appendAssumeCapacity(switch (field.type) {
390390 u32 => @field(extra, field.name),
391391 i32 => @bitCast(u32, @field(extra, field.name)),
392392 else => @compileError("bad field type"),
src/arch/arm/Mir.zig+1-1
......@@ -283,7 +283,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end
283283 var i: usize = index;
284284 var result: T = undefined;
285285 inline for (fields) |field| {
286 @field(result, field.name) = switch (field.field_type) {
286 @field(result, field.name) = switch (field.type) {
287287 u32 => mir.extra[i],
288288 i32 => @bitCast(i32, mir.extra[i]),
289289 else => @compileError("bad field type"),
src/arch/riscv64/CodeGen.zig+1-1
......@@ -340,7 +340,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
340340 const fields = std.meta.fields(@TypeOf(extra));
341341 const result = @intCast(u32, self.mir_extra.items.len);
342342 inline for (fields) |field| {
343 self.mir_extra.appendAssumeCapacity(switch (field.field_type) {
343 self.mir_extra.appendAssumeCapacity(switch (field.type) {
344344 u32 => @field(extra, field.name),
345345 i32 => @bitCast(u32, @field(extra, field.name)),
346346 else => @compileError("bad field type"),
src/arch/riscv64/Mir.zig+1-1
......@@ -132,7 +132,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end
132132 var i: usize = index;
133133 var result: T = undefined;
134134 inline for (fields) |field| {
135 @field(result, field.name) = switch (field.field_type) {
135 @field(result, field.name) = switch (field.type) {
136136 u32 => mir.extra[i],
137137 i32 => @bitCast(i32, mir.extra[i]),
138138 else => @compileError("bad field type"),
src/arch/sparc64/Mir.zig+1-1
......@@ -347,7 +347,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end
347347 var i: usize = index;
348348 var result: T = undefined;
349349 inline for (fields) |field| {
350 @field(result, field.name) = switch (field.field_type) {
350 @field(result, field.name) = switch (field.type) {
351351 u32 => mir.extra[i],
352352 i32 => @bitCast(i32, mir.extra[i]),
353353 else => @compileError("bad field type"),
src/arch/wasm/CodeGen.zig+1-1
......@@ -960,7 +960,7 @@ fn addExtraAssumeCapacity(func: *CodeGen, extra: anytype) error{OutOfMemory}!u32
960960 const fields = std.meta.fields(@TypeOf(extra));
961961 const result = @intCast(u32, func.mir_extra.items.len);
962962 inline for (fields) |field| {
963 func.mir_extra.appendAssumeCapacity(switch (field.field_type) {
963 func.mir_extra.appendAssumeCapacity(switch (field.type) {
964964 u32 => @field(extra, field.name),
965965 else => |field_type| @compileError("Unsupported field type " ++ @typeName(field_type)),
966966 });
src/arch/wasm/Mir.zig+1-1
......@@ -589,7 +589,7 @@ pub fn extraData(self: *const Mir, comptime T: type, index: usize) struct { data
589589 var i: usize = index;
590590 var result: T = undefined;
591591 inline for (fields) |field| {
592 @field(result, field.name) = switch (field.field_type) {
592 @field(result, field.name) = switch (field.type) {
593593 u32 => self.extra[i],
594594 else => |field_type| @compileError("Unsupported field type " ++ @typeName(field_type)),
595595 };
src/arch/x86_64/CodeGen.zig+1-1
......@@ -374,7 +374,7 @@ pub fn addExtraAssumeCapacity(self: *Self, extra: anytype) u32 {
374374 const fields = std.meta.fields(@TypeOf(extra));
375375 const result = @intCast(u32, self.mir_extra.items.len);
376376 inline for (fields) |field| {
377 self.mir_extra.appendAssumeCapacity(switch (field.field_type) {
377 self.mir_extra.appendAssumeCapacity(switch (field.type) {
378378 u32 => @field(extra, field.name),
379379 i32 => @bitCast(u32, @field(extra, field.name)),
380380 else => @compileError("bad field type"),
src/arch/x86_64/Mir.zig+1-1
......@@ -612,7 +612,7 @@ pub fn extraData(mir: Mir, comptime T: type, index: usize) struct { data: T, end
612612 var i: usize = index;
613613 var result: T = undefined;
614614 inline for (fields) |field| {
615 @field(result, field.name) = switch (field.field_type) {
615 @field(result, field.name) = switch (field.type) {
616616 u32 => mir.extra[i],
617617 i32 => @bitCast(i32, mir.extra[i]),
618618 else => @compileError("bad field type"),
src/codegen/spirv/Section.zig+7-7
......@@ -116,7 +116,7 @@ fn writeOperands(section: *Section, comptime Operands: type, operands: Operands)
116116 };
117117
118118 inline for (fields) |field| {
119 section.writeOperand(field.field_type, @field(operands, field.name));
119 section.writeOperand(field.type, @field(operands, field.name));
120120 }
121121}
122122
......@@ -196,7 +196,7 @@ fn writeContextDependentNumber(section: *Section, operand: spec.LiteralContextDe
196196fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand) void {
197197 var mask: Word = 0;
198198 inline for (@typeInfo(Operand).Struct.fields) |field, bit| {
199 switch (@typeInfo(field.field_type)) {
199 switch (@typeInfo(field.type)) {
200200 .Optional => if (@field(operand, field.name) != null) {
201201 mask |= 1 << @intCast(u5, bit);
202202 },
......@@ -214,7 +214,7 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand
214214 section.writeWord(mask);
215215
216216 inline for (@typeInfo(Operand).Struct.fields) |field| {
217 switch (@typeInfo(field.field_type)) {
217 switch (@typeInfo(field.type)) {
218218 .Optional => |info| if (@field(operand, field.name)) |child| {
219219 section.writeOperands(info.child, child);
220220 },
......@@ -230,7 +230,7 @@ fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operan
230230
231231 inline for (@typeInfo(Operand).Union.fields) |field| {
232232 if (@field(Operand, field.name) == tag) {
233 section.writeOperands(field.field_type, @field(operand, field.name));
233 section.writeOperands(field.type, @field(operand, field.name));
234234 return;
235235 }
236236 }
......@@ -250,7 +250,7 @@ fn operandsSize(comptime Operands: type, operands: Operands) usize {
250250
251251 var total: usize = 0;
252252 inline for (fields) |field| {
253 total += operandSize(field.field_type, @field(operands, field.name));
253 total += operandSize(field.type, @field(operands, field.name));
254254 }
255255
256256 return total;
......@@ -304,7 +304,7 @@ fn extendedMaskSize(comptime Operand: type, operand: Operand) usize {
304304 var total: usize = 0;
305305 var any_set = false;
306306 inline for (@typeInfo(Operand).Struct.fields) |field| {
307 switch (@typeInfo(field.field_type)) {
307 switch (@typeInfo(field.type)) {
308308 .Optional => |info| if (@field(operand, field.name)) |child| {
309309 total += operandsSize(info.child, child);
310310 any_set = true;
......@@ -326,7 +326,7 @@ fn extendedUnionSize(comptime Operand: type, operand: Operand) usize {
326326 inline for (@typeInfo(Operand).Union.fields) |field| {
327327 if (@field(Operand, field.name) == tag) {
328328 // Add one for the tag itself.
329 return 1 + operandsSize(field.field_type, @field(operand, field.name));
329 return 1 + operandsSize(field.type, @field(operand, field.name));
330330 }
331331 }
332332 unreachable;
src/link/tapi/yaml.zig+5-5
......@@ -339,7 +339,7 @@ pub const Yaml = struct {
339339
340340 if (union_info.tag_type) |_| {
341341 inline for (union_info.fields) |field| {
342 if (self.parseValue(field.field_type, value)) |u_value| {
342 if (self.parseValue(field.type, value)) |u_value| {
343343 return @unionInit(T, field.name, u_value);
344344 } else |err| {
345345 if (@as(@TypeOf(err) || error{TypeMismatch}, err) != error.TypeMismatch) return err;
......@@ -366,16 +366,16 @@ pub const Yaml = struct {
366366 break :blk map.get(field_name);
367367 };
368368
369 if (@typeInfo(field.field_type) == .Optional) {
370 @field(parsed, field.name) = try self.parseOptional(field.field_type, value);
369 if (@typeInfo(field.type) == .Optional) {
370 @field(parsed, field.name) = try self.parseOptional(field.type, value);
371371 continue;
372372 }
373373
374374 const unwrapped = value orelse {
375 log.debug("missing struct field: {s}: {s}", .{ field.name, @typeName(field.field_type) });
375 log.debug("missing struct field: {s}: {s}", .{ field.name, @typeName(field.type) });
376376 return error.StructFieldMissing;
377377 };
378 @field(parsed, field.name) = try self.parseValue(field.field_type, unwrapped);
378 @field(parsed, field.name) = try self.parseValue(field.type, unwrapped);
379379 }
380380
381381 return parsed;
src/print_zir.zig+4-4
......@@ -1312,7 +1312,7 @@ const Writer = struct {
13121312 type_len: u32 = 0,
13131313 align_len: u32 = 0,
13141314 init_len: u32 = 0,
1315 field_type: Zir.Inst.Ref = .none,
1315 type: Zir.Inst.Ref = .none,
13161316 name: u32,
13171317 is_comptime: bool,
13181318 };
......@@ -1353,7 +1353,7 @@ const Writer = struct {
13531353 if (has_type_body) {
13541354 fields[field_i].type_len = self.code.extra[extra_index];
13551355 } else {
1356 fields[field_i].field_type = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
1356 fields[field_i].type = @intToEnum(Zir.Inst.Ref, self.code.extra[extra_index]);
13571357 }
13581358 extra_index += 1;
13591359
......@@ -1384,8 +1384,8 @@ const Writer = struct {
13841384 } else {
13851385 try stream.print("@\"{d}\": ", .{i});
13861386 }
1387 if (field.field_type != .none) {
1388 try self.writeInstRef(stream, field.field_type);
1387 if (field.type != .none) {
1388 try self.writeInstRef(stream, field.type);
13891389 }
13901390
13911391 if (field.type_len > 0) {
src/translate_c/ast.zig+2-2
......@@ -392,7 +392,7 @@ pub const Node = extern union {
392392 }
393393
394394 pub fn Data(comptime t: Tag) type {
395 return std.meta.fieldInfo(t.Type(), .data).field_type;
395 return std.meta.fieldInfo(t.Type(), .data).type;
396396 }
397397 };
398398
......@@ -845,7 +845,7 @@ const Context = struct {
845845 try c.extra_data.ensureUnusedCapacity(c.gpa, fields.len);
846846 const result = @intCast(u32, c.extra_data.items.len);
847847 inline for (fields) |field| {
848 comptime std.debug.assert(field.field_type == NodeIndex);
848 comptime std.debug.assert(field.type == NodeIndex);
849849 c.extra_data.appendAssumeCapacity(@field(extra, field.name));
850850 }
851851 return result;
src/type.zig+1-1
......@@ -6216,7 +6216,7 @@ pub const Type = extern union {
62166216 }
62176217
62186218 pub fn Data(comptime t: Tag) type {
6219 return std.meta.fieldInfo(t.Type(), .data).field_type;
6219 return std.meta.fieldInfo(t.Type(), .data).type;
62206220 }
62216221 };
62226222
src/value.zig+1-1
......@@ -338,7 +338,7 @@ pub const Value = extern union {
338338 }
339339
340340 pub fn Data(comptime t: Tag) type {
341 return std.meta.fieldInfo(t.Type(), .data).field_type;
341 return std.meta.fieldInfo(t.Type(), .data).type;
342342 }
343343 };
344344
stage1/zig1.wasm
Binary files a/stage1/zig1.wasm and b/stage1/zig1.wasm differ
test/behavior/bitcast.zig+1-1
......@@ -358,7 +358,7 @@ test "comptime @bitCast packed struct to int and back" {
358358 const rt_cast = @bitCast(S, i);
359359 const ct_cast = comptime @bitCast(S, @as(Int, 0));
360360 inline for (@typeInfo(S).Struct.fields) |field| {
361 if (@typeInfo(field.field_type) == .Vector)
361 if (@typeInfo(field.type) == .Vector)
362362 continue; //TODO: https://github.com/ziglang/zig/issues/13201
363363
364364 try expectEqual(@field(rt_cast, field.name), @field(ct_cast, field.name));
test/behavior/bugs/12786.zig+1-1
......@@ -8,7 +8,7 @@ fn NamespacedGlobals(comptime modules: anytype) type {
88 .fields = &.{
99 .{
1010 .name = "globals",
11 .field_type = modules.mach.globals,
11 .type = modules.mach.globals,
1212 .default_value = null,
1313 .is_comptime = false,
1414 .alignment = @alignOf(modules.mach.globals),
test/behavior/bugs/12794.zig+1-1
......@@ -7,7 +7,7 @@ fn NamespacedComponents(comptime modules: anytype) type {
77 .is_tuple = false,
88 .fields = &.{.{
99 .name = "components",
10 .field_type = @TypeOf(modules.components),
10 .type = @TypeOf(modules.components),
1111 .default_value = null,
1212 .is_comptime = false,
1313 .alignment = @alignOf(@TypeOf(modules.components)),
test/behavior/bugs/12885.zig+3-3
......@@ -15,8 +15,8 @@ test "ErrorSet comptime_field_ptr" {
1515}
1616
1717const fn_info = .{
18 .args = [_]builtin.Type.Fn.Param{
19 .{ .is_generic = false, .is_noalias = false, .arg_type = u8 },
18 .params = [_]builtin.Type.Fn.Param{
19 .{ .is_generic = false, .is_noalias = false, .type = u8 },
2020 },
2121};
2222const Bar = @Type(.{
......@@ -26,7 +26,7 @@ const Bar = @Type(.{
2626 .is_generic = false,
2727 .is_var_args = false,
2828 .return_type = void,
29 .args = &fn_info.args,
29 .params = &fn_info.params,
3030 },
3131});
3232test "fn comptime_field_ptr" {
test/behavior/bugs/13435.zig+1-1
......@@ -8,7 +8,7 @@ fn CreateUnion(comptime T: type) type {
88 .fields = &[_]std.builtin.Type.UnionField{
99 .{
1010 .name = "field",
11 .field_type = T,
11 .type = T,
1212 .alignment = @alignOf(T),
1313 },
1414 },
test/behavior/bugs/6456.zig+1-1
......@@ -23,7 +23,7 @@ test "issue 6456" {
2323 fields = fields ++ &[_]StructField{StructField{
2424 .alignment = 0,
2525 .name = name,
26 .field_type = usize,
26 .type = usize,
2727 .default_value = &@as(?usize, null),
2828 .is_comptime = false,
2929 }};
test/behavior/generics.zig-1
......@@ -273,7 +273,6 @@ test "generic function instantiation turns into comptime call" {
273273 var enumFields: [1]std.builtin.Type.EnumField = .{.{ .name = "A", .value = 0 }};
274274 return @Type(.{
275275 .Enum = .{
276 .layout = .Auto,
277276 .tag_type = u0,
278277 .fields = &enumFields,
279278 .decls = &.{},
test/behavior/reflection.zig+4-4
......@@ -9,10 +9,10 @@ test "reflection: function return type, var args, and param types" {
99 const info = @typeInfo(@TypeOf(dummy)).Fn;
1010 try expect(info.return_type.? == i32);
1111 try expect(!info.is_var_args);
12 try expect(info.args.len == 3);
13 try expect(info.args[0].arg_type.? == bool);
14 try expect(info.args[1].arg_type.? == i32);
15 try expect(info.args[2].arg_type.? == f32);
12 try expect(info.params.len == 3);
13 try expect(info.params[0].type.? == bool);
14 try expect(info.params[1].type.? == i32);
15 try expect(info.params[2].type.? == f32);
1616 }
1717}
1818
test/behavior/tuple.zig+3-3
......@@ -136,14 +136,14 @@ test "array-like initializer for tuple types" {
136136 .fields = &.{
137137 .{
138138 .name = "0",
139 .field_type = i32,
139 .type = i32,
140140 .default_value = null,
141141 .is_comptime = false,
142142 .alignment = @alignOf(i32),
143143 },
144144 .{
145145 .name = "1",
146 .field_type = u8,
146 .type = u8,
147147 .default_value = null,
148148 .is_comptime = false,
149149 .alignment = @alignOf(i32),
......@@ -314,7 +314,7 @@ test "zero sized struct in tuple handled correctly" {
314314 .decls = &.{},
315315 .fields = &.{.{
316316 .name = "0",
317 .field_type = struct {},
317 .type = struct {},
318318 .default_value = null,
319319 .is_comptime = false,
320320 .alignment = 0,
test/behavior/tuple_declarations.zig+5-5
......@@ -20,13 +20,13 @@ test "tuple declaration type info" {
2020 try expect(info.is_tuple);
2121
2222 try expectEqualStrings(info.fields[0].name, "0");
23 try expect(info.fields[0].field_type == u32);
23 try expect(info.fields[0].type == u32);
2424 try expect(@ptrCast(*const u32, @alignCast(@alignOf(u32), info.fields[0].default_value)).* == 1);
2525 try expect(info.fields[0].is_comptime);
2626 try expect(info.fields[0].alignment == 2);
2727
2828 try expectEqualStrings(info.fields[1].name, "1");
29 try expect(info.fields[1].field_type == []const u8);
29 try expect(info.fields[1].type == []const u8);
3030 try expect(info.fields[1].default_value == null);
3131 try expect(!info.fields[1].is_comptime);
3232 try expect(info.fields[1].alignment == @alignOf([]const u8));
......@@ -44,13 +44,13 @@ test "tuple declaration type info" {
4444 try expect(info.is_tuple);
4545
4646 try expectEqualStrings(info.fields[0].name, "0");
47 try expect(info.fields[0].field_type == u1);
47 try expect(info.fields[0].type == u1);
4848
4949 try expectEqualStrings(info.fields[1].name, "1");
50 try expect(info.fields[1].field_type == u30);
50 try expect(info.fields[1].type == u30);
5151
5252 try expectEqualStrings(info.fields[2].name, "2");
53 try expect(info.fields[2].field_type == u1);
53 try expect(info.fields[2].type == u1);
5454 }
5555}
5656
test/behavior/type.zig+22-26
......@@ -268,10 +268,10 @@ test "Type.Struct" {
268268 const infoA = @typeInfo(A).Struct;
269269 try testing.expectEqual(Type.ContainerLayout.Auto, infoA.layout);
270270 try testing.expectEqualSlices(u8, "x", infoA.fields[0].name);
271 try testing.expectEqual(u8, infoA.fields[0].field_type);
271 try testing.expectEqual(u8, infoA.fields[0].type);
272272 try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[0].default_value);
273273 try testing.expectEqualSlices(u8, "y", infoA.fields[1].name);
274 try testing.expectEqual(u32, infoA.fields[1].field_type);
274 try testing.expectEqual(u32, infoA.fields[1].type);
275275 try testing.expectEqual(@as(?*const anyopaque, null), infoA.fields[1].default_value);
276276 try testing.expectEqualSlices(Type.Declaration, &.{}, infoA.decls);
277277 try testing.expectEqual(@as(bool, false), infoA.is_tuple);
......@@ -286,10 +286,10 @@ test "Type.Struct" {
286286 const infoB = @typeInfo(B).Struct;
287287 try testing.expectEqual(Type.ContainerLayout.Extern, infoB.layout);
288288 try testing.expectEqualSlices(u8, "x", infoB.fields[0].name);
289 try testing.expectEqual(u8, infoB.fields[0].field_type);
289 try testing.expectEqual(u8, infoB.fields[0].type);
290290 try testing.expectEqual(@as(?*const anyopaque, null), infoB.fields[0].default_value);
291291 try testing.expectEqualSlices(u8, "y", infoB.fields[1].name);
292 try testing.expectEqual(u32, infoB.fields[1].field_type);
292 try testing.expectEqual(u32, infoB.fields[1].type);
293293 try testing.expectEqual(@as(u32, 5), @ptrCast(*align(1) const u32, infoB.fields[1].default_value.?).*);
294294 try testing.expectEqual(@as(usize, 0), infoB.decls.len);
295295 try testing.expectEqual(@as(bool, false), infoB.is_tuple);
......@@ -298,10 +298,10 @@ test "Type.Struct" {
298298 const infoC = @typeInfo(C).Struct;
299299 try testing.expectEqual(Type.ContainerLayout.Packed, infoC.layout);
300300 try testing.expectEqualSlices(u8, "x", infoC.fields[0].name);
301 try testing.expectEqual(u8, infoC.fields[0].field_type);
301 try testing.expectEqual(u8, infoC.fields[0].type);
302302 try testing.expectEqual(@as(u8, 3), @ptrCast(*const u8, infoC.fields[0].default_value.?).*);
303303 try testing.expectEqualSlices(u8, "y", infoC.fields[1].name);
304 try testing.expectEqual(u32, infoC.fields[1].field_type);
304 try testing.expectEqual(u32, infoC.fields[1].type);
305305 try testing.expectEqual(@as(u32, 5), @ptrCast(*align(1) const u32, infoC.fields[1].default_value.?).*);
306306 try testing.expectEqual(@as(usize, 0), infoC.decls.len);
307307 try testing.expectEqual(@as(bool, false), infoC.is_tuple);
......@@ -311,10 +311,10 @@ test "Type.Struct" {
311311 const infoD = @typeInfo(D).Struct;
312312 try testing.expectEqual(Type.ContainerLayout.Auto, infoD.layout);
313313 try testing.expectEqualSlices(u8, "x", infoD.fields[0].name);
314 try testing.expectEqual(comptime_int, infoD.fields[0].field_type);
314 try testing.expectEqual(comptime_int, infoD.fields[0].type);
315315 try testing.expectEqual(@as(comptime_int, 3), @ptrCast(*const comptime_int, infoD.fields[0].default_value.?).*);
316316 try testing.expectEqualSlices(u8, "y", infoD.fields[1].name);
317 try testing.expectEqual(comptime_int, infoD.fields[1].field_type);
317 try testing.expectEqual(comptime_int, infoD.fields[1].type);
318318 try testing.expectEqual(@as(comptime_int, 5), @ptrCast(*const comptime_int, infoD.fields[1].default_value.?).*);
319319 try testing.expectEqual(@as(usize, 0), infoD.decls.len);
320320 try testing.expectEqual(@as(bool, false), infoD.is_tuple);
......@@ -324,10 +324,10 @@ test "Type.Struct" {
324324 const infoE = @typeInfo(E).Struct;
325325 try testing.expectEqual(Type.ContainerLayout.Auto, infoE.layout);
326326 try testing.expectEqualSlices(u8, "0", infoE.fields[0].name);
327 try testing.expectEqual(comptime_int, infoE.fields[0].field_type);
327 try testing.expectEqual(comptime_int, infoE.fields[0].type);
328328 try testing.expectEqual(@as(comptime_int, 1), @ptrCast(*const comptime_int, infoE.fields[0].default_value.?).*);
329329 try testing.expectEqualSlices(u8, "1", infoE.fields[1].name);
330 try testing.expectEqual(comptime_int, infoE.fields[1].field_type);
330 try testing.expectEqual(comptime_int, infoE.fields[1].type);
331331 try testing.expectEqual(@as(comptime_int, 2), @ptrCast(*const comptime_int, infoE.fields[1].default_value.?).*);
332332 try testing.expectEqual(@as(usize, 0), infoE.decls.len);
333333 try testing.expectEqual(@as(bool, true), infoE.is_tuple);
......@@ -354,7 +354,6 @@ test "Type.Enum" {
354354
355355 const Foo = @Type(.{
356356 .Enum = .{
357 .layout = .Auto,
358357 .tag_type = u8,
359358 .fields = &.{
360359 .{ .name = "a", .value = 1 },
......@@ -369,7 +368,6 @@ test "Type.Enum" {
369368 try testing.expectEqual(@as(u8, 5), @enumToInt(Foo.b));
370369 const Bar = @Type(.{
371370 .Enum = .{
372 .layout = .Auto,
373371 .tag_type = u32,
374372 .fields = &.{
375373 .{ .name = "a", .value = 1 },
......@@ -396,8 +394,8 @@ test "Type.Union" {
396394 .layout = .Extern,
397395 .tag_type = null,
398396 .fields = &.{
399 .{ .name = "int", .field_type = i32, .alignment = @alignOf(f32) },
400 .{ .name = "float", .field_type = f32, .alignment = @alignOf(f32) },
397 .{ .name = "int", .type = i32, .alignment = @alignOf(f32) },
398 .{ .name = "float", .type = f32, .alignment = @alignOf(f32) },
401399 },
402400 .decls = &.{},
403401 },
......@@ -412,8 +410,8 @@ test "Type.Union" {
412410 .layout = .Packed,
413411 .tag_type = null,
414412 .fields = &.{
415 .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
416 .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
413 .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
414 .{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
417415 },
418416 .decls = &.{},
419417 },
......@@ -424,7 +422,6 @@ test "Type.Union" {
424422
425423 const Tag = @Type(.{
426424 .Enum = .{
427 .layout = .Auto,
428425 .tag_type = u1,
429426 .fields = &.{
430427 .{ .name = "signed", .value = 0 },
......@@ -439,8 +436,8 @@ test "Type.Union" {
439436 .layout = .Auto,
440437 .tag_type = Tag,
441438 .fields = &.{
442 .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
443 .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
439 .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
440 .{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
444441 },
445442 .decls = &.{},
446443 },
......@@ -456,7 +453,6 @@ test "Type.Union from Type.Enum" {
456453
457454 const Tag = @Type(.{
458455 .Enum = .{
459 .layout = .Auto,
460456 .tag_type = u0,
461457 .fields = &.{
462458 .{ .name = "working_as_expected", .value = 0 },
......@@ -470,7 +466,7 @@ test "Type.Union from Type.Enum" {
470466 .layout = .Auto,
471467 .tag_type = Tag,
472468 .fields = &.{
473 .{ .name = "working_as_expected", .field_type = u32, .alignment = @alignOf(u32) },
469 .{ .name = "working_as_expected", .type = u32, .alignment = @alignOf(u32) },
474470 },
475471 .decls = &.{},
476472 },
......@@ -487,7 +483,7 @@ test "Type.Union from regular enum" {
487483 .layout = .Auto,
488484 .tag_type = E,
489485 .fields = &.{
490 .{ .name = "working_as_expected", .field_type = u32, .alignment = @alignOf(u32) },
486 .{ .name = "working_as_expected", .type = u32, .alignment = @alignOf(u32) },
491487 },
492488 .decls = &.{},
493489 },
......@@ -512,9 +508,9 @@ test "Type.Fn" {
512508 .is_generic = false,
513509 .is_var_args = false,
514510 .return_type = void,
515 .args = &.{
516 .{ .is_generic = false, .is_noalias = false, .arg_type = c_int },
517 .{ .is_generic = false, .is_noalias = false, .arg_type = some_ptr },
511 .params = &.{
512 .{ .is_generic = false, .is_noalias = false, .type = c_int },
513 .{ .is_generic = false, .is_noalias = false, .type = some_ptr },
518514 },
519515 } };
520516
......@@ -537,7 +533,7 @@ test "reified struct field name from optional payload" {
537533 .layout = .Auto,
538534 .fields = &.{.{
539535 .name = name,
540 .field_type = u8,
536 .type = u8,
541537 .default_value = null,
542538 .is_comptime = false,
543539 .alignment = 1,
test/behavior/type_info.zig+21-22
......@@ -238,7 +238,6 @@ fn testEnum() !void {
238238
239239 const os_info = @typeInfo(Os);
240240 try expect(os_info == .Enum);
241 try expect(os_info.Enum.layout == .Auto);
242241 try expect(os_info.Enum.fields.len == 4);
243242 try expect(mem.eql(u8, os_info.Enum.fields[1].name, "Macos"));
244243 try expect(os_info.Enum.fields[3].value == 3);
......@@ -257,7 +256,7 @@ fn testUnion() !void {
257256 try expect(typeinfo_info.Union.layout == .Auto);
258257 try expect(typeinfo_info.Union.tag_type.? == TypeId);
259258 try expect(typeinfo_info.Union.fields.len == 24);
260 try expect(typeinfo_info.Union.fields[4].field_type == @TypeOf(@typeInfo(u8).Int));
259 try expect(typeinfo_info.Union.fields[4].type == @TypeOf(@typeInfo(u8).Int));
261260 try expect(typeinfo_info.Union.decls.len == 22);
262261
263262 const TestNoTagUnion = union {
......@@ -271,7 +270,7 @@ fn testUnion() !void {
271270 try expect(notag_union_info.Union.layout == .Auto);
272271 try expect(notag_union_info.Union.fields.len == 2);
273272 try expect(notag_union_info.Union.fields[0].alignment == @alignOf(void));
274 try expect(notag_union_info.Union.fields[1].field_type == u32);
273 try expect(notag_union_info.Union.fields[1].type == u32);
275274 try expect(notag_union_info.Union.fields[1].alignment == @alignOf(u32));
276275
277276 const TestExternUnion = extern union {
......@@ -281,7 +280,7 @@ fn testUnion() !void {
281280 const extern_union_info = @typeInfo(TestExternUnion);
282281 try expect(extern_union_info.Union.layout == .Extern);
283282 try expect(extern_union_info.Union.tag_type == null);
284 try expect(extern_union_info.Union.fields[0].field_type == *anyopaque);
283 try expect(extern_union_info.Union.fields[0].type == *anyopaque);
285284}
286285
287286test "type info: struct info" {
......@@ -319,7 +318,7 @@ fn testPackedStruct() !void {
319318 try expect(struct_info.Struct.backing_integer == u128);
320319 try expect(struct_info.Struct.fields.len == 4);
321320 try expect(struct_info.Struct.fields[0].alignment == 0);
322 try expect(struct_info.Struct.fields[2].field_type == f32);
321 try expect(struct_info.Struct.fields[2].type == f32);
323322 try expect(struct_info.Struct.fields[2].default_value == null);
324323 try expect(@ptrCast(*align(1) const u32, struct_info.Struct.fields[3].default_value.?).* == 4);
325324 try expect(struct_info.Struct.fields[3].alignment == 0);
......@@ -365,7 +364,7 @@ fn testFunction() !void {
365364 try expect(fn_info.Fn.alignment > 0);
366365 try expect(fn_info.Fn.calling_convention == .C);
367366 try expect(!fn_info.Fn.is_generic);
368 try expect(fn_info.Fn.args.len == 2);
367 try expect(fn_info.Fn.params.len == 2);
369368 try expect(fn_info.Fn.is_var_args);
370369 try expect(fn_info.Fn.return_type.? == usize);
371370 const fn_aligned_info = @typeInfo(@TypeOf(typeInfoFooAligned));
......@@ -377,31 +376,31 @@ extern fn typeInfoFooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize
377376
378377test "type info: generic function types" {
379378 const G1 = @typeInfo(@TypeOf(generic1));
380 try expect(G1.Fn.args.len == 1);
381 try expect(G1.Fn.args[0].is_generic == true);
382 try expect(G1.Fn.args[0].arg_type == null);
379 try expect(G1.Fn.params.len == 1);
380 try expect(G1.Fn.params[0].is_generic == true);
381 try expect(G1.Fn.params[0].type == null);
383382 try expect(G1.Fn.return_type == void);
384383
385384 const G2 = @typeInfo(@TypeOf(generic2));
386 try expect(G2.Fn.args.len == 3);
387 try expect(G2.Fn.args[0].is_generic == false);
388 try expect(G2.Fn.args[0].arg_type == type);
389 try expect(G2.Fn.args[1].is_generic == true);
390 try expect(G2.Fn.args[1].arg_type == null);
391 try expect(G2.Fn.args[2].is_generic == false);
392 try expect(G2.Fn.args[2].arg_type == u8);
385 try expect(G2.Fn.params.len == 3);
386 try expect(G2.Fn.params[0].is_generic == false);
387 try expect(G2.Fn.params[0].type == type);
388 try expect(G2.Fn.params[1].is_generic == true);
389 try expect(G2.Fn.params[1].type == null);
390 try expect(G2.Fn.params[2].is_generic == false);
391 try expect(G2.Fn.params[2].type == u8);
393392 try expect(G2.Fn.return_type == void);
394393
395394 const G3 = @typeInfo(@TypeOf(generic3));
396 try expect(G3.Fn.args.len == 1);
397 try expect(G3.Fn.args[0].is_generic == true);
398 try expect(G3.Fn.args[0].arg_type == null);
395 try expect(G3.Fn.params.len == 1);
396 try expect(G3.Fn.params[0].is_generic == true);
397 try expect(G3.Fn.params[0].type == null);
399398 try expect(G3.Fn.return_type == null);
400399
401400 const G4 = @typeInfo(@TypeOf(generic4));
402 try expect(G4.Fn.args.len == 1);
403 try expect(G4.Fn.args[0].is_generic == true);
404 try expect(G4.Fn.args[0].arg_type == null);
401 try expect(G4.Fn.params.len == 1);
402 try expect(G4.Fn.params[0].is_generic == true);
403 try expect(G4.Fn.params[0].type == null);
405404 try expect(G4.Fn.return_type == null);
406405}
407406
test/behavior/union.zig+1-1
......@@ -454,7 +454,7 @@ test "global union with single field is correctly initialized" {
454454 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
455455
456456 glbl = Foo1{
457 .f = @typeInfo(Foo1).Union.fields[0].field_type{ .x = 123 },
457 .f = @typeInfo(Foo1).Union.fields[0].type{ .x = 123 },
458458 };
459459 try expect(glbl.f.x == 123);
460460}
test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig+1-1
......@@ -9,7 +9,7 @@ pub export fn entry() void {
99 const info = @typeInfo(Widget).Union;
1010 inline for (info.fields) |field| {
1111 if (foo()) {
12 switch (field.field_type) {
12 switch (field.type) {
1313 u0 => a = 2,
1414 else => unreachable,
1515 }
test/cases/compile_errors/dereference_anyopaque.zig+1-1
......@@ -16,7 +16,7 @@ fn parseFree(comptime T: type, value: T, allocator: std.mem.Allocator) void {
1616 .Struct => |structInfo| {
1717 inline for (structInfo.fields) |field| {
1818 if (!field.is_comptime)
19 parseFree(field.field_type, undefined, allocator);
19 parseFree(field.type, undefined, allocator);
2020 }
2121 },
2222 .Pointer => |ptrInfo| {
test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig+1-1
......@@ -1,6 +1,6 @@
11export fn entry() void {
22 _ = @Type(.{ .Struct = .{ .layout = .Packed, .fields = &.{
3 .{ .name = "one", .field_type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
3 .{ .name = "one", .type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
44 }, .decls = &.{}, .is_tuple = false } });
55}
66
test/cases/compile_errors/reified_enum_field_value_overflow.zig-1
......@@ -1,6 +1,5 @@
11comptime {
22 const E = @Type(.{ .Enum = .{
3 .layout = .Auto,
43 .tag_type = u1,
54 .fields = &.{
65 .{ .name = "f0", .value = 0 },
test/cases/compile_errors/reify_enum_with_duplicate_field.zig-1
......@@ -1,7 +1,6 @@
11export fn entry() void {
22 _ = @Type(.{
33 .Enum = .{
4 .layout = .Auto,
54 .tag_type = u32,
65 .fields = &.{
76 .{ .name = "A", .value = 0 },
test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig-1
......@@ -1,7 +1,6 @@
11export fn entry() void {
22 _ = @Type(.{
33 .Enum = .{
4 .layout = .Auto,
54 .tag_type = u32,
65 .fields = &.{
76 .{ .name = "A", .value = 10 },
test/cases/compile_errors/reify_struct.zig+5-5
......@@ -3,7 +3,7 @@ comptime {
33 .layout = .Auto,
44 .fields = &.{.{
55 .name = "foo",
6 .field_type = u32,
6 .type = u32,
77 .default_value = null,
88 .is_comptime = false,
99 .alignment = 4,
......@@ -17,7 +17,7 @@ comptime {
1717 .layout = .Auto,
1818 .fields = &.{.{
1919 .name = "3",
20 .field_type = u32,
20 .type = u32,
2121 .default_value = null,
2222 .is_comptime = false,
2323 .alignment = 4,
......@@ -31,7 +31,7 @@ comptime {
3131 .layout = .Auto,
3232 .fields = &.{.{
3333 .name = "0",
34 .field_type = u32,
34 .type = u32,
3535 .default_value = null,
3636 .is_comptime = true,
3737 .alignment = 4,
......@@ -45,7 +45,7 @@ comptime {
4545 .layout = .Extern,
4646 .fields = &.{.{
4747 .name = "0",
48 .field_type = u32,
48 .type = u32,
4949 .default_value = null,
5050 .is_comptime = true,
5151 .alignment = 4,
......@@ -59,7 +59,7 @@ comptime {
5959 .layout = .Packed,
6060 .fields = &.{.{
6161 .name = "0",
62 .field_type = u32,
62 .type = u32,
6363 .default_value = null,
6464 .is_comptime = true,
6565 .alignment = 4,
test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig+1-1
......@@ -5,7 +5,7 @@ const Foo = @Type(.{
55 .is_generic = true,
66 .is_var_args = false,
77 .return_type = u0,
8 .args = &.{},
8 .params = &.{},
99 },
1010});
1111comptime { _ = Foo; }
test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig+1-1
......@@ -5,7 +5,7 @@ const Foo = @Type(.{
55 .is_generic = false,
66 .is_var_args = true,
77 .return_type = u0,
8 .args = &.{},
8 .params = &.{},
99 },
1010});
1111comptime { _ = Foo; }
test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig+1-1
......@@ -5,7 +5,7 @@ const Foo = @Type(.{
55 .is_generic = false,
66 .is_var_args = false,
77 .return_type = null,
8 .args = &.{},
8 .params = &.{},
99 },
1010});
1111comptime { _ = Foo; }
test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig-1
......@@ -1,6 +1,5 @@
11const Tag = @Type(.{
22 .Enum = .{
3 .layout = .Auto,
43 .tag_type = bool,
54 .fields = &.{},
65 .decls = &.{},
test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig-1
......@@ -1,6 +1,5 @@
11const Tag = @Type(.{
22 .Enum = .{
3 .layout = .Auto,
43 .tag_type = undefined,
54 .fields = &.{},
65 .decls = &.{},
test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig+3-4
......@@ -1,6 +1,5 @@
11const Tag = @Type(.{
22 .Enum = .{
3 .layout = .Auto,
43 .tag_type = u2,
54 .fields = &.{
65 .{ .name = "signed", .value = 0 },
......@@ -16,8 +15,8 @@ const Tagged = @Type(.{
1615 .layout = .Auto,
1716 .tag_type = Tag,
1817 .fields = &.{
19 .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
20 .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
18 .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
19 .{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
2120 },
2221 .decls = &.{},
2322 },
......@@ -31,6 +30,6 @@ export fn entry() void {
3130// backend=stage2
3231// target=native
3332//
34// :14:16: error: enum field(s) missing in union
33// :13:16: error: enum field(s) missing in union
3534// :1:13: note: field 'arst' missing, declared here
3635// :1:13: note: enum declared here
test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig+4-5
......@@ -1,6 +1,5 @@
11const Tag = @Type(.{
22 .Enum = .{
3 .layout = .Auto,
43 .tag_type = u1,
54 .fields = &.{
65 .{ .name = "signed", .value = 0 },
......@@ -15,9 +14,9 @@ const Tagged = @Type(.{
1514 .layout = .Auto,
1615 .tag_type = Tag,
1716 .fields = &.{
18 .{ .name = "signed", .field_type = i32, .alignment = @alignOf(i32) },
19 .{ .name = "unsigned", .field_type = u32, .alignment = @alignOf(u32) },
20 .{ .name = "arst", .field_type = f32, .alignment = @alignOf(f32) },
17 .{ .name = "signed", .type = i32, .alignment = @alignOf(i32) },
18 .{ .name = "unsigned", .type = u32, .alignment = @alignOf(u32) },
19 .{ .name = "arst", .type = f32, .alignment = @alignOf(f32) },
2120 },
2221 .decls = &.{},
2322 },
......@@ -31,5 +30,5 @@ export fn entry() void {
3130// backend=stage2
3231// target=native
3332//
34// :13:16: error: no field named 'arst' in enum 'tmp.Tag'
33// :12:16: error: no field named 'arst' in enum 'tmp.Tag'
3534// :1:13: note: enum declared here
test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig+2-2
......@@ -3,7 +3,7 @@ const Untagged = @Type(.{
33 .layout = .Auto,
44 .tag_type = null,
55 .fields = &.{
6 .{ .name = "foo", .field_type = opaque {}, .alignment = 1 },
6 .{ .name = "foo", .type = opaque {}, .alignment = 1 },
77 },
88 .decls = &.{},
99 },
......@@ -17,4 +17,4 @@ export fn entry() usize {
1717// target=native
1818//
1919// :1:18: error: opaque types have unknown size and therefore cannot be directly embedded in unions
20// :6:45: note: opaque declared here
20// :6:39: note: opaque declared here
test/cases/fn_typeinfo_passed_to_comptime_fn.zig+1-1
......@@ -9,7 +9,7 @@ fn someFn(arg: ?*c_int) f64 {
99 return 8;
1010}
1111fn foo(comptime info: std.builtin.Type) !void {
12 try std.testing.expect(info.Fn.args[0].arg_type.? == ?*c_int);
12 try std.testing.expect(info.Fn.params[0].type.? == ?*c_int);
1313}
1414
1515// run