authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-08-28 10:49:31-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-08-28 10:49:31-07:00
log31fef6f1103ea64a899729adea13b0ab9b66cb46
tree31c13b06483af84cd0977be8de00d3539e3e3c4d
parent9a12905a2da045b0948f612583b526bca3a1b2f0
parentaaa7e739831f39151a37c7beb08660f0fb6ae0ed
signaturebadge-check Signed by PGP key B5690EEEBB952194

Merge pull request #21225 from mlugg/std-builtin-type

std: update `std.builtin.Type` fields to follow naming conventions

336 files changed, 4119 insertions(+), 4118 deletions(-)

doc/langref.html.in+12-12
......@@ -4299,7 +4299,7 @@ comptime {
42994299 Asserts that {#syntax#}@sizeOf(@TypeOf(value)) == @sizeOf(DestType){#endsyntax#}.
43004300 </p>
43014301 <p>
4302 Asserts that {#syntax#}@typeInfo(DestType) != .Pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@ptrFromInt{#endsyntax#} if you need this.
4302 Asserts that {#syntax#}@typeInfo(DestType) != .pointer{#endsyntax#}. Use {#syntax#}@ptrCast{#endsyntax#} or {#syntax#}@ptrFromInt{#endsyntax#} if you need this.
43034303 </p>
43044304 <p>
43054305 Can be used for these things for example:
......@@ -4517,7 +4517,7 @@ comptime {
45174517 {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float,
45184518 an integer or an enum.
45194519 </p>
4520 <p>{#syntax#}@typeInfo(@TypeOf(ptr)).Pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}</p>
4520 <p>{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}</p>
45214521 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.</p>
45224522 {#see_also|@atomicStore|@atomicLoad|@atomicRmw|@fence|@cmpxchgWeak#}
45234523 {#header_close#}
......@@ -4549,7 +4549,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
45494549 {#syntax#}T{#endsyntax#} must be a pointer, a {#syntax#}bool{#endsyntax#}, a float,
45504550 an integer or an enum.
45514551 </p>
4552 <p>{#syntax#}@typeInfo(@TypeOf(ptr)).Pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}</p>
4552 <p>{#syntax#}@typeInfo(@TypeOf(ptr)).pointer.alignment{#endsyntax#} must be {#syntax#}>= @sizeOf(T).{#endsyntax#}</p>
45534553 <p>{#syntax#}AtomicOrder{#endsyntax#} can be found with {#syntax#}@import("std").builtin.AtomicOrder{#endsyntax#}.</p>
45544554 {#see_also|@atomicStore|@atomicLoad|@atomicRmw|@fence|@cmpxchgStrong#}
45554555 {#header_close#}
......@@ -4672,7 +4672,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
46724672 <p>
46734673 Floored division. Rounds toward negative infinity. For unsigned integers it is
46744674 the same as {#syntax#}numerator / denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#} and
4675 {#syntax#}!(@typeInfo(T) == .Int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
4675 {#syntax#}!(@typeInfo(T) == .int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
46764676 </p>
46774677 <ul>
46784678 <li>{#syntax#}@divFloor(-5, 3) == -2{#endsyntax#}</li>
......@@ -4686,7 +4686,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
46864686 <p>
46874687 Truncated division. Rounds toward zero. For unsigned integers it is
46884688 the same as {#syntax#}numerator / denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#} and
4689 {#syntax#}!(@typeInfo(T) == .Int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
4689 {#syntax#}!(@typeInfo(T) == .int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
46904690 </p>
46914691 <ul>
46924692 <li>{#syntax#}@divTrunc(-5, 3) == -1{#endsyntax#}</li>
......@@ -5320,8 +5320,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
53205320 any bits that disagree with the resultant sign bit are shifted out.
53215321 </p>
53225322 <p>
5323 The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).Int.bits){#endsyntax#} bits.
5324 This is because {#syntax#}shift_amt >= @typeInfo(T).Int.bits{#endsyntax#} is undefined behavior.
5323 The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).int.bits){#endsyntax#} bits.
5324 This is because {#syntax#}shift_amt >= @typeInfo(T).int.bits{#endsyntax#} is undefined behavior.
53255325 </p>
53265326 <p>
53275327 {#syntax#}comptime_int{#endsyntax#} is modeled as an integer with an infinite number of bits,
......@@ -5337,8 +5337,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
53375337 Performs {#syntax#}a << b{#endsyntax#} and returns a tuple with the result and a possible overflow bit.
53385338 </p>
53395339 <p>
5340 The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(@TypeOf(a)).Int.bits){#endsyntax#} bits.
5341 This is because {#syntax#}shift_amt >= @typeInfo(@TypeOf(a)).Int.bits{#endsyntax#} is undefined behavior.
5340 The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(@TypeOf(a)).int.bits){#endsyntax#} bits.
5341 This is because {#syntax#}shift_amt >= @typeInfo(@TypeOf(a)).int.bits{#endsyntax#} is undefined behavior.
53425342 </p>
53435343 {#see_also|@shlExact|@shrExact#}
53445344 {#header_close#}
......@@ -5350,8 +5350,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
53505350 that the shift will not shift any 1 bits out.
53515351 </p>
53525352 <p>
5353 The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).Int.bits){#endsyntax#} bits.
5354 This is because {#syntax#}shift_amt >= @typeInfo(T).Int.bits{#endsyntax#} is undefined behavior.
5353 The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).int.bits){#endsyntax#} bits.
5354 This is because {#syntax#}shift_amt >= @typeInfo(T).int.bits{#endsyntax#} is undefined behavior.
53555355 </p>
53565356 {#see_also|@shlExact|@shlWithOverflow#}
53575357 {#header_close#}
......@@ -5405,7 +5405,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
54055405 This size may contain padding bytes. If there were two consecutive T in memory, the padding would be the offset
54065406 in bytes between element at index 0 and the element at index 1. For {#link|integer|Integers#},
54075407 consider whether you want to use {#syntax#}@sizeOf(T){#endsyntax#} or
5408 {#syntax#}@typeInfo(T).Int.bits{#endsyntax#}.
5408 {#syntax#}@typeInfo(T).int.bits{#endsyntax#}.
54095409 </p>
54105410 <p>
54115411 This function measures the size at runtime. For types that are disallowed at runtime, such as
doc/langref/inline_prong_range.zig+2-2
......@@ -1,7 +1,7 @@
11fn isFieldOptional(comptime T: type, field_index: usize) !bool {
2 const fields = @typeInfo(T).Struct.fields;
2 const fields = @typeInfo(T).@"struct".fields;
33 return switch (field_index) {
4 inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].type) == .Optional,
4 inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].type) == .optional,
55 else => return error.IndexOutOfBounds,
66 };
77}
doc/langref/poc_printValue_fn.zig+3-3
......@@ -1,13 +1,13 @@
11const Writer = struct {
22 pub fn printValue(self: *Writer, value: anytype) !void {
33 switch (@typeInfo(@TypeOf(value))) {
4 .Int => {
4 .int => {
55 return self.writeInt(value);
66 },
7 .Float => {
7 .float => {
88 return self.writeFloat(value);
99 },
10 .Pointer => {
10 .pointer => {
1111 return self.write(value);
1212 },
1313 else => {
doc/langref/test_enums.zig+3-3
......@@ -95,13 +95,13 @@ const Small = enum {
9595 four,
9696};
9797test "std.meta.Tag" {
98 try expect(@typeInfo(Small).Enum.tag_type == u2);
98 try expect(@typeInfo(Small).@"enum".tag_type == u2);
9999}
100100
101101// @typeInfo tells us the field count and the fields names:
102102test "@typeInfo" {
103 try expect(@typeInfo(Small).Enum.fields.len == 4);
104 try expect(mem.eql(u8, @typeInfo(Small).Enum.fields[1].name, "two"));
103 try expect(@typeInfo(Small).@"enum".fields.len == 4);
104 try expect(mem.eql(u8, @typeInfo(Small).@"enum".fields[1].name, "two"));
105105}
106106
107107// @tagName gives a [:0]const u8 representation of an enum value:
doc/langref/test_error_union.zig+2-2
......@@ -10,10 +10,10 @@ test "error union" {
1010 foo = error.SomeError;
1111
1212 // Use compile-time reflection to access the payload type of an error union:
13 try comptime expect(@typeInfo(@TypeOf(foo)).ErrorUnion.payload == i32);
13 try comptime expect(@typeInfo(@TypeOf(foo)).error_union.payload == i32);
1414
1515 // Use compile-time reflection to access the error set type of an error union:
16 try comptime expect(@typeInfo(@TypeOf(foo)).ErrorUnion.error_set == anyerror);
16 try comptime expect(@typeInfo(@TypeOf(foo)).error_union.error_set == anyerror);
1717}
1818
1919// test
doc/langref/test_fn_reflection.zig+3-3
......@@ -3,10 +3,10 @@ const math = std.math;
33const testing = std.testing;
44
55test "fn reflection" {
6 try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.params[0].type.? == bool);
7 try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).Fn.return_type.? == testing.TmpDir);
6 try testing.expect(@typeInfo(@TypeOf(testing.expect)).@"fn".params[0].type.? == bool);
7 try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).@"fn".return_type.? == testing.TmpDir);
88
9 try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).Fn.is_generic);
9 try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).@"fn".is_generic);
1010}
1111
1212// test
doc/langref/test_inline_else.zig+2-2
......@@ -17,8 +17,8 @@ const AnySlice = union(enum) {
1717};
1818
1919fn withFor(any: AnySlice) usize {
20 const Tag = @typeInfo(AnySlice).Union.tag_type.?;
21 inline for (@typeInfo(Tag).Enum.fields) |field| {
20 const Tag = @typeInfo(AnySlice).@"union".tag_type.?;
21 inline for (@typeInfo(Tag).@"enum".fields) |field| {
2222 // With `inline for` the function gets generated as
2323 // a series of `if` statements relying on the optimizer
2424 // to convert it to a switch.
doc/langref/test_inline_switch.zig+2-2
......@@ -3,11 +3,11 @@ const expect = std.testing.expect;
33const expectError = std.testing.expectError;
44
55fn isFieldOptional(comptime T: type, field_index: usize) !bool {
6 const fields = @typeInfo(T).Struct.fields;
6 const fields = @typeInfo(T).@"struct".fields;
77 return switch (field_index) {
88 // This prong is analyzed twice with `idx` being a
99 // comptime-known value each time.
10 inline 0, 1 => |idx| @typeInfo(fields[idx].type) == .Optional,
10 inline 0, 1 => |idx| @typeInfo(fields[idx].type) == .optional,
1111 else => return error.IndexOutOfBounds,
1212 };
1313}
doc/langref/test_optional_type.zig+1-1
......@@ -8,7 +8,7 @@ test "optional type" {
88 foo = 1234;
99
1010 // Use compile-time reflection to access the child type of the optional:
11 try comptime expect(@typeInfo(@TypeOf(foo)).Optional.child == i32);
11 try comptime expect(@typeInfo(@TypeOf(foo)).optional.child == i32);
1212}
1313
1414// test
doc/langref/test_pointer_casting.zig+1-1
......@@ -17,7 +17,7 @@ test "pointer casting" {
1717
1818test "pointer child type" {
1919 // pointer types have a `child` field which tells you the type they point to.
20 try expect(@typeInfo(*u32).Pointer.child == u32);
20 try expect(@typeInfo(*u32).pointer.child == u32);
2121}
2222
2323// test
doc/langref/test_variable_alignment.zig+1-1
......@@ -8,7 +8,7 @@ test "variable alignment" {
88 try expect(@TypeOf(&x) == *i32);
99 try expect(*i32 == *align(align_of_i32) i32);
1010 if (builtin.target.cpu.arch == .x86_64) {
11 try expect(@typeInfo(*i32).Pointer.alignment == 4);
11 try expect(@typeInfo(*i32).pointer.alignment == 4);
1212 }
1313}
1414
doc/langref/test_variable_func_alignment.zig+1-1
......@@ -3,7 +3,7 @@ const expect = @import("std").testing.expect;
33var foo: u8 align(4) = 100;
44
55test "global variable alignment" {
6 try expect(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4);
6 try expect(@typeInfo(@TypeOf(&foo)).pointer.alignment == 4);
77 try expect(@TypeOf(&foo) == *align(4) u8);
88 const as_pointer_to_array: *align(4) [1]u8 = &foo;
99 const as_slice: []align(4) u8 = as_pointer_to_array;
doc/langref/test_variadic_function.zig+1-1
......@@ -5,7 +5,7 @@ pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
55
66test "variadic function" {
77 try testing.expect(printf("Hello, world!\n") == 14);
8 try testing.expect(@typeInfo(@TypeOf(printf)).Fn.is_var_args);
8 try testing.expect(@typeInfo(@TypeOf(printf)).@"fn".is_var_args);
99}
1010
1111// test
lib/compiler/aro/aro/Attribute.zig+14-14
......@@ -67,7 +67,7 @@ pub fn requiredArgCount(attr: Tag) u32 {
6767 comptime {
6868 const fields = std.meta.fields(@field(attributes, @tagName(tag)));
6969 for (fields) |arg_field| {
70 if (!mem.eql(u8, arg_field.name, "__name_tok") and @typeInfo(arg_field.type) != .Optional) needed += 1;
70 if (!mem.eql(u8, arg_field.name, "__name_tok") and @typeInfo(arg_field.type) != .optional) needed += 1;
7171 }
7272 }
7373 return needed;
......@@ -93,7 +93,7 @@ pub fn maxArgCount(attr: Tag) u32 {
9393
9494fn UnwrapOptional(comptime T: type) type {
9595 return switch (@typeInfo(T)) {
96 .Optional => |optional| optional.child,
96 .optional => |optional| optional.child,
9797 else => T,
9898 };
9999}
......@@ -110,7 +110,7 @@ pub const Formatting = struct {
110110
111111 if (fields.len == 0) unreachable;
112112 const Unwrapped = UnwrapOptional(fields[0].type);
113 if (@typeInfo(Unwrapped) != .Enum) unreachable;
113 if (@typeInfo(Unwrapped) != .@"enum") unreachable;
114114
115115 return if (Unwrapped.opts.enum_kind == .identifier) "'" else "\"";
116116 },
......@@ -127,9 +127,9 @@ pub const Formatting = struct {
127127
128128 if (fields.len == 0) unreachable;
129129 const Unwrapped = UnwrapOptional(fields[0].type);
130 if (@typeInfo(Unwrapped) != .Enum) unreachable;
130 if (@typeInfo(Unwrapped) != .@"enum") unreachable;
131131
132 const enum_fields = @typeInfo(Unwrapped).Enum.fields;
132 const enum_fields = @typeInfo(Unwrapped).@"enum".fields;
133133 @setEvalBranchQuota(3000);
134134 const quote = comptime quoteChar(@enumFromInt(@intFromEnum(tag)));
135135 comptime var values: []const u8 = quote ++ enum_fields[0].name ++ quote;
......@@ -152,7 +152,7 @@ pub fn wantsIdentEnum(attr: Tag) bool {
152152
153153 if (fields.len == 0) return false;
154154 const Unwrapped = UnwrapOptional(fields[0].type);
155 if (@typeInfo(Unwrapped) != .Enum) return false;
155 if (@typeInfo(Unwrapped) != .@"enum") return false;
156156
157157 return Unwrapped.opts.enum_kind == .identifier;
158158 },
......@@ -165,7 +165,7 @@ pub fn diagnoseIdent(attr: Tag, arguments: *Arguments, ident: []const u8) ?Diagn
165165 const fields = std.meta.fields(@field(attributes, @tagName(tag)));
166166 if (fields.len == 0) unreachable;
167167 const Unwrapped = UnwrapOptional(fields[0].type);
168 if (@typeInfo(Unwrapped) != .Enum) unreachable;
168 if (@typeInfo(Unwrapped) != .@"enum") unreachable;
169169 if (std.meta.stringToEnum(Unwrapped, normalize(ident))) |enum_val| {
170170 @field(@field(arguments, @tagName(tag)), fields[0].name) = enum_val;
171171 return null;
......@@ -239,7 +239,7 @@ fn diagnoseField(
239239 const key = p.comp.interner.get(res.val.ref());
240240 switch (key) {
241241 .int => {
242 if (@typeInfo(Wanted) == .Int) {
242 if (@typeInfo(Wanted) == .int) {
243243 @field(@field(arguments, decl.name), field.name) = res.val.toInt(Wanted, p.comp) orelse return .{
244244 .tag = .attribute_int_out_of_range,
245245 .extra = .{ .str = try res.str(p) },
......@@ -258,7 +258,7 @@ fn diagnoseField(
258258 }
259259 @field(@field(arguments, decl.name), field.name) = try p.removeNull(res.val);
260260 return null;
261 } else if (@typeInfo(Wanted) == .Enum and @hasDecl(Wanted, "opts") and Wanted.opts.enum_kind == .string) {
261 } else if (@typeInfo(Wanted) == .@"enum" and @hasDecl(Wanted, "opts") and Wanted.opts.enum_kind == .string) {
262262 const str = bytes[0 .. bytes.len - 1];
263263 if (std.meta.stringToEnum(Wanted, str)) |enum_val| {
264264 @field(@field(arguments, decl.name), field.name) = enum_val;
......@@ -293,7 +293,7 @@ fn invalidArgMsg(comptime Expected: type, actual: ArgumentType) Diagnostics.Mess
293293 Alignment => .alignment,
294294 CallingConvention => .identifier,
295295 else => switch (@typeInfo(Expected)) {
296 .Enum => if (Expected.opts.enum_kind == .string) .string else .identifier,
296 .@"enum" => if (Expected.opts.enum_kind == .string) .string else .identifier,
297297 else => unreachable,
298298 },
299299 }, .actual = actual } },
......@@ -303,7 +303,7 @@ fn invalidArgMsg(comptime Expected: type, actual: ArgumentType) Diagnostics.Mess
303303pub fn diagnose(attr: Tag, arguments: *Arguments, arg_idx: u32, res: Parser.Result, node: Tree.Node, p: *Parser) !?Diagnostics.Message {
304304 switch (attr) {
305305 inline else => |tag| {
306 const decl = @typeInfo(attributes).Struct.decls[@intFromEnum(tag)];
306 const decl = @typeInfo(attributes).@"struct".decls[@intFromEnum(tag)];
307307 const max_arg_count = comptime maxArgCount(tag);
308308 if (arg_idx >= max_arg_count) return Diagnostics.Message{
309309 .tag = .attribute_too_many_args,
......@@ -641,7 +641,7 @@ const attributes = struct {
641641pub const Tag = std.meta.DeclEnum(attributes);
642642
643643pub const Arguments = blk: {
644 const decls = @typeInfo(attributes).Struct.decls;
644 const decls = @typeInfo(attributes).@"struct".decls;
645645 var union_fields: [decls.len]ZigType.UnionField = undefined;
646646 for (decls, &union_fields) |decl, *field| {
647647 field.* = .{
......@@ -652,7 +652,7 @@ pub const Arguments = blk: {
652652 }
653653
654654 break :blk @Type(.{
655 .Union = .{
655 .@"union" = .{
656656 .layout = .auto,
657657 .tag_type = null,
658658 .fields = &union_fields,
......@@ -662,7 +662,7 @@ pub const Arguments = blk: {
662662};
663663
664664pub fn ArgumentsForTag(comptime tag: Tag) type {
665 const decl = @typeInfo(attributes).Struct.decls[@intFromEnum(tag)];
665 const decl = @typeInfo(attributes).@"struct".decls[@intFromEnum(tag)];
666666 return @field(attributes, decl.name);
667667}
668668
lib/compiler/aro/aro/Compilation.zig+2-2
......@@ -61,7 +61,7 @@ pub const Environment = struct {
6161 var env: Environment = .{};
6262 errdefer env.deinit(allocator);
6363
64 inline for (@typeInfo(@TypeOf(env)).Struct.fields) |field| {
64 inline for (@typeInfo(@TypeOf(env)).@"struct".fields) |field| {
6565 std.debug.assert(@field(env, field.name) == null);
6666
6767 var env_var_buf: [field.name.len]u8 = undefined;
......@@ -78,7 +78,7 @@ pub const Environment = struct {
7878
7979 /// Use this only if environment slices were allocated with `allocator` (such as via `loadAll`)
8080 pub fn deinit(self: *Environment, allocator: std.mem.Allocator) void {
81 inline for (@typeInfo(@TypeOf(self.*)).Struct.fields) |field| {
81 inline for (@typeInfo(@TypeOf(self.*)).@"struct".fields) |field| {
8282 if (@field(self, field.name)) |slice| {
8383 allocator.free(slice);
8484 }
lib/compiler/aro/aro/Tree.zig+2-2
......@@ -707,7 +707,7 @@ fn dumpAttribute(tree: *const Tree, attr: Attribute, writer: anytype) !void {
707707 switch (attr.tag) {
708708 inline else => |tag| {
709709 const args = @field(attr.args, @tagName(tag));
710 const fields = @typeInfo(@TypeOf(args)).Struct.fields;
710 const fields = @typeInfo(@TypeOf(args)).@"struct".fields;
711711 if (fields.len == 0) {
712712 try writer.writeByte('\n');
713713 return;
......@@ -724,7 +724,7 @@ fn dumpAttribute(tree: *const Tree, attr: Attribute, writer: anytype) !void {
724724 Interner.Ref => try writer.print("\"{s}\"", .{tree.interner.get(@field(args, f.name)).bytes}),
725725 ?Interner.Ref => try writer.print("\"{?s}\"", .{if (@field(args, f.name)) |str| tree.interner.get(str).bytes else null}),
726726 else => switch (@typeInfo(f.type)) {
727 .Enum => try writer.writeAll(@tagName(@field(args, f.name))),
727 .@"enum" => try writer.writeAll(@tagName(@field(args, f.name))),
728728 else => try writer.print("{any}", .{@field(args, f.name)}),
729729 },
730730 }
lib/compiler/aro/aro/Value.zig+1-1
......@@ -24,7 +24,7 @@ pub fn intern(comp: *Compilation, k: Interner.Key) !Value {
2424
2525pub fn int(i: anytype, comp: *Compilation) !Value {
2626 const info = @typeInfo(@TypeOf(i));
27 if (info == .ComptimeInt or info.Int.signedness == .unsigned) {
27 if (info == .comptime_int or info.int.signedness == .unsigned) {
2828 return intern(comp, .{ .int = .{ .u64 = i } });
2929 } else {
3030 return intern(comp, .{ .int = .{ .i64 = i } });
lib/compiler/aro/backend/Interner.zig+4-4
......@@ -505,7 +505,7 @@ pub fn put(i: *Interner, gpa: Allocator, key: Key) !Ref {
505505 });
506506 },
507507 .record_ty => |elems| {
508 try i.extra.ensureUnusedCapacity(gpa, @typeInfo(Tag.Record).Struct.fields.len +
508 try i.extra.ensureUnusedCapacity(gpa, @typeInfo(Tag.Record).@"struct".fields.len +
509509 elems.len);
510510 i.items.appendAssumeCapacity(.{
511511 .tag = .record_ty,
......@@ -527,14 +527,14 @@ pub fn put(i: *Interner, gpa: Allocator, key: Key) !Ref {
527527}
528528
529529fn addExtra(i: *Interner, gpa: Allocator, extra: anytype) Allocator.Error!u32 {
530 const fields = @typeInfo(@TypeOf(extra)).Struct.fields;
530 const fields = @typeInfo(@TypeOf(extra)).@"struct".fields;
531531 try i.extra.ensureUnusedCapacity(gpa, fields.len);
532532 return i.addExtraAssumeCapacity(extra);
533533}
534534
535535fn addExtraAssumeCapacity(i: *Interner, extra: anytype) u32 {
536536 const result = @as(u32, @intCast(i.extra.items.len));
537 inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
537 inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
538538 i.extra.appendAssumeCapacity(switch (field.type) {
539539 Ref => @intFromEnum(@field(extra, field.name)),
540540 u32 => @field(extra, field.name),
......@@ -631,7 +631,7 @@ fn extraData(i: *const Interner, comptime T: type, index: usize) T {
631631
632632fn extraDataTrail(i: *const Interner, comptime T: type, index: usize) struct { data: T, end: u32 } {
633633 var result: T = undefined;
634 const fields = @typeInfo(T).Struct.fields;
634 const fields = @typeInfo(T).@"struct".fields;
635635 inline for (fields, 0..) |field, field_i| {
636636 const int32 = i.extra.items[field_i + index];
637637 @field(result, field.name) = switch (field.type) {
lib/compiler/aro_translate_c.zig+1-1
......@@ -168,7 +168,7 @@ pub fn translate(
168168 context.pattern_list.deinit(gpa);
169169 }
170170
171 inline for (@typeInfo(std.zig.c_builtins).Struct.decls) |decl| {
171 inline for (@typeInfo(std.zig.c_builtins).@"struct".decls) |decl| {
172172 const builtin_fn = try ZigTag.pub_var_simple.create(arena, .{
173173 .name = decl.name,
174174 .init = try ZigTag.import_c_builtin.create(arena, decl.name),
lib/compiler/resinator/bmp.zig+1-1
......@@ -224,7 +224,7 @@ pub const Compression = enum(u32) {
224224};
225225
226226fn structFieldsLittleToNative(comptime T: type, x: *T) void {
227 inline for (@typeInfo(T).Struct.fields) |field| {
227 inline for (@typeInfo(T).@"struct".fields) |field| {
228228 @field(x, field.name) = std.mem.littleToNative(field.type, @field(x, field.name));
229229 }
230230}
lib/compiler/resinator/code_pages.zig+1-1
......@@ -259,7 +259,7 @@ pub const CodePage = enum(u16) {
259259 pub fn getByIdentifier(identifier: u16) !CodePage {
260260 // There's probably a more efficient way to do this (e.g. ComptimeHashMap?) but
261261 // this should be fine, especially since this function likely won't be called much.
262 inline for (@typeInfo(CodePage).Enum.fields) |enumField| {
262 inline for (@typeInfo(CodePage).@"enum".fields) |enumField| {
263263 if (identifier == enumField.value) {
264264 return @field(CodePage, enumField.name);
265265 }
lib/compiler/resinator/errors.zig+1-1
......@@ -250,7 +250,7 @@ pub const ErrorDetails = struct {
250250 });
251251
252252 pub fn writeCommaSeparated(self: ExpectedTypes, writer: anytype) !void {
253 const struct_info = @typeInfo(ExpectedTypes).Struct;
253 const struct_info = @typeInfo(ExpectedTypes).@"struct";
254254 const num_real_fields = struct_info.fields.len - 1;
255255 const num_padding_bits = @bitSizeOf(ExpectedTypes) - num_real_fields;
256256 const mask = std.math.maxInt(struct_info.backing_integer.?) >> num_padding_bits;
lib/compiler/resinator/ico.zig+1-1
......@@ -14,7 +14,7 @@ pub fn read(allocator: std.mem.Allocator, reader: anytype, max_size: u64) ReadEr
1414 // Some Reader implementations have an empty ReadError error set which would
1515 // cause 'unreachable else' if we tried to use an else in the switch, so we
1616 // need to detect this case and not try to translate to ReadError
17 const empty_reader_errorset = @typeInfo(@TypeOf(reader).Error).ErrorSet == null or @typeInfo(@TypeOf(reader).Error).ErrorSet.?.len == 0;
17 const empty_reader_errorset = @typeInfo(@TypeOf(reader).Error).error_set == null or @typeInfo(@TypeOf(reader).Error).error_set.?.len == 0;
1818 if (empty_reader_errorset) {
1919 return readAnyError(allocator, reader, max_size) catch |err| switch (err) {
2020 error.EndOfStream => error.UnexpectedEOF,
lib/compiler/resinator/lang.zig+1-1
......@@ -87,7 +87,7 @@ pub fn tagToId(tag: []const u8) error{InvalidLanguageTag}!?LanguageId {
8787 if (parsed.multiple_suffixes) return null;
8888 const longest_known_tag = comptime blk: {
8989 var len = 0;
90 for (@typeInfo(LanguageId).Enum.fields) |field| {
90 for (@typeInfo(LanguageId).@"enum".fields) |field| {
9191 if (field.name.len > len) len = field.name.len;
9292 }
9393 break :blk len;
lib/compiler/test_runner.zig+1-1
......@@ -265,7 +265,7 @@ fn mainTerminal() void {
265265
266266pub fn log(
267267 comptime message_level: std.log.Level,
268 comptime scope: @Type(.EnumLiteral),
268 comptime scope: @Type(.enum_literal),
269269 comptime format: []const u8,
270270 args: anytype,
271271) void {
lib/compiler_rt/addf3.zig+1-1
......@@ -7,7 +7,7 @@ const normalize = common.normalize;
77///
88/// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/lib/builtins/fp_add_impl.inc
99pub inline fn addf3(comptime T: type, a: T, b: T) T {
10 const bits = @typeInfo(T).Float.bits;
10 const bits = @typeInfo(T).float.bits;
1111 const Z = std.meta.Int(.unsigned, bits);
1212
1313 const typeWidth = bits;
lib/compiler_rt/ceil.zig+1-1
......@@ -130,7 +130,7 @@ pub fn ceilq(x: f128) callconv(.C) f128 {
130130}
131131
132132pub fn ceill(x: c_longdouble) callconv(.C) c_longdouble {
133 switch (@typeInfo(c_longdouble).Float.bits) {
133 switch (@typeInfo(c_longdouble).float.bits) {
134134 16 => return __ceilh(x),
135135 32 => return ceilf(x),
136136 64 => return ceil(x),
lib/compiler_rt/common.zig+5-5
......@@ -219,8 +219,8 @@ pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void {
219219 }
220220}
221221
222pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).Float.bits)) i32 {
223 const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
222pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 {
223 const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
224224 const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);
225225
226226 const shift = @clz(significand.*) - @clz(integerBit);
......@@ -230,8 +230,8 @@ pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeIn
230230
231231pub inline fn fneg(a: anytype) @TypeOf(a) {
232232 const F = @TypeOf(a);
233 const bits = @typeInfo(F).Float.bits;
234 const U = @Type(.{ .Int = .{
233 const bits = @typeInfo(F).float.bits;
234 const U = @Type(.{ .int = .{
235235 .signedness = .unsigned,
236236 .bits = bits,
237237 } });
......@@ -244,7 +244,7 @@ pub inline fn fneg(a: anytype) @TypeOf(a) {
244244/// signed or unsigned integers.
245245pub fn HalveInt(comptime T: type, comptime signed_half: bool) type {
246246 return extern union {
247 pub const bits = @divExact(@typeInfo(T).Int.bits, 2);
247 pub const bits = @divExact(@typeInfo(T).int.bits, 2);
248248 pub const HalfTU = std.meta.Int(.unsigned, bits);
249249 pub const HalfTS = std.meta.Int(.signed, bits);
250250 pub const HalfT = if (signed_half) HalfTS else HalfTU;
lib/compiler_rt/comparef.zig+2-2
......@@ -17,7 +17,7 @@ pub const GE = enum(i32) {
1717};
1818
1919pub inline fn cmpf2(comptime T: type, comptime RT: type, a: T, b: T) RT {
20 const bits = @typeInfo(T).Float.bits;
20 const bits = @typeInfo(T).float.bits;
2121 const srep_t = std.meta.Int(.signed, bits);
2222 const rep_t = std.meta.Int(.unsigned, bits);
2323
......@@ -109,7 +109,7 @@ test "cmp_f80" {
109109}
110110
111111pub inline fn unordcmp(comptime T: type, a: T, b: T) i32 {
112 const rep_t = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
112 const rep_t = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
113113
114114 const significandBits = std.math.floatMantissaBits(T);
115115 const exponentBits = std.math.floatExponentBits(T);
lib/compiler_rt/cos.zig+1-1
......@@ -124,7 +124,7 @@ pub fn cosq(a: f128) callconv(.C) f128 {
124124}
125125
126126pub fn cosl(x: c_longdouble) callconv(.C) c_longdouble {
127 switch (@typeInfo(c_longdouble).Float.bits) {
127 switch (@typeInfo(c_longdouble).float.bits) {
128128 16 => return __cosh(x),
129129 32 => return cosf(x),
130130 64 => return cos(x),
lib/compiler_rt/count0bits.zig+1-1
......@@ -203,7 +203,7 @@ pub fn __ctzti2(a: i128) callconv(.C) i32 {
203203}
204204
205205inline fn ffsXi2(comptime T: type, a: T) i32 {
206 var x: std.meta.Int(.unsigned, @typeInfo(T).Int.bits) = @bitCast(a);
206 var x: std.meta.Int(.unsigned, @typeInfo(T).int.bits) = @bitCast(a);
207207 var n: T = 1;
208208 // adapted from Number of trailing zeroes (see ctzXi2)
209209 var mask: @TypeOf(x) = std.math.maxInt(@TypeOf(x));
lib/compiler_rt/exp.zig+1-1
......@@ -201,7 +201,7 @@ pub fn expq(a: f128) callconv(.C) f128 {
201201}
202202
203203pub fn expl(x: c_longdouble) callconv(.C) c_longdouble {
204 switch (@typeInfo(c_longdouble).Float.bits) {
204 switch (@typeInfo(c_longdouble).float.bits) {
205205 16 => return __exph(x),
206206 32 => return expf(x),
207207 64 => return exp(x),
lib/compiler_rt/exp2.zig+1-1
......@@ -168,7 +168,7 @@ pub fn exp2q(x: f128) callconv(.C) f128 {
168168}
169169
170170pub fn exp2l(x: c_longdouble) callconv(.C) c_longdouble {
171 switch (@typeInfo(c_longdouble).Float.bits) {
171 switch (@typeInfo(c_longdouble).float.bits) {
172172 16 => return __exp2h(x),
173173 32 => return exp2f(x),
174174 64 => return exp2(x),
lib/compiler_rt/extendf.zig+5-5
......@@ -3,10 +3,10 @@ const std = @import("std");
33pub inline fn extendf(
44 comptime dst_t: type,
55 comptime src_t: type,
6 a: std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits),
6 a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits),
77) dst_t {
8 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits);
9 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).Float.bits);
8 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);
9 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);
1010 const srcSigBits = std.math.floatMantissaBits(src_t);
1111 const dstSigBits = std.math.floatMantissaBits(dst_t);
1212
......@@ -70,8 +70,8 @@ pub inline fn extendf(
7070 return @bitCast(result);
7171}
7272
73pub inline fn extend_f80(comptime src_t: type, a: std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits)) f80 {
74 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits);
73pub inline fn extend_f80(comptime src_t: type, a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits)) f80 {
74 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);
7575 const src_sig_bits = std.math.floatMantissaBits(src_t);
7676 const dst_int_bit = 0x8000000000000000;
7777 const dst_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit
lib/compiler_rt/fabs.zig+2-2
......@@ -38,7 +38,7 @@ pub fn fabsq(a: f128) callconv(.C) f128 {
3838}
3939
4040pub fn fabsl(x: c_longdouble) callconv(.C) c_longdouble {
41 switch (@typeInfo(c_longdouble).Float.bits) {
41 switch (@typeInfo(c_longdouble).float.bits) {
4242 16 => return __fabsh(x),
4343 32 => return fabsf(x),
4444 64 => return fabs(x),
......@@ -50,7 +50,7 @@ pub fn fabsl(x: c_longdouble) callconv(.C) c_longdouble {
5050
5151inline fn generic_fabs(x: anytype) @TypeOf(x) {
5252 const T = @TypeOf(x);
53 const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
53 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
5454 const float_bits: TBits = @bitCast(x);
5555 const remove_sign = ~@as(TBits, 0) >> 1;
5656 return @bitCast(float_bits & remove_sign);
lib/compiler_rt/float_from_int.zig+1-1
......@@ -18,7 +18,7 @@ pub fn floatFromInt(comptime T: type, x: anytype) T {
1818 const max_exp = exp_bias;
1919
2020 // Sign
21 const abs_val = if (@TypeOf(x) == comptime_int or @typeInfo(@TypeOf(x)).Int.signedness == .signed) @abs(x) else x;
21 const abs_val = if (@TypeOf(x) == comptime_int or @typeInfo(@TypeOf(x)).int.signedness == .signed) @abs(x) else x;
2222 const sign_bit = if (x < 0) @as(uT, 1) << (float_bits - 1) else 0;
2323 var result: uT = sign_bit;
2424
lib/compiler_rt/floor.zig+1-1
......@@ -160,7 +160,7 @@ pub fn floorq(x: f128) callconv(.C) f128 {
160160}
161161
162162pub fn floorl(x: c_longdouble) callconv(.C) c_longdouble {
163 switch (@typeInfo(c_longdouble).Float.bits) {
163 switch (@typeInfo(c_longdouble).float.bits) {
164164 16 => return __floorh(x),
165165 32 => return floorf(x),
166166 64 => return floor(x),
lib/compiler_rt/fma.zig+1-1
......@@ -151,7 +151,7 @@ pub fn fmaq(x: f128, y: f128, z: f128) callconv(.C) f128 {
151151}
152152
153153pub fn fmal(x: c_longdouble, y: c_longdouble, z: c_longdouble) callconv(.C) c_longdouble {
154 switch (@typeInfo(c_longdouble).Float.bits) {
154 switch (@typeInfo(c_longdouble).float.bits) {
155155 16 => return __fmah(x, y, z),
156156 32 => return fmaf(x, y, z),
157157 64 => return fma(x, y, z),
lib/compiler_rt/fmax.zig+1-1
......@@ -39,7 +39,7 @@ pub fn fmaxq(x: f128, y: f128) callconv(.C) f128 {
3939}
4040
4141pub fn fmaxl(x: c_longdouble, y: c_longdouble) callconv(.C) c_longdouble {
42 switch (@typeInfo(c_longdouble).Float.bits) {
42 switch (@typeInfo(c_longdouble).float.bits) {
4343 16 => return __fmaxh(x, y),
4444 32 => return fmaxf(x, y),
4545 64 => return fmax(x, y),
lib/compiler_rt/fmin.zig+1-1
......@@ -39,7 +39,7 @@ pub fn fminq(x: f128, y: f128) callconv(.C) f128 {
3939}
4040
4141pub fn fminl(x: c_longdouble, y: c_longdouble) callconv(.C) c_longdouble {
42 switch (@typeInfo(c_longdouble).Float.bits) {
42 switch (@typeInfo(c_longdouble).float.bits) {
4343 16 => return __fminh(x, y),
4444 32 => return fminf(x, y),
4545 64 => return fmin(x, y),
lib/compiler_rt/fmod.zig+2-2
......@@ -251,7 +251,7 @@ pub fn fmodq(a: f128, b: f128) callconv(.C) f128 {
251251}
252252
253253pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.C) c_longdouble {
254 switch (@typeInfo(c_longdouble).Float.bits) {
254 switch (@typeInfo(c_longdouble).float.bits) {
255255 16 => return __fmodh(a, b),
256256 32 => return fmodf(a, b),
257257 64 => return fmod(a, b),
......@@ -262,7 +262,7 @@ pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.C) c_longdouble {
262262}
263263
264264inline fn generic_fmod(comptime T: type, x: T, y: T) T {
265 const bits = @typeInfo(T).Float.bits;
265 const bits = @typeInfo(T).float.bits;
266266 const uint = std.meta.Int(.unsigned, bits);
267267 comptime assert(T == f32 or T == f64);
268268 const digits = if (T == f32) 23 else 52;
lib/compiler_rt/int_from_float.zig+4-4
......@@ -4,8 +4,8 @@ const Log2Int = math.Log2Int;
44
55pub inline fn intFromFloat(comptime I: type, a: anytype) I {
66 const F = @TypeOf(a);
7 const float_bits = @typeInfo(F).Float.bits;
8 const int_bits = @typeInfo(I).Int.bits;
7 const float_bits = @typeInfo(F).float.bits;
8 const int_bits = @typeInfo(I).int.bits;
99 const rep_t = Int(.unsigned, float_bits);
1010 const sig_bits = math.floatMantissaBits(F);
1111 const exp_bits = math.floatExponentBits(F);
......@@ -26,7 +26,7 @@ pub inline fn intFromFloat(comptime I: type, a: anytype) I {
2626 if (exponent < 0) return 0;
2727
2828 // If the value is too large for the integer type, saturate.
29 switch (@typeInfo(I).Int.signedness) {
29 switch (@typeInfo(I).int.signedness) {
3030 .unsigned => {
3131 if (negative) return 0;
3232 if (@as(c_uint, @intCast(exponent)) >= @min(int_bits, max_exp)) return math.maxInt(I);
......@@ -45,7 +45,7 @@ pub inline fn intFromFloat(comptime I: type, a: anytype) I {
4545 result = @as(I, @intCast(significand)) << @intCast(exponent - fractional_bits);
4646 }
4747
48 if ((@typeInfo(I).Int.signedness == .signed) and negative)
48 if ((@typeInfo(I).int.signedness == .signed) and negative)
4949 return ~result +% 1;
5050 return result;
5151}
lib/compiler_rt/log.zig+1-1
......@@ -149,7 +149,7 @@ pub fn logq(a: f128) callconv(.C) f128 {
149149}
150150
151151pub fn logl(x: c_longdouble) callconv(.C) c_longdouble {
152 switch (@typeInfo(c_longdouble).Float.bits) {
152 switch (@typeInfo(c_longdouble).float.bits) {
153153 16 => return __logh(x),
154154 32 => return logf(x),
155155 64 => return log(x),
lib/compiler_rt/log10.zig+1-1
......@@ -177,7 +177,7 @@ pub fn log10q(a: f128) callconv(.C) f128 {
177177}
178178
179179pub fn log10l(x: c_longdouble) callconv(.C) c_longdouble {
180 switch (@typeInfo(c_longdouble).Float.bits) {
180 switch (@typeInfo(c_longdouble).float.bits) {
181181 16 => return __log10h(x),
182182 32 => return log10f(x),
183183 64 => return log10(x),
lib/compiler_rt/log2.zig+1-1
......@@ -169,7 +169,7 @@ pub fn log2q(a: f128) callconv(.C) f128 {
169169}
170170
171171pub fn log2l(x: c_longdouble) callconv(.C) c_longdouble {
172 switch (@typeInfo(c_longdouble).Float.bits) {
172 switch (@typeInfo(c_longdouble).float.bits) {
173173 16 => return __log2h(x),
174174 32 => return log2f(x),
175175 64 => return log2(x),
lib/compiler_rt/mulf3.zig+3-3
......@@ -7,7 +7,7 @@ const common = @import("./common.zig");
77/// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/lib/builtins/fp_mul_impl.inc
88pub inline fn mulf3(comptime T: type, a: T, b: T) T {
99 @setRuntimeSafety(builtin.is_test);
10 const typeWidth = @typeInfo(T).Float.bits;
10 const typeWidth = @typeInfo(T).float.bits;
1111 const significandBits = math.floatMantissaBits(T);
1212 const fractionalBits = math.floatFractionalBits(T);
1313 const exponentBits = math.floatExponentBits(T);
......@@ -16,7 +16,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {
1616
1717 // ZSignificand is large enough to contain the significand, including an explicit integer bit
1818 const ZSignificand = PowerOfTwoSignificandZ(T);
19 const ZSignificandBits = @typeInfo(ZSignificand).Int.bits;
19 const ZSignificandBits = @typeInfo(ZSignificand).int.bits;
2020
2121 const roundBit = (1 << (ZSignificandBits - 1));
2222 const signBit = (@as(Z, 1) << (significandBits + exponentBits));
......@@ -164,7 +164,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {
164164/// This is analogous to an shr version of `@shlWithOverflow`
165165fn wideShrWithTruncation(comptime Z: type, hi: *Z, lo: *Z, count: u32) bool {
166166 @setRuntimeSafety(builtin.is_test);
167 const typeWidth = @typeInfo(Z).Int.bits;
167 const typeWidth = @typeInfo(Z).int.bits;
168168 var inexact = false;
169169 if (count < typeWidth) {
170170 inexact = (lo.* << @intCast(typeWidth -% count)) != 0;
lib/compiler_rt/parity.zig+1-1
......@@ -26,7 +26,7 @@ pub fn __parityti2(a: i128) callconv(.C) i32 {
2626}
2727
2828inline fn parityXi2(comptime T: type, a: T) i32 {
29 var x: std.meta.Int(.unsigned, @typeInfo(T).Int.bits) = @bitCast(a);
29 var x: std.meta.Int(.unsigned, @typeInfo(T).int.bits) = @bitCast(a);
3030 // Bit Twiddling Hacks: Compute parity in parallel
3131 comptime var shift: u8 = @bitSizeOf(T) / 2;
3232 inline while (shift > 2) {
lib/compiler_rt/round.zig+1-1
......@@ -142,7 +142,7 @@ pub fn roundq(x_: f128) callconv(.C) f128 {
142142}
143143
144144pub fn roundl(x: c_longdouble) callconv(.C) c_longdouble {
145 switch (@typeInfo(c_longdouble).Float.bits) {
145 switch (@typeInfo(c_longdouble).float.bits) {
146146 16 => return __roundh(x),
147147 32 => return roundf(x),
148148 64 => return round(x),
lib/compiler_rt/sin.zig+1-1
......@@ -130,7 +130,7 @@ pub fn sinq(x: f128) callconv(.C) f128 {
130130}
131131
132132pub fn sinl(x: c_longdouble) callconv(.C) c_longdouble {
133 switch (@typeInfo(c_longdouble).Float.bits) {
133 switch (@typeInfo(c_longdouble).float.bits) {
134134 16 => return __sinh(x),
135135 32 => return sinf(x),
136136 64 => return sin(x),
lib/compiler_rt/sincos.zig+2-2
......@@ -198,7 +198,7 @@ pub fn sincosq(x: f128, r_sin: *f128, r_cos: *f128) callconv(.C) void {
198198}
199199
200200pub fn sincosl(x: c_longdouble, r_sin: *c_longdouble, r_cos: *c_longdouble) callconv(.C) void {
201 switch (@typeInfo(c_longdouble).Float.bits) {
201 switch (@typeInfo(c_longdouble).float.bits) {
202202 16 => return __sincosh(x, r_sin, r_cos),
203203 32 => return sincosf(x, r_sin, r_cos),
204204 64 => return sincos(x, r_sin, r_cos),
......@@ -216,7 +216,7 @@ pub const rem_pio2_generic = @compileError("TODO");
216216/// * trig.cos_generic ported from __cosl.c
217217inline fn sincos_generic(comptime F: type, x: F, r_sin: *F, r_cos: *F) void {
218218 const sc1pio4: F = 1.0 * math.pi / 4.0;
219 const bits = @typeInfo(F).Float.bits;
219 const bits = @typeInfo(F).float.bits;
220220 const I = std.meta.Int(.unsigned, bits);
221221 const ix = @as(I, @bitCast(x)) & (math.maxInt(I) >> 1);
222222 const se: u16 = @truncate(ix >> (bits - 16));
lib/compiler_rt/sqrt.zig+1-1
......@@ -243,7 +243,7 @@ pub fn sqrtq(x: f128) callconv(.C) f128 {
243243}
244244
245245pub fn sqrtl(x: c_longdouble) callconv(.C) c_longdouble {
246 switch (@typeInfo(c_longdouble).Float.bits) {
246 switch (@typeInfo(c_longdouble).float.bits) {
247247 16 => return __sqrth(x),
248248 32 => return sqrtf(x),
249249 64 => return sqrt(x),
lib/compiler_rt/tan.zig+1-1
......@@ -116,7 +116,7 @@ pub fn tanq(x: f128) callconv(.C) f128 {
116116}
117117
118118pub fn tanl(x: c_longdouble) callconv(.C) c_longdouble {
119 switch (@typeInfo(c_longdouble).Float.bits) {
119 switch (@typeInfo(c_longdouble).float.bits) {
120120 16 => return __tanh(x),
121121 32 => return tanf(x),
122122 64 => return tan(x),
lib/compiler_rt/trunc.zig+1-1
......@@ -100,7 +100,7 @@ pub fn truncq(x: f128) callconv(.C) f128 {
100100}
101101
102102pub fn truncl(x: c_longdouble) callconv(.C) c_longdouble {
103 switch (@typeInfo(c_longdouble).Float.bits) {
103 switch (@typeInfo(c_longdouble).float.bits) {
104104 16 => return __trunch(x),
105105 32 => return truncf(x),
106106 64 => return trunc(x),
lib/compiler_rt/truncf.zig+6-6
......@@ -1,14 +1,14 @@
11const std = @import("std");
22
33pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t {
4 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits);
5 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).Float.bits);
4 const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);
5 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);
66 const srcSigBits = std.math.floatMantissaBits(src_t);
77 const dstSigBits = std.math.floatMantissaBits(dst_t);
88
99 // Various constants whose values follow from the type parameters.
1010 // Any reasonable optimizer will fold and propagate all of these.
11 const srcBits = @typeInfo(src_t).Float.bits;
11 const srcBits = @typeInfo(src_t).float.bits;
1212 const srcExpBits = srcBits - srcSigBits - 1;
1313 const srcInfExp = (1 << srcExpBits) - 1;
1414 const srcExpBias = srcInfExp >> 1;
......@@ -23,7 +23,7 @@ pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t
2323 const srcQNaN = 1 << (srcSigBits - 1);
2424 const srcNaNCode = srcQNaN - 1;
2525
26 const dstBits = @typeInfo(dst_t).Float.bits;
26 const dstBits = @typeInfo(dst_t).float.bits;
2727 const dstExpBits = dstBits - dstSigBits - 1;
2828 const dstInfExp = (1 << dstExpBits) - 1;
2929 const dstExpBias = dstInfExp >> 1;
......@@ -100,7 +100,7 @@ pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t
100100}
101101
102102pub inline fn trunc_f80(comptime dst_t: type, a: f80) dst_t {
103 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).Float.bits);
103 const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);
104104 const src_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit
105105 const dst_sig_bits = std.math.floatMantissaBits(dst_t);
106106
......@@ -109,7 +109,7 @@ pub inline fn trunc_f80(comptime dst_t: type, a: f80) dst_t {
109109 const round_mask = (1 << (src_sig_bits - dst_sig_bits)) - 1;
110110 const halfway = 1 << (src_sig_bits - dst_sig_bits - 1);
111111
112 const dst_bits = @typeInfo(dst_t).Float.bits;
112 const dst_bits = @typeInfo(dst_t).float.bits;
113113 const dst_exp_bits = dst_bits - dst_sig_bits - 1;
114114 const dst_inf_exp = (1 << dst_exp_bits) - 1;
115115 const dst_exp_bias = dst_inf_exp >> 1;
lib/compiler_rt/trunctfxf2.zig+1-1
......@@ -14,7 +14,7 @@ pub fn __trunctfxf2(a: f128) callconv(.C) f80 {
1414
1515 // Various constants whose values follow from the type parameters.
1616 // Any reasonable optimizer will fold and propagate all of these.
17 const src_bits = @typeInfo(f128).Float.bits;
17 const src_bits = @typeInfo(f128).float.bits;
1818 const src_exp_bits = src_bits - src_sig_bits - 1;
1919 const src_inf_exp = 0x7FFF;
2020
lib/docs/wasm/Walk.zig+1-1
......@@ -36,7 +36,7 @@ pub const Category = union(enum(u8)) {
3636 /// A function that returns a type.
3737 type_function: Ast.Node.Index,
3838
39 pub const Tag = @typeInfo(Category).Union.tag_type.?;
39 pub const Tag = @typeInfo(Category).@"union".tag_type.?;
4040};
4141
4242pub const File = struct {
lib/docs/wasm/markdown/Document.zig+1-1
......@@ -170,7 +170,7 @@ pub fn ExtraData(comptime T: type) type {
170170}
171171
172172pub fn extraData(doc: Document, comptime T: type, index: ExtraIndex) ExtraData(T) {
173 const fields = @typeInfo(T).Struct.fields;
173 const fields = @typeInfo(T).@"struct".fields;
174174 var i: usize = @intFromEnum(index);
175175 var result: T = undefined;
176176 inline for (fields) |field| {
lib/docs/wasm/markdown/Parser.zig+1-1
......@@ -1564,7 +1564,7 @@ fn parseInlines(p: *Parser, content: []const u8) !ExtraIndex {
15641564}
15651565
15661566pub fn extraData(p: Parser, comptime T: type, index: ExtraIndex) ExtraData(T) {
1567 const fields = @typeInfo(T).Struct.fields;
1567 const fields = @typeInfo(T).@"struct".fields;
15681568 var i: usize = @intFromEnum(index);
15691569 var result: T = undefined;
15701570 inline for (fields) |field| {
lib/fuzzer.zig+2-2
......@@ -13,7 +13,7 @@ var log_file: ?std.fs.File = null;
1313
1414fn logOverride(
1515 comptime level: std.log.Level,
16 comptime scope: @TypeOf(.EnumLiteral),
16 comptime scope: @Type(.enum_literal),
1717 comptime format: []const u8,
1818 args: anytype,
1919) void {
......@@ -178,7 +178,7 @@ const Fuzzer = struct {
178178 addr: usize,
179179 flags: packed struct(usize) {
180180 entry: bool,
181 _: @Type(.{ .Int = .{ .signedness = .unsigned, .bits = @bitSizeOf(usize) - 1 } }),
181 _: @Type(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(usize) - 1 } }),
182182 },
183183 };
184184
lib/std/Build.zig+23-23
......@@ -408,7 +408,7 @@ fn createChildOnly(
408408
409409fn userInputOptionsFromArgs(allocator: Allocator, args: anytype) UserInputOptionsMap {
410410 var user_input_options = UserInputOptionsMap.init(allocator);
411 inline for (@typeInfo(@TypeOf(args)).Struct.fields) |field| {
411 inline for (@typeInfo(@TypeOf(args)).@"struct".fields) |field| {
412412 const v = @field(args, field.name);
413413 const T = @TypeOf(v);
414414 switch (T) {
......@@ -454,28 +454,28 @@ fn userInputOptionsFromArgs(allocator: Allocator, args: anytype) UserInputOption
454454 }) catch @panic("OOM");
455455 },
456456 else => switch (@typeInfo(T)) {
457 .Bool => {
457 .bool => {
458458 user_input_options.put(field.name, .{
459459 .name = field.name,
460460 .value = .{ .scalar = if (v) "true" else "false" },
461461 .used = false,
462462 }) catch @panic("OOM");
463463 },
464 .Enum, .EnumLiteral => {
464 .@"enum", .enum_literal => {
465465 user_input_options.put(field.name, .{
466466 .name = field.name,
467467 .value = .{ .scalar = @tagName(v) },
468468 .used = false,
469469 }) catch @panic("OOM");
470470 },
471 .ComptimeInt, .Int => {
471 .comptime_int, .int => {
472472 user_input_options.put(field.name, .{
473473 .name = field.name,
474474 .value = .{ .scalar = std.fmt.allocPrint(allocator, "{d}", .{v}) catch @panic("OOM") },
475475 .used = false,
476476 }) catch @panic("OOM");
477477 },
478 .ComptimeFloat, .Float => {
478 .comptime_float, .float => {
479479 user_input_options.put(field.name, .{
480480 .name = field.name,
481481 .value = .{ .scalar = std.fmt.allocPrint(allocator, "{e}", .{v}) catch @panic("OOM") },
......@@ -1111,7 +1111,7 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw
11111111 const description = b.dupe(description_raw);
11121112 const type_id = comptime typeToEnum(T);
11131113 const enum_options = if (type_id == .@"enum" or type_id == .enum_list) blk: {
1114 const EnumType = if (type_id == .enum_list) @typeInfo(T).Pointer.child else T;
1114 const EnumType = if (type_id == .enum_list) @typeInfo(T).pointer.child else T;
11151115 const fields = comptime std.meta.fields(EnumType);
11161116 var options = ArrayList([]const u8).initCapacity(b.allocator, fields.len) catch @panic("OOM");
11171117
......@@ -1265,7 +1265,7 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw
12651265 return null;
12661266 },
12671267 .scalar => |s| {
1268 const Child = @typeInfo(T).Pointer.child;
1268 const Child = @typeInfo(T).pointer.child;
12691269 const value = std.meta.stringToEnum(Child, s) orelse {
12701270 log.err("Expected -D{s} to be of type {s}.", .{ name, @typeName(Child) });
12711271 b.markInvalidUserInput();
......@@ -1274,7 +1274,7 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw
12741274 return b.allocator.dupe(Child, &[_]Child{value}) catch @panic("OOM");
12751275 },
12761276 .list => |lst| {
1277 const Child = @typeInfo(T).Pointer.child;
1277 const Child = @typeInfo(T).pointer.child;
12781278 var new_list = b.allocator.alloc(Child, lst.items.len) catch @panic("OOM");
12791279 for (lst.items, 0..) |str, i| {
12801280 const value = std.meta.stringToEnum(Child, str) orelse {
......@@ -1542,15 +1542,15 @@ fn typeToEnum(comptime T: type) TypeId {
15421542 return switch (T) {
15431543 std.zig.BuildId => .build_id,
15441544 else => return switch (@typeInfo(T)) {
1545 .Int => .int,
1546 .Float => .float,
1547 .Bool => .bool,
1548 .Enum => .@"enum",
1549 .Pointer => |pointer| switch (pointer.child) {
1545 .int => .int,
1546 .float => .float,
1547 .bool => .bool,
1548 .@"enum" => .@"enum",
1549 .pointer => |pointer| switch (pointer.child) {
15501550 u8 => .string,
15511551 []const u8 => .list,
15521552 else => switch (@typeInfo(pointer.child)) {
1553 .Enum => .enum_list,
1553 .@"enum" => .enum_list,
15541554 else => @compileError("Unsupported type: " ++ @typeName(T)),
15551555 },
15561556 },
......@@ -1726,7 +1726,7 @@ pub fn fmt(b: *Build, comptime format: []const u8, args: anytype) []u8 {
17261726}
17271727
17281728fn supportedWindowsProgramExtension(ext: []const u8) bool {
1729 inline for (@typeInfo(std.process.Child.WindowsExtension).Enum.fields) |field| {
1729 inline for (@typeInfo(std.process.Child.WindowsExtension).@"enum".fields) |field| {
17301730 if (std.ascii.eqlIgnoreCase(ext, "." ++ field.name)) return true;
17311731 }
17321732 return false;
......@@ -1925,7 +1925,7 @@ inline fn findImportPkgHashOrFatal(b: *Build, comptime asking_build_zig: type, c
19251925 const build_runner = @import("root");
19261926 const deps = build_runner.dependencies;
19271927
1928 const b_pkg_hash, const b_pkg_deps = comptime for (@typeInfo(deps.packages).Struct.decls) |decl| {
1928 const b_pkg_hash, const b_pkg_deps = comptime for (@typeInfo(deps.packages).@"struct".decls) |decl| {
19291929 const pkg_hash = decl.name;
19301930 const pkg = @field(deps.packages, pkg_hash);
19311931 if (@hasDecl(pkg, "build_zig") and pkg.build_zig == asking_build_zig) break .{ pkg_hash, pkg.deps };
......@@ -1963,7 +1963,7 @@ pub fn lazyDependency(b: *Build, name: []const u8, args: anytype) ?*Dependency {
19631963 const deps = build_runner.dependencies;
19641964 const pkg_hash = findPkgHashOrFatal(b, name);
19651965
1966 inline for (@typeInfo(deps.packages).Struct.decls) |decl| {
1966 inline for (@typeInfo(deps.packages).@"struct".decls) |decl| {
19671967 if (mem.eql(u8, decl.name, pkg_hash)) {
19681968 const pkg = @field(deps.packages, decl.name);
19691969 const available = !@hasDecl(pkg, "available") or pkg.available;
......@@ -1983,7 +1983,7 @@ pub fn dependency(b: *Build, name: []const u8, args: anytype) *Dependency {
19831983 const deps = build_runner.dependencies;
19841984 const pkg_hash = findPkgHashOrFatal(b, name);
19851985
1986 inline for (@typeInfo(deps.packages).Struct.decls) |decl| {
1986 inline for (@typeInfo(deps.packages).@"struct".decls) |decl| {
19871987 if (mem.eql(u8, decl.name, pkg_hash)) {
19881988 const pkg = @field(deps.packages, decl.name);
19891989 if (@hasDecl(pkg, "available")) {
......@@ -2013,7 +2013,7 @@ pub inline fn lazyImport(
20132013 const deps = build_runner.dependencies;
20142014 const pkg_hash = findImportPkgHashOrFatal(b, asking_build_zig, dep_name);
20152015
2016 inline for (@typeInfo(deps.packages).Struct.decls) |decl| {
2016 inline for (@typeInfo(deps.packages).@"struct".decls) |decl| {
20172017 if (comptime mem.eql(u8, decl.name, pkg_hash)) {
20182018 const pkg = @field(deps.packages, decl.name);
20192019 const available = !@hasDecl(pkg, "available") or pkg.available;
......@@ -2042,7 +2042,7 @@ pub fn dependencyFromBuildZig(
20422042 const deps = build_runner.dependencies;
20432043
20442044 find_dep: {
2045 const pkg, const pkg_hash = inline for (@typeInfo(deps.packages).Struct.decls) |decl| {
2045 const pkg, const pkg_hash = inline for (@typeInfo(deps.packages).@"struct".decls) |decl| {
20462046 const pkg_hash = decl.name;
20472047 const pkg = @field(deps.packages, pkg_hash);
20482048 if (@hasDecl(pkg, "build_zig") and pkg.build_zig == build_zig) break .{ pkg, pkg_hash };
......@@ -2150,9 +2150,9 @@ fn dependencyInner(
21502150}
21512151
21522152pub fn runBuild(b: *Build, build_zig: anytype) anyerror!void {
2153 switch (@typeInfo(@typeInfo(@TypeOf(build_zig.build)).Fn.return_type.?)) {
2154 .Void => build_zig.build(b),
2155 .ErrorUnion => try build_zig.build(b),
2153 switch (@typeInfo(@typeInfo(@TypeOf(build_zig.build)).@"fn".return_type.?)) {
2154 .void => build_zig.build(b),
2155 .error_union => try build_zig.build(b),
21562156 else => @compileError("expected return type of build to be 'void' or '!void'"),
21572157 }
21582158}
lib/std/Build/Cache.zig+3-3
......@@ -222,7 +222,7 @@ pub const HashHelper = struct {
222222 .hexstring => |hex_string| hh.addBytes(hex_string.toSlice()),
223223 },
224224 else => switch (@typeInfo(@TypeOf(x))) {
225 .Bool, .Int, .Enum, .Array => hh.addBytes(mem.asBytes(&x)),
225 .bool, .int, .@"enum", .array => hh.addBytes(mem.asBytes(&x)),
226226 else => @compileError("unable to hash type " ++ @typeName(@TypeOf(x))),
227227 },
228228 }
......@@ -1014,7 +1014,7 @@ pub const Manifest = struct {
10141014 }
10151015
10161016 pub fn populateFileSystemInputs(man: *Manifest, buf: *std.ArrayListUnmanaged(u8)) Allocator.Error!void {
1017 assert(@typeInfo(std.zig.Server.Message.PathPrefix).Enum.fields.len == man.cache.prefixes_len);
1017 assert(@typeInfo(std.zig.Server.Message.PathPrefix).@"enum".fields.len == man.cache.prefixes_len);
10181018 buf.clearRetainingCapacity();
10191019 const gpa = man.cache.gpa;
10201020 const files = man.files.keys();
......@@ -1032,7 +1032,7 @@ pub const Manifest = struct {
10321032
10331033 pub fn populateOtherManifest(man: *Manifest, other: *Manifest, prefix_map: [4]u8) Allocator.Error!void {
10341034 const gpa = other.cache.gpa;
1035 assert(@typeInfo(std.zig.Server.Message.PathPrefix).Enum.fields.len == man.cache.prefixes_len);
1035 assert(@typeInfo(std.zig.Server.Message.PathPrefix).@"enum".fields.len == man.cache.prefixes_len);
10361036 assert(man.cache.prefixes_len == 4);
10371037 for (man.files.keys()) |file| {
10381038 const prefixed_path: PrefixedPath = .{
lib/std/Build/Cache/Path.zig+2-2
......@@ -189,8 +189,8 @@ pub const TableAdapter = struct {
189189 pub fn hash(self: TableAdapter, a: Cache.Path) u32 {
190190 _ = self;
191191 const seed = switch (@typeInfo(@TypeOf(a.root_dir.handle.fd))) {
192 .Pointer => @intFromPtr(a.root_dir.handle.fd),
193 .Int => @as(u32, @bitCast(a.root_dir.handle.fd)),
192 .pointer => @intFromPtr(a.root_dir.handle.fd),
193 .int => @as(u32, @bitCast(a.root_dir.handle.fd)),
194194 else => @compileError("unimplemented hash function"),
195195 };
196196 return @truncate(Hash.hash(seed, a.sub_path));
lib/std/Build/Step/ConfigHeader.zig+11-11
......@@ -109,47 +109,47 @@ pub fn getOutput(config_header: *ConfigHeader) std.Build.LazyPath {
109109}
110110
111111fn addValuesInner(config_header: *ConfigHeader, values: anytype) !void {
112 inline for (@typeInfo(@TypeOf(values)).Struct.fields) |field| {
112 inline for (@typeInfo(@TypeOf(values)).@"struct".fields) |field| {
113113 try putValue(config_header, field.name, field.type, @field(values, field.name));
114114 }
115115}
116116
117117fn putValue(config_header: *ConfigHeader, field_name: []const u8, comptime T: type, v: T) !void {
118118 switch (@typeInfo(T)) {
119 .Null => {
119 .null => {
120120 try config_header.values.put(field_name, .undef);
121121 },
122 .Void => {
122 .void => {
123123 try config_header.values.put(field_name, .defined);
124124 },
125 .Bool => {
125 .bool => {
126126 try config_header.values.put(field_name, .{ .boolean = v });
127127 },
128 .Int => {
128 .int => {
129129 try config_header.values.put(field_name, .{ .int = v });
130130 },
131 .ComptimeInt => {
131 .comptime_int => {
132132 try config_header.values.put(field_name, .{ .int = v });
133133 },
134 .EnumLiteral => {
134 .enum_literal => {
135135 try config_header.values.put(field_name, .{ .ident = @tagName(v) });
136136 },
137 .Optional => {
137 .optional => {
138138 if (v) |x| {
139139 return putValue(config_header, field_name, @TypeOf(x), x);
140140 } else {
141141 try config_header.values.put(field_name, .undef);
142142 }
143143 },
144 .Pointer => |ptr| {
144 .pointer => |ptr| {
145145 switch (@typeInfo(ptr.child)) {
146 .Array => |array| {
146 .array => |array| {
147147 if (ptr.size == .One and array.child == u8) {
148148 try config_header.values.put(field_name, .{ .string = v });
149149 return;
150150 }
151151 },
152 .Int => {
152 .int => {
153153 if (ptr.size == .Slice and ptr.child == u8) {
154154 try config_header.values.put(field_name, .{ .string = v });
155155 return;
lib/std/Build/Step/Options.zig+17-17
......@@ -151,7 +151,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
151151 }
152152
153153 switch (@typeInfo(T)) {
154 .Array => {
154 .array => {
155155 if (name) |some| {
156156 try out.print("pub const {}: {s} = ", .{ std.zig.fmtId(some), @typeName(T) });
157157 }
......@@ -171,7 +171,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
171171 }
172172 return;
173173 },
174 .Pointer => |p| {
174 .pointer => |p| {
175175 if (p.size != .Slice) {
176176 @compileError("Non-slice pointers are not yet supported in build options");
177177 }
......@@ -195,7 +195,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
195195 }
196196 return;
197197 },
198 .Optional => {
198 .optional => {
199199 if (name) |some| {
200200 try out.print("pub const {}: {s} = ", .{ std.zig.fmtId(some), @typeName(T) });
201201 }
......@@ -216,12 +216,12 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
216216 }
217217 return;
218218 },
219 .Void,
220 .Bool,
221 .Int,
222 .ComptimeInt,
223 .Float,
224 .Null,
219 .void,
220 .bool,
221 .int,
222 .comptime_int,
223 .float,
224 .null,
225225 => {
226226 if (name) |some| {
227227 try out.print("pub const {}: {s} = {any};\n", .{ std.zig.fmtId(some), @typeName(T), value });
......@@ -230,7 +230,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
230230 }
231231 return;
232232 },
233 .Enum => |info| {
233 .@"enum" => |info| {
234234 try printEnum(options, out, T, info, indent);
235235
236236 if (name) |some| {
......@@ -242,7 +242,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
242242 }
243243 return;
244244 },
245 .Struct => |info| {
245 .@"struct" => |info| {
246246 try printStruct(options, out, T, info, indent);
247247
248248 if (name) |some| {
......@@ -260,10 +260,10 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
260260
261261fn printUserDefinedType(options: *Options, out: anytype, comptime T: type, indent: u8) !void {
262262 switch (@typeInfo(T)) {
263 .Enum => |info| {
263 .@"enum" => |info| {
264264 return try printEnum(options, out, T, info, indent);
265265 },
266 .Struct => |info| {
266 .@"struct" => |info| {
267267 return try printStruct(options, out, T, info, indent);
268268 },
269269 else => {},
......@@ -323,8 +323,8 @@ fn printStruct(options: *Options, out: anytype, comptime T: type, comptime val:
323323
324324 try out.writeAll(" = ");
325325 switch (@typeInfo(@TypeOf(default_value))) {
326 .Enum => try out.print(".{s},\n", .{@tagName(default_value)}),
327 .Struct => |info| {
326 .@"enum" => try out.print(".{s},\n", .{@tagName(default_value)}),
327 .@"struct" => |info| {
328328 try printStructValue(options, out, info, default_value, indent + 4);
329329 },
330330 else => try printType(options, out, @TypeOf(default_value), default_value, indent, null),
......@@ -359,8 +359,8 @@ fn printStructValue(options: *Options, out: anytype, comptime struct_val: std.bu
359359
360360 const field_name = @field(val, field.name);
361361 switch (@typeInfo(@TypeOf(field_name))) {
362 .Enum => try out.print(".{s},\n", .{@tagName(field_name)}),
363 .Struct => |struct_info| {
362 .@"enum" => try out.print(".{s},\n", .{@tagName(field_name)}),
363 .@"struct" => |struct_info| {
364364 try printStructValue(options, out, struct_info, field_name, indent + 4);
365365 },
366366 else => try printType(options, out, @TypeOf(field_name), field_name, indent, null),
lib/std/Build/Step/Run.zig+1-1
......@@ -614,7 +614,7 @@ fn checksContainStderr(checks: []const StdIo.Check) bool {
614614
615615const IndexedOutput = struct {
616616 index: usize,
617 tag: @typeInfo(Arg).Union.tag_type.?,
617 tag: @typeInfo(Arg).@"union".tag_type.?,
618618 output: *Output,
619619};
620620fn make(step: *Step, options: Step.MakeOptions) !void {
lib/std/Progress.zig+9-9
......@@ -95,8 +95,8 @@ pub const Node = struct {
9595 /// Not thread-safe.
9696 fn getIpcFd(s: Storage) ?posix.fd_t {
9797 return if (s.estimated_total_count == std.math.maxInt(u32)) switch (@typeInfo(posix.fd_t)) {
98 .Int => @bitCast(s.completed_count),
99 .Pointer => @ptrFromInt(s.completed_count),
98 .int => @bitCast(s.completed_count),
99 .pointer => @ptrFromInt(s.completed_count),
100100 else => @compileError("unsupported fd_t of " ++ @typeName(posix.fd_t)),
101101 } else null;
102102 }
......@@ -104,8 +104,8 @@ pub const Node = struct {
104104 /// Thread-safe.
105105 fn setIpcFd(s: *Storage, fd: posix.fd_t) void {
106106 const integer: u32 = switch (@typeInfo(posix.fd_t)) {
107 .Int => @bitCast(fd),
108 .Pointer => @intFromPtr(fd),
107 .int => @bitCast(fd),
108 .pointer => @intFromPtr(fd),
109109 else => @compileError("unsupported fd_t of " ++ @typeName(posix.fd_t)),
110110 };
111111 // `estimated_total_count` max int indicates the special state that
......@@ -276,8 +276,8 @@ pub const Node = struct {
276276 const storage = storageByIndex(index);
277277 const int = @atomicLoad(u32, &storage.completed_count, .monotonic);
278278 return switch (@typeInfo(posix.fd_t)) {
279 .Int => @bitCast(int),
280 .Pointer => @ptrFromInt(int),
279 .int => @bitCast(int),
280 .pointer => @ptrFromInt(int),
281281 else => @compileError("unsupported fd_t of " ++ @typeName(posix.fd_t)),
282282 };
283283 }
......@@ -381,8 +381,8 @@ pub fn start(options: Options) Node {
381381 if (std.process.parseEnvVarInt("ZIG_PROGRESS", u31, 10)) |ipc_fd| {
382382 global_progress.update_thread = std.Thread.spawn(.{}, ipcThreadRun, .{
383383 @as(posix.fd_t, switch (@typeInfo(posix.fd_t)) {
384 .Int => ipc_fd,
385 .Pointer => @ptrFromInt(ipc_fd),
384 .int => ipc_fd,
385 .pointer => @ptrFromInt(ipc_fd),
386386 else => @compileError("unsupported fd_t of " ++ @typeName(posix.fd_t)),
387387 }),
388388 }) catch |err| {
......@@ -633,7 +633,7 @@ const TreeSymbol = enum {
633633
634634 fn maxByteLen(symbol: TreeSymbol) usize {
635635 var max: usize = 0;
636 inline for (@typeInfo(Encoding).Enum.fields) |field| {
636 inline for (@typeInfo(Encoding).@"enum".fields) |field| {
637637 const len = symbol.bytes(@field(Encoding, field.name)).len;
638638 max = @max(max, len);
639639 }
lib/std/Random.zig+20-20
......@@ -34,9 +34,9 @@ fillFn: *const fn (ptr: *anyopaque, buf: []u8) void,
3434
3535pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random {
3636 const Ptr = @TypeOf(pointer);
37 assert(@typeInfo(Ptr) == .Pointer); // Must be a pointer
38 assert(@typeInfo(Ptr).Pointer.size == .One); // Must be a single-item pointer
39 assert(@typeInfo(@typeInfo(Ptr).Pointer.child) == .Struct); // Must point to a struct
37 assert(@typeInfo(Ptr) == .pointer); // Must be a pointer
38 assert(@typeInfo(Ptr).pointer.size == .One); // Must be a single-item pointer
39 assert(@typeInfo(@typeInfo(Ptr).pointer.child) == .@"struct"); // Must point to a struct
4040 const gen = struct {
4141 fn fill(ptr: *anyopaque, buf: []u8) void {
4242 const self: Ptr = @ptrCast(@alignCast(ptr));
......@@ -79,7 +79,7 @@ pub inline fn enumValue(r: Random, comptime EnumType: type) EnumType {
7979/// See `uintLessThan`, which this function uses in most cases,
8080/// for commentary on the runtime of this function.
8181pub fn enumValueWithIndex(r: Random, comptime EnumType: type, comptime Index: type) EnumType {
82 comptime assert(@typeInfo(EnumType) == .Enum);
82 comptime assert(@typeInfo(EnumType) == .@"enum");
8383
8484 // We won't use int -> enum casting because enum elements can have
8585 // arbitrary values. Instead we'll randomly pick one of the type's values.
......@@ -100,7 +100,7 @@ pub fn enumValueWithIndex(r: Random, comptime EnumType: type, comptime Index: ty
100100/// Returns a random int `i` such that `minInt(T) <= i <= maxInt(T)`.
101101/// `i` is evenly distributed.
102102pub fn int(r: Random, comptime T: type) T {
103 const bits = @typeInfo(T).Int.bits;
103 const bits = @typeInfo(T).int.bits;
104104 const UnsignedT = std.meta.Int(.unsigned, bits);
105105 const ceil_bytes = comptime std.math.divCeil(u16, bits, 8) catch unreachable;
106106 const ByteAlignedT = std.meta.Int(.unsigned, ceil_bytes * 8);
......@@ -119,7 +119,7 @@ pub fn int(r: Random, comptime T: type) T {
119119/// Constant-time implementation off `uintLessThan`.
120120/// The results of this function may be biased.
121121pub fn uintLessThanBiased(r: Random, comptime T: type, less_than: T) T {
122 comptime assert(@typeInfo(T).Int.signedness == .unsigned);
122 comptime assert(@typeInfo(T).int.signedness == .unsigned);
123123 assert(0 < less_than);
124124 return limitRangeBiased(T, r.int(T), less_than);
125125}
......@@ -133,8 +133,8 @@ pub fn uintLessThanBiased(r: Random, comptime T: type, less_than: T) T {
133133/// this function is guaranteed to return.
134134/// If you need deterministic runtime bounds, use `uintLessThanBiased`.
135135pub fn uintLessThan(r: Random, comptime T: type, less_than: T) T {
136 comptime assert(@typeInfo(T).Int.signedness == .unsigned);
137 const bits = @typeInfo(T).Int.bits;
136 comptime assert(@typeInfo(T).int.signedness == .unsigned);
137 const bits = @typeInfo(T).int.bits;
138138 assert(0 < less_than);
139139
140140 // adapted from:
......@@ -164,7 +164,7 @@ pub fn uintLessThan(r: Random, comptime T: type, less_than: T) T {
164164/// Constant-time implementation off `uintAtMost`.
165165/// The results of this function may be biased.
166166pub fn uintAtMostBiased(r: Random, comptime T: type, at_most: T) T {
167 assert(@typeInfo(T).Int.signedness == .unsigned);
167 assert(@typeInfo(T).int.signedness == .unsigned);
168168 if (at_most == maxInt(T)) {
169169 // have the full range
170170 return r.int(T);
......@@ -176,7 +176,7 @@ pub fn uintAtMostBiased(r: Random, comptime T: type, at_most: T) T {
176176/// See `uintLessThan`, which this function uses in most cases,
177177/// for commentary on the runtime of this function.
178178pub fn uintAtMost(r: Random, comptime T: type, at_most: T) T {
179 assert(@typeInfo(T).Int.signedness == .unsigned);
179 assert(@typeInfo(T).int.signedness == .unsigned);
180180 if (at_most == maxInt(T)) {
181181 // have the full range
182182 return r.int(T);
......@@ -188,7 +188,7 @@ pub fn uintAtMost(r: Random, comptime T: type, at_most: T) T {
188188/// The results of this function may be biased.
189189pub fn intRangeLessThanBiased(r: Random, comptime T: type, at_least: T, less_than: T) T {
190190 assert(at_least < less_than);
191 const info = @typeInfo(T).Int;
191 const info = @typeInfo(T).int;
192192 if (info.signedness == .signed) {
193193 // Two's complement makes this math pretty easy.
194194 const UnsignedT = std.meta.Int(.unsigned, info.bits);
......@@ -207,7 +207,7 @@ pub fn intRangeLessThanBiased(r: Random, comptime T: type, at_least: T, less_tha
207207/// for commentary on the runtime of this function.
208208pub fn intRangeLessThan(r: Random, comptime T: type, at_least: T, less_than: T) T {
209209 assert(at_least < less_than);
210 const info = @typeInfo(T).Int;
210 const info = @typeInfo(T).int;
211211 if (info.signedness == .signed) {
212212 // Two's complement makes this math pretty easy.
213213 const UnsignedT = std.meta.Int(.unsigned, info.bits);
......@@ -225,7 +225,7 @@ pub fn intRangeLessThan(r: Random, comptime T: type, at_least: T, less_than: T)
225225/// The results of this function may be biased.
226226pub fn intRangeAtMostBiased(r: Random, comptime T: type, at_least: T, at_most: T) T {
227227 assert(at_least <= at_most);
228 const info = @typeInfo(T).Int;
228 const info = @typeInfo(T).int;
229229 if (info.signedness == .signed) {
230230 // Two's complement makes this math pretty easy.
231231 const UnsignedT = std.meta.Int(.unsigned, info.bits);
......@@ -244,7 +244,7 @@ pub fn intRangeAtMostBiased(r: Random, comptime T: type, at_least: T, at_most: T
244244/// for commentary on the runtime of this function.
245245pub fn intRangeAtMost(r: Random, comptime T: type, at_least: T, at_most: T) T {
246246 assert(at_least <= at_most);
247 const info = @typeInfo(T).Int;
247 const info = @typeInfo(T).int;
248248 if (info.signedness == .signed) {
249249 // Two's complement makes this math pretty easy.
250250 const UnsignedT = std.meta.Int(.unsigned, info.bits);
......@@ -392,12 +392,12 @@ pub fn weightedIndex(r: Random, comptime T: type, proportions: []const T) usize
392392 };
393393
394394 const point = switch (@typeInfo(T)) {
395 .Int => |int_info| switch (int_info.signedness) {
395 .int => |int_info| switch (int_info.signedness) {
396396 .signed => r.intRangeLessThan(T, 0, sum),
397397 .unsigned => r.uintLessThan(T, sum),
398398 },
399399 // take care that imprecision doesn't lead to a value slightly greater than sum
400 .Float => @min(r.float(T) * sum, sum - std.math.floatEps(T)),
400 .float => @min(r.float(T) * sum, sum - std.math.floatEps(T)),
401401 else => @compileError("weightedIndex does not support proportions of type " ++
402402 @typeName(T)),
403403 };
......@@ -415,8 +415,8 @@ pub fn weightedIndex(r: Random, comptime T: type, proportions: []const T) usize
415415/// into an integer 0 <= result < less_than.
416416/// This function introduces a minor bias.
417417pub fn limitRangeBiased(comptime T: type, random_int: T, less_than: T) T {
418 comptime assert(@typeInfo(T).Int.signedness == .unsigned);
419 const bits = @typeInfo(T).Int.bits;
418 comptime assert(@typeInfo(T).int.signedness == .unsigned);
419 const bits = @typeInfo(T).int.bits;
420420
421421 // adapted from:
422422 // http://www.pcg-random.org/posts/bounded-rands.html
......@@ -427,9 +427,9 @@ pub fn limitRangeBiased(comptime T: type, random_int: T, less_than: T) T {
427427
428428/// Returns the smallest of `Index` and `usize`.
429429fn MinArrayIndex(comptime Index: type) type {
430 const index_info = @typeInfo(Index).Int;
430 const index_info = @typeInfo(Index).int;
431431 assert(index_info.signedness == .unsigned);
432 return if (index_info.bits >= @typeInfo(usize).Int.bits) usize else Index;
432 return if (index_info.bits >= @typeInfo(usize).int.bits) usize else Index;
433433}
434434
435435test {
lib/std/Target.zig+2-2
......@@ -154,7 +154,7 @@ pub const Os = struct {
154154 };
155155 }
156156
157 pub inline fn getVersionRangeTag(tag: Tag) @typeInfo(TaggedVersionRange).Union.tag_type.? {
157 pub inline fn getVersionRangeTag(tag: Tag) @typeInfo(TaggedVersionRange).@"union".tag_type.? {
158158 return switch (tag) {
159159 .freestanding,
160160 .fuchsia,
......@@ -1458,7 +1458,7 @@ pub const Cpu = struct {
14581458
14591459 fn allCpusFromDecls(comptime cpus: type) []const *const Cpu.Model {
14601460 @setEvalBranchQuota(2000);
1461 const decls = @typeInfo(cpus).Struct.decls;
1461 const decls = @typeInfo(cpus).@"struct".decls;
14621462 var array: [decls.len]*const Cpu.Model = undefined;
14631463 for (decls, 0..) |decl, i| {
14641464 array[i] = &@field(cpus, decl.name);
lib/std/Target/Query.zig+2-2
......@@ -53,7 +53,7 @@ pub const CpuModel = union(enum) {
5353 explicit: *const Target.Cpu.Model,
5454
5555 pub fn eql(a: CpuModel, b: CpuModel) bool {
56 const Tag = @typeInfo(CpuModel).Union.tag_type.?;
56 const Tag = @typeInfo(CpuModel).@"union".tag_type.?;
5757 const a_tag: Tag = a;
5858 const b_tag: Tag = b;
5959 if (a_tag != b_tag) return false;
......@@ -70,7 +70,7 @@ pub const OsVersion = union(enum) {
7070 windows: Target.Os.WindowsVersion,
7171
7272 pub fn eql(a: OsVersion, b: OsVersion) bool {
73 const Tag = @typeInfo(OsVersion).Union.tag_type.?;
73 const Tag = @typeInfo(OsVersion).@"union".tag_type.?;
7474 const a_tag: Tag = a;
7575 const b_tag: Tag = b;
7676 if (a_tag != b_tag) return false;
lib/std/Target/aarch64.zig+2-2
......@@ -242,7 +242,7 @@ pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
242242
243243pub const all_features = blk: {
244244 @setEvalBranchQuota(2000);
245 const len = @typeInfo(Feature).Enum.fields.len;
245 const len = @typeInfo(Feature).@"enum".fields.len;
246246 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
247247 var result: [len]CpuFeature = undefined;
248248 result[@intFromEnum(Feature.a510)] = .{
......@@ -1660,7 +1660,7 @@ pub const all_features = blk: {
16601660 const ti = @typeInfo(Feature);
16611661 for (&result, 0..) |*elem, i| {
16621662 elem.index = i;
1663 elem.name = ti.Enum.fields[i].name;
1663 elem.name = ti.@"enum".fields[i].name;
16641664 }
16651665 break :blk result;
16661666};
lib/std/Target/amdgpu.zig+2-2
......@@ -183,7 +183,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
183183pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
184184
185185pub const all_features = blk: {
186 const len = @typeInfo(Feature).Enum.fields.len;
186 const len = @typeInfo(Feature).@"enum".fields.len;
187187 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
188188 var result: [len]CpuFeature = undefined;
189189 result[@intFromEnum(Feature.@"16_bit_insts")] = .{
......@@ -1284,7 +1284,7 @@ pub const all_features = blk: {
12841284 const ti = @typeInfo(Feature);
12851285 for (&result, 0..) |*elem, i| {
12861286 elem.index = i;
1287 elem.name = ti.Enum.fields[i].name;
1287 elem.name = ti.@"enum".fields[i].name;
12881288 }
12891289 break :blk result;
12901290};
lib/std/Target/arc.zig+2-2
......@@ -14,7 +14,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
1414pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
1515
1616pub const all_features = blk: {
17 const len = @typeInfo(Feature).Enum.fields.len;
17 const len = @typeInfo(Feature).@"enum".fields.len;
1818 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
1919 var result: [len]CpuFeature = undefined;
2020 result[@intFromEnum(Feature.norm)] = .{
......@@ -25,7 +25,7 @@ pub const all_features = blk: {
2525 const ti = @typeInfo(Feature);
2626 for (&result, 0..) |*elem, i| {
2727 elem.index = i;
28 elem.name = ti.Enum.fields[i].name;
28 elem.name = ti.@"enum".fields[i].name;
2929 }
3030 break :blk result;
3131};
lib/std/Target/arm.zig+2-2
......@@ -215,7 +215,7 @@ pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
215215
216216pub const all_features = blk: {
217217 @setEvalBranchQuota(10000);
218 const len = @typeInfo(Feature).Enum.fields.len;
218 const len = @typeInfo(Feature).@"enum".fields.len;
219219 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
220220 var result: [len]CpuFeature = undefined;
221221 result[@intFromEnum(Feature.@"32bit")] = .{
......@@ -1735,7 +1735,7 @@ pub const all_features = blk: {
17351735 const ti = @typeInfo(Feature);
17361736 for (&result, 0..) |*elem, i| {
17371737 elem.index = i;
1738 elem.name = ti.Enum.fields[i].name;
1738 elem.name = ti.@"enum".fields[i].name;
17391739 }
17401740 break :blk result;
17411741};
lib/std/Target/avr.zig+2-2
......@@ -49,7 +49,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
4949pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
5050
5151pub const all_features = blk: {
52 const len = @typeInfo(Feature).Enum.fields.len;
52 const len = @typeInfo(Feature).@"enum".fields.len;
5353 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
5454 var result: [len]CpuFeature = undefined;
5555 result[@intFromEnum(Feature.addsubiw)] = .{
......@@ -340,7 +340,7 @@ pub const all_features = blk: {
340340 const ti = @typeInfo(Feature);
341341 for (&result, 0..) |*elem, i| {
342342 elem.index = i;
343 elem.name = ti.Enum.fields[i].name;
343 elem.name = ti.@"enum".fields[i].name;
344344 }
345345 break :blk result;
346346};
lib/std/Target/bpf.zig+2-2
......@@ -16,7 +16,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
1616pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
1717
1818pub const all_features = blk: {
19 const len = @typeInfo(Feature).Enum.fields.len;
19 const len = @typeInfo(Feature).@"enum".fields.len;
2020 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
2121 var result: [len]CpuFeature = undefined;
2222 result[@intFromEnum(Feature.alu32)] = .{
......@@ -37,7 +37,7 @@ pub const all_features = blk: {
3737 const ti = @typeInfo(Feature);
3838 for (&result, 0..) |*elem, i| {
3939 elem.index = i;
40 elem.name = ti.Enum.fields[i].name;
40 elem.name = ti.@"enum".fields[i].name;
4141 }
4242 break :blk result;
4343};
lib/std/Target/csky.zig+2-2
......@@ -76,7 +76,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
7676pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
7777
7878pub const all_features = blk: {
79 const len = @typeInfo(Feature).Enum.fields.len;
79 const len = @typeInfo(Feature).@"enum".fields.len;
8080 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
8181 var result: [len]CpuFeature = undefined;
8282 result[@intFromEnum(Feature.@"10e60")] = .{
......@@ -418,7 +418,7 @@ pub const all_features = blk: {
418418 const ti = @typeInfo(Feature);
419419 for (&result, 0..) |*elem, i| {
420420 elem.index = i;
421 elem.name = ti.Enum.fields[i].name;
421 elem.name = ti.@"enum".fields[i].name;
422422 }
423423 break :blk result;
424424};
lib/std/Target/hexagon.zig+2-2
......@@ -55,7 +55,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
5555pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
5656
5757pub const all_features = blk: {
58 const len = @typeInfo(Feature).Enum.fields.len;
58 const len = @typeInfo(Feature).@"enum".fields.len;
5959 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
6060 var result: [len]CpuFeature = undefined;
6161 result[@intFromEnum(Feature.audio)] = .{
......@@ -298,7 +298,7 @@ pub const all_features = blk: {
298298 const ti = @typeInfo(Feature);
299299 for (&result, 0..) |*elem, i| {
300300 elem.index = i;
301 elem.name = ti.Enum.fields[i].name;
301 elem.name = ti.@"enum".fields[i].name;
302302 }
303303 break :blk result;
304304};
lib/std/Target/loongarch.zig+2-2
......@@ -28,7 +28,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
2828pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
2929
3030pub const all_features = blk: {
31 const len = @typeInfo(Feature).Enum.fields.len;
31 const len = @typeInfo(Feature).@"enum".fields.len;
3232 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
3333 var result: [len]CpuFeature = undefined;
3434 result[@intFromEnum(Feature.@"32bit")] = .{
......@@ -115,7 +115,7 @@ pub const all_features = blk: {
115115 const ti = @typeInfo(Feature);
116116 for (&result, 0..) |*elem, i| {
117117 elem.index = i;
118 elem.name = ti.Enum.fields[i].name;
118 elem.name = ti.@"enum".fields[i].name;
119119 }
120120 break :blk result;
121121};
lib/std/Target/m68k.zig+2-2
......@@ -36,7 +36,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
3636pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
3737
3838pub const all_features = blk: {
39 const len = @typeInfo(Feature).Enum.fields.len;
39 const len = @typeInfo(Feature).@"enum".fields.len;
4040 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
4141 var result: [len]CpuFeature = undefined;
4242 result[@intFromEnum(Feature.isa_68000)] = .{
......@@ -170,7 +170,7 @@ pub const all_features = blk: {
170170 const ti = @typeInfo(Feature);
171171 for (&result, 0..) |*elem, i| {
172172 elem.index = i;
173 elem.name = ti.Enum.fields[i].name;
173 elem.name = ti.@"enum".fields[i].name;
174174 }
175175 break :blk result;
176176};
lib/std/Target/mips.zig+2-2
......@@ -65,7 +65,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
6565pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
6666
6767pub const all_features = blk: {
68 const len = @typeInfo(Feature).Enum.fields.len;
68 const len = @typeInfo(Feature).@"enum".fields.len;
6969 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
7070 var result: [len]CpuFeature = undefined;
7171 result[@intFromEnum(Feature.abs2008)] = .{
......@@ -389,7 +389,7 @@ pub const all_features = blk: {
389389 const ti = @typeInfo(Feature);
390390 for (&result, 0..) |*elem, i| {
391391 elem.index = i;
392 elem.name = ti.Enum.fields[i].name;
392 elem.name = ti.@"enum".fields[i].name;
393393 }
394394 break :blk result;
395395};
lib/std/Target/msp430.zig+2-2
......@@ -17,7 +17,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
1717pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
1818
1919pub const all_features = blk: {
20 const len = @typeInfo(Feature).Enum.fields.len;
20 const len = @typeInfo(Feature).@"enum".fields.len;
2121 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
2222 var result: [len]CpuFeature = undefined;
2323 result[@intFromEnum(Feature.ext)] = .{
......@@ -43,7 +43,7 @@ pub const all_features = blk: {
4343 const ti = @typeInfo(Feature);
4444 for (&result, 0..) |*elem, i| {
4545 elem.index = i;
46 elem.name = ti.Enum.fields[i].name;
46 elem.name = ti.@"enum".fields[i].name;
4747 }
4848 break :blk result;
4949};
lib/std/Target/nvptx.zig+2-2
......@@ -58,7 +58,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
5858pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
5959
6060pub const all_features = blk: {
61 const len = @typeInfo(Feature).Enum.fields.len;
61 const len = @typeInfo(Feature).@"enum".fields.len;
6262 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
6363 var result: [len]CpuFeature = undefined;
6464 result[@intFromEnum(Feature.ptx32)] = .{
......@@ -289,7 +289,7 @@ pub const all_features = blk: {
289289 const ti = @typeInfo(Feature);
290290 for (&result, 0..) |*elem, i| {
291291 elem.index = i;
292 elem.name = ti.Enum.fields[i].name;
292 elem.name = ti.@"enum".fields[i].name;
293293 }
294294 break :blk result;
295295};
lib/std/Target/powerpc.zig+2-2
......@@ -95,7 +95,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
9595pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
9696
9797pub const all_features = blk: {
98 const len = @typeInfo(Feature).Enum.fields.len;
98 const len = @typeInfo(Feature).@"enum".fields.len;
9999 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
100100 var result: [len]CpuFeature = undefined;
101101 result[@intFromEnum(Feature.@"64bit")] = .{
......@@ -606,7 +606,7 @@ pub const all_features = blk: {
606606 const ti = @typeInfo(Feature);
607607 for (&result, 0..) |*elem, i| {
608608 elem.index = i;
609 elem.name = ti.Enum.fields[i].name;
609 elem.name = ti.@"enum".fields[i].name;
610610 }
611611 break :blk result;
612612};
lib/std/Target/riscv.zig+2-2
......@@ -201,7 +201,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
201201pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
202202
203203pub const all_features = blk: {
204 const len = @typeInfo(Feature).Enum.fields.len;
204 const len = @typeInfo(Feature).@"enum".fields.len;
205205 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
206206 var result: [len]CpuFeature = undefined;
207207 result[@intFromEnum(Feature.@"32bit")] = .{
......@@ -1298,7 +1298,7 @@ pub const all_features = blk: {
12981298 const ti = @typeInfo(Feature);
12991299 for (&result, 0..) |*elem, i| {
13001300 elem.index = i;
1301 elem.name = ti.Enum.fields[i].name;
1301 elem.name = ti.@"enum".fields[i].name;
13021302 }
13031303 break :blk result;
13041304};
lib/std/Target/s390x.zig+2-2
......@@ -55,7 +55,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
5555pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
5656
5757pub const all_features = blk: {
58 const len = @typeInfo(Feature).Enum.fields.len;
58 const len = @typeInfo(Feature).@"enum".fields.len;
5959 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
6060 var result: [len]CpuFeature = undefined;
6161 result[@intFromEnum(Feature.backchain)] = .{
......@@ -271,7 +271,7 @@ pub const all_features = blk: {
271271 const ti = @typeInfo(Feature);
272272 for (&result, 0..) |*elem, i| {
273273 elem.index = i;
274 elem.name = ti.Enum.fields[i].name;
274 elem.name = ti.@"enum".fields[i].name;
275275 }
276276 break :blk result;
277277};
lib/std/Target/sparc.zig+2-2
......@@ -60,7 +60,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
6060pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
6161
6262pub const all_features = blk: {
63 const len = @typeInfo(Feature).Enum.fields.len;
63 const len = @typeInfo(Feature).@"enum".fields.len;
6464 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
6565 var result: [len]CpuFeature = undefined;
6666 result[@intFromEnum(Feature.deprecated_v8)] = .{
......@@ -303,7 +303,7 @@ pub const all_features = blk: {
303303 const ti = @typeInfo(Feature);
304304 for (&result, 0..) |*elem, i| {
305305 elem.index = i;
306 elem.name = ti.Enum.fields[i].name;
306 elem.name = ti.@"enum".fields[i].name;
307307 }
308308 break :blk result;
309309};
lib/std/Target/spirv.zig+2-2
......@@ -301,7 +301,7 @@ pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
301301
302302pub const all_features = blk: {
303303 @setEvalBranchQuota(2000);
304 const len = @typeInfo(Feature).Enum.fields.len;
304 const len = @typeInfo(Feature).@"enum".fields.len;
305305 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
306306 var result: [len]CpuFeature = undefined;
307307 result[@intFromEnum(Feature.v1_1)] = .{
......@@ -2077,7 +2077,7 @@ pub const all_features = blk: {
20772077 const ti = @typeInfo(Feature);
20782078 for (&result, 0..) |*elem, i| {
20792079 elem.index = i;
2080 elem.name = ti.Enum.fields[i].name;
2080 elem.name = ti.@"enum".fields[i].name;
20812081 }
20822082 break :blk result;
20832083};
lib/std/Target/ve.zig+2-2
......@@ -14,7 +14,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
1414pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
1515
1616pub const all_features = blk: {
17 const len = @typeInfo(Feature).Enum.fields.len;
17 const len = @typeInfo(Feature).@"enum".fields.len;
1818 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
1919 var result: [len]CpuFeature = undefined;
2020 result[@intFromEnum(Feature.vpu)] = .{
......@@ -25,7 +25,7 @@ pub const all_features = blk: {
2525 const ti = @typeInfo(Feature);
2626 for (&result, 0..) |*elem, i| {
2727 elem.index = i;
28 elem.name = ti.Enum.fields[i].name;
28 elem.name = ti.@"enum".fields[i].name;
2929 }
3030 break :blk result;
3131};
lib/std/Target/wasm.zig+2-2
......@@ -26,7 +26,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
2626pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
2727
2828pub const all_features = blk: {
29 const len = @typeInfo(Feature).Enum.fields.len;
29 const len = @typeInfo(Feature).@"enum".fields.len;
3030 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
3131 var result: [len]CpuFeature = undefined;
3232 result[@intFromEnum(Feature.atomics)] = .{
......@@ -97,7 +97,7 @@ pub const all_features = blk: {
9797 const ti = @typeInfo(Feature);
9898 for (&result, 0..) |*elem, i| {
9999 elem.index = i;
100 elem.name = ti.Enum.fields[i].name;
100 elem.name = ti.@"enum".fields[i].name;
101101 }
102102 break :blk result;
103103};
lib/std/Target/x86.zig+2-2
......@@ -199,7 +199,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
199199pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
200200
201201pub const all_features = blk: {
202 const len = @typeInfo(Feature).Enum.fields.len;
202 const len = @typeInfo(Feature).@"enum".fields.len;
203203 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
204204 var result: [len]CpuFeature = undefined;
205205 result[@intFromEnum(Feature.@"16bit_mode")] = .{
......@@ -1272,7 +1272,7 @@ pub const all_features = blk: {
12721272 const ti = @typeInfo(Feature);
12731273 for (&result, 0..) |*elem, i| {
12741274 elem.index = i;
1275 elem.name = ti.Enum.fields[i].name;
1275 elem.name = ti.@"enum".fields[i].name;
12761276 }
12771277 break :blk result;
12781278};
lib/std/Target/xtensa.zig+2-2
......@@ -14,7 +14,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
1414pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
1515
1616pub const all_features = blk: {
17 const len = @typeInfo(Feature).Enum.fields.len;
17 const len = @typeInfo(Feature).@"enum".fields.len;
1818 std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
1919 var result: [len]CpuFeature = undefined;
2020 result[@intFromEnum(Feature.density)] = .{
......@@ -25,7 +25,7 @@ pub const all_features = blk: {
2525 const ti = @typeInfo(Feature);
2626 for (&result, 0..) |*elem, i| {
2727 elem.index = i;
28 elem.name = ti.Enum.fields[i].name;
28 elem.name = ti.@"enum".fields[i].name;
2929 }
3030 break :blk result;
3131};
lib/std/Thread.zig+9-9
......@@ -401,15 +401,15 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) {
401401 const default_value = if (Impl == PosixThreadImpl) null else 0;
402402 const bad_fn_ret = "expected return type of startFn to be 'u8', 'noreturn', '!noreturn', 'void', or '!void'";
403403
404 switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) {
405 .NoReturn => {
404 switch (@typeInfo(@typeInfo(@TypeOf(f)).@"fn".return_type.?)) {
405 .noreturn => {
406406 @call(.auto, f, args);
407407 },
408 .Void => {
408 .void => {
409409 @call(.auto, f, args);
410410 return default_value;
411411 },
412 .Int => |info| {
412 .int => |info| {
413413 if (info.bits != 8) {
414414 @compileError(bad_fn_ret);
415415 }
......@@ -422,7 +422,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) {
422422 // pthreads don't support exit status, ignore value
423423 return default_value;
424424 },
425 .ErrorUnion => |info| {
425 .error_union => |info| {
426426 switch (info.payload) {
427427 void, noreturn => {
428428 @call(.auto, f, args) catch |err| {
......@@ -850,17 +850,17 @@ const WasiThreadImpl = struct {
850850 fn entry(ptr: usize) void {
851851 const w: *@This() = @ptrFromInt(ptr);
852852 const bad_fn_ret = "expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'";
853 switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) {
854 .NoReturn, .Void => {
853 switch (@typeInfo(@typeInfo(@TypeOf(f)).@"fn".return_type.?)) {
854 .noreturn, .void => {
855855 @call(.auto, f, w.args);
856856 },
857 .Int => |info| {
857 .int => |info| {
858858 if (info.bits != 8) {
859859 @compileError(bad_fn_ret);
860860 }
861861 _ = @call(.auto, f, w.args); // WASI threads don't support exit status, ignore value
862862 },
863 .ErrorUnion => |info| {
863 .error_union => |info| {
864864 if (info.payload != void) {
865865 @compileError(bad_fn_ret);
866866 }
lib/std/array_hash_map.zig+11-11
......@@ -2584,17 +2584,17 @@ pub fn getAutoEqlFn(comptime K: type, comptime Context: type) (fn (Context, K, K
25842584
25852585pub fn autoEqlIsCheap(comptime K: type) bool {
25862586 return switch (@typeInfo(K)) {
2587 .Bool,
2588 .Int,
2589 .Float,
2590 .Pointer,
2591 .ComptimeFloat,
2592 .ComptimeInt,
2593 .Enum,
2594 .Fn,
2595 .ErrorSet,
2596 .AnyFrame,
2597 .EnumLiteral,
2587 .bool,
2588 .int,
2589 .float,
2590 .pointer,
2591 .comptime_float,
2592 .comptime_int,
2593 .@"enum",
2594 .@"fn",
2595 .error_set,
2596 .@"anyframe",
2597 .enum_literal,
25982598 => true,
25992599 else => false,
26002600 };
lib/std/bit_set.zig+2-2
......@@ -319,10 +319,10 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
319319 const mask_info: std.builtin.Type = @typeInfo(MaskIntType);
320320
321321 // Make sure the mask int is indeed an int
322 if (mask_info != .Int) @compileError("ArrayBitSet can only operate on integer masks, but was passed " ++ @typeName(MaskIntType));
322 if (mask_info != .int) @compileError("ArrayBitSet can only operate on integer masks, but was passed " ++ @typeName(MaskIntType));
323323
324324 // It must also be unsigned.
325 if (mask_info.Int.signedness != .unsigned) @compileError("ArrayBitSet requires an unsigned integer mask type, but was passed " ++ @typeName(MaskIntType));
325 if (mask_info.int.signedness != .unsigned) @compileError("ArrayBitSet requires an unsigned integer mask type, but was passed " ++ @typeName(MaskIntType));
326326
327327 // And it must not be empty.
328328 if (MaskIntType == u0)
lib/std/builtin.zig+24-24
......@@ -257,30 +257,30 @@ pub const TypeId = std.meta.Tag(Type);
257257/// This data structure is used by the Zig language code generation and
258258/// therefore must be kept in sync with the compiler implementation.
259259pub const Type = union(enum) {
260 Type: void,
261 Void: void,
262 Bool: void,
263 NoReturn: void,
264 Int: Int,
265 Float: Float,
266 Pointer: Pointer,
267 Array: Array,
268 Struct: Struct,
269 ComptimeFloat: void,
270 ComptimeInt: void,
271 Undefined: void,
272 Null: void,
273 Optional: Optional,
274 ErrorUnion: ErrorUnion,
275 ErrorSet: ErrorSet,
276 Enum: Enum,
277 Union: Union,
278 Fn: Fn,
279 Opaque: Opaque,
280 Frame: Frame,
281 AnyFrame: AnyFrame,
282 Vector: Vector,
283 EnumLiteral: void,
260 type: void,
261 void: void,
262 bool: void,
263 noreturn: void,
264 int: Int,
265 float: Float,
266 pointer: Pointer,
267 array: Array,
268 @"struct": Struct,
269 comptime_float: void,
270 comptime_int: void,
271 undefined: void,
272 null: void,
273 optional: Optional,
274 error_union: ErrorUnion,
275 error_set: ErrorSet,
276 @"enum": Enum,
277 @"union": Union,
278 @"fn": Fn,
279 @"opaque": Opaque,
280 frame: Frame,
281 @"anyframe": AnyFrame,
282 vector: Vector,
283 enum_literal: void,
284284
285285 /// This data structure is used by the Zig language code generation and
286286 /// therefore must be kept in sync with the compiler implementation.
lib/std/c/darwin.zig+1-1
......@@ -54,7 +54,7 @@ pub const EXC = enum(exception_type_t) {
5454 /// Abnormal process exited to corpse state
5555 CORPSE_NOTIFY = 13,
5656
57 pub const TYPES_COUNT = @typeInfo(EXC).Enum.fields.len;
57 pub const TYPES_COUNT = @typeInfo(EXC).@"enum".fields.len;
5858 pub const SOFT_SIGNAL = 0x10003;
5959
6060 pub const MASK = packed struct(u32) {
lib/std/compress/flate/huffman_encoder.zig+1-1
......@@ -455,7 +455,7 @@ test "generate a Huffman code for the 30 possible relative distances (LZ77 dista
455455// Reverse bit-by-bit a N-bit code.
456456fn bitReverse(comptime T: type, value: T, n: usize) T {
457457 const r = @bitReverse(value);
458 return r >> @as(math.Log2Int(T), @intCast(@typeInfo(T).Int.bits - n));
458 return r >> @as(math.Log2Int(T), @intCast(@typeInfo(T).int.bits - n));
459459}
460460
461461test bitReverse {
lib/std/crypto/cmac.zig+1-1
......@@ -8,7 +8,7 @@ pub const CmacAes128 = Cmac(crypto.core.aes.Aes128);
88/// NIST Special Publication 800-38B - The CMAC Mode for Authentication
99/// https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38b.pdf
1010pub fn Cmac(comptime BlockCipher: type) type {
11 const BlockCipherCtx = @typeInfo(@TypeOf(BlockCipher.initEnc)).Fn.return_type.?;
11 const BlockCipherCtx = @typeInfo(@TypeOf(BlockCipher.initEnc)).@"fn".return_type.?;
1212 const Block = [BlockCipher.block.block_length]u8;
1313
1414 return struct {
lib/std/crypto/ff.zig+2-2
......@@ -848,7 +848,7 @@ const ct_protected = struct {
848848
849849 // Multiplies two limbs and returns the result as a wide limb.
850850 fn mulWide(x: Limb, y: Limb) WideLimb {
851 const half_bits = @typeInfo(Limb).Int.bits / 2;
851 const half_bits = @typeInfo(Limb).int.bits / 2;
852852 const Half = meta.Int(.unsigned, half_bits);
853853 const x0 = @as(Half, @truncate(x));
854854 const x1 = @as(Half, @truncate(x >> half_bits));
......@@ -901,7 +901,7 @@ const ct_unprotected = struct {
901901 fn mulWide(x: Limb, y: Limb) WideLimb {
902902 const wide = math.mulWide(Limb, x, y);
903903 return .{
904 .hi = @as(Limb, @truncate(wide >> @typeInfo(Limb).Int.bits)),
904 .hi = @as(Limb, @truncate(wide >> @typeInfo(Limb).int.bits)),
905905 .lo = @as(Limb, @truncate(wide)),
906906 };
907907 }
lib/std/crypto/phc_encoding.zig+8-8
......@@ -91,7 +91,7 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
9191 if (mem.eql(u8, opt_version.key, version_param_name)) {
9292 if (@hasField(HashResult, "alg_version")) {
9393 const value_type_info = switch (@typeInfo(@TypeOf(out.alg_version))) {
94 .Optional => |opt| comptime @typeInfo(opt.child),
94 .optional => |opt| @typeInfo(opt.child),
9595 else => |t| t,
9696 };
9797 out.alg_version = fmt.parseUnsigned(
......@@ -114,16 +114,16 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
114114 inline for (comptime meta.fields(HashResult)) |p| {
115115 if (mem.eql(u8, p.name, param.key)) {
116116 switch (@typeInfo(p.type)) {
117 .Int => @field(out, p.name) = fmt.parseUnsigned(
117 .int => @field(out, p.name) = fmt.parseUnsigned(
118118 p.type,
119119 param.value,
120120 10,
121121 ) catch return Error.InvalidEncoding,
122 .Pointer => |ptr| {
122 .pointer => |ptr| {
123123 if (!ptr.is_const) @compileError("Value slice must be constant");
124124 @field(out, p.name) = param.value;
125125 },
126 .Struct => try @field(out, p.name).fromB64(param.value),
126 .@"struct" => try @field(out, p.name).fromB64(param.value),
127127 else => std.debug.panic(
128128 "Value for [{s}] must be an integer, a constant slice or a BinValue",
129129 .{p.name},
......@@ -164,7 +164,7 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
164164 // with default values
165165 var expected_fields: usize = 0;
166166 inline for (comptime meta.fields(HashResult)) |p| {
167 if (@typeInfo(p.type) != .Optional and p.default_value == null) {
167 if (@typeInfo(p.type) != .optional and p.default_value == null) {
168168 expected_fields += 1;
169169 }
170170 }
......@@ -202,7 +202,7 @@ fn serializeTo(params: anytype, out: anytype) !void {
202202 try out.writeAll(params.alg_id);
203203
204204 if (@hasField(HashResult, "alg_version")) {
205 if (@typeInfo(@TypeOf(params.alg_version)) == .Optional) {
205 if (@typeInfo(@TypeOf(params.alg_version)) == .optional) {
206206 if (params.alg_version) |alg_version| {
207207 try out.print(
208208 "{s}{s}{s}{}",
......@@ -226,12 +226,12 @@ fn serializeTo(params: anytype, out: anytype) !void {
226226 {
227227 const value = @field(params, p.name);
228228 try out.writeAll(if (has_params) params_delimiter else fields_delimiter);
229 if (@typeInfo(p.type) == .Struct) {
229 if (@typeInfo(p.type) == .@"struct") {
230230 var buf: [@TypeOf(value).max_encoded_length]u8 = undefined;
231231 try out.print("{s}{s}{s}", .{ p.name, kv_delimiter, try value.toB64(&buf) });
232232 } else {
233233 try out.print(
234 if (@typeInfo(@TypeOf(value)) == .Pointer) "{s}{s}{s}" else "{s}{s}{}",
234 if (@typeInfo(@TypeOf(value)) == .pointer) "{s}{s}{s}" else "{s}{s}{}",
235235 .{ p.name, kv_delimiter, value },
236236 );
237237 }
lib/std/crypto/timing_safe.zig+7-7
......@@ -11,27 +11,27 @@ const Order = std.math.Order;
1111/// For all other applications, use mem.eql() instead.
1212pub fn eql(comptime T: type, a: T, b: T) bool {
1313 switch (@typeInfo(T)) {
14 .Array => |info| {
14 .array => |info| {
1515 const C = info.child;
16 if (@typeInfo(C) != .Int) {
16 if (@typeInfo(C) != .int) {
1717 @compileError("Elements to be compared must be integers");
1818 }
1919 var acc = @as(C, 0);
2020 for (a, 0..) |x, i| {
2121 acc |= x ^ b[i];
2222 }
23 const s = @typeInfo(C).Int.bits;
23 const s = @typeInfo(C).int.bits;
2424 const Cu = std.meta.Int(.unsigned, s);
2525 const Cext = std.meta.Int(.unsigned, s + 1);
2626 return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));
2727 },
28 .Vector => |info| {
28 .vector => |info| {
2929 const C = info.child;
30 if (@typeInfo(C) != .Int) {
30 if (@typeInfo(C) != .int) {
3131 @compileError("Elements to be compared must be integers");
3232 }
3333 const acc = @reduce(.Or, a ^ b);
34 const s = @typeInfo(C).Int.bits;
34 const s = @typeInfo(C).int.bits;
3535 const Cu = std.meta.Int(.unsigned, s);
3636 const Cext = std.meta.Int(.unsigned, s + 1);
3737 return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));
......@@ -47,7 +47,7 @@ pub fn eql(comptime T: type, a: T, b: T) bool {
4747pub fn compare(comptime T: type, a: []const T, b: []const T, endian: Endian) Order {
4848 assert(a.len == b.len);
4949 const bits = switch (@typeInfo(T)) {
50 .Int => |cinfo| if (cinfo.signedness != .unsigned) @compileError("Elements to be compared must be unsigned") else cinfo.bits,
50 .int => |cinfo| if (cinfo.signedness != .unsigned) @compileError("Elements to be compared must be unsigned") else cinfo.bits,
5151 else => @compileError("Elements to be compared must be integers"),
5252 };
5353 const Cext = std.meta.Int(.unsigned, bits + 1);
lib/std/crypto/tls.zig+2-2
......@@ -491,7 +491,7 @@ pub const Decoder = struct {
491491 /// Use this function to increase `idx`.
492492 pub fn decode(d: *Decoder, comptime T: type) T {
493493 switch (@typeInfo(T)) {
494 .Int => |info| switch (info.bits) {
494 .int => |info| switch (info.bits) {
495495 8 => {
496496 skip(d, 1);
497497 return d.buf[d.idx - 1];
......@@ -511,7 +511,7 @@ pub const Decoder = struct {
511511 },
512512 else => @compileError("unsupported int type: " ++ @typeName(T)),
513513 },
514 .Enum => |info| {
514 .@"enum" => |info| {
515515 const int = d.decode(info.tag_type);
516516 if (info.is_exhaustive) @compileError("exhaustive enum cannot be used");
517517 return @as(T, @enumFromInt(int));
lib/std/debug.zig+1-1
......@@ -547,7 +547,7 @@ pub fn writeStackTrace(
547547}
548548
549549pub const UnwindError = if (have_ucontext)
550 @typeInfo(@typeInfo(@TypeOf(StackIterator.next_unwind)).Fn.return_type.?).ErrorUnion.error_set
550 @typeInfo(@typeInfo(@TypeOf(StackIterator.next_unwind)).@"fn".return_type.?).error_union.error_set
551551else
552552 void;
553553
lib/std/debug/Dwarf.zig+1-1
......@@ -2216,7 +2216,7 @@ pub const ElfModule = struct {
22162216 }
22172217
22182218 var section_index: ?usize = null;
2219 inline for (@typeInfo(Dwarf.Section.Id).Enum.fields, 0..) |sect, i| {
2219 inline for (@typeInfo(Dwarf.Section.Id).@"enum".fields, 0..) |sect, i| {
22202220 if (mem.eql(u8, "." ++ sect.name, name)) section_index = i;
22212221 }
22222222 if (section_index == null) continue;
lib/std/debug/Dwarf/expression.zig+3-3
......@@ -164,7 +164,7 @@ pub fn StackMachine(comptime options: Options) type {
164164 }
165165
166166 fn generic(value: anytype) Operand {
167 const int_info = @typeInfo(@TypeOf(value)).Int;
167 const int_info = @typeInfo(@TypeOf(value)).int;
168168 if (@sizeOf(@TypeOf(value)) > options.addr_size) {
169169 return .{ .generic = switch (int_info.signedness) {
170170 .signed => @bitCast(@as(addr_type_signed, @truncate(value))),
......@@ -843,7 +843,7 @@ pub fn Builder(comptime options: Options) type {
843843 }
844844
845845 pub fn writeConst(writer: anytype, comptime T: type, value: T) !void {
846 if (@typeInfo(T) != .Int) @compileError("Constants must be integers");
846 if (@typeInfo(T) != .int) @compileError("Constants must be integers");
847847
848848 switch (T) {
849849 u8, i8, u16, i16, u32, i32, u64, i64 => {
......@@ -861,7 +861,7 @@ pub fn Builder(comptime options: Options) type {
861861
862862 try writer.writeInt(T, value, options.endian);
863863 },
864 else => switch (@typeInfo(T).Int.signedness) {
864 else => switch (@typeInfo(T).int.signedness) {
865865 .unsigned => {
866866 try writer.writeByte(OP.constu);
867867 try leb.writeUleb128(writer, value);
lib/std/debug/FixedBufferReader.zig+1-1
......@@ -32,7 +32,7 @@ pub fn readByteSigned(fbr: *FixedBufferReader) Error!i8 {
3232}
3333
3434pub fn readInt(fbr: *FixedBufferReader, comptime T: type) Error!T {
35 const size = @divExact(@typeInfo(T).Int.bits, 8);
35 const size = @divExact(@typeInfo(T).int.bits, 8);
3636 if (fbr.buf.len - fbr.pos < size) return error.EndOfBuffer;
3737 defer fbr.pos += size;
3838 return std.mem.readInt(T, fbr.buf[fbr.pos..][0..size], fbr.endian);
lib/std/debug/Pdb.zig+1-1
......@@ -495,7 +495,7 @@ const MsfStream = struct {
495495 blocks: []u32 = undefined,
496496 block_size: u32 = undefined,
497497
498 pub const Error = @typeInfo(@typeInfo(@TypeOf(read)).Fn.return_type.?).ErrorUnion.error_set;
498 pub const Error = @typeInfo(@typeInfo(@TypeOf(read)).@"fn".return_type.?).error_union.error_set;
499499
500500 fn init(block_size: u32, file: File, blocks: []u32) MsfStream {
501501 const stream = MsfStream{
lib/std/debug/SelfInfo.zig+5-5
......@@ -37,7 +37,7 @@ modules: if (native_os == .windows) std.ArrayListUnmanaged(WindowsModule) else v
3737pub const OpenError = error{
3838 MissingDebugInfo,
3939 UnsupportedOperatingSystem,
40} || @typeInfo(@typeInfo(@TypeOf(SelfInfo.init)).Fn.return_type.?).ErrorUnion.error_set;
40} || @typeInfo(@typeInfo(@TypeOf(SelfInfo.init)).@"fn".return_type.?).error_union.error_set;
4141
4242pub fn open(allocator: Allocator) OpenError!SelfInfo {
4343 nosuspend {
......@@ -582,7 +582,7 @@ pub const Module = switch (native_os) {
582582 if (!std.mem.eql(u8, "__DWARF", sect.segName())) continue;
583583
584584 var section_index: ?usize = null;
585 inline for (@typeInfo(Dwarf.Section.Id).Enum.fields, 0..) |section, i| {
585 inline for (@typeInfo(Dwarf.Section.Id).@"enum".fields, 0..) |section, i| {
586586 if (mem.eql(u8, "__" ++ section.name, sect.sectName())) section_index = i;
587587 }
588588 if (section_index == null) continue;
......@@ -981,7 +981,7 @@ fn readCoffDebugInfo(allocator: Allocator, coff_obj: *coff.Coff) !Module {
981981 var sections: Dwarf.SectionArray = Dwarf.null_section_array;
982982 errdefer for (sections) |section| if (section) |s| if (s.owned) allocator.free(s.data);
983983
984 inline for (@typeInfo(Dwarf.Section.Id).Enum.fields, 0..) |section, i| {
984 inline for (@typeInfo(Dwarf.Section.Id).@"enum".fields, 0..) |section, i| {
985985 sections[i] = if (coff_obj.getSectionByName("." ++ section.name)) |section_header| blk: {
986986 break :blk .{
987987 .data = try coff_obj.getSectionDataAlloc(section_header, allocator),
......@@ -1443,7 +1443,7 @@ pub fn unwindFrameMachO(
14431443 if (ma.load(usize, new_sp) == null or ma.load(usize, min_reg_addr) == null) return error.InvalidUnwindInfo;
14441444
14451445 var reg_addr = fp - @sizeOf(usize);
1446 inline for (@typeInfo(@TypeOf(encoding.value.arm64.frame.x_reg_pairs)).Struct.fields, 0..) |field, i| {
1446 inline for (@typeInfo(@TypeOf(encoding.value.arm64.frame.x_reg_pairs)).@"struct".fields, 0..) |field, i| {
14471447 if (@field(encoding.value.arm64.frame.x_reg_pairs, field.name) != 0) {
14481448 (try regValueNative(context.thread_context, 19 + i, reg_context)).* = @as(*const usize, @ptrFromInt(reg_addr)).*;
14491449 reg_addr += @sizeOf(usize);
......@@ -1452,7 +1452,7 @@ pub fn unwindFrameMachO(
14521452 }
14531453 }
14541454
1455 inline for (@typeInfo(@TypeOf(encoding.value.arm64.frame.d_reg_pairs)).Struct.fields, 0..) |field, i| {
1455 inline for (@typeInfo(@TypeOf(encoding.value.arm64.frame.d_reg_pairs)).@"struct".fields, 0..) |field, i| {
14561456 if (@field(encoding.value.arm64.frame.d_reg_pairs, field.name) != 0) {
14571457 // Only the lower half of the 128-bit V registers are restored during unwinding
14581458 @memcpy(
lib/std/enums.zig+31-31
......@@ -13,9 +13,9 @@ const eval_branch_quota_cushion = 10;
1313/// the first name is used. Each field is of type Data and has the provided
1414/// default, which may be undefined.
1515pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_default: ?Data) type {
16 @setEvalBranchQuota(@typeInfo(E).Enum.fields.len + eval_branch_quota_cushion);
17 var struct_fields: [@typeInfo(E).Enum.fields.len]std.builtin.Type.StructField = undefined;
18 for (&struct_fields, @typeInfo(E).Enum.fields) |*struct_field, enum_field| {
16 @setEvalBranchQuota(@typeInfo(E).@"enum".fields.len + eval_branch_quota_cushion);
17 var struct_fields: [@typeInfo(E).@"enum".fields.len]std.builtin.Type.StructField = undefined;
18 for (&struct_fields, @typeInfo(E).@"enum".fields) |*struct_field, enum_field| {
1919 struct_field.* = .{
2020 .name = enum_field.name ++ "",
2121 .type = Data,
......@@ -24,7 +24,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def
2424 .alignment = if (@sizeOf(Data) > 0) @alignOf(Data) else 0,
2525 };
2626 }
27 return @Type(.{ .Struct = .{
27 return @Type(.{ .@"struct" = .{
2828 .layout = .auto,
2929 .fields = &struct_fields,
3030 .decls = &.{},
......@@ -49,14 +49,14 @@ pub inline fn valuesFromFields(comptime E: type, comptime fields: []const EnumFi
4949/// Returns the set of all named values in the given enum, in
5050/// declaration order.
5151pub fn values(comptime E: type) []const E {
52 return comptime valuesFromFields(E, @typeInfo(E).Enum.fields);
52 return comptime valuesFromFields(E, @typeInfo(E).@"enum".fields);
5353}
5454
5555/// A safe alternative to @tagName() for non-exhaustive enums that doesn't
5656/// panic when `e` has no tagged value.
5757/// Returns the tag name for `e` or null if no tag exists.
5858pub fn tagName(comptime E: type, e: E) ?[]const u8 {
59 return inline for (@typeInfo(E).Enum.fields) |f| {
59 return inline for (@typeInfo(E).@"enum".fields) |f| {
6060 if (@intFromEnum(e) == f.value) break f.name;
6161 } else null;
6262}
......@@ -80,7 +80,7 @@ test tagName {
8080pub fn directEnumArrayLen(comptime E: type, comptime max_unused_slots: comptime_int) comptime_int {
8181 var max_value: comptime_int = -1;
8282 const max_usize: comptime_int = ~@as(usize, 0);
83 const fields = @typeInfo(E).Enum.fields;
83 const fields = @typeInfo(E).@"enum".fields;
8484 for (fields) |f| {
8585 if (f.value < 0) {
8686 @compileError("Cannot create a direct enum array for " ++ @typeName(E) ++ ", field ." ++ f.name ++ " has a negative value.");
......@@ -159,7 +159,7 @@ pub fn directEnumArrayDefault(
159159) [directEnumArrayLen(E, max_unused_slots)]Data {
160160 const len = comptime directEnumArrayLen(E, max_unused_slots);
161161 var result: [len]Data = if (default) |d| [_]Data{d} ** len else undefined;
162 inline for (@typeInfo(@TypeOf(init_values)).Struct.fields) |f| {
162 inline for (@typeInfo(@TypeOf(init_values)).@"struct".fields) |f| {
163163 const enum_value = @field(E, f.name);
164164 const index = @as(usize, @intCast(@intFromEnum(enum_value)));
165165 result[index] = @field(init_values, f.name);
......@@ -204,8 +204,8 @@ pub fn nameCast(comptime E: type, comptime value: anytype) E {
204204 const V = @TypeOf(value);
205205 if (V == E) break :blk value;
206206 const name: ?[]const u8 = switch (@typeInfo(V)) {
207 .EnumLiteral, .Enum => @tagName(value),
208 .Pointer => value,
207 .enum_literal, .@"enum" => @tagName(value),
208 .pointer => value,
209209 else => null,
210210 };
211211 if (name) |n| {
......@@ -262,9 +262,9 @@ pub fn EnumSet(comptime E: type) type {
262262
263263 /// Initializes the set using a struct of bools
264264 pub fn init(init_values: EnumFieldStruct(E, bool, false)) Self {
265 @setEvalBranchQuota(2 * @typeInfo(E).Enum.fields.len);
265 @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
266266 var result: Self = .{};
267 if (@typeInfo(E).Enum.is_exhaustive) {
267 if (@typeInfo(E).@"enum".is_exhaustive) {
268268 inline for (0..Self.len) |i| {
269269 const key = comptime Indexer.keyForIndex(i);
270270 const tag = @tagName(key);
......@@ -453,9 +453,9 @@ pub fn EnumMap(comptime E: type, comptime V: type) type {
453453
454454 /// Initializes the map using a sparse struct of optionals
455455 pub fn init(init_values: EnumFieldStruct(E, ?Value, @as(?Value, null))) Self {
456 @setEvalBranchQuota(2 * @typeInfo(E).Enum.fields.len);
456 @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
457457 var result: Self = .{};
458 if (@typeInfo(E).Enum.is_exhaustive) {
458 if (@typeInfo(E).@"enum".is_exhaustive) {
459459 inline for (0..Self.len) |i| {
460460 const key = comptime Indexer.keyForIndex(i);
461461 const tag = @tagName(key);
......@@ -497,7 +497,7 @@ pub fn EnumMap(comptime E: type, comptime V: type) type {
497497 /// Initializes a full mapping with a provided default.
498498 /// Consider using EnumArray instead if the map will remain full.
499499 pub fn initFullWithDefault(comptime default: ?Value, init_values: EnumFieldStruct(E, Value, default)) Self {
500 @setEvalBranchQuota(2 * @typeInfo(E).Enum.fields.len);
500 @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
501501 var result: Self = .{
502502 .bits = Self.BitSet.initFull(),
503503 .values = undefined,
......@@ -683,9 +683,9 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
683683
684684 /// Initializes the multiset using a struct of counts.
685685 pub fn init(init_counts: EnumFieldStruct(E, CountSize, 0)) Self {
686 @setEvalBranchQuota(2 * @typeInfo(E).Enum.fields.len);
686 @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
687687 var self = initWithCount(0);
688 inline for (@typeInfo(E).Enum.fields) |field| {
688 inline for (@typeInfo(E).@"enum".fields) |field| {
689689 const c = @field(init_counts, field.name);
690690 const key = @as(E, @enumFromInt(field.value));
691691 self.counts.set(key, c);
......@@ -757,7 +757,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
757757 /// Increases the all key counts by given multiset. Caller
758758 /// asserts operation will not overflow any key.
759759 pub fn addSetAssertSafe(self: *Self, other: Self) void {
760 inline for (@typeInfo(E).Enum.fields) |field| {
760 inline for (@typeInfo(E).@"enum".fields) |field| {
761761 const key = @as(E, @enumFromInt(field.value));
762762 self.addAssertSafe(key, other.getCount(key));
763763 }
......@@ -765,7 +765,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
765765
766766 /// Increases the all key counts by given multiset.
767767 pub fn addSet(self: *Self, other: Self) error{Overflow}!void {
768 inline for (@typeInfo(E).Enum.fields) |field| {
768 inline for (@typeInfo(E).@"enum".fields) |field| {
769769 const key = @as(E, @enumFromInt(field.value));
770770 try self.add(key, other.getCount(key));
771771 }
......@@ -775,7 +775,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
775775 /// the given multiset has more key counts than this,
776776 /// then that key will have a key count of zero.
777777 pub fn removeSet(self: *Self, other: Self) void {
778 inline for (@typeInfo(E).Enum.fields) |field| {
778 inline for (@typeInfo(E).@"enum".fields) |field| {
779779 const key = @as(E, @enumFromInt(field.value));
780780 self.remove(key, other.getCount(key));
781781 }
......@@ -784,7 +784,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
784784 /// Returns true iff all key counts are the same as
785785 /// given multiset.
786786 pub fn eql(self: Self, other: Self) bool {
787 inline for (@typeInfo(E).Enum.fields) |field| {
787 inline for (@typeInfo(E).@"enum".fields) |field| {
788788 const key = @as(E, @enumFromInt(field.value));
789789 if (self.getCount(key) != other.getCount(key)) {
790790 return false;
......@@ -796,7 +796,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
796796 /// Returns true iff all key counts less than or
797797 /// equal to the given multiset.
798798 pub fn subsetOf(self: Self, other: Self) bool {
799 inline for (@typeInfo(E).Enum.fields) |field| {
799 inline for (@typeInfo(E).@"enum".fields) |field| {
800800 const key = @as(E, @enumFromInt(field.value));
801801 if (self.getCount(key) > other.getCount(key)) {
802802 return false;
......@@ -808,7 +808,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
808808 /// Returns true iff all key counts greater than or
809809 /// equal to the given multiset.
810810 pub fn supersetOf(self: Self, other: Self) bool {
811 inline for (@typeInfo(E).Enum.fields) |field| {
811 inline for (@typeInfo(E).@"enum".fields) |field| {
812812 const key = @as(E, @enumFromInt(field.value));
813813 if (self.getCount(key) < other.getCount(key)) {
814814 return false;
......@@ -1087,7 +1087,7 @@ pub fn EnumArray(comptime E: type, comptime V: type) type {
10871087
10881088 /// Initializes values in the enum array, with the specified default.
10891089 pub fn initDefault(comptime default: ?Value, init_values: EnumFieldStruct(E, Value, default)) Self {
1090 @setEvalBranchQuota(2 * @typeInfo(E).Enum.fields.len);
1090 @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
10911091 var result: Self = .{ .values = undefined };
10921092 inline for (0..Self.len) |i| {
10931093 const key = comptime Indexer.keyForIndex(i);
......@@ -1277,17 +1277,17 @@ test "EnumSet non-exhaustive" {
12771277pub fn EnumIndexer(comptime E: type) type {
12781278 // Assumes that the enum fields are sorted in ascending order (optimistic).
12791279 // Unsorted enums may require the user to manually increase the quota.
1280 @setEvalBranchQuota(3 * @typeInfo(E).Enum.fields.len + eval_branch_quota_cushion);
1280 @setEvalBranchQuota(3 * @typeInfo(E).@"enum".fields.len + eval_branch_quota_cushion);
12811281
1282 if (!@typeInfo(E).Enum.is_exhaustive) {
1283 const BackingInt = @typeInfo(E).Enum.tag_type;
1282 if (!@typeInfo(E).@"enum".is_exhaustive) {
1283 const BackingInt = @typeInfo(E).@"enum".tag_type;
12841284 if (@bitSizeOf(BackingInt) > @bitSizeOf(usize))
12851285 @compileError("Cannot create an enum indexer for a given non-exhaustive enum, tag_type is larger than usize.");
12861286
12871287 return struct {
12881288 pub const Key: type = E;
12891289
1290 const backing_int_sign = @typeInfo(BackingInt).Int.signedness;
1290 const backing_int_sign = @typeInfo(BackingInt).int.signedness;
12911291 const min_value = std.math.minInt(BackingInt);
12921292 const max_value = std.math.maxInt(BackingInt);
12931293
......@@ -1312,7 +1312,7 @@ pub fn EnumIndexer(comptime E: type) type {
13121312 };
13131313 }
13141314
1315 const const_fields = @typeInfo(E).Enum.fields;
1315 const const_fields = @typeInfo(E).@"enum".fields;
13161316 var fields = const_fields[0..const_fields.len].*;
13171317 const fields_len = fields.len;
13181318
......@@ -1359,7 +1359,7 @@ pub fn EnumIndexer(comptime E: type) type {
13591359 // gives up some safety to avoid artificially limiting
13601360 // the range of signed enum values to max_isize.
13611361 const enum_value = if (min < 0) @as(isize, @bitCast(i)) +% min else i + min;
1362 return @as(E, @enumFromInt(@as(@typeInfo(E).Enum.tag_type, @intCast(enum_value))));
1362 return @as(E, @enumFromInt(@as(@typeInfo(E).@"enum".tag_type, @intCast(enum_value))));
13631363 }
13641364 };
13651365 }
......@@ -1411,7 +1411,7 @@ test "EnumIndexer non-exhaustive" {
14111411
14121412 const RangedType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt));
14131413 const max_index: comptime_int = std.math.maxInt(RangedType);
1414 const number_zero_tag_index: usize = switch (@typeInfo(BackingInt).Int.signedness) {
1414 const number_zero_tag_index: usize = switch (@typeInfo(BackingInt).int.signedness) {
14151415 .unsigned => 0,
14161416 .signed => std.math.divCeil(comptime_int, max_index, 2) catch unreachable,
14171417 };
lib/std/fmt.zig+38-38
......@@ -87,11 +87,11 @@ pub fn format(
8787) !void {
8888 const ArgsType = @TypeOf(args);
8989 const args_type_info = @typeInfo(ArgsType);
90 if (args_type_info != .Struct) {
90 if (args_type_info != .@"struct") {
9191 @compileError("expected tuple or struct argument, found " ++ @typeName(ArgsType));
9292 }
9393
94 const fields_info = args_type_info.Struct.fields;
94 const fields_info = args_type_info.@"struct".fields;
9595 if (fields_info.len > max_format_args) {
9696 @compileError("32 arguments max are supported per format call");
9797 }
......@@ -397,7 +397,7 @@ pub const Parser = struct {
397397};
398398
399399pub const ArgSetType = u32;
400const max_format_args = @typeInfo(ArgSetType).Int.bits;
400const max_format_args = @typeInfo(ArgSetType).int.bits;
401401
402402pub const ArgState = struct {
403403 next_arg: usize = 0,
......@@ -430,7 +430,7 @@ pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @T
430430 const T = @TypeOf(value);
431431
432432 switch (@typeInfo(T)) {
433 .Pointer => |info| {
433 .pointer => |info| {
434434 try writer.writeAll(@typeName(info.child) ++ "@");
435435 if (info.size == .Slice)
436436 try formatInt(@intFromPtr(value.ptr), 16, .lower, FormatOptions{}, writer)
......@@ -438,8 +438,8 @@ pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @T
438438 try formatInt(@intFromPtr(value), 16, .lower, FormatOptions{}, writer);
439439 return;
440440 },
441 .Optional => |info| {
442 if (@typeInfo(info.child) == .Pointer) {
441 .optional => |info| {
442 if (@typeInfo(info.child) == .pointer) {
443443 try writer.writeAll(@typeName(info.child) ++ "@");
444444 try formatInt(@intFromPtr(value), 16, .lower, FormatOptions{}, writer);
445445 return;
......@@ -456,17 +456,17 @@ const ANY = "any";
456456
457457pub fn defaultSpec(comptime T: type) [:0]const u8 {
458458 switch (@typeInfo(T)) {
459 .Array => |_| return ANY,
460 .Pointer => |ptr_info| switch (ptr_info.size) {
459 .array => |_| return ANY,
460 .pointer => |ptr_info| switch (ptr_info.size) {
461461 .One => switch (@typeInfo(ptr_info.child)) {
462 .Array => |_| return ANY,
462 .array => |_| return ANY,
463463 else => {},
464464 },
465465 .Many, .C => return "*",
466466 .Slice => return ANY,
467467 },
468 .Optional => |info| return "?" ++ defaultSpec(info.child),
469 .ErrorUnion => |info| return "!" ++ defaultSpec(info.payload),
468 .optional => |info| return "?" ++ defaultSpec(info.child),
469 .error_union => |info| return "!" ++ defaultSpec(info.payload),
470470 else => {},
471471 }
472472 return "";
......@@ -494,7 +494,7 @@ pub fn formatType(
494494 const actual_fmt = comptime if (std.mem.eql(u8, fmt, ANY))
495495 defaultSpec(T)
496496 else if (fmt.len != 0 and (fmt[0] == '?' or fmt[0] == '!')) switch (@typeInfo(T)) {
497 .Optional, .ErrorUnion => fmt,
497 .optional, .error_union => fmt,
498498 else => stripOptionalOrErrorUnionSpec(fmt),
499499 } else fmt;
500500
......@@ -507,18 +507,18 @@ pub fn formatType(
507507 }
508508
509509 switch (@typeInfo(T)) {
510 .ComptimeInt, .Int, .ComptimeFloat, .Float => {
510 .comptime_int, .int, .comptime_float, .float => {
511511 return formatValue(value, actual_fmt, options, writer);
512512 },
513 .Void => {
513 .void => {
514514 if (actual_fmt.len != 0) invalidFmtError(fmt, value);
515515 return formatBuf("void", options, writer);
516516 },
517 .Bool => {
517 .bool => {
518518 if (actual_fmt.len != 0) invalidFmtError(fmt, value);
519519 return formatBuf(if (value) "true" else "false", options, writer);
520520 },
521 .Optional => {
521 .optional => {
522522 if (actual_fmt.len == 0 or actual_fmt[0] != '?')
523523 @compileError("cannot format optional without a specifier (i.e. {?} or {any})");
524524 const remaining_fmt = comptime stripOptionalOrErrorUnionSpec(actual_fmt);
......@@ -528,7 +528,7 @@ pub fn formatType(
528528 return formatBuf("null", options, writer);
529529 }
530530 },
531 .ErrorUnion => {
531 .error_union => {
532532 if (actual_fmt.len == 0 or actual_fmt[0] != '!')
533533 @compileError("cannot format error union without a specifier (i.e. {!} or {any})");
534534 const remaining_fmt = comptime stripOptionalOrErrorUnionSpec(actual_fmt);
......@@ -538,12 +538,12 @@ pub fn formatType(
538538 return formatType(err, "", options, writer, max_depth);
539539 }
540540 },
541 .ErrorSet => {
541 .error_set => {
542542 if (actual_fmt.len != 0) invalidFmtError(fmt, value);
543543 try writer.writeAll("error.");
544544 return writer.writeAll(@errorName(value));
545545 },
546 .Enum => |enumInfo| {
546 .@"enum" => |enumInfo| {
547547 try writer.writeAll(@typeName(T));
548548 if (enumInfo.is_exhaustive) {
549549 if (actual_fmt.len != 0) invalidFmtError(fmt, value);
......@@ -566,7 +566,7 @@ pub fn formatType(
566566 try formatType(@intFromEnum(value), actual_fmt, options, writer, max_depth);
567567 try writer.writeAll(")");
568568 },
569 .Union => |info| {
569 .@"union" => |info| {
570570 if (actual_fmt.len != 0) invalidFmtError(fmt, value);
571571 try writer.writeAll(@typeName(T));
572572 if (max_depth == 0) {
......@@ -586,7 +586,7 @@ pub fn formatType(
586586 try format(writer, "@{x}", .{@intFromPtr(&value)});
587587 }
588588 },
589 .Struct => |info| {
589 .@"struct" => |info| {
590590 if (actual_fmt.len != 0) invalidFmtError(fmt, value);
591591 if (info.is_tuple) {
592592 // Skip the type and field names when formatting tuples.
......@@ -621,9 +621,9 @@ pub fn formatType(
621621 }
622622 try writer.writeAll(" }");
623623 },
624 .Pointer => |ptr_info| switch (ptr_info.size) {
624 .pointer => |ptr_info| switch (ptr_info.size) {
625625 .One => switch (@typeInfo(ptr_info.child)) {
626 .Array, .Enum, .Union, .Struct => {
626 .array, .@"enum", .@"union", .@"struct" => {
627627 return formatType(value.*, actual_fmt, options, writer, max_depth);
628628 },
629629 else => return format(writer, "{s}@{x}", .{ @typeName(ptr_info.child), @intFromPtr(value) }),
......@@ -658,7 +658,7 @@ pub fn formatType(
658658 try writer.writeAll(" }");
659659 },
660660 },
661 .Array => |info| {
661 .array => |info| {
662662 if (actual_fmt.len == 0)
663663 @compileError("cannot format array without a specifier (i.e. {s} or {any})");
664664 if (max_depth == 0) {
......@@ -676,7 +676,7 @@ pub fn formatType(
676676 }
677677 try writer.writeAll(" }");
678678 },
679 .Vector => |info| {
679 .vector => |info| {
680680 try writer.writeAll("{ ");
681681 var i: usize = 0;
682682 while (i < info.len) : (i += 1) {
......@@ -687,17 +687,17 @@ pub fn formatType(
687687 }
688688 try writer.writeAll(" }");
689689 },
690 .Fn => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),
691 .Type => {
690 .@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),
691 .type => {
692692 if (actual_fmt.len != 0) invalidFmtError(fmt, value);
693693 return formatBuf(@typeName(value), options, writer);
694694 },
695 .EnumLiteral => {
695 .enum_literal => {
696696 if (actual_fmt.len != 0) invalidFmtError(fmt, value);
697697 const buffer = [_]u8{'.'} ++ @tagName(value);
698698 return formatBuf(buffer, options, writer);
699699 },
700 .Null => {
700 .null => {
701701 if (actual_fmt.len != 0) invalidFmtError(fmt, value);
702702 return formatBuf("null", options, writer);
703703 },
......@@ -713,9 +713,9 @@ fn formatValue(
713713) !void {
714714 const T = @TypeOf(value);
715715 switch (@typeInfo(T)) {
716 .Float, .ComptimeFloat => return formatFloatValue(value, fmt, options, writer),
717 .Int, .ComptimeInt => return formatIntValue(value, fmt, options, writer),
718 .Bool => return formatBuf(if (value) "true" else "false", options, writer),
716 .float, .comptime_float => return formatFloatValue(value, fmt, options, writer),
717 .int, .comptime_int => return formatIntValue(value, fmt, options, writer),
718 .bool => return formatBuf(if (value) "true" else "false", options, writer),
719719 else => comptime unreachable,
720720 }
721721}
......@@ -738,13 +738,13 @@ pub fn formatIntValue(
738738 base = 10;
739739 case = .lower;
740740 } else if (comptime std.mem.eql(u8, fmt, "c")) {
741 if (@typeInfo(@TypeOf(int_value)).Int.bits <= 8) {
741 if (@typeInfo(@TypeOf(int_value)).int.bits <= 8) {
742742 return formatAsciiChar(@as(u8, int_value), options, writer);
743743 } else {
744744 @compileError("cannot print integer that is larger than 8 bits as an ASCII character");
745745 }
746746 } else if (comptime std.mem.eql(u8, fmt, "u")) {
747 if (@typeInfo(@TypeOf(int_value)).Int.bits <= 21) {
747 if (@typeInfo(@TypeOf(int_value)).int.bits <= 21) {
748748 return formatUnicodeCodepoint(@as(u21, int_value), options, writer);
749749 } else {
750750 @compileError("cannot print integer that is larger than 21 bits as an UTF-8 sequence");
......@@ -1179,7 +1179,7 @@ pub fn formatInt(
11791179 break :blk @as(Int, value);
11801180 } else value;
11811181
1182 const value_info = @typeInfo(@TypeOf(int_value)).Int;
1182 const value_info = @typeInfo(@TypeOf(int_value)).int;
11831183
11841184 // The type must have the same size as `base` or be wider in order for the
11851185 // division to work
......@@ -1480,7 +1480,7 @@ pub const ParseIntError = error{
14801480/// ) !void;
14811481///
14821482pub fn Formatter(comptime format_fn: anytype) type {
1483 const Data = @typeInfo(@TypeOf(format_fn)).Fn.params[0].type.?;
1483 const Data = @typeInfo(@TypeOf(format_fn)).@"fn".params[0].type.?;
14841484 return struct {
14851485 data: Data,
14861486 pub fn format(
......@@ -1624,7 +1624,7 @@ fn parseIntWithSign(
16241624 // accumulate into Accumulate which is always 8 bits or larger. this prevents
16251625 // `buf_base` from overflowing Result.
16261626 const info = @typeInfo(Result);
1627 const Accumulate = std.meta.Int(info.Int.signedness, @max(8, info.Int.bits));
1627 const Accumulate = std.meta.Int(info.int.signedness, @max(8, info.int.bits));
16281628 var accumulate: Accumulate = 0;
16291629
16301630 if (buf_start[0] == '_' or buf_start[buf_start.len - 1] == '_') return error.InvalidCharacter;
......@@ -2724,7 +2724,7 @@ pub const hex_charset = "0123456789abcdef";
27242724/// Converts an unsigned integer of any multiple of u8 to an array of lowercase
27252725/// hex bytes, little endian.
27262726pub fn hex(x: anytype) [@sizeOf(@TypeOf(x)) * 2]u8 {
2727 comptime assert(@typeInfo(@TypeOf(x)).Int.signedness == .unsigned);
2727 comptime assert(@typeInfo(@TypeOf(x)).int.signedness == .unsigned);
27282728 var result: [@sizeOf(@TypeOf(x)) * 2]u8 = undefined;
27292729 var i: usize = 0;
27302730 while (i < result.len / 2) : (i += 1) {
lib/std/fmt/format_float.zig+6-6
......@@ -12,7 +12,7 @@ pub const min_buffer_size = 53;
1212
1313/// Returns the minimum buffer size needed to print every float of a specific type and format.
1414pub fn bufferSize(comptime mode: Format, comptime T: type) comptime_int {
15 comptime std.debug.assert(@typeInfo(T) == .Float);
15 comptime std.debug.assert(@typeInfo(T) == .float);
1616 return switch (mode) {
1717 .scientific => 53,
1818 // Based on minimum subnormal values.
......@@ -60,8 +60,8 @@ pub fn formatFloat(buf: []u8, v_: anytype, options: FormatOptions) FormatError![
6060 };
6161
6262 const T = @TypeOf(v);
63 comptime std.debug.assert(@typeInfo(T) == .Float);
64 const I = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
63 comptime std.debug.assert(@typeInfo(T) == .float);
64 const I = @Type(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
6565
6666 const DT = if (@bitSizeOf(T) <= 64) u64 else u128;
6767 const tables = switch (DT) {
......@@ -563,13 +563,13 @@ fn pow5Factor(value_: anytype) u32 {
563563
564564fn multipleOfPowerOf5(value: anytype, p: u32) bool {
565565 const T = @TypeOf(value);
566 std.debug.assert(@typeInfo(T) == .Int);
566 std.debug.assert(@typeInfo(T) == .int);
567567 return pow5Factor(value) >= p;
568568}
569569
570570fn multipleOfPowerOf2(value: anytype, p: u32) bool {
571571 const T = @TypeOf(value);
572 std.debug.assert(@typeInfo(T) == .Int);
572 std.debug.assert(@typeInfo(T) == .int);
573573 return (value & ((@as(T, 1) << @as(std.math.Log2Int(T), @intCast(p))) - 1)) == 0;
574574}
575575
......@@ -1516,7 +1516,7 @@ const FLOAT128_POW5_INV_ERRORS: [154]u64 = .{
15161516const builtin = @import("builtin");
15171517
15181518fn check(comptime T: type, value: T, comptime expected: []const u8) !void {
1519 const I = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
1519 const I = @Type(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
15201520
15211521 var buf: [6000]u8 = undefined;
15221522 const value_bits: I = @bitCast(value);
lib/std/fmt/parse_float.zig+2-2
......@@ -17,7 +17,7 @@ pub const ParseFloatError = error{
1717};
1818
1919pub fn parseFloat(comptime T: type, s: []const u8) ParseFloatError!T {
20 if (@typeInfo(T) != .Float) {
20 if (@typeInfo(T) != .float) {
2121 @compileError("Cannot parse a float into a non-floating point type.");
2222 }
2323
......@@ -128,7 +128,7 @@ test parseFloat {
128128
129129test "nan and inf" {
130130 inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| {
131 const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
131 const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
132132
133133 try expectEqual(@as(Z, @bitCast(try parseFloat(T, "nAn"))), @as(Z, @bitCast(std.math.nan(T))));
134134 try expectEqual(try parseFloat(T, "inF"), std.math.inf(T));
lib/std/hash/auto_hash.zig+28-28
......@@ -22,7 +22,7 @@ pub const HashStrategy = enum {
2222pub fn hashPointer(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
2323 const info = @typeInfo(@TypeOf(key));
2424
25 switch (info.Pointer.size) {
25 switch (info.pointer.size) {
2626 .One => switch (strat) {
2727 .Shallow => hash(hasher, @intFromPtr(key), .Shallow),
2828 .Deep => hash(hasher, key.*, .Shallow),
......@@ -64,7 +64,7 @@ pub fn hashArray(hasher: anytype, key: anytype, comptime strat: HashStrategy) vo
6464pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
6565 const Key = @TypeOf(key);
6666 const Hasher = switch (@typeInfo(@TypeOf(hasher))) {
67 .Pointer => |ptr| ptr.child,
67 .pointer => |ptr| ptr.child,
6868 else => @TypeOf(hasher),
6969 };
7070
......@@ -74,24 +74,24 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
7474 }
7575
7676 switch (@typeInfo(Key)) {
77 .NoReturn,
78 .Opaque,
79 .Undefined,
80 .Null,
81 .ComptimeFloat,
82 .ComptimeInt,
83 .Type,
84 .EnumLiteral,
85 .Frame,
86 .Float,
77 .noreturn,
78 .@"opaque",
79 .undefined,
80 .null,
81 .comptime_float,
82 .comptime_int,
83 .type,
84 .enum_literal,
85 .frame,
86 .float,
8787 => @compileError("unable to hash type " ++ @typeName(Key)),
8888
89 .Void => return,
89 .void => return,
9090
9191 // Help the optimizer see that hashing an int is easy by inlining!
9292 // TODO Check if the situation is better after #561 is resolved.
93 .Int => |int| switch (int.signedness) {
94 .signed => hash(hasher, @as(@Type(.{ .Int = .{
93 .int => |int| switch (int.signedness) {
94 .signed => hash(hasher, @as(@Type(.{ .int = .{
9595 .bits = int.bits,
9696 .signedness = .unsigned,
9797 } }), @bitCast(key)), strat),
......@@ -107,18 +107,18 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
107107 },
108108 },
109109
110 .Bool => hash(hasher, @intFromBool(key), strat),
111 .Enum => hash(hasher, @intFromEnum(key), strat),
112 .ErrorSet => hash(hasher, @intFromError(key), strat),
113 .AnyFrame, .Fn => hash(hasher, @intFromPtr(key), strat),
110 .bool => hash(hasher, @intFromBool(key), strat),
111 .@"enum" => hash(hasher, @intFromEnum(key), strat),
112 .error_set => hash(hasher, @intFromError(key), strat),
113 .@"anyframe", .@"fn" => hash(hasher, @intFromPtr(key), strat),
114114
115 .Pointer => @call(.always_inline, hashPointer, .{ hasher, key, strat }),
115 .pointer => @call(.always_inline, hashPointer, .{ hasher, key, strat }),
116116
117 .Optional => if (key) |k| hash(hasher, k, strat),
117 .optional => if (key) |k| hash(hasher, k, strat),
118118
119 .Array => hashArray(hasher, key, strat),
119 .array => hashArray(hasher, key, strat),
120120
121 .Vector => |info| {
121 .vector => |info| {
122122 if (std.meta.hasUniqueRepresentation(Key)) {
123123 hasher.update(mem.asBytes(&key));
124124 } else {
......@@ -129,7 +129,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
129129 }
130130 },
131131
132 .Struct => |info| {
132 .@"struct" => |info| {
133133 inline for (info.fields) |field| {
134134 // We reuse the hash of the previous field as the seed for the
135135 // next one so that they're dependant.
......@@ -137,7 +137,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
137137 }
138138 },
139139
140 .Union => |info| {
140 .@"union" => |info| {
141141 if (info.tag_type) |tag_type| {
142142 const tag = std.meta.activeTag(key);
143143 hash(hasher, tag, strat);
......@@ -155,7 +155,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
155155 } else @compileError("cannot hash untagged union type: " ++ @typeName(Key) ++ ", provide your own hash function");
156156 },
157157
158 .ErrorUnion => blk: {
158 .error_union => blk: {
159159 const payload = key catch |err| {
160160 hash(hasher, err, strat);
161161 break :blk;
......@@ -167,9 +167,9 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
167167
168168inline fn typeContainsSlice(comptime K: type) bool {
169169 return switch (@typeInfo(K)) {
170 .Pointer => |info| info.size == .Slice,
170 .pointer => |info| info.size == .Slice,
171171
172 inline .Struct, .Union => |info| {
172 inline .@"struct", .@"union" => |info| {
173173 inline for (info.fields) |field| {
174174 if (typeContainsSlice(field.type)) {
175175 return true;
lib/std/hash/verify.zig+5-5
......@@ -1,9 +1,9 @@
11const std = @import("std");
22
3fn hashMaybeSeed(comptime hash_fn: anytype, seed: anytype, buf: []const u8) @typeInfo(@TypeOf(hash_fn)).Fn.return_type.? {
4 const HashFn = @typeInfo(@TypeOf(hash_fn)).Fn;
3fn hashMaybeSeed(comptime hash_fn: anytype, seed: anytype, buf: []const u8) @typeInfo(@TypeOf(hash_fn)).@"fn".return_type.? {
4 const HashFn = @typeInfo(@TypeOf(hash_fn)).@"fn";
55 if (HashFn.params.len > 1) {
6 if (@typeInfo(HashFn.params[0].type.?) == .Int) {
6 if (@typeInfo(HashFn.params[0].type.?) == .int) {
77 return hash_fn(@intCast(seed), buf);
88 } else {
99 return hash_fn(buf, @intCast(seed));
......@@ -14,7 +14,7 @@ fn hashMaybeSeed(comptime hash_fn: anytype, seed: anytype, buf: []const u8) @typ
1414}
1515
1616fn initMaybeSeed(comptime Hash: anytype, seed: anytype) Hash {
17 const HashFn = @typeInfo(@TypeOf(Hash.init)).Fn;
17 const HashFn = @typeInfo(@TypeOf(Hash.init)).@"fn";
1818 if (HashFn.params.len == 1) {
1919 return Hash.init(@intCast(seed));
2020 } else {
......@@ -27,7 +27,7 @@ fn initMaybeSeed(comptime Hash: anytype, seed: anytype) Hash {
2727// Hash keys of the form {0}, {0,1}, {0,1,2}... up to N=255, using 256-N as seed.
2828// First four-bytes of the hash, interpreted as little-endian is the verification code.
2929pub fn smhasher(comptime hash_fn: anytype) u32 {
30 const HashFnTy = @typeInfo(@TypeOf(hash_fn)).Fn;
30 const HashFnTy = @typeInfo(@TypeOf(hash_fn)).@"fn";
3131 const HashResult = HashFnTy.return_type.?;
3232 const hash_size = @sizeOf(HashResult);
3333
lib/std/hash_map.zig+11-11
......@@ -139,10 +139,10 @@ pub fn verifyContext(
139139 var Context = RawContext;
140140 // Make sure the context is a namespace type which may have member functions
141141 switch (@typeInfo(Context)) {
142 .Struct, .Union, .Enum => {},
143 // Special-case .Opaque for a better error message
144 .Opaque => @compileError("Hash context must be a type with hash and eql member functions. Cannot use " ++ @typeName(Context) ++ " because it is opaque. Use a pointer instead."),
145 .Pointer => |ptr| {
142 .@"struct", .@"union", .@"enum" => {},
143 // Special-case .@"opaque" for a better error message
144 .@"opaque" => @compileError("Hash context must be a type with hash and eql member functions. Cannot use " ++ @typeName(Context) ++ " because it is opaque. Use a pointer instead."),
145 .pointer => |ptr| {
146146 if (ptr.size != .One) {
147147 @compileError("Hash context must be a type with hash and eql member functions. Cannot use " ++ @typeName(Context) ++ " because it is not a single pointer.");
148148 }
......@@ -150,7 +150,7 @@ pub fn verifyContext(
150150 allow_const_ptr = true;
151151 allow_mutable_ptr = !ptr.is_const;
152152 switch (@typeInfo(Context)) {
153 .Struct, .Union, .Enum, .Opaque => {},
153 .@"struct", .@"union", .@"enum", .@"opaque" => {},
154154 else => @compileError("Hash context must be a type with hash and eql member functions. Cannot use " ++ @typeName(Context)),
155155 }
156156 },
......@@ -179,8 +179,8 @@ pub fn verifyContext(
179179 if (@hasDecl(Context, "hash")) {
180180 const hash = Context.hash;
181181 const info = @typeInfo(@TypeOf(hash));
182 if (info == .Fn) {
183 const func = info.Fn;
182 if (info == .@"fn") {
183 const func = info.@"fn";
184184 if (func.params.len != 2) {
185185 errors = errors ++ lazy.err_invalid_hash_signature;
186186 } else {
......@@ -255,8 +255,8 @@ pub fn verifyContext(
255255 if (@hasDecl(Context, "eql")) {
256256 const eql = Context.eql;
257257 const info = @typeInfo(@TypeOf(eql));
258 if (info == .Fn) {
259 const func = info.Fn;
258 if (info == .@"fn") {
259 const func = info.@"fn";
260260 const args_len = if (is_array) 4 else 3;
261261 if (func.params.len != args_len) {
262262 errors = errors ++ lazy.err_invalid_eql_signature;
......@@ -824,8 +824,8 @@ pub fn HashMapUnmanaged(
824824 }
825825
826826 pub fn takeFingerprint(hash: Hash) FingerPrint {
827 const hash_bits = @typeInfo(Hash).Int.bits;
828 const fp_bits = @typeInfo(FingerPrint).Int.bits;
827 const hash_bits = @typeInfo(Hash).int.bits;
828 const fp_bits = @typeInfo(FingerPrint).int.bits;
829829 return @as(FingerPrint, @truncate(hash >> (hash_bits - fp_bits)));
830830 }
831831
lib/std/heap/logging_allocator.zig+1-1
......@@ -15,7 +15,7 @@ pub fn LoggingAllocator(
1515/// with the given scope on every call to the allocator.
1616/// For logging to a `std.io.Writer` see `std.heap.LogToWriterAllocator`
1717pub fn ScopedLoggingAllocator(
18 comptime scope: @Type(.EnumLiteral),
18 comptime scope: @Type(.enum_literal),
1919 comptime success_log_level: std.log.Level,
2020 comptime failure_log_level: std.log.Level,
2121) type {
lib/std/io.zig+4-4
......@@ -434,7 +434,7 @@ pub fn poll(
434434 comptime StreamEnum: type,
435435 files: PollFiles(StreamEnum),
436436) Poller(StreamEnum) {
437 const enum_fields = @typeInfo(StreamEnum).Enum.fields;
437 const enum_fields = @typeInfo(StreamEnum).@"enum".fields;
438438 var result: Poller(StreamEnum) = undefined;
439439
440440 if (is_windows) result.windows = .{
......@@ -473,7 +473,7 @@ pub const PollFifo = std.fifo.LinearFifo(u8, .Dynamic);
473473
474474pub fn Poller(comptime StreamEnum: type) type {
475475 return struct {
476 const enum_fields = @typeInfo(StreamEnum).Enum.fields;
476 const enum_fields = @typeInfo(StreamEnum).@"enum".fields;
477477 const PollFd = if (is_windows) void else posix.pollfd;
478478
479479 fifos: [enum_fields.len]PollFifo,
......@@ -676,7 +676,7 @@ fn windowsAsyncRead(
676676/// Given an enum, returns a struct with fields of that enum, each field
677677/// representing an I/O stream for polling.
678678pub fn PollFiles(comptime StreamEnum: type) type {
679 const enum_fields = @typeInfo(StreamEnum).Enum.fields;
679 const enum_fields = @typeInfo(StreamEnum).@"enum".fields;
680680 var struct_fields: [enum_fields.len]std.builtin.Type.StructField = undefined;
681681 for (&struct_fields, enum_fields) |*struct_field, enum_field| {
682682 struct_field.* = .{
......@@ -687,7 +687,7 @@ pub fn PollFiles(comptime StreamEnum: type) type {
687687 .alignment = @alignOf(fs.File),
688688 };
689689 }
690 return @Type(.{ .Struct = .{
690 return @Type(.{ .@"struct" = .{
691691 .layout = .auto,
692692 .fields = &struct_fields,
693693 .decls = &.{},
lib/std/io/Reader.zig+3-3
......@@ -277,7 +277,7 @@ pub fn readBoundedBytes(self: Self, comptime num_bytes: usize) anyerror!std.Boun
277277}
278278
279279pub inline fn readInt(self: Self, comptime T: type, endian: std.builtin.Endian) anyerror!T {
280 const bytes = try self.readBytesNoEof(@divExact(@typeInfo(T).Int.bits, 8));
280 const bytes = try self.readBytesNoEof(@divExact(@typeInfo(T).int.bits, 8));
281281 return mem.readInt(T, &bytes, endian);
282282}
283283
......@@ -326,7 +326,7 @@ pub fn isBytes(self: Self, slice: []const u8) anyerror!bool {
326326
327327pub fn readStruct(self: Self, comptime T: type) anyerror!T {
328328 // Only extern and packed structs have defined in-memory layout.
329 comptime assert(@typeInfo(T).Struct.layout != .auto);
329 comptime assert(@typeInfo(T).@"struct".layout != .auto);
330330 var res: [1]T = undefined;
331331 try self.readNoEof(mem.sliceAsBytes(res[0..]));
332332 return res[0];
......@@ -348,7 +348,7 @@ pub fn readEnum(self: Self, comptime Enum: type, endian: std.builtin.Endian) any
348348 /// An integer was read, but it did not match any of the tags in the supplied enum.
349349 InvalidValue,
350350 };
351 const type_info = @typeInfo(Enum).Enum;
351 const type_info = @typeInfo(Enum).@"enum";
352352 const tag = try self.readInt(type_info.tag_type, endian);
353353
354354 inline for (std.meta.fields(Enum)) |field| {
lib/std/io/Writer.zig+2-2
......@@ -49,14 +49,14 @@ pub fn writeBytesNTimes(self: Self, bytes: []const u8, n: usize) anyerror!void {
4949}
5050
5151pub inline fn writeInt(self: Self, comptime T: type, value: T, endian: std.builtin.Endian) anyerror!void {
52 var bytes: [@divExact(@typeInfo(T).Int.bits, 8)]u8 = undefined;
52 var bytes: [@divExact(@typeInfo(T).int.bits, 8)]u8 = undefined;
5353 mem.writeInt(std.math.ByteAlignedInt(@TypeOf(value)), &bytes, value, endian);
5454 return self.writeAll(&bytes);
5555}
5656
5757pub fn writeStruct(self: Self, value: anytype) anyerror!void {
5858 // Only extern and packed structs have defined in-memory layout.
59 comptime assert(@typeInfo(@TypeOf(value)).Struct.layout != .auto);
59 comptime assert(@typeInfo(@TypeOf(value)).@"struct".layout != .auto);
6060 return self.writeAll(mem.asBytes(&value));
6161}
6262
lib/std/io/bit_writer.zig+1-1
......@@ -33,7 +33,7 @@ pub fn BitWriter(comptime endian: std.builtin.Endian, comptime WriterType: type)
3333 if (bits == 0) return;
3434
3535 const U = @TypeOf(value);
36 comptime assert(@typeInfo(U).Int.signedness == .unsigned);
36 comptime assert(@typeInfo(U).int.signedness == .unsigned);
3737
3838 //by extending the buffer to a minimum of u8 we can cover a number of edge cases
3939 // related to shifting and casting.
lib/std/io/fixed_buffer_stream.zig+3-3
......@@ -115,18 +115,18 @@ pub fn fixedBufferStream(buffer: anytype) FixedBufferStream(Slice(@TypeOf(buffer
115115
116116fn Slice(comptime T: type) type {
117117 switch (@typeInfo(T)) {
118 .Pointer => |ptr_info| {
118 .pointer => |ptr_info| {
119119 var new_ptr_info = ptr_info;
120120 switch (ptr_info.size) {
121121 .Slice => {},
122122 .One => switch (@typeInfo(ptr_info.child)) {
123 .Array => |info| new_ptr_info.child = info.child,
123 .array => |info| new_ptr_info.child = info.child,
124124 else => @compileError("invalid type given to fixedBufferStream"),
125125 },
126126 else => @compileError("invalid type given to fixedBufferStream"),
127127 }
128128 new_ptr_info.size = .Slice;
129 return @Type(.{ .Pointer = new_ptr_info });
129 return @Type(.{ .pointer = new_ptr_info });
130130 },
131131 else => @compileError("invalid type given to fixedBufferStream"),
132132 }
lib/std/io/multi_writer.zig+1-1
......@@ -4,7 +4,7 @@ const io = std.io;
44/// Takes a tuple of streams, and constructs a new stream that writes to all of them
55pub fn MultiWriter(comptime Writers: type) type {
66 comptime var ErrSet = error{};
7 inline for (@typeInfo(Writers).Struct.fields) |field| {
7 inline for (@typeInfo(Writers).@"struct".fields) |field| {
88 const StreamType = field.type;
99 ErrSet = ErrSet || StreamType.Error;
1010 }
lib/std/io/tty.zig+1-1
......@@ -75,7 +75,7 @@ pub const Config = union(enum) {
7575 conf: Config,
7676 writer: anytype,
7777 color: Color,
78 ) (@typeInfo(@TypeOf(writer.writeAll(""))).ErrorUnion.error_set ||
78 ) (@typeInfo(@TypeOf(writer.writeAll(""))).error_union.error_set ||
7979 windows.SetConsoleTextAttributeError)!void {
8080 nosuspend switch (conf) {
8181 .no_color => return,
lib/std/json/static.zig+23-23
......@@ -219,14 +219,14 @@ pub fn innerParse(
219219 options: ParseOptions,
220220) ParseError(@TypeOf(source.*))!T {
221221 switch (@typeInfo(T)) {
222 .Bool => {
222 .bool => {
223223 return switch (try source.next()) {
224224 .true => true,
225225 .false => false,
226226 else => error.UnexpectedToken,
227227 };
228228 },
229 .Float, .ComptimeFloat => {
229 .float, .comptime_float => {
230230 const token = try source.nextAllocMax(allocator, .alloc_if_needed, options.max_value_len.?);
231231 defer freeAllocated(allocator, token);
232232 const slice = switch (token) {
......@@ -235,7 +235,7 @@ pub fn innerParse(
235235 };
236236 return try std.fmt.parseFloat(T, slice);
237237 },
238 .Int, .ComptimeInt => {
238 .int, .comptime_int => {
239239 const token = try source.nextAllocMax(allocator, .alloc_if_needed, options.max_value_len.?);
240240 defer freeAllocated(allocator, token);
241241 const slice = switch (token) {
......@@ -244,7 +244,7 @@ pub fn innerParse(
244244 };
245245 return sliceToInt(T, slice);
246246 },
247 .Optional => |optionalInfo| {
247 .optional => |optionalInfo| {
248248 switch (try source.peekNextTokenType()) {
249249 .null => {
250250 _ = try source.next();
......@@ -255,7 +255,7 @@ pub fn innerParse(
255255 },
256256 }
257257 },
258 .Enum => {
258 .@"enum" => {
259259 if (std.meta.hasFn(T, "jsonParse")) {
260260 return T.jsonParse(allocator, source, options);
261261 }
......@@ -268,7 +268,7 @@ pub fn innerParse(
268268 };
269269 return sliceToEnum(T, slice);
270270 },
271 .Union => |unionInfo| {
271 .@"union" => |unionInfo| {
272272 if (std.meta.hasFn(T, "jsonParse")) {
273273 return T.jsonParse(allocator, source, options);
274274 }
......@@ -313,7 +313,7 @@ pub fn innerParse(
313313 return result.?;
314314 },
315315
316 .Struct => |structInfo| {
316 .@"struct" => |structInfo| {
317317 if (structInfo.is_tuple) {
318318 if (.array_begin != try source.next()) return error.UnexpectedToken;
319319
......@@ -385,7 +385,7 @@ pub fn innerParse(
385385 return r;
386386 },
387387
388 .Array => |arrayInfo| {
388 .array => |arrayInfo| {
389389 switch (try source.peekNextTokenType()) {
390390 .array_begin => {
391391 // Typical array.
......@@ -440,7 +440,7 @@ pub fn innerParse(
440440 }
441441 },
442442
443 .Vector => |vecInfo| {
443 .vector => |vecInfo| {
444444 switch (try source.peekNextTokenType()) {
445445 .array_begin => {
446446 return internalParseArray(T, vecInfo.child, vecInfo.len, allocator, source, options);
......@@ -449,7 +449,7 @@ pub fn innerParse(
449449 }
450450 },
451451
452 .Pointer => |ptrInfo| {
452 .pointer => |ptrInfo| {
453453 switch (ptrInfo.size) {
454454 .One => {
455455 const r: *ptrInfo.child = try allocator.create(ptrInfo.child);
......@@ -550,13 +550,13 @@ pub fn innerParseFromValue(
550550 options: ParseOptions,
551551) ParseFromValueError!T {
552552 switch (@typeInfo(T)) {
553 .Bool => {
553 .bool => {
554554 switch (source) {
555555 .bool => |b| return b,
556556 else => return error.UnexpectedToken,
557557 }
558558 },
559 .Float, .ComptimeFloat => {
559 .float, .comptime_float => {
560560 switch (source) {
561561 .float => |f| return @as(T, @floatCast(f)),
562562 .integer => |i| return @as(T, @floatFromInt(i)),
......@@ -564,7 +564,7 @@ pub fn innerParseFromValue(
564564 else => return error.UnexpectedToken,
565565 }
566566 },
567 .Int, .ComptimeInt => {
567 .int, .comptime_int => {
568568 switch (source) {
569569 .float => |f| {
570570 if (@round(f) != f) return error.InvalidNumber;
......@@ -583,13 +583,13 @@ pub fn innerParseFromValue(
583583 else => return error.UnexpectedToken,
584584 }
585585 },
586 .Optional => |optionalInfo| {
586 .optional => |optionalInfo| {
587587 switch (source) {
588588 .null => return null,
589589 else => return try innerParseFromValue(optionalInfo.child, allocator, source, options),
590590 }
591591 },
592 .Enum => {
592 .@"enum" => {
593593 if (std.meta.hasFn(T, "jsonParseFromValue")) {
594594 return T.jsonParseFromValue(allocator, source, options);
595595 }
......@@ -601,7 +601,7 @@ pub fn innerParseFromValue(
601601 else => return error.UnexpectedToken,
602602 }
603603 },
604 .Union => |unionInfo| {
604 .@"union" => |unionInfo| {
605605 if (std.meta.hasFn(T, "jsonParseFromValue")) {
606606 return T.jsonParseFromValue(allocator, source, options);
607607 }
......@@ -631,7 +631,7 @@ pub fn innerParseFromValue(
631631 return error.UnknownField;
632632 },
633633
634 .Struct => |structInfo| {
634 .@"struct" => |structInfo| {
635635 if (structInfo.is_tuple) {
636636 if (source != .array) return error.UnexpectedToken;
637637 if (source.array.items.len != structInfo.fields.len) return error.UnexpectedToken;
......@@ -674,7 +674,7 @@ pub fn innerParseFromValue(
674674 return r;
675675 },
676676
677 .Array => |arrayInfo| {
677 .array => |arrayInfo| {
678678 switch (source) {
679679 .array => |array| {
680680 // Typical array.
......@@ -695,7 +695,7 @@ pub fn innerParseFromValue(
695695 }
696696 },
697697
698 .Vector => |vecInfo| {
698 .vector => |vecInfo| {
699699 switch (source) {
700700 .array => |array| {
701701 return innerParseArrayFromArrayValue(T, vecInfo.child, vecInfo.len, allocator, array, options);
......@@ -704,7 +704,7 @@ pub fn innerParseFromValue(
704704 }
705705 },
706706
707 .Pointer => |ptrInfo| {
707 .pointer => |ptrInfo| {
708708 switch (ptrInfo.size) {
709709 .One => {
710710 const r: *ptrInfo.child = try allocator.create(ptrInfo.child);
......@@ -780,12 +780,12 @@ fn sliceToEnum(comptime T: type, slice: []const u8) !T {
780780 if (std.meta.stringToEnum(T, slice)) |value| return value;
781781 // Check for a numeric value.
782782 if (!isNumberFormattedLikeAnInteger(slice)) return error.InvalidEnumTag;
783 const n = std.fmt.parseInt(@typeInfo(T).Enum.tag_type, slice, 10) catch return error.InvalidEnumTag;
783 const n = std.fmt.parseInt(@typeInfo(T).@"enum".tag_type, slice, 10) catch return error.InvalidEnumTag;
784784 return std.meta.intToEnum(T, n);
785785}
786786
787fn fillDefaultStructValues(comptime T: type, r: *T, fields_seen: *[@typeInfo(T).Struct.fields.len]bool) !void {
788 inline for (@typeInfo(T).Struct.fields, 0..) |field, i| {
787fn fillDefaultStructValues(comptime T: type, r: *T, fields_seen: *[@typeInfo(T).@"struct".fields.len]bool) !void {
788 inline for (@typeInfo(T).@"struct".fields, 0..) |field, i| {
789789 if (!fields_seen[i]) {
790790 if (field.default_value) |default_ptr| {
791791 const default = @as(*align(1) const field.type, @ptrCast(default_ptr)).*;
lib/std/json/stringify.zig+16-16
......@@ -493,7 +493,7 @@ pub fn WriteStream(
493493 if (build_mode_has_safety) assert(self.raw_streaming_mode == .none);
494494 const T = @TypeOf(value);
495495 switch (@typeInfo(T)) {
496 .Int => {
496 .int => {
497497 try self.valueStart();
498498 if (self.options.emit_nonportable_numbers_as_strings and
499499 (value <= -(1 << 53) or value >= (1 << 53)))
......@@ -505,10 +505,10 @@ pub fn WriteStream(
505505 self.valueDone();
506506 return;
507507 },
508 .ComptimeInt => {
508 .comptime_int => {
509509 return self.write(@as(std.math.IntFittingRange(value, value), value));
510510 },
511 .Float, .ComptimeFloat => {
511 .float, .comptime_float => {
512512 if (@as(f64, @floatCast(value)) == value) {
513513 try self.valueStart();
514514 try self.stream.print("{}", .{@as(f64, @floatCast(value))});
......@@ -521,38 +521,38 @@ pub fn WriteStream(
521521 return;
522522 },
523523
524 .Bool => {
524 .bool => {
525525 try self.valueStart();
526526 try self.stream.writeAll(if (value) "true" else "false");
527527 self.valueDone();
528528 return;
529529 },
530 .Null => {
530 .null => {
531531 try self.valueStart();
532532 try self.stream.writeAll("null");
533533 self.valueDone();
534534 return;
535535 },
536 .Optional => {
536 .optional => {
537537 if (value) |payload| {
538538 return try self.write(payload);
539539 } else {
540540 return try self.write(null);
541541 }
542542 },
543 .Enum, .EnumLiteral => {
543 .@"enum", .enum_literal => {
544544 if (std.meta.hasFn(T, "jsonStringify")) {
545545 return value.jsonStringify(self);
546546 }
547547
548548 return self.stringValue(@tagName(value));
549549 },
550 .Union => {
550 .@"union" => {
551551 if (std.meta.hasFn(T, "jsonStringify")) {
552552 return value.jsonStringify(self);
553553 }
554554
555 const info = @typeInfo(T).Union;
555 const info = @typeInfo(T).@"union";
556556 if (info.tag_type) |UnionTagType| {
557557 try self.beginObject();
558558 inline for (info.fields) |u_field| {
......@@ -576,7 +576,7 @@ pub fn WriteStream(
576576 @compileError("Unable to stringify untagged union '" ++ @typeName(T) ++ "'");
577577 }
578578 },
579 .Struct => |S| {
579 .@"struct" => |S| {
580580 if (std.meta.hasFn(T, "jsonStringify")) {
581581 return value.jsonStringify(self);
582582 }
......@@ -593,7 +593,7 @@ pub fn WriteStream(
593593 var emit_field = true;
594594
595595 // don't include optional fields that are null when emit_null_optional_fields is set to false
596 if (@typeInfo(Field.type) == .Optional) {
596 if (@typeInfo(Field.type) == .optional) {
597597 if (self.options.emit_null_optional_fields == false) {
598598 if (@field(value, Field.name) == null) {
599599 emit_field = false;
......@@ -615,10 +615,10 @@ pub fn WriteStream(
615615 }
616616 return;
617617 },
618 .ErrorSet => return self.stringValue(@errorName(value)),
619 .Pointer => |ptr_info| switch (ptr_info.size) {
618 .error_set => return self.stringValue(@errorName(value)),
619 .pointer => |ptr_info| switch (ptr_info.size) {
620620 .One => switch (@typeInfo(ptr_info.child)) {
621 .Array => {
621 .array => {
622622 // Coerce `*[N]T` to `[]const T`.
623623 const Slice = []const std.meta.Elem(ptr_info.child);
624624 return self.write(@as(Slice, value));
......@@ -648,11 +648,11 @@ pub fn WriteStream(
648648 },
649649 else => @compileError("Unable to stringify type '" ++ @typeName(T) ++ "'"),
650650 },
651 .Array => {
651 .array => {
652652 // Coerce `[N]T` to `*const [N]T` (and then to `[]const T`).
653653 return self.write(&value);
654654 },
655 .Vector => |info| {
655 .vector => |info| {
656656 const array: [info.len]info.child = value;
657657 return self.write(&array);
658658 },
lib/std/leb128.zig+19-19
......@@ -4,10 +4,10 @@ const testing = std.testing;
44/// Read a single unsigned LEB128 value from the given reader as type T,
55/// or error.Overflow if the value cannot fit.
66pub fn readUleb128(comptime T: type, reader: anytype) !T {
7 const U = if (@typeInfo(T).Int.bits < 8) u8 else T;
7 const U = if (@typeInfo(T).int.bits < 8) u8 else T;
88 const ShiftT = std.math.Log2Int(U);
99
10 const max_group = (@typeInfo(U).Int.bits + 6) / 7;
10 const max_group = (@typeInfo(U).int.bits + 6) / 7;
1111
1212 var value: U = 0;
1313 var group: ShiftT = 0;
......@@ -42,7 +42,7 @@ pub fn writeUleb128(writer: anytype, arg: anytype) !void {
4242 comptime_int => std.math.IntFittingRange(arg, arg),
4343 else => Arg,
4444 };
45 const Value = if (@typeInfo(Int).Int.bits < 8) u8 else Int;
45 const Value = if (@typeInfo(Int).int.bits < 8) u8 else Int;
4646 var value: Value = arg;
4747
4848 while (true) {
......@@ -63,11 +63,11 @@ pub const writeULEB128 = writeUleb128;
6363/// Read a single signed LEB128 value from the given reader as type T,
6464/// or error.Overflow if the value cannot fit.
6565pub fn readIleb128(comptime T: type, reader: anytype) !T {
66 const S = if (@typeInfo(T).Int.bits < 8) i8 else T;
67 const U = std.meta.Int(.unsigned, @typeInfo(S).Int.bits);
66 const S = if (@typeInfo(T).int.bits < 8) i8 else T;
67 const U = std.meta.Int(.unsigned, @typeInfo(S).int.bits);
6868 const ShiftU = std.math.Log2Int(U);
6969
70 const max_group = (@typeInfo(U).Int.bits + 6) / 7;
70 const max_group = (@typeInfo(U).int.bits + 6) / 7;
7171
7272 var value = @as(U, 0);
7373 var group = @as(ShiftU, 0);
......@@ -83,14 +83,14 @@ pub fn readIleb128(comptime T: type, reader: anytype) !T {
8383 if (@as(S, @bitCast(ov[0])) >= 0) return error.Overflow;
8484
8585 // and all the overflowed bits are 1
86 const remaining_shift = @as(u3, @intCast(@typeInfo(U).Int.bits - @as(u16, shift)));
86 const remaining_shift = @as(u3, @intCast(@typeInfo(U).int.bits - @as(u16, shift)));
8787 const remaining_bits = @as(i8, @bitCast(byte | 0x80)) >> remaining_shift;
8888 if (remaining_bits != -1) return error.Overflow;
8989 } else {
9090 // If we don't overflow and this is the last byte and the number being decoded
9191 // is negative, check that the remaining bits are 1
9292 if ((byte & 0x80 == 0) and (@as(S, @bitCast(ov[0])) < 0)) {
93 const remaining_shift = @as(u3, @intCast(@typeInfo(U).Int.bits - @as(u16, shift)));
93 const remaining_shift = @as(u3, @intCast(@typeInfo(U).int.bits - @as(u16, shift)));
9494 const remaining_bits = @as(i8, @bitCast(byte | 0x80)) >> remaining_shift;
9595 if (remaining_bits != -1) return error.Overflow;
9696 }
......@@ -128,8 +128,8 @@ pub fn writeIleb128(writer: anytype, arg: anytype) !void {
128128 comptime_int => std.math.IntFittingRange(-@abs(arg), @abs(arg)),
129129 else => Arg,
130130 };
131 const Signed = if (@typeInfo(Int).Int.bits < 8) i8 else Int;
132 const Unsigned = std.meta.Int(.unsigned, @typeInfo(Signed).Int.bits);
131 const Signed = if (@typeInfo(Int).int.bits < 8) i8 else Int;
132 const Unsigned = std.meta.Int(.unsigned, @typeInfo(Signed).int.bits);
133133 var value: Signed = arg;
134134
135135 while (true) {
......@@ -165,7 +165,7 @@ pub fn writeUnsignedExtended(slice: []u8, arg: anytype) void {
165165 comptime_int => std.math.IntFittingRange(arg, arg),
166166 else => Arg,
167167 };
168 const Value = if (@typeInfo(Int).Int.bits < 8) u8 else Int;
168 const Value = if (@typeInfo(Int).int.bits < 8) u8 else Int;
169169 var value: Value = arg;
170170
171171 for (slice[0 .. slice.len - 1]) |*byte| {
......@@ -210,7 +210,7 @@ test writeUnsignedFixed {
210210/// different value without shifting all the following code.
211211pub fn writeSignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.signed, l * 7)) void {
212212 const T = @TypeOf(int);
213 const U = if (@typeInfo(T).Int.bits < 8) u8 else T;
213 const U = if (@typeInfo(T).int.bits < 8) u8 else T;
214214 var value: U = @intCast(int);
215215
216216 comptime var i = 0;
......@@ -388,7 +388,7 @@ test "deserialize unsigned LEB128" {
388388
389389fn test_write_leb128(value: anytype) !void {
390390 const T = @TypeOf(value);
391 const signedness = @typeInfo(T).Int.signedness;
391 const signedness = @typeInfo(T).int.signedness;
392392 const t_signed = signedness == .signed;
393393
394394 const writeStream = if (t_signed) writeIleb128 else writeUleb128;
......@@ -396,19 +396,19 @@ fn test_write_leb128(value: anytype) !void {
396396
397397 // decode to a larger bit size too, to ensure sign extension
398398 // is working as expected
399 const larger_type_bits = ((@typeInfo(T).Int.bits + 8) / 8) * 8;
399 const larger_type_bits = ((@typeInfo(T).int.bits + 8) / 8) * 8;
400400 const B = std.meta.Int(signedness, larger_type_bits);
401401
402402 const bytes_needed = bn: {
403 if (@typeInfo(T).Int.bits <= 7) break :bn @as(u16, 1);
403 if (@typeInfo(T).int.bits <= 7) break :bn @as(u16, 1);
404404
405405 const unused_bits = if (value < 0) @clz(~value) else @clz(value);
406 const used_bits: u16 = (@typeInfo(T).Int.bits - unused_bits) + @intFromBool(t_signed);
406 const used_bits: u16 = (@typeInfo(T).int.bits - unused_bits) + @intFromBool(t_signed);
407407 if (used_bits <= 7) break :bn @as(u16, 1);
408408 break :bn ((used_bits + 6) / 7);
409409 };
410410
411 const max_groups = if (@typeInfo(T).Int.bits == 0) 1 else (@typeInfo(T).Int.bits + 6) / 7;
411 const max_groups = if (@typeInfo(T).int.bits == 0) 1 else (@typeInfo(T).int.bits + 6) / 7;
412412
413413 var buf: [max_groups]u8 = undefined;
414414 var fbs = std.io.fixedBufferStream(&buf);
......@@ -439,7 +439,7 @@ test "serialize unsigned LEB128" {
439439 const T = std.meta.Int(.unsigned, t);
440440 const min = std.math.minInt(T);
441441 const max = std.math.maxInt(T);
442 var i = @as(std.meta.Int(.unsigned, @typeInfo(T).Int.bits + 1), min);
442 var i = @as(std.meta.Int(.unsigned, @typeInfo(T).int.bits + 1), min);
443443
444444 while (i <= max) : (i += 1) try test_write_leb128(@as(T, @intCast(i)));
445445 }
......@@ -457,7 +457,7 @@ test "serialize signed LEB128" {
457457 const T = std.meta.Int(.signed, t);
458458 const min = std.math.minInt(T);
459459 const max = std.math.maxInt(T);
460 var i = @as(std.meta.Int(.signed, @typeInfo(T).Int.bits + 1), min);
460 var i = @as(std.meta.Int(.signed, @typeInfo(T).int.bits + 1), min);
461461
462462 while (i <= max) : (i += 1) try test_write_leb128(@as(T, @intCast(i)));
463463 }
lib/std/log.zig+6-6
......@@ -28,7 +28,7 @@
2828//!
2929//! pub fn myLogFn(
3030//! comptime level: std.log.Level,
31//! comptime scope: @TypeOf(.EnumLiteral),
31//! comptime scope: @Type(.enum_literal),
3232//! comptime format: []const u8,
3333//! args: anytype,
3434//! ) void {
......@@ -108,7 +108,7 @@ pub const default_level: Level = switch (builtin.mode) {
108108const level = std.options.log_level;
109109
110110pub const ScopeLevel = struct {
111 scope: @Type(.EnumLiteral),
111 scope: @Type(.enum_literal),
112112 level: Level,
113113};
114114
......@@ -116,7 +116,7 @@ const scope_levels = std.options.log_scope_levels;
116116
117117fn log(
118118 comptime message_level: Level,
119 comptime scope: @Type(.EnumLiteral),
119 comptime scope: @Type(.enum_literal),
120120 comptime format: []const u8,
121121 args: anytype,
122122) void {
......@@ -126,7 +126,7 @@ fn log(
126126}
127127
128128/// Determine if a specific log message level and scope combination are enabled for logging.
129pub fn logEnabled(comptime message_level: Level, comptime scope: @Type(.EnumLiteral)) bool {
129pub fn logEnabled(comptime message_level: Level, comptime scope: @Type(.enum_literal)) bool {
130130 inline for (scope_levels) |scope_level| {
131131 if (scope_level.scope == scope) return @intFromEnum(message_level) <= @intFromEnum(scope_level.level);
132132 }
......@@ -142,7 +142,7 @@ pub fn defaultLogEnabled(comptime message_level: Level) bool {
142142/// forward log messages to this function.
143143pub fn defaultLog(
144144 comptime message_level: Level,
145 comptime scope: @Type(.EnumLiteral),
145 comptime scope: @Type(.enum_literal),
146146 comptime format: []const u8,
147147 args: anytype,
148148) void {
......@@ -162,7 +162,7 @@ pub fn defaultLog(
162162
163163/// Returns a scoped logging namespace that logs all messages using the scope
164164/// provided here.
165pub fn scoped(comptime scope: @Type(.EnumLiteral)) type {
165pub fn scoped(comptime scope: @Type(.enum_literal)) type {
166166 return struct {
167167 /// Log an error message. This log level is intended to be used
168168 /// when something has gone wrong. This might be recoverable or might
lib/std/math.zig+98-98
......@@ -71,7 +71,7 @@ pub const snan = float.snan;
7171///
7272/// NaN values are never considered equal to any value.
7373pub fn approxEqAbs(comptime T: type, x: T, y: T, tolerance: T) bool {
74 assert(@typeInfo(T) == .Float or @typeInfo(T) == .ComptimeFloat);
74 assert(@typeInfo(T) == .float or @typeInfo(T) == .comptime_float);
7575 assert(tolerance >= 0);
7676
7777 // Fast path for equal values (and signed zeros and infinites).
......@@ -99,7 +99,7 @@ pub fn approxEqAbs(comptime T: type, x: T, y: T, tolerance: T) bool {
9999///
100100/// NaN values are never considered equal to any value.
101101pub fn approxEqRel(comptime T: type, x: T, y: T, tolerance: T) bool {
102 assert(@typeInfo(T) == .Float or @typeInfo(T) == .ComptimeFloat);
102 assert(@typeInfo(T) == .float or @typeInfo(T) == .comptime_float);
103103 assert(tolerance > 0);
104104
105105 // Fast path for equal values (and signed zeros and infinites).
......@@ -263,8 +263,8 @@ pub inline fn tan(value: anytype) @TypeOf(value) {
263263pub fn radiansToDegrees(ang: anytype) if (@TypeOf(ang) == comptime_int) comptime_float else @TypeOf(ang) {
264264 const T = @TypeOf(ang);
265265 switch (@typeInfo(T)) {
266 .Float, .ComptimeFloat, .ComptimeInt => return ang * deg_per_rad,
267 .Vector => |V| if (@typeInfo(V.child) == .Float) return ang * @as(T, @splat(deg_per_rad)),
266 .float, .comptime_float, .comptime_int => return ang * deg_per_rad,
267 .vector => |V| if (@typeInfo(V.child) == .float) return ang * @as(T, @splat(deg_per_rad)),
268268 else => {},
269269 }
270270 @compileError("Input must be float or a comptime number, or a vector of floats.");
......@@ -298,8 +298,8 @@ test radiansToDegrees {
298298pub fn degreesToRadians(ang: anytype) if (@TypeOf(ang) == comptime_int) comptime_float else @TypeOf(ang) {
299299 const T = @TypeOf(ang);
300300 switch (@typeInfo(T)) {
301 .Float, .ComptimeFloat, .ComptimeInt => return ang * rad_per_deg,
302 .Vector => |V| if (@typeInfo(V.child) == .Float) return ang * @as(T, @splat(rad_per_deg)),
301 .float, .comptime_float, .comptime_int => return ang * rad_per_deg,
302 .vector => |V| if (@typeInfo(V.child) == .float) return ang * @as(T, @splat(rad_per_deg)),
303303 else => {},
304304 }
305305 @compileError("Input must be float or a comptime number, or a vector of floats.");
......@@ -408,8 +408,8 @@ test {
408408/// full range of the minimum value.
409409pub fn Min(comptime A: type, comptime B: type) type {
410410 switch (@typeInfo(A)) {
411 .Int => |a_info| switch (@typeInfo(B)) {
412 .Int => |b_info| if (a_info.signedness == .unsigned and b_info.signedness == .unsigned) {
411 .int => |a_info| switch (@typeInfo(B)) {
412 .int => |b_info| if (a_info.signedness == .unsigned and b_info.signedness == .unsigned) {
413413 if (a_info.bits < b_info.bits) {
414414 return A;
415415 } else {
......@@ -437,21 +437,21 @@ pub fn Min(comptime A: type, comptime B: type) type {
437437pub fn wrap(x: anytype, r: anytype) @TypeOf(x) {
438438 const info_x = @typeInfo(@TypeOf(x));
439439 const info_r = @typeInfo(@TypeOf(r));
440 if (info_x == .Int and info_x.Int.signedness != .signed) {
440 if (info_x == .int and info_x.int.signedness != .signed) {
441441 @compileError("x must be floating point, comptime integer, or signed integer.");
442442 }
443443 switch (info_r) {
444 .Int => {
444 .int => {
445445 // in the rare usecase of r not being comptime_int or float,
446446 // take the penalty of having an intermediary type conversion,
447447 // otherwise the alternative is to unwind iteratively to avoid overflow
448448 const R = comptime do: {
449449 var info = info_r;
450 info.Int.bits += 1;
451 info.Int.signedness = .signed;
450 info.int.bits += 1;
451 info.int.signedness = .signed;
452452 break :do @Type(info);
453453 };
454 const radius: if (info_r.Int.signedness == .signed) @TypeOf(r) else R = r;
454 const radius: if (info_r.int.signedness == .signed) @TypeOf(r) else R = r;
455455 return @intCast(@mod(x - radius, 2 * @as(R, r)) - r); // provably impossible to overflow
456456 },
457457 else => {
......@@ -520,9 +520,9 @@ test wrap {
520520pub fn clamp(val: anytype, lower: anytype, upper: anytype) @TypeOf(val, lower, upper) {
521521 const T = @TypeOf(val, lower, upper);
522522 switch (@typeInfo(T)) {
523 .Int, .Float, .ComptimeInt, .ComptimeFloat => assert(lower <= upper),
524 .Vector => |vinfo| switch (@typeInfo(vinfo.child)) {
525 .Int, .Float => assert(@reduce(.And, lower <= upper)),
523 .int, .float, .comptime_int, .comptime_float => assert(lower <= upper),
524 .vector => |vinfo| switch (@typeInfo(vinfo.child)) {
525 .int, .float => assert(@reduce(.And, lower <= upper)),
526526 else => @compileError("Expected vector of ints or floats, found " ++ @typeName(T)),
527527 },
528528 else => @compileError("Expected an int, float or vector of one, found " ++ @typeName(T)),
......@@ -593,18 +593,18 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T {
593593 const abs_shift_amt = @abs(shift_amt);
594594
595595 const casted_shift_amt = blk: {
596 if (@typeInfo(T) == .Vector) {
597 const C = @typeInfo(T).Vector.child;
598 const len = @typeInfo(T).Vector.len;
599 if (abs_shift_amt >= @typeInfo(C).Int.bits) return @splat(0);
596 if (@typeInfo(T) == .vector) {
597 const C = @typeInfo(T).vector.child;
598 const len = @typeInfo(T).vector.len;
599 if (abs_shift_amt >= @typeInfo(C).int.bits) return @splat(0);
600600 break :blk @as(@Vector(len, Log2Int(C)), @splat(@as(Log2Int(C), @intCast(abs_shift_amt))));
601601 } else {
602 if (abs_shift_amt >= @typeInfo(T).Int.bits) return 0;
602 if (abs_shift_amt >= @typeInfo(T).int.bits) return 0;
603603 break :blk @as(Log2Int(T), @intCast(abs_shift_amt));
604604 }
605605 };
606606
607 if (@TypeOf(shift_amt) == comptime_int or @typeInfo(@TypeOf(shift_amt)).Int.signedness == .signed) {
607 if (@TypeOf(shift_amt) == comptime_int or @typeInfo(@TypeOf(shift_amt)).int.signedness == .signed) {
608608 if (shift_amt < 0) {
609609 return a >> casted_shift_amt;
610610 }
......@@ -633,18 +633,18 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T {
633633 const abs_shift_amt = @abs(shift_amt);
634634
635635 const casted_shift_amt = blk: {
636 if (@typeInfo(T) == .Vector) {
637 const C = @typeInfo(T).Vector.child;
638 const len = @typeInfo(T).Vector.len;
639 if (abs_shift_amt >= @typeInfo(C).Int.bits) return @splat(0);
636 if (@typeInfo(T) == .vector) {
637 const C = @typeInfo(T).vector.child;
638 const len = @typeInfo(T).vector.len;
639 if (abs_shift_amt >= @typeInfo(C).int.bits) return @splat(0);
640640 break :blk @as(@Vector(len, Log2Int(C)), @splat(@as(Log2Int(C), @intCast(abs_shift_amt))));
641641 } else {
642 if (abs_shift_amt >= @typeInfo(T).Int.bits) return 0;
642 if (abs_shift_amt >= @typeInfo(T).int.bits) return 0;
643643 break :blk @as(Log2Int(T), @intCast(abs_shift_amt));
644644 }
645645 };
646646
647 if (@TypeOf(shift_amt) == comptime_int or @typeInfo(@TypeOf(shift_amt)).Int.signedness == .signed) {
647 if (@TypeOf(shift_amt) == comptime_int or @typeInfo(@TypeOf(shift_amt)).int.signedness == .signed) {
648648 if (shift_amt < 0) {
649649 return a << casted_shift_amt;
650650 }
......@@ -670,26 +670,26 @@ test shr {
670670/// Rotates right. Only unsigned values can be rotated. Negative shift
671671/// values result in shift modulo the bit count.
672672pub fn rotr(comptime T: type, x: T, r: anytype) T {
673 if (@typeInfo(T) == .Vector) {
674 const C = @typeInfo(T).Vector.child;
673 if (@typeInfo(T) == .vector) {
674 const C = @typeInfo(T).vector.child;
675675 if (C == u0) return 0;
676676
677 if (@typeInfo(C).Int.signedness == .signed) {
677 if (@typeInfo(C).int.signedness == .signed) {
678678 @compileError("cannot rotate signed integers");
679679 }
680 const ar: Log2Int(C) = @intCast(@mod(r, @typeInfo(C).Int.bits));
680 const ar: Log2Int(C) = @intCast(@mod(r, @typeInfo(C).int.bits));
681681 return (x >> @splat(ar)) | (x << @splat(1 + ~ar));
682 } else if (@typeInfo(T).Int.signedness == .signed) {
682 } else if (@typeInfo(T).int.signedness == .signed) {
683683 @compileError("cannot rotate signed integer");
684684 } else {
685685 if (T == u0) return 0;
686686
687 if (comptime isPowerOfTwo(@typeInfo(T).Int.bits)) {
688 const ar: Log2Int(T) = @intCast(@mod(r, @typeInfo(T).Int.bits));
687 if (comptime isPowerOfTwo(@typeInfo(T).int.bits)) {
688 const ar: Log2Int(T) = @intCast(@mod(r, @typeInfo(T).int.bits));
689689 return x >> ar | x << (1 +% ~ar);
690690 } else {
691 const ar = @mod(r, @typeInfo(T).Int.bits);
692 return shr(T, x, ar) | shl(T, x, @typeInfo(T).Int.bits - ar);
691 const ar = @mod(r, @typeInfo(T).int.bits);
692 return shr(T, x, ar) | shl(T, x, @typeInfo(T).int.bits - ar);
693693 }
694694 }
695695}
......@@ -711,26 +711,26 @@ test rotr {
711711/// Rotates left. Only unsigned values can be rotated. Negative shift
712712/// values result in shift modulo the bit count.
713713pub fn rotl(comptime T: type, x: T, r: anytype) T {
714 if (@typeInfo(T) == .Vector) {
715 const C = @typeInfo(T).Vector.child;
714 if (@typeInfo(T) == .vector) {
715 const C = @typeInfo(T).vector.child;
716716 if (C == u0) return 0;
717717
718 if (@typeInfo(C).Int.signedness == .signed) {
718 if (@typeInfo(C).int.signedness == .signed) {
719719 @compileError("cannot rotate signed integers");
720720 }
721 const ar: Log2Int(C) = @intCast(@mod(r, @typeInfo(C).Int.bits));
721 const ar: Log2Int(C) = @intCast(@mod(r, @typeInfo(C).int.bits));
722722 return (x << @splat(ar)) | (x >> @splat(1 +% ~ar));
723 } else if (@typeInfo(T).Int.signedness == .signed) {
723 } else if (@typeInfo(T).int.signedness == .signed) {
724724 @compileError("cannot rotate signed integer");
725725 } else {
726726 if (T == u0) return 0;
727727
728 if (comptime isPowerOfTwo(@typeInfo(T).Int.bits)) {
729 const ar: Log2Int(T) = @intCast(@mod(r, @typeInfo(T).Int.bits));
728 if (comptime isPowerOfTwo(@typeInfo(T).int.bits)) {
729 const ar: Log2Int(T) = @intCast(@mod(r, @typeInfo(T).int.bits));
730730 return x << ar | x >> 1 +% ~ar;
731731 } else {
732 const ar = @mod(r, @typeInfo(T).Int.bits);
733 return shl(T, x, ar) | shr(T, x, @typeInfo(T).Int.bits - ar);
732 const ar = @mod(r, @typeInfo(T).int.bits);
733 return shl(T, x, ar) | shr(T, x, @typeInfo(T).int.bits - ar);
734734 }
735735 }
736736}
......@@ -754,7 +754,7 @@ test rotl {
754754pub fn Log2Int(comptime T: type) type {
755755 // comptime ceil log2
756756 if (T == comptime_int) return comptime_int;
757 const bits: u16 = @typeInfo(T).Int.bits;
757 const bits: u16 = @typeInfo(T).int.bits;
758758 const log2_bits = 16 - @clz(bits - 1);
759759 return std.meta.Int(.unsigned, log2_bits);
760760}
......@@ -763,7 +763,7 @@ pub fn Log2Int(comptime T: type) type {
763763pub fn Log2IntCeil(comptime T: type) type {
764764 // comptime ceil log2
765765 if (T == comptime_int) return comptime_int;
766 const bits: u16 = @typeInfo(T).Int.bits;
766 const bits: u16 = @typeInfo(T).int.bits;
767767 const log2_bits = 16 - @clz(bits);
768768 return std.meta.Int(.unsigned, log2_bits);
769769}
......@@ -849,7 +849,7 @@ fn testOverflow() !void {
849849pub fn divTrunc(comptime T: type, numerator: T, denominator: T) !T {
850850 @setRuntimeSafety(false);
851851 if (denominator == 0) return error.DivisionByZero;
852 if (@typeInfo(T) == .Int and @typeInfo(T).Int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
852 if (@typeInfo(T) == .int and @typeInfo(T).int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
853853 return @divTrunc(numerator, denominator);
854854}
855855
......@@ -873,7 +873,7 @@ fn testDivTrunc() !void {
873873pub fn divFloor(comptime T: type, numerator: T, denominator: T) !T {
874874 @setRuntimeSafety(false);
875875 if (denominator == 0) return error.DivisionByZero;
876 if (@typeInfo(T) == .Int and @typeInfo(T).Int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
876 if (@typeInfo(T) == .int and @typeInfo(T).int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
877877 return @divFloor(numerator, denominator);
878878}
879879
......@@ -899,10 +899,10 @@ pub fn divCeil(comptime T: type, numerator: T, denominator: T) !T {
899899 if (denominator == 0) return error.DivisionByZero;
900900 const info = @typeInfo(T);
901901 switch (info) {
902 .ComptimeFloat, .Float => return @ceil(numerator / denominator),
903 .ComptimeInt, .Int => {
902 .comptime_float, .float => return @ceil(numerator / denominator),
903 .comptime_int, .int => {
904904 if (numerator < 0 and denominator < 0) {
905 if (info == .Int and numerator == minInt(T) and denominator == -1)
905 if (info == .int and numerator == minInt(T) and denominator == -1)
906906 return error.Overflow;
907907 return @divFloor(numerator + 1, denominator) + 1;
908908 }
......@@ -952,7 +952,7 @@ fn testDivCeil() !void {
952952pub fn divExact(comptime T: type, numerator: T, denominator: T) !T {
953953 @setRuntimeSafety(false);
954954 if (denominator == 0) return error.DivisionByZero;
955 if (@typeInfo(T) == .Int and @typeInfo(T).Int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
955 if (@typeInfo(T) == .int and @typeInfo(T).int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
956956 const result = @divTrunc(numerator, denominator);
957957 if (result * denominator != numerator) return error.UnexpectedRemainder;
958958 return result;
......@@ -1029,7 +1029,7 @@ fn testRem() !void {
10291029/// Returns the negation of the integer parameter.
10301030/// Result is a signed integer.
10311031pub fn negateCast(x: anytype) !std.meta.Int(.signed, @bitSizeOf(@TypeOf(x))) {
1032 if (@typeInfo(@TypeOf(x)).Int.signedness == .signed) return negate(x);
1032 if (@typeInfo(@TypeOf(x)).int.signedness == .signed) return negate(x);
10331033
10341034 const int = std.meta.Int(.signed, @bitSizeOf(@TypeOf(x)));
10351035 if (x > -minInt(int)) return error.Overflow;
......@@ -1052,9 +1052,9 @@ test negateCast {
10521052/// Cast an integer to a different integer type. If the value doesn't fit,
10531053/// return null.
10541054pub fn cast(comptime T: type, x: anytype) ?T {
1055 comptime assert(@typeInfo(T) == .Int); // must pass an integer
1055 comptime assert(@typeInfo(T) == .int); // must pass an integer
10561056 const is_comptime = @TypeOf(x) == comptime_int;
1057 comptime assert(is_comptime or @typeInfo(@TypeOf(x)) == .Int); // must pass an integer
1057 comptime assert(is_comptime or @typeInfo(@TypeOf(x)) == .int); // must pass an integer
10581058 if ((is_comptime or maxInt(@TypeOf(x)) > maxInt(T)) and x > maxInt(T)) {
10591059 return null;
10601060 } else if ((is_comptime or minInt(@TypeOf(x)) < minInt(T)) and x < minInt(T)) {
......@@ -1084,7 +1084,7 @@ pub const AlignCastError = error{UnalignedMemory};
10841084
10851085fn AlignCastResult(comptime alignment: u29, comptime Ptr: type) type {
10861086 var ptr_info = @typeInfo(Ptr);
1087 ptr_info.Pointer.alignment = alignment;
1087 ptr_info.pointer.alignment = alignment;
10881088 return @Type(ptr_info);
10891089}
10901090
......@@ -1117,7 +1117,7 @@ test isPowerOfTwo {
11171117
11181118/// Aligns the given integer type bit width to a width divisible by 8.
11191119pub fn ByteAlignedInt(comptime T: type) type {
1120 const info = @typeInfo(T).Int;
1120 const info = @typeInfo(T).int;
11211121 const bits = (info.bits + 7) / 8 * 8;
11221122 const extended_type = std.meta.Int(info.signedness, bits);
11231123 return extended_type;
......@@ -1157,7 +1157,7 @@ pub inline fn floor(value: anytype) @TypeOf(value) {
11571157/// Returns the nearest power of two less than or equal to value, or
11581158/// zero if value is less than or equal to zero.
11591159pub fn floorPowerOfTwo(comptime T: type, value: T) T {
1160 const uT = std.meta.Int(.unsigned, @typeInfo(T).Int.bits);
1160 const uT = std.meta.Int(.unsigned, @typeInfo(T).int.bits);
11611161 if (value <= 0) return 0;
11621162 return @as(T, 1) << log2_int(uT, @as(uT, @intCast(value)));
11631163}
......@@ -1192,21 +1192,21 @@ pub inline fn ceil(value: anytype) @TypeOf(value) {
11921192/// Returns the next power of two (if the value is not already a power of two).
11931193/// Only unsigned integers can be used. Zero is not an allowed input.
11941194/// Result is a type with 1 more bit than the input type.
1195pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo(T).Int.signedness, @typeInfo(T).Int.bits + 1) {
1196 comptime assert(@typeInfo(T) == .Int);
1197 comptime assert(@typeInfo(T).Int.signedness == .unsigned);
1195pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1) {
1196 comptime assert(@typeInfo(T) == .int);
1197 comptime assert(@typeInfo(T).int.signedness == .unsigned);
11981198 assert(value != 0);
1199 const PromotedType = std.meta.Int(@typeInfo(T).Int.signedness, @typeInfo(T).Int.bits + 1);
1199 const PromotedType = std.meta.Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1);
12001200 const ShiftType = std.math.Log2Int(PromotedType);
1201 return @as(PromotedType, 1) << @as(ShiftType, @intCast(@typeInfo(T).Int.bits - @clz(value - 1)));
1201 return @as(PromotedType, 1) << @as(ShiftType, @intCast(@typeInfo(T).int.bits - @clz(value - 1)));
12021202}
12031203
12041204/// Returns the next power of two (if the value is not already a power of two).
12051205/// Only unsigned integers can be used. Zero is not an allowed input.
12061206/// If the value doesn't fit, returns an error.
12071207pub fn ceilPowerOfTwo(comptime T: type, value: T) (error{Overflow}!T) {
1208 comptime assert(@typeInfo(T) == .Int);
1209 const info = @typeInfo(T).Int;
1208 comptime assert(@typeInfo(T) == .int);
1209 const info = @typeInfo(T).int;
12101210 comptime assert(info.signedness == .unsigned);
12111211 const PromotedType = std.meta.Int(info.signedness, info.bits + 1);
12121212 const overflowBit = @as(PromotedType, 1) << info.bits;
......@@ -1261,16 +1261,16 @@ fn testCeilPowerOfTwo() !void {
12611261/// Return the log base 2 of integer value x, rounding down to the
12621262/// nearest integer.
12631263pub fn log2_int(comptime T: type, x: T) Log2Int(T) {
1264 if (@typeInfo(T) != .Int or @typeInfo(T).Int.signedness != .unsigned)
1264 if (@typeInfo(T) != .int or @typeInfo(T).int.signedness != .unsigned)
12651265 @compileError("log2_int requires an unsigned integer, found " ++ @typeName(T));
12661266 assert(x != 0);
1267 return @as(Log2Int(T), @intCast(@typeInfo(T).Int.bits - 1 - @clz(x)));
1267 return @as(Log2Int(T), @intCast(@typeInfo(T).int.bits - 1 - @clz(x)));
12681268}
12691269
12701270/// Return the log base 2 of integer value x, rounding up to the
12711271/// nearest integer.
12721272pub fn log2_int_ceil(comptime T: type, x: T) Log2IntCeil(T) {
1273 if (@typeInfo(T) != .Int or @typeInfo(T).Int.signedness != .unsigned)
1273 if (@typeInfo(T) != .int or @typeInfo(T).int.signedness != .unsigned)
12741274 @compileError("log2_int_ceil requires an unsigned integer, found " ++ @typeName(T));
12751275 assert(x != 0);
12761276 if (x == 1) return 0;
......@@ -1296,35 +1296,35 @@ test log2_int_ceil {
12961296/// converted to the closest possible representation.
12971297pub fn lossyCast(comptime T: type, value: anytype) T {
12981298 switch (@typeInfo(T)) {
1299 .Float => {
1299 .float => {
13001300 switch (@typeInfo(@TypeOf(value))) {
1301 .Int => return @as(T, @floatFromInt(value)),
1302 .Float => return @as(T, @floatCast(value)),
1303 .ComptimeInt => return @as(T, value),
1304 .ComptimeFloat => return @as(T, value),
1301 .int => return @floatFromInt(value),
1302 .float => return @floatCast(value),
1303 .comptime_int => return value,
1304 .comptime_float => return value,
13051305 else => @compileError("bad type"),
13061306 }
13071307 },
1308 .Int => {
1308 .int => {
13091309 switch (@typeInfo(@TypeOf(value))) {
1310 .Int, .ComptimeInt => {
1310 .int, .comptime_int => {
13111311 if (value >= maxInt(T)) {
1312 return @as(T, maxInt(T));
1312 return maxInt(T);
13131313 } else if (value <= minInt(T)) {
1314 return @as(T, minInt(T));
1314 return minInt(T);
13151315 } else {
1316 return @as(T, @intCast(value));
1316 return @intCast(value);
13171317 }
13181318 },
1319 .Float, .ComptimeFloat => {
1319 .float, .comptime_float => {
13201320 if (isNan(value)) {
13211321 return 0;
13221322 } else if (value >= maxInt(T)) {
1323 return @as(T, maxInt(T));
1323 return maxInt(T);
13241324 } else if (value <= minInt(T)) {
1325 return @as(T, minInt(T));
1325 return minInt(T);
13261326 } else {
1327 return @as(T, @intFromFloat(value));
1327 return @intFromFloat(value);
13281328 }
13291329 },
13301330 else => @compileError("bad type"),
......@@ -1405,16 +1405,16 @@ test lerp {
14051405/// Returns the maximum value of integer type T.
14061406pub fn maxInt(comptime T: type) comptime_int {
14071407 const info = @typeInfo(T);
1408 const bit_count = info.Int.bits;
1408 const bit_count = info.int.bits;
14091409 if (bit_count == 0) return 0;
1410 return (1 << (bit_count - @intFromBool(info.Int.signedness == .signed))) - 1;
1410 return (1 << (bit_count - @intFromBool(info.int.signedness == .signed))) - 1;
14111411}
14121412
14131413/// Returns the minimum value of integer type T.
14141414pub fn minInt(comptime T: type) comptime_int {
14151415 const info = @typeInfo(T);
1416 const bit_count = info.Int.bits;
1417 if (info.Int.signedness == .unsigned) return 0;
1416 const bit_count = info.int.bits;
1417 if (info.int.signedness == .unsigned) return 0;
14181418 if (bit_count == 0) return 0;
14191419 return -(1 << (bit_count - 1));
14201420}
......@@ -1466,12 +1466,12 @@ test "max value type" {
14661466/// Multiply a and b. Return type is wide enough to guarantee no
14671467/// overflow.
14681468pub fn mulWide(comptime T: type, a: T, b: T) std.meta.Int(
1469 @typeInfo(T).Int.signedness,
1470 @typeInfo(T).Int.bits * 2,
1469 @typeInfo(T).int.signedness,
1470 @typeInfo(T).int.bits * 2,
14711471) {
14721472 const ResultInt = std.meta.Int(
1473 @typeInfo(T).Int.signedness,
1474 @typeInfo(T).Int.bits * 2,
1473 @typeInfo(T).int.signedness,
1474 @typeInfo(T).int.bits * 2,
14751475 );
14761476 return @as(ResultInt, a) * @as(ResultInt, b);
14771477}
......@@ -1616,7 +1616,7 @@ pub const CompareOperator = enum {
16161616 }
16171617
16181618 test reverse {
1619 inline for (@typeInfo(CompareOperator).Enum.fields) |op_field| {
1619 inline for (@typeInfo(CompareOperator).@"enum".fields) |op_field| {
16201620 const op = @as(CompareOperator, @enumFromInt(op_field.value));
16211621 try testing.expect(compare(2, op, 3) == compare(3, op.reverse(), 2));
16221622 try testing.expect(compare(3, op, 3) == compare(3, op.reverse(), 3));
......@@ -1669,7 +1669,7 @@ test order {
16691669/// and a mask of all zeroes if value is false.
16701670/// Compiles to one instruction for register sized integers.
16711671pub inline fn boolMask(comptime MaskInt: type, value: bool) MaskInt {
1672 if (@typeInfo(MaskInt) != .Int)
1672 if (@typeInfo(MaskInt) != .int)
16731673 @compileError("boolMask requires an integer mask type.");
16741674
16751675 if (MaskInt == u0 or MaskInt == i0)
......@@ -1742,11 +1742,11 @@ pub fn break_f80(x: f80) F80 {
17421742pub inline fn sign(i: anytype) @TypeOf(i) {
17431743 const T = @TypeOf(i);
17441744 return switch (@typeInfo(T)) {
1745 .Int, .ComptimeInt => @as(T, @intFromBool(i > 0)) - @as(T, @intFromBool(i < 0)),
1746 .Float, .ComptimeFloat => @as(T, @floatFromInt(@intFromBool(i > 0))) - @as(T, @floatFromInt(@intFromBool(i < 0))),
1747 .Vector => |vinfo| blk: {
1745 .int, .comptime_int => @as(T, @intFromBool(i > 0)) - @as(T, @intFromBool(i < 0)),
1746 .float, .comptime_float => @as(T, @floatFromInt(@intFromBool(i > 0))) - @as(T, @floatFromInt(@intFromBool(i < 0))),
1747 .vector => |vinfo| blk: {
17481748 switch (@typeInfo(vinfo.child)) {
1749 .Int, .Float => {
1749 .int, .float => {
17501750 const zero: T = @splat(0);
17511751 const one: T = @splat(1);
17521752 break :blk @select(vinfo.child, i > zero, one, zero) - @select(vinfo.child, i < zero, one, zero);
lib/std/math/big.zig+1-1
......@@ -4,7 +4,7 @@ const assert = std.debug.assert;
44pub const Rational = @import("big/rational.zig").Rational;
55pub const int = @import("big/int.zig");
66pub const Limb = usize;
7const limb_info = @typeInfo(Limb).Int;
7const limb_info = @typeInfo(Limb).int;
88pub const SignedLimb = std.meta.Int(.signed, limb_info.bits);
99pub const DoubleLimb = std.meta.Int(.unsigned, 2 * limb_info.bits);
1010pub const HalfLimb = std.meta.Int(.unsigned, limb_info.bits / 2);
lib/std/math/big/int.zig+12-12
......@@ -2,9 +2,9 @@ const std = @import("../../std.zig");
22const builtin = @import("builtin");
33const math = std.math;
44const Limb = std.math.big.Limb;
5const limb_bits = @typeInfo(Limb).Int.bits;
5const limb_bits = @typeInfo(Limb).int.bits;
66const HalfLimb = std.math.big.HalfLimb;
7const half_limb_bits = @typeInfo(HalfLimb).Int.bits;
7const half_limb_bits = @typeInfo(HalfLimb).int.bits;
88const DoubleLimb = std.math.big.DoubleLimb;
99const SignedDoubleLimb = std.math.big.SignedDoubleLimb;
1010const Log2Limb = std.math.big.Log2Limb;
......@@ -23,7 +23,7 @@ const debug_safety = false;
2323/// primitive integer value.
2424/// Note: A comptime-known upper bound of this value that may be used
2525/// instead if `scalar` is not already comptime-known is
26/// `calcTwosCompLimbCount(@typeInfo(@TypeOf(scalar)).Int.bits)`
26/// `calcTwosCompLimbCount(@typeInfo(@TypeOf(scalar)).int.bits)`
2727pub fn calcLimbLen(scalar: anytype) usize {
2828 if (scalar == 0) {
2929 return 1;
......@@ -236,7 +236,7 @@ pub const Mutable = struct {
236236 self.positive = value >= 0;
237237
238238 switch (@typeInfo(T)) {
239 .Int => |info| {
239 .int => |info| {
240240 var w_value = @abs(value);
241241
242242 if (info.bits <= limb_bits) {
......@@ -251,7 +251,7 @@ pub const Mutable = struct {
251251 }
252252 }
253253 },
254 .ComptimeInt => {
254 .comptime_int => {
255255 comptime var w_value = @abs(value);
256256
257257 if (w_value <= maxInt(Limb)) {
......@@ -405,8 +405,8 @@ pub const Mutable = struct {
405405 // is well worth being able to use the stack and not needing an allocator passed in.
406406 // Note that Mutable.init still sets len to calcLimbLen(scalar) in any case.
407407 const limb_len = comptime switch (@typeInfo(@TypeOf(scalar))) {
408 .ComptimeInt => calcLimbLen(scalar),
409 .Int => |info| calcTwosCompLimbCount(info.bits),
408 .comptime_int => calcLimbLen(scalar),
409 .int => |info| calcTwosCompLimbCount(info.bits),
410410 else => @compileError("expected scalar to be an int"),
411411 };
412412 var limbs: [limb_len]Limb = undefined;
......@@ -2158,7 +2158,7 @@ pub const Const = struct {
21582158
21592159 /// Returns whether self can fit into an integer of the requested type.
21602160 pub fn fits(self: Const, comptime T: type) bool {
2161 const info = @typeInfo(T).Int;
2161 const info = @typeInfo(T).int;
21622162 return self.fitsInTwosComp(info.signedness, info.bits);
21632163 }
21642164
......@@ -2181,7 +2181,7 @@ pub const Const = struct {
21812181 /// Returns an error if self cannot be narrowed into the requested type without truncation.
21822182 pub fn to(self: Const, comptime T: type) ConvertError!T {
21832183 switch (@typeInfo(T)) {
2184 .Int => |info| {
2184 .int => |info| {
21852185 // Make sure -0 is handled correctly.
21862186 if (self.eqlZero()) return 0;
21872187
......@@ -2495,8 +2495,8 @@ pub const Const = struct {
24952495 // is well worth being able to use the stack and not needing an allocator passed in.
24962496 // Note that Mutable.init still sets len to calcLimbLen(scalar) in any case.
24972497 const limb_len = comptime switch (@typeInfo(@TypeOf(scalar))) {
2498 .ComptimeInt => calcLimbLen(scalar),
2499 .Int => |info| calcTwosCompLimbCount(info.bits),
2498 .comptime_int => calcLimbLen(scalar),
2499 .int => |info| calcTwosCompLimbCount(info.bits),
25002500 else => @compileError("expected scalar to be an int"),
25012501 };
25022502 var limbs: [limb_len]Limb = undefined;
......@@ -2555,7 +2555,7 @@ pub const Const = struct {
25552555/// Memory is allocated as needed to ensure operations never overflow. The range
25562556/// is bounded only by available memory.
25572557pub const Managed = struct {
2558 pub const sign_bit: usize = 1 << (@typeInfo(usize).Int.bits - 1);
2558 pub const sign_bit: usize = 1 << (@typeInfo(usize).int.bits - 1);
25592559
25602560 /// Default number of limbs to allocate on creation of a `Managed`.
25612561 pub const default_capacity = 4;
lib/std/math/big/int_test.zig+13-13
......@@ -22,13 +22,13 @@ test "comptime_int set" {
2222 var a = try Managed.initSet(testing.allocator, s);
2323 defer a.deinit();
2424
25 const s_limb_count = 128 / @typeInfo(Limb).Int.bits;
25 const s_limb_count = 128 / @typeInfo(Limb).int.bits;
2626
2727 comptime var i: usize = 0;
2828 inline while (i < s_limb_count) : (i += 1) {
2929 const result = @as(Limb, s & maxInt(Limb));
30 s >>= @typeInfo(Limb).Int.bits / 2;
31 s >>= @typeInfo(Limb).Int.bits / 2;
30 s >>= @typeInfo(Limb).int.bits / 2;
31 s >>= @typeInfo(Limb).int.bits / 2;
3232 try testing.expect(a.limbs[i] == result);
3333 }
3434}
......@@ -299,7 +299,7 @@ test "twos complement limit set" {
299299}
300300
301301fn testTwosComplementLimit(comptime T: type) !void {
302 const int_info = @typeInfo(T).Int;
302 const int_info = @typeInfo(T).int;
303303
304304 var a = try Managed.init(testing.allocator);
305305 defer a.deinit();
......@@ -1893,7 +1893,7 @@ test "truncate multi to single signed" {
18931893}
18941894
18951895test "truncate multi to multi unsigned" {
1896 const bits = @typeInfo(SignedDoubleLimb).Int.bits;
1896 const bits = @typeInfo(SignedDoubleLimb).int.bits;
18971897 const Int = std.meta.Int(.unsigned, bits - 1);
18981898
18991899 var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));
......@@ -2239,11 +2239,11 @@ test "bitNotWrap more than two limbs" {
22392239 const bits = @bitSizeOf(Limb) * 4 + 2;
22402240
22412241 try res.bitNotWrap(&a, .unsigned, bits);
2242 const Unsigned = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = bits } });
2242 const Unsigned = @Type(.{ .int = .{ .signedness = .unsigned, .bits = bits } });
22432243 try testing.expectEqual((try res.to(Unsigned)), ~@as(Unsigned, maxInt(Limb)));
22442244
22452245 try res.bitNotWrap(&a, .signed, bits);
2246 const Signed = @Type(.{ .Int = .{ .signedness = .signed, .bits = bits } });
2246 const Signed = @Type(.{ .int = .{ .signedness = .signed, .bits = bits } });
22472247 try testing.expectEqual((try res.to(Signed)), ~@as(Signed, maxInt(Limb)));
22482248}
22492249
......@@ -3037,8 +3037,8 @@ test "big int conversion write twos complement zero" {
30373037}
30383038
30393039fn bitReverseTest(comptime T: type, comptime input: comptime_int, comptime expected_output: comptime_int) !void {
3040 const bit_count = @typeInfo(T).Int.bits;
3041 const signedness = @typeInfo(T).Int.signedness;
3040 const bit_count = @typeInfo(T).int.bits;
3041 const signedness = @typeInfo(T).int.signedness;
30423042
30433043 var a = try Managed.initSet(testing.allocator, input);
30443044 defer a.deinit();
......@@ -3084,8 +3084,8 @@ test "big int bit reverse" {
30843084}
30853085
30863086fn byteSwapTest(comptime T: type, comptime input: comptime_int, comptime expected_output: comptime_int) !void {
3087 const byte_count = @typeInfo(T).Int.bits / 8;
3088 const signedness = @typeInfo(T).Int.signedness;
3087 const byte_count = @typeInfo(T).int.bits / 8;
3088 const signedness = @typeInfo(T).int.signedness;
30893089
30903090 var a = try Managed.initSet(testing.allocator, input);
30913091 defer a.deinit();
......@@ -3151,7 +3151,7 @@ test "mul multi-multi alias r with a and b" {
31513151
31523152 try testing.expect(a.eql(want));
31533153
3154 if (@typeInfo(Limb).Int.bits == 64) {
3154 if (@typeInfo(Limb).int.bits == 64) {
31553155 try testing.expectEqual(@as(usize, 5), a.limbs.len);
31563156 }
31573157}
......@@ -3167,7 +3167,7 @@ test "sqr multi alias r with a" {
31673167
31683168 try testing.expect(a.eql(want));
31693169
3170 if (@typeInfo(Limb).Int.bits == 64) {
3170 if (@typeInfo(Limb).int.bits == 64) {
31713171 try testing.expectEqual(@as(usize, 5), a.limbs.len);
31723172 }
31733173}
lib/std/math/big/rational.zig+7-7
......@@ -135,9 +135,9 @@ pub const Rational = struct {
135135 /// completely represent the provided float.
136136 pub fn setFloat(self: *Rational, comptime T: type, f: T) !void {
137137 // Translated from golang.go/src/math/big/rat.go.
138 debug.assert(@typeInfo(T) == .Float);
138 debug.assert(@typeInfo(T) == .float);
139139
140 const UnsignedInt = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
140 const UnsignedInt = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
141141 const f_bits = @as(UnsignedInt, @bitCast(f));
142142
143143 const exponent_bits = math.floatExponentBits(T);
......@@ -193,9 +193,9 @@ pub const Rational = struct {
193193 pub fn toFloat(self: Rational, comptime T: type) !T {
194194 // Translated from golang.go/src/math/big/rat.go.
195195 // TODO: Indicate whether the result is not exact.
196 debug.assert(@typeInfo(T) == .Float);
196 debug.assert(@typeInfo(T) == .float);
197197
198 const fsize = @typeInfo(T).Float.bits;
198 const fsize = @typeInfo(T).float.bits;
199199 const BitReprType = std.meta.Int(.unsigned, fsize);
200200
201201 const msize = math.floatMantissaBits(T);
......@@ -473,10 +473,10 @@ pub const Rational = struct {
473473};
474474
475475fn extractLowBits(a: Int, comptime T: type) T {
476 debug.assert(@typeInfo(T) == .Int);
476 debug.assert(@typeInfo(T) == .int);
477477
478 const t_bits = @typeInfo(T).Int.bits;
479 const limb_bits = @typeInfo(Limb).Int.bits;
478 const t_bits = @typeInfo(T).int.bits;
479 const limb_bits = @typeInfo(Limb).int.bits;
480480 if (t_bits <= limb_bits) {
481481 return @as(T, @truncate(a.limbs[0]));
482482 } else {
lib/std/math/copysign.zig+1-1
......@@ -5,7 +5,7 @@ const expect = std.testing.expect;
55/// Returns a value with the magnitude of `magnitude` and the sign of `sign`.
66pub fn copysign(magnitude: anytype, sign: @TypeOf(magnitude)) @TypeOf(magnitude) {
77 const T = @TypeOf(magnitude);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
99 const sign_bit_mask = @as(TBits, 1) << (@bitSizeOf(T) - 1);
1010 const mag = @as(TBits, @bitCast(magnitude)) & ~sign_bit_mask;
1111 const sgn = @as(TBits, @bitCast(sign)) & sign_bit_mask;
lib/std/math/float.zig+10-10
......@@ -6,21 +6,21 @@ const expectEqual = std.testing.expectEqual;
66
77/// Creates a raw "1.0" mantissa for floating point type T. Used to dedupe f80 logic.
88inline fn mantissaOne(comptime T: type) comptime_int {
9 return if (@typeInfo(T).Float.bits == 80) 1 << floatFractionalBits(T) else 0;
9 return if (@typeInfo(T).float.bits == 80) 1 << floatFractionalBits(T) else 0;
1010}
1111
1212/// Creates floating point type T from an unbiased exponent and raw mantissa.
1313inline fn reconstructFloat(comptime T: type, comptime exponent: comptime_int, comptime mantissa: comptime_int) T {
14 const TBits = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
14 const TBits = @Type(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
1515 const biased_exponent = @as(TBits, exponent + floatExponentMax(T));
1616 return @as(T, @bitCast((biased_exponent << floatMantissaBits(T)) | @as(TBits, mantissa)));
1717}
1818
1919/// Returns the number of bits in the exponent of floating point type T.
2020pub inline fn floatExponentBits(comptime T: type) comptime_int {
21 comptime assert(@typeInfo(T) == .Float);
21 comptime assert(@typeInfo(T) == .float);
2222
23 return switch (@typeInfo(T).Float.bits) {
23 return switch (@typeInfo(T).float.bits) {
2424 16 => 5,
2525 32 => 8,
2626 64 => 11,
......@@ -32,9 +32,9 @@ pub inline fn floatExponentBits(comptime T: type) comptime_int {
3232
3333/// Returns the number of bits in the mantissa of floating point type T.
3434pub inline fn floatMantissaBits(comptime T: type) comptime_int {
35 comptime assert(@typeInfo(T) == .Float);
35 comptime assert(@typeInfo(T) == .float);
3636
37 return switch (@typeInfo(T).Float.bits) {
37 return switch (@typeInfo(T).float.bits) {
3838 16 => 10,
3939 32 => 23,
4040 64 => 52,
......@@ -46,12 +46,12 @@ pub inline fn floatMantissaBits(comptime T: type) comptime_int {
4646
4747/// Returns the number of fractional bits in the mantissa of floating point type T.
4848pub inline fn floatFractionalBits(comptime T: type) comptime_int {
49 comptime assert(@typeInfo(T) == .Float);
49 comptime assert(@typeInfo(T) == .float);
5050
5151 // standard IEEE floats have an implicit 0.m or 1.m integer part
5252 // f80 is special and has an explicitly stored bit in the MSB
5353 // this function corresponds to `MANT_DIG - 1' from C
54 return switch (@typeInfo(T).Float.bits) {
54 return switch (@typeInfo(T).float.bits) {
5555 16 => 10,
5656 32 => 23,
5757 64 => 52,
......@@ -97,8 +97,8 @@ pub inline fn floatEps(comptime T: type) T {
9797/// Returns the local epsilon of floating point type T.
9898pub inline fn floatEpsAt(comptime T: type, x: T) T {
9999 switch (@typeInfo(T)) {
100 .Float => |F| {
101 const U: type = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = F.bits } });
100 .float => |F| {
101 const U: type = @Type(.{ .int = .{ .signedness = .unsigned, .bits = F.bits } });
102102 const u: U = @bitCast(x);
103103 const y: T = @bitCast(u ^ 1);
104104 return @abs(x - y);
lib/std/math/frexp.zig+1-1
......@@ -21,7 +21,7 @@ pub fn Frexp(comptime T: type) type {
2121pub fn frexp(x: anytype) Frexp(@TypeOf(x)) {
2222 const T: type = @TypeOf(x);
2323
24 const bits: comptime_int = @typeInfo(T).Float.bits;
24 const bits: comptime_int = @typeInfo(T).float.bits;
2525 const Int: type = std.meta.Int(.unsigned, bits);
2626
2727 const exp_bits: comptime_int = math.floatExponentBits(T);
lib/std/math/gcd.zig+2-2
......@@ -8,8 +8,8 @@ pub fn gcd(a: anytype, b: anytype) @TypeOf(a, b) {
88
99 // only unsigned integers are allowed and not both must be zero
1010 comptime switch (@typeInfo(@TypeOf(a, b))) {
11 .Int => |int| std.debug.assert(int.signedness == .unsigned),
12 .ComptimeInt => {
11 .int => |int| std.debug.assert(int.signedness == .unsigned),
12 .comptime_int => {
1313 std.debug.assert(a >= 0);
1414 std.debug.assert(b >= 0);
1515 },
lib/std/math/hypot.zig+2-2
......@@ -23,8 +23,8 @@ const floatMax = math.floatMax;
2323pub fn hypot(x: anytype, y: anytype) @TypeOf(x, y) {
2424 const T = @TypeOf(x, y);
2525 switch (@typeInfo(T)) {
26 .Float => {},
27 .ComptimeFloat => return @sqrt(x * x + y * y),
26 .float => {},
27 .comptime_float => return @sqrt(x * x + y * y),
2828 else => @compileError("hypot not implemented for " ++ @typeName(T)),
2929 }
3030 const lower = @sqrt(floatMin(T));
lib/std/math/ilogb.zig+1-1
......@@ -26,7 +26,7 @@ pub const fp_ilogbnan = minInt(i32);
2626pub const fp_ilogb0 = minInt(i32);
2727
2828fn ilogbX(comptime T: type, x: T) i32 {
29 const typeWidth = @typeInfo(T).Float.bits;
29 const typeWidth = @typeInfo(T).float.bits;
3030 const significandBits = math.floatMantissaBits(T);
3131 const exponentBits = math.floatExponentBits(T);
3232
lib/std/math/isfinite.zig+1-1
......@@ -5,7 +5,7 @@ const expect = std.testing.expect;
55/// Returns whether x is a finite value.
66pub fn isFinite(x: anytype) bool {
77 const T = @TypeOf(x);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
99 const remove_sign = ~@as(TBits, 0) >> 1;
1010 return @as(TBits, @bitCast(x)) & remove_sign < @as(TBits, @bitCast(math.inf(T)));
1111}
lib/std/math/isinf.zig+1-1
......@@ -5,7 +5,7 @@ const expect = std.testing.expect;
55/// Returns whether x is an infinity, ignoring sign.
66pub inline fn isInf(x: anytype) bool {
77 const T = @TypeOf(x);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
99 const remove_sign = ~@as(TBits, 0) >> 1;
1010 return @as(TBits, @bitCast(x)) & remove_sign == @as(TBits, @bitCast(math.inf(T)));
1111}
lib/std/math/isnormal.zig+1-1
......@@ -5,7 +5,7 @@ const expect = std.testing.expect;
55/// Returns whether x is neither zero, subnormal, infinity, or NaN.
66pub fn isNormal(x: anytype) bool {
77 const T = @TypeOf(x);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
99
1010 const increment_exp = 1 << math.floatMantissaBits(T);
1111 const remove_sign = ~@as(TBits, 0) >> 1;
lib/std/math/iszero.zig+2-2
......@@ -5,7 +5,7 @@ const expect = std.testing.expect;
55/// Returns whether x is positive zero.
66pub inline fn isPositiveZero(x: anytype) bool {
77 const T = @TypeOf(x);
8 const bit_count = @typeInfo(T).Float.bits;
8 const bit_count = @typeInfo(T).float.bits;
99 const TBits = std.meta.Int(.unsigned, bit_count);
1010 return @as(TBits, @bitCast(x)) == @as(TBits, 0);
1111}
......@@ -13,7 +13,7 @@ pub inline fn isPositiveZero(x: anytype) bool {
1313/// Returns whether x is negative zero.
1414pub inline fn isNegativeZero(x: anytype) bool {
1515 const T = @TypeOf(x);
16 const bit_count = @typeInfo(T).Float.bits;
16 const bit_count = @typeInfo(T).float.bits;
1717 const TBits = std.meta.Int(.unsigned, bit_count);
1818 return @as(TBits, @bitCast(x)) == @as(TBits, 1) << (bit_count - 1);
1919}
lib/std/math/ldexp.zig+1-1
......@@ -7,7 +7,7 @@ const expect = std.testing.expect;
77/// Returns x * 2^n.
88pub fn ldexp(x: anytype, n: i32) @TypeOf(x) {
99 const T = @TypeOf(x);
10 const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
10 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
1111
1212 const exponent_bits = math.floatExponentBits(T);
1313 const mantissa_bits = math.floatMantissaBits(T);
lib/std/math/log.zig+5-5
......@@ -14,26 +14,26 @@ pub fn log(comptime T: type, base: T, x: T) T {
1414 return math.log2(x);
1515 } else if (base == 10) {
1616 return math.log10(x);
17 } else if ((@typeInfo(T) == .Float or @typeInfo(T) == .ComptimeFloat) and base == math.e) {
17 } else if ((@typeInfo(T) == .float or @typeInfo(T) == .comptime_float) and base == math.e) {
1818 return @log(x);
1919 }
2020
2121 const float_base = math.lossyCast(f64, base);
2222 switch (@typeInfo(T)) {
23 .ComptimeFloat => {
23 .comptime_float => {
2424 return @as(comptime_float, @log(@as(f64, x)) / @log(float_base));
2525 },
2626
27 .ComptimeInt => {
27 .comptime_int => {
2828 return @as(comptime_int, math.log_int(comptime_int, base, x));
2929 },
3030
31 .Int => |IntType| switch (IntType.signedness) {
31 .int => |IntType| switch (IntType.signedness) {
3232 .signed => @compileError("log not implemented for signed integers"),
3333 .unsigned => return @as(T, math.log_int(T, base, x)),
3434 },
3535
36 .Float => {
36 .float => {
3737 switch (T) {
3838 f32 => return @as(f32, @floatCast(@log(@as(f64, x)) / @log(float_base))),
3939 f64 => return @log(x) / @log(float_base),
lib/std/math/log10.zig+6-6
......@@ -12,14 +12,14 @@ const testing = std.testing;
1212pub fn log10(x: anytype) @TypeOf(x) {
1313 const T = @TypeOf(x);
1414 switch (@typeInfo(T)) {
15 .ComptimeFloat => {
15 .comptime_float => {
1616 return @as(comptime_float, @log10(x));
1717 },
18 .Float => return @log10(x),
19 .ComptimeInt => {
18 .float => return @log10(x),
19 .comptime_int => {
2020 return @as(comptime_int, @floor(@log10(@as(f64, x))));
2121 },
22 .Int => |IntType| switch (IntType.signedness) {
22 .int => |IntType| switch (IntType.signedness) {
2323 .signed => @compileError("log10 not implemented for signed integers"),
2424 .unsigned => return log10_int(x),
2525 },
......@@ -37,12 +37,12 @@ pub fn log10(x: anytype) @TypeOf(x) {
3737pub fn log10_int(x: anytype) std.math.Log2Int(@TypeOf(x)) {
3838 const T = @TypeOf(x);
3939 const OutT = std.math.Log2Int(T);
40 if (@typeInfo(T) != .Int or @typeInfo(T).Int.signedness != .unsigned)
40 if (@typeInfo(T) != .int or @typeInfo(T).int.signedness != .unsigned)
4141 @compileError("log10_int requires an unsigned integer, found " ++ @typeName(T));
4242
4343 std.debug.assert(x != 0);
4444
45 const bit_size = @typeInfo(T).Int.bits;
45 const bit_size = @typeInfo(T).int.bits;
4646
4747 if (bit_size <= 8) {
4848 return @as(OutT, @intCast(log10_int_u8(x)));
lib/std/math/log2.zig+4-4
......@@ -13,11 +13,11 @@ const expect = std.testing.expect;
1313pub fn log2(x: anytype) @TypeOf(x) {
1414 const T = @TypeOf(x);
1515 switch (@typeInfo(T)) {
16 .ComptimeFloat => {
16 .comptime_float => {
1717 return @as(comptime_float, @log2(x));
1818 },
19 .Float => return @log2(x),
20 .ComptimeInt => comptime {
19 .float => return @log2(x),
20 .comptime_int => comptime {
2121 var x_shifted = x;
2222 // First, calculate floorPowerOfTwo(x)
2323 var shift_amt = 1;
......@@ -34,7 +34,7 @@ pub fn log2(x: anytype) @TypeOf(x) {
3434 }
3535 return result;
3636 },
37 .Int => |IntType| switch (IntType.signedness) {
37 .int => |IntType| switch (IntType.signedness) {
3838 .signed => @compileError("log2 not implemented for signed integers"),
3939 .unsigned => return math.log2_int(T, x),
4040 },
lib/std/math/log_int.zig+3-5
......@@ -8,8 +8,8 @@ const Log2Int = math.Log2Int;
88/// Asserts that `base > 1` and `x > 0`.
99pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) {
1010 const valid = switch (@typeInfo(T)) {
11 .ComptimeInt => true,
12 .Int => |IntType| IntType.signedness == .unsigned,
11 .comptime_int => true,
12 .int => |IntType| IntType.signedness == .unsigned,
1313 else => false,
1414 };
1515 if (!valid) @compileError("log_int requires an unsigned integer, found " ++ @typeName(T));
......@@ -64,9 +64,7 @@ test "log_int" {
6464 // Test all unsigned integers with 2, 3, ..., 64 bits.
6565 // We cannot test 0 or 1 bits since base must be > 1.
6666 inline for (2..64 + 1) |bits| {
67 const T = @Type(std.builtin.Type{
68 .Int = std.builtin.Type.Int{ .signedness = .unsigned, .bits = @intCast(bits) },
69 });
67 const T = @Type(.{ .int = .{ .signedness = .unsigned, .bits = @intCast(bits) } });
7068
7169 // for base = 2, 3, ..., min(maxInt(T),1024)
7270 var base: T = 1;
lib/std/math/nextafter.zig+6-6
......@@ -14,15 +14,15 @@ const expect = std.testing.expect;
1414///
1515pub fn nextAfter(comptime T: type, x: T, y: T) T {
1616 return switch (@typeInfo(T)) {
17 .Int, .ComptimeInt => nextAfterInt(T, x, y),
18 .Float => nextAfterFloat(T, x, y),
17 .int, .comptime_int => nextAfterInt(T, x, y),
18 .float => nextAfterFloat(T, x, y),
1919 else => @compileError("expected int or non-comptime float, found '" ++ @typeName(T) ++ "'"),
2020 };
2121}
2222
2323fn nextAfterInt(comptime T: type, x: T, y: T) T {
24 comptime assert(@typeInfo(T) == .Int or @typeInfo(T) == .ComptimeInt);
25 return if (@typeInfo(T) == .Int and @bitSizeOf(T) < 2)
24 comptime assert(@typeInfo(T) == .int or @typeInfo(T) == .comptime_int);
25 return if (@typeInfo(T) == .int and @bitSizeOf(T) < 2)
2626 // Special case for `i0`, `u0`, `i1`, and `u1`.
2727 y
2828 else if (y > x)
......@@ -38,7 +38,7 @@ fn nextAfterInt(comptime T: type, x: T, y: T) T {
3838// <https://github.com/mingw-w64/mingw-w64/blob/e89de847dd3e05bb8e46344378ce3e124f4e7d1c/mingw-w64-crt/math/nextafterl.c>
3939
4040fn nextAfterFloat(comptime T: type, x: T, y: T) T {
41 comptime assert(@typeInfo(T) == .Float);
41 comptime assert(@typeInfo(T) == .float);
4242 if (x == y) {
4343 // Returning `y` ensures that (0.0, -0.0) returns -0.0 and that (-0.0, 0.0) returns 0.0.
4444 return y;
......@@ -320,7 +320,7 @@ test "float" {
320320
321321/// Helps ensure that 0.0 doesn't compare equal to -0.0.
322322fn bitwiseEqual(comptime T: type, x: T, y: T) bool {
323 comptime assert(@typeInfo(T) == .Float);
323 comptime assert(@typeInfo(T) == .float);
324324 const Bits = std.meta.Int(.unsigned, @bitSizeOf(T));
325325 return @as(Bits, @bitCast(x)) == @as(Bits, @bitCast(y));
326326}
lib/std/math/pow.zig+3-3
......@@ -31,7 +31,7 @@ const expect = std.testing.expect;
3131/// - pow(-inf, y) = pow(-0, -y)
3232/// - pow(x, y) = nan for finite x < 0 and finite non-integer y
3333pub fn pow(comptime T: type, x: T, y: T) T {
34 if (@typeInfo(T) == .Int) {
34 if (@typeInfo(T) == .int) {
3535 return math.powi(T, x, y) catch unreachable;
3636 }
3737
......@@ -122,7 +122,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
122122 if (yf != 0 and x < 0) {
123123 return math.nan(T);
124124 }
125 if (yi >= 1 << (@typeInfo(T).Float.bits - 1)) {
125 if (yi >= 1 << (@typeInfo(T).float.bits - 1)) {
126126 return @exp(y * @log(x));
127127 }
128128
......@@ -144,7 +144,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
144144 var xe = r2.exponent;
145145 var x1 = r2.significand;
146146
147 var i = @as(std.meta.Int(.signed, @typeInfo(T).Float.bits), @intFromFloat(yi));
147 var i = @as(std.meta.Int(.signed, @typeInfo(T).float.bits), @intFromFloat(yi));
148148 while (i != 0) : (i >>= 1) {
149149 const overflow_shift = math.floatExponentBits(T) + 1;
150150 if (xe < -(1 << overflow_shift) or (1 << overflow_shift) < xe) {
lib/std/math/powi.zig+1-1
......@@ -27,7 +27,7 @@ pub fn powi(comptime T: type, x: T, y: T) (error{
2727 Overflow,
2828 Underflow,
2929}!T) {
30 const bit_size = @typeInfo(T).Int.bits;
30 const bit_size = @typeInfo(T).int.bits;
3131
3232 // `y & 1 == 0` won't compile when `does_one_overflow`.
3333 const does_one_overflow = math.maxInt(T) < 1;
lib/std/math/signbit.zig+1-1
......@@ -5,7 +5,7 @@ const expect = std.testing.expect;
55/// Returns whether x is negative or negative 0.
66pub fn signbit(x: anytype) bool {
77 const T = @TypeOf(x);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
8 const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
99 return @as(TBits, @bitCast(x)) >> (@bitSizeOf(T) - 1) != 0;
1010}
1111
lib/std/math/sqrt.zig+6-6
......@@ -15,8 +15,8 @@ const maxInt = std.math.maxInt;
1515pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) {
1616 const T = @TypeOf(x);
1717 switch (@typeInfo(T)) {
18 .Float, .ComptimeFloat => return @sqrt(x),
19 .ComptimeInt => comptime {
18 .float, .comptime_float => return @sqrt(x),
19 .comptime_int => comptime {
2020 if (x > maxInt(u128)) {
2121 @compileError("sqrt not implemented for comptime_int greater than 128 bits");
2222 }
......@@ -25,7 +25,7 @@ pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) {
2525 }
2626 return @as(T, sqrt_int(u128, x));
2727 },
28 .Int => |IntType| switch (IntType.signedness) {
28 .int => |IntType| switch (IntType.signedness) {
2929 .signed => @compileError("sqrt not implemented for signed integers"),
3030 .unsigned => return sqrt_int(T, x),
3131 },
......@@ -34,10 +34,10 @@ pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) {
3434}
3535
3636fn sqrt_int(comptime T: type, value: T) Sqrt(T) {
37 if (@typeInfo(T).Int.bits <= 2) {
37 if (@typeInfo(T).int.bits <= 2) {
3838 return if (value == 0) 0 else 1; // shortcut for small number of bits to simplify general case
3939 } else {
40 const bits = @typeInfo(T).Int.bits;
40 const bits = @typeInfo(T).int.bits;
4141 const max = math.maxInt(T);
4242 const minustwo = (@as(T, 2) ^ max) + 1; // unsigned int cannot represent -2
4343 var op = value;
......@@ -80,7 +80,7 @@ test sqrt_int {
8080/// Returns the return type `sqrt` will return given an operand of type `T`.
8181pub fn Sqrt(comptime T: type) type {
8282 return switch (@typeInfo(T)) {
83 .Int => |int| std.meta.Int(.unsigned, (int.bits + 1) / 2),
83 .int => |int| @Type(.{ .int = .{ .signedness = .unsigned, .bits = (int.bits + 1) / 2 } }),
8484 else => T,
8585 };
8686}
lib/std/mem.zig+89-89
......@@ -229,22 +229,22 @@ pub fn copyBackwards(comptime T: type, dest: []T, source: []const T) void {
229229/// This can be used to zero-initialize any type for which it makes sense. Structs will be initialized recursively.
230230pub fn zeroes(comptime T: type) T {
231231 switch (@typeInfo(T)) {
232 .ComptimeInt, .Int, .ComptimeFloat, .Float => {
232 .comptime_int, .int, .comptime_float, .float => {
233233 return @as(T, 0);
234234 },
235 .Enum => {
235 .@"enum" => {
236236 return @as(T, @enumFromInt(0));
237237 },
238 .Void => {
238 .void => {
239239 return {};
240240 },
241 .Bool => {
241 .bool => {
242242 return false;
243243 },
244 .Optional, .Null => {
244 .optional, .null => {
245245 return null;
246246 },
247 .Struct => |struct_info| {
247 .@"struct" => |struct_info| {
248248 if (@sizeOf(T) == 0) return undefined;
249249 if (struct_info.layout == .@"extern") {
250250 var item: T = undefined;
......@@ -260,7 +260,7 @@ pub fn zeroes(comptime T: type) T {
260260 return structure;
261261 }
262262 },
263 .Pointer => |ptr_info| {
263 .pointer => |ptr_info| {
264264 switch (ptr_info.size) {
265265 .Slice => {
266266 if (ptr_info.sentinel) |sentinel| {
......@@ -281,17 +281,17 @@ pub fn zeroes(comptime T: type) T {
281281 },
282282 }
283283 },
284 .Array => |info| {
284 .array => |info| {
285285 if (info.sentinel) |sentinel_ptr| {
286286 const sentinel = @as(*align(1) const info.child, @ptrCast(sentinel_ptr)).*;
287287 return [_:sentinel]info.child{zeroes(info.child)} ** info.len;
288288 }
289289 return [_]info.child{zeroes(info.child)} ** info.len;
290290 },
291 .Vector => |info| {
291 .vector => |info| {
292292 return @splat(zeroes(info.child));
293293 },
294 .Union => |info| {
294 .@"union" => |info| {
295295 if (info.layout == .@"extern") {
296296 var item: T = undefined;
297297 @memset(asBytes(&item), 0);
......@@ -299,16 +299,16 @@ pub fn zeroes(comptime T: type) T {
299299 }
300300 @compileError("Can't set a " ++ @typeName(T) ++ " to zero.");
301301 },
302 .EnumLiteral,
303 .ErrorUnion,
304 .ErrorSet,
305 .Fn,
306 .Type,
307 .NoReturn,
308 .Undefined,
309 .Opaque,
310 .Frame,
311 .AnyFrame,
302 .enum_literal,
303 .error_union,
304 .error_set,
305 .@"fn",
306 .type,
307 .noreturn,
308 .undefined,
309 .@"opaque",
310 .frame,
311 .@"anyframe",
312312 => {
313313 @compileError("Can't set a " ++ @typeName(T) ++ " to zero.");
314314 },
......@@ -423,9 +423,9 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
423423 const Init = @TypeOf(init);
424424
425425 switch (@typeInfo(T)) {
426 .Struct => |struct_info| {
426 .@"struct" => |struct_info| {
427427 switch (@typeInfo(Init)) {
428 .Struct => |init_info| {
428 .@"struct" => |init_info| {
429429 if (init_info.is_tuple) {
430430 if (init_info.fields.len > struct_info.fields.len) {
431431 @compileError("Tuple initializer has more elements than there are fields in `" ++ @typeName(T) ++ "`");
......@@ -449,7 +449,7 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
449449 @field(value, field.name) = @field(init, init_info.fields[i].name);
450450 } else if (@hasField(@TypeOf(init), field.name)) {
451451 switch (@typeInfo(field.type)) {
452 .Struct => {
452 .@"struct" => {
453453 @field(value, field.name) = zeroInit(field.type, @field(init, field.name));
454454 },
455455 else => {
......@@ -461,7 +461,7 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
461461 @field(value, field.name) = default_value;
462462 } else {
463463 switch (@typeInfo(field.type)) {
464 .Struct => {
464 .@"struct" => {
465465 @field(value, field.name) = std.mem.zeroInit(field.type, .{});
466466 },
467467 else => {
......@@ -752,10 +752,10 @@ test indexOfDiff {
752752/// `[*c]` pointers are assumed to be 0-terminated and assumed to not be allowzero.
753753fn Span(comptime T: type) type {
754754 switch (@typeInfo(T)) {
755 .Optional => |optional_info| {
755 .optional => |optional_info| {
756756 return ?Span(optional_info.child);
757757 },
758 .Pointer => |ptr_info| {
758 .pointer => |ptr_info| {
759759 var new_ptr_info = ptr_info;
760760 switch (ptr_info.size) {
761761 .C => {
......@@ -766,7 +766,7 @@ fn Span(comptime T: type) type {
766766 .One, .Slice => @compileError("invalid type given to std.mem.span: " ++ @typeName(T)),
767767 }
768768 new_ptr_info.size = .Slice;
769 return @Type(.{ .Pointer = new_ptr_info });
769 return @Type(.{ .pointer = new_ptr_info });
770770 },
771771 else => {},
772772 }
......@@ -789,7 +789,7 @@ test Span {
789789/// Pointer attributes such as const are preserved.
790790/// `[*c]` pointers are assumed to be non-null and 0-terminated.
791791pub fn span(ptr: anytype) Span(@TypeOf(ptr)) {
792 if (@typeInfo(@TypeOf(ptr)) == .Optional) {
792 if (@typeInfo(@TypeOf(ptr)) == .optional) {
793793 if (ptr) |non_null| {
794794 return span(non_null);
795795 } else {
......@@ -798,7 +798,7 @@ pub fn span(ptr: anytype) Span(@TypeOf(ptr)) {
798798 }
799799 const Result = Span(@TypeOf(ptr));
800800 const l = len(ptr);
801 const ptr_info = @typeInfo(Result).Pointer;
801 const ptr_info = @typeInfo(Result).pointer;
802802 if (ptr_info.sentinel) |s_ptr| {
803803 const s = @as(*align(1) const ptr_info.child, @ptrCast(s_ptr)).*;
804804 return ptr[0..l :s];
......@@ -817,15 +817,15 @@ test span {
817817/// Helper for the return type of sliceTo()
818818fn SliceTo(comptime T: type, comptime end: std.meta.Elem(T)) type {
819819 switch (@typeInfo(T)) {
820 .Optional => |optional_info| {
820 .optional => |optional_info| {
821821 return ?SliceTo(optional_info.child, end);
822822 },
823 .Pointer => |ptr_info| {
823 .pointer => |ptr_info| {
824824 var new_ptr_info = ptr_info;
825825 new_ptr_info.size = .Slice;
826826 switch (ptr_info.size) {
827827 .One => switch (@typeInfo(ptr_info.child)) {
828 .Array => |array_info| {
828 .array => |array_info| {
829829 new_ptr_info.child = array_info.child;
830830 // The return type must only be sentinel terminated if we are guaranteed
831831 // to find the value searched for, which is only the case if it matches
......@@ -861,7 +861,7 @@ fn SliceTo(comptime T: type, comptime end: std.meta.Elem(T)) type {
861861 new_ptr_info.is_allowzero = false;
862862 },
863863 }
864 return @Type(.{ .Pointer = new_ptr_info });
864 return @Type(.{ .pointer = new_ptr_info });
865865 },
866866 else => {},
867867 }
......@@ -876,13 +876,13 @@ fn SliceTo(comptime T: type, comptime end: std.meta.Elem(T)) type {
876876/// Pointer properties such as mutability and alignment are preserved.
877877/// C pointers are assumed to be non-null.
878878pub fn sliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) SliceTo(@TypeOf(ptr), end) {
879 if (@typeInfo(@TypeOf(ptr)) == .Optional) {
879 if (@typeInfo(@TypeOf(ptr)) == .optional) {
880880 const non_null = ptr orelse return null;
881881 return sliceTo(non_null, end);
882882 }
883883 const Result = SliceTo(@TypeOf(ptr), end);
884884 const length = lenSliceTo(ptr, end);
885 const ptr_info = @typeInfo(Result).Pointer;
885 const ptr_info = @typeInfo(Result).pointer;
886886 if (ptr_info.sentinel) |s_ptr| {
887887 const s = @as(*align(1) const ptr_info.child, @ptrCast(s_ptr)).*;
888888 return ptr[0..length :s];
......@@ -933,9 +933,9 @@ test sliceTo {
933933/// Private helper for sliceTo(). If you want the length, use sliceTo(foo, x).len
934934fn lenSliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) usize {
935935 switch (@typeInfo(@TypeOf(ptr))) {
936 .Pointer => |ptr_info| switch (ptr_info.size) {
936 .pointer => |ptr_info| switch (ptr_info.size) {
937937 .One => switch (@typeInfo(ptr_info.child)) {
938 .Array => |array_info| {
938 .array => |array_info| {
939939 if (array_info.sentinel) |sentinel_ptr| {
940940 const sentinel = @as(*align(1) const array_info.child, @ptrCast(sentinel_ptr)).*;
941941 if (sentinel == end) {
......@@ -1015,7 +1015,7 @@ test lenSliceTo {
10151015/// `[*c]` pointers are assumed to be non-null and 0-terminated.
10161016pub fn len(value: anytype) usize {
10171017 switch (@typeInfo(@TypeOf(value))) {
1018 .Pointer => |info| switch (info.size) {
1018 .pointer => |info| switch (info.size) {
10191019 .Many => {
10201020 const sentinel_ptr = info.sentinel orelse
10211021 @compileError("invalid type given to std.mem.len: " ++ @typeName(@TypeOf(value)));
......@@ -1051,7 +1051,7 @@ pub fn indexOfSentinel(comptime T: type, comptime sentinel: T, p: [*:sentinel]co
10511051 if (backend_supports_vectors and
10521052 !std.debug.inValgrind() and // https://github.com/ziglang/zig/issues/17717
10531053 !@inComptime() and
1054 (@typeInfo(T) == .Int or @typeInfo(T) == .Float) and std.math.isPowerOfTwo(@bitSizeOf(T)))
1054 (@typeInfo(T) == .int or @typeInfo(T) == .float) and std.math.isPowerOfTwo(@bitSizeOf(T)))
10551055 {
10561056 switch (@import("builtin").cpu.arch) {
10571057 // The below branch assumes that reading past the end of the buffer is valid, as long
......@@ -1202,7 +1202,7 @@ pub fn indexOfScalarPos(comptime T: type, slice: []const T, start_index: usize,
12021202 if (backend_supports_vectors and
12031203 !std.debug.inValgrind() and // https://github.com/ziglang/zig/issues/17717
12041204 !@inComptime() and
1205 (@typeInfo(T) == .Int or @typeInfo(T) == .Float) and std.math.isPowerOfTwo(@bitSizeOf(T)))
1205 (@typeInfo(T) == .int or @typeInfo(T) == .float) and std.math.isPowerOfTwo(@bitSizeOf(T)))
12061206 {
12071207 if (std.simd.suggestVectorLength(T)) |block_len| {
12081208 // For Intel Nehalem (2009) and AMD Bulldozer (2012) or later, unaligned loads on aligned data result
......@@ -1602,8 +1602,8 @@ test containsAtLeast {
16021602/// T specifies the return type, which must be large enough to store
16031603/// the result.
16041604pub fn readVarInt(comptime ReturnType: type, bytes: []const u8, endian: Endian) ReturnType {
1605 const bits = @typeInfo(ReturnType).Int.bits;
1606 const signedness = @typeInfo(ReturnType).Int.signedness;
1605 const bits = @typeInfo(ReturnType).int.bits;
1606 const signedness = @typeInfo(ReturnType).int.signedness;
16071607 const WorkType = std.meta.Int(signedness, @max(16, bits));
16081608 var result: WorkType = 0;
16091609 switch (endian) {
......@@ -1635,7 +1635,7 @@ test readVarInt {
16351635 try testing.expect(readVarInt(i16, &[_]u8{ 0xff, 0xfd }, .big) == -3);
16361636 try testing.expect(readVarInt(i16, &[_]u8{ 0xfc, 0xff }, .little) == -4);
16371637
1638 // Return type can be oversized (bytes.len * 8 < @typeInfo(ReturnType).Int.bits)
1638 // Return type can be oversized (bytes.len * 8 < @typeInfo(ReturnType).int.bits)
16391639 try testing.expect(readVarInt(u9, &[_]u8{0x12}, .little) == 0x12);
16401640 try testing.expect(readVarInt(u9, &[_]u8{0xde}, .big) == 0xde);
16411641 try testing.expect(readVarInt(u80, &[_]u8{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x24 }, .big) == 0x123456789abcdef024);
......@@ -1719,7 +1719,7 @@ test readVarPackedInt {
17191719/// Reads an integer from memory with bit count specified by T.
17201720/// The bit count of T must be evenly divisible by 8.
17211721/// This function cannot fail and cannot cause undefined behavior.
1722pub inline fn readInt(comptime T: type, buffer: *const [@divExact(@typeInfo(T).Int.bits, 8)]u8, endian: Endian) T {
1722pub inline fn readInt(comptime T: type, buffer: *const [@divExact(@typeInfo(T).int.bits, 8)]u8, endian: Endian) T {
17231723 const value: T = @bitCast(buffer.*);
17241724 return if (endian == native_endian) value else @byteSwap(value);
17251725}
......@@ -1844,7 +1844,7 @@ test "comptime read/write int" {
18441844/// Writes an integer to memory, storing it in twos-complement.
18451845/// This function always succeeds, has defined behavior for all inputs, but
18461846/// the integer bit width must be divisible by 8.
1847pub inline fn writeInt(comptime T: type, buffer: *[@divExact(@typeInfo(T).Int.bits, 8)]u8, value: T, endian: Endian) void {
1847pub inline fn writeInt(comptime T: type, buffer: *[@divExact(@typeInfo(T).int.bits, 8)]u8, value: T, endian: Endian) void {
18481848 buffer.* = @bitCast(if (endian == native_endian) value else @byteSwap(value));
18491849}
18501850
......@@ -2047,20 +2047,20 @@ test writeVarPackedInt {
20472047/// (Changing their endianness)
20482048pub fn byteSwapAllFields(comptime S: type, ptr: *S) void {
20492049 switch (@typeInfo(S)) {
2050 .Struct => {
2050 .@"struct" => {
20512051 inline for (std.meta.fields(S)) |f| {
20522052 switch (@typeInfo(f.type)) {
2053 .Struct => |struct_info| if (struct_info.backing_integer) |Int| {
2053 .@"struct" => |struct_info| if (struct_info.backing_integer) |Int| {
20542054 @field(ptr, f.name) = @bitCast(@byteSwap(@as(Int, @bitCast(@field(ptr, f.name)))));
20552055 } else {
20562056 byteSwapAllFields(f.type, &@field(ptr, f.name));
20572057 },
2058 .Array => byteSwapAllFields(f.type, &@field(ptr, f.name)),
2059 .Enum => {
2058 .array => byteSwapAllFields(f.type, &@field(ptr, f.name)),
2059 .@"enum" => {
20602060 @field(ptr, f.name) = @enumFromInt(@byteSwap(@intFromEnum(@field(ptr, f.name))));
20612061 },
2062 .Bool => {},
2063 .Float => |float_info| {
2062 .bool => {},
2063 .float => |float_info| {
20642064 @field(ptr, f.name) = @bitCast(@byteSwap(@as(std.meta.Int(.unsigned, float_info.bits), @bitCast(@field(ptr, f.name)))));
20652065 },
20662066 else => {
......@@ -2069,15 +2069,15 @@ pub fn byteSwapAllFields(comptime S: type, ptr: *S) void {
20692069 }
20702070 }
20712071 },
2072 .Array => {
2072 .array => {
20732073 for (ptr) |*item| {
20742074 switch (@typeInfo(@TypeOf(item.*))) {
2075 .Struct, .Array => byteSwapAllFields(@TypeOf(item.*), item),
2076 .Enum => {
2075 .@"struct", .array => byteSwapAllFields(@TypeOf(item.*), item),
2076 .@"enum" => {
20772077 item.* = @enumFromInt(@byteSwap(@intFromEnum(item.*)));
20782078 },
2079 .Bool => {},
2080 .Float => |float_info| {
2079 .bool => {},
2080 .float => |float_info| {
20812081 item.* = @bitCast(@byteSwap(@as(std.meta.Int(.unsigned, float_info.bits), @bitCast(item.*))));
20822082 },
20832083 else => {
......@@ -3560,21 +3560,21 @@ test reverse {
35603560fn ReverseIterator(comptime T: type) type {
35613561 const Pointer = blk: {
35623562 switch (@typeInfo(T)) {
3563 .Pointer => |ptr_info| switch (ptr_info.size) {
3563 .pointer => |ptr_info| switch (ptr_info.size) {
35643564 .One => switch (@typeInfo(ptr_info.child)) {
3565 .Array => |array_info| {
3565 .array => |array_info| {
35663566 var new_ptr_info = ptr_info;
35673567 new_ptr_info.size = .Many;
35683568 new_ptr_info.child = array_info.child;
35693569 new_ptr_info.sentinel = array_info.sentinel;
3570 break :blk @Type(.{ .Pointer = new_ptr_info });
3570 break :blk @Type(.{ .pointer = new_ptr_info });
35713571 },
35723572 else => {},
35733573 },
35743574 .Slice => {
35753575 var new_ptr_info = ptr_info;
35763576 new_ptr_info.size = .Many;
3577 break :blk @Type(.{ .Pointer = new_ptr_info });
3577 break :blk @Type(.{ .pointer = new_ptr_info });
35783578 },
35793579 else => {},
35803580 },
......@@ -3583,8 +3583,8 @@ fn ReverseIterator(comptime T: type) type {
35833583 @compileError("expected slice or pointer to array, found '" ++ @typeName(T) ++ "'");
35843584 };
35853585 const Element = std.meta.Elem(Pointer);
3586 const ElementPointer = @Type(.{ .Pointer = ptr: {
3587 var ptr = @typeInfo(Pointer).Pointer;
3586 const ElementPointer = @Type(.{ .pointer = ptr: {
3587 var ptr = @typeInfo(Pointer).pointer;
35883588 ptr.size = .One;
35893589 ptr.child = Element;
35903590 ptr.sentinel = null;
......@@ -3891,11 +3891,11 @@ pub fn alignPointerOffset(ptr: anytype, align_to: usize) ?usize {
38913891
38923892 const T = @TypeOf(ptr);
38933893 const info = @typeInfo(T);
3894 if (info != .Pointer or info.Pointer.size != .Many)
3894 if (info != .pointer or info.pointer.size != .Many)
38953895 @compileError("expected many item pointer, got " ++ @typeName(T));
38963896
38973897 // Do nothing if the pointer is already well-aligned.
3898 if (align_to <= info.Pointer.alignment)
3898 if (align_to <= info.pointer.alignment)
38993899 return 0;
39003900
39013901 // Calculate the aligned base address with an eye out for overflow.
......@@ -3907,7 +3907,7 @@ pub fn alignPointerOffset(ptr: anytype, align_to: usize) ?usize {
39073907 // The delta is expressed in terms of bytes, turn it into a number of child
39083908 // type elements.
39093909 const delta = ov[0] - addr;
3910 const pointee_size = @sizeOf(info.Pointer.child);
3910 const pointee_size = @sizeOf(info.pointer.child);
39113911 if (delta % pointee_size != 0) return null;
39123912 return delta / pointee_size;
39133913}
......@@ -3948,9 +3948,9 @@ fn CopyPtrAttrs(
39483948 comptime size: std.builtin.Type.Pointer.Size,
39493949 comptime child: type,
39503950) type {
3951 const info = @typeInfo(source).Pointer;
3951 const info = @typeInfo(source).pointer;
39523952 return @Type(.{
3953 .Pointer = .{
3953 .pointer = .{
39543954 .size = size,
39553955 .is_const = info.is_const,
39563956 .is_volatile = info.is_volatile,
......@@ -4019,8 +4019,8 @@ test "asBytes preserves pointer attributes" {
40194019 const inPtr = @as(*align(16) const volatile u32, @ptrCast(&inArr));
40204020 const outSlice = asBytes(inPtr);
40214021
4022 const in = @typeInfo(@TypeOf(inPtr)).Pointer;
4023 const out = @typeInfo(@TypeOf(outSlice)).Pointer;
4022 const in = @typeInfo(@TypeOf(inPtr)).pointer;
4023 const out = @typeInfo(@TypeOf(outSlice)).pointer;
40244024
40254025 try testing.expectEqual(in.is_const, out.is_const);
40264026 try testing.expectEqual(in.is_volatile, out.is_volatile);
......@@ -4102,8 +4102,8 @@ test "bytesAsValue preserves pointer attributes" {
41024102 const inSlice = @as(*align(16) const volatile [4]u8, @ptrCast(&inArr))[0..];
41034103 const outPtr = bytesAsValue(u32, inSlice);
41044104
4105 const in = @typeInfo(@TypeOf(inSlice)).Pointer;
4106 const out = @typeInfo(@TypeOf(outPtr)).Pointer;
4105 const in = @typeInfo(@TypeOf(inSlice)).pointer;
4106 const out = @typeInfo(@TypeOf(outPtr)).pointer;
41074107
41084108 try testing.expectEqual(in.is_const, out.is_const);
41094109 try testing.expectEqual(in.is_volatile, out.is_volatile);
......@@ -4204,8 +4204,8 @@ test "bytesAsSlice preserves pointer attributes" {
42044204 const inSlice = @as(*align(16) const volatile [4]u8, @ptrCast(&inArr))[0..];
42054205 const outSlice = bytesAsSlice(u16, inSlice);
42064206
4207 const in = @typeInfo(@TypeOf(inSlice)).Pointer;
4208 const out = @typeInfo(@TypeOf(outSlice)).Pointer;
4207 const in = @typeInfo(@TypeOf(inSlice)).pointer;
4208 const out = @typeInfo(@TypeOf(outSlice)).pointer;
42094209
42104210 try testing.expectEqual(in.is_const, out.is_const);
42114211 try testing.expectEqual(in.is_volatile, out.is_volatile);
......@@ -4303,8 +4303,8 @@ test "sliceAsBytes preserves pointer attributes" {
43034303 const inSlice = @as(*align(16) const volatile [2]u16, @ptrCast(&inArr))[0..];
43044304 const outSlice = sliceAsBytes(inSlice);
43054305
4306 const in = @typeInfo(@TypeOf(inSlice)).Pointer;
4307 const out = @typeInfo(@TypeOf(outSlice)).Pointer;
4306 const in = @typeInfo(@TypeOf(inSlice)).pointer;
4307 const out = @typeInfo(@TypeOf(outSlice)).pointer;
43084308
43094309 try testing.expectEqual(in.is_const, out.is_const);
43104310 try testing.expectEqual(in.is_volatile, out.is_volatile);
......@@ -4346,14 +4346,14 @@ pub fn doNotOptimizeAway(val: anytype) void {
43464346 const max_gp_register_bits = @bitSizeOf(c_long);
43474347 const t = @typeInfo(@TypeOf(val));
43484348 switch (t) {
4349 .Void, .Null, .ComptimeInt, .ComptimeFloat => return,
4350 .Enum => doNotOptimizeAway(@intFromEnum(val)),
4351 .Bool => doNotOptimizeAway(@intFromBool(val)),
4352 .Int => {
4353 const bits = t.Int.bits;
4349 .void, .null, .comptime_int, .comptime_float => return,
4350 .@"enum" => doNotOptimizeAway(@intFromEnum(val)),
4351 .bool => doNotOptimizeAway(@intFromBool(val)),
4352 .int => {
4353 const bits = t.int.bits;
43544354 if (bits <= max_gp_register_bits and builtin.zig_backend != .stage2_c) {
43554355 const val2 = @as(
4356 std.meta.Int(t.Int.signedness, @max(8, std.math.ceilPowerOfTwoAssert(u16, bits))),
4356 std.meta.Int(t.int.signedness, @max(8, std.math.ceilPowerOfTwoAssert(u16, bits))),
43574357 val,
43584358 );
43594359 asm volatile (""
......@@ -4362,15 +4362,15 @@ pub fn doNotOptimizeAway(val: anytype) void {
43624362 );
43634363 } else doNotOptimizeAway(&val);
43644364 },
4365 .Float => {
4366 if ((t.Float.bits == 32 or t.Float.bits == 64) and builtin.zig_backend != .stage2_c) {
4365 .float => {
4366 if ((t.float.bits == 32 or t.float.bits == 64) and builtin.zig_backend != .stage2_c) {
43674367 asm volatile (""
43684368 :
43694369 : [val] "rm" (val),
43704370 );
43714371 } else doNotOptimizeAway(&val);
43724372 },
4373 .Pointer => {
4373 .pointer => {
43744374 if (builtin.zig_backend == .stage2_c) {
43754375 doNotOptimizeAwayC(val);
43764376 } else {
......@@ -4381,8 +4381,8 @@ pub fn doNotOptimizeAway(val: anytype) void {
43814381 );
43824382 }
43834383 },
4384 .Array => {
4385 if (t.Array.len * @sizeOf(t.Array.child) <= 64) {
4384 .array => {
4385 if (t.array.len * @sizeOf(t.array.child) <= 64) {
43864386 for (val) |v| doNotOptimizeAway(v);
43874387 } else doNotOptimizeAway(&val);
43884388 },
......@@ -4518,9 +4518,9 @@ test "freeing empty string with null-terminated sentinel" {
45184518/// Returns a slice with the given new alignment,
45194519/// all other pointer attributes copied from `AttributeSource`.
45204520fn AlignedSlice(comptime AttributeSource: type, comptime new_alignment: usize) type {
4521 const info = @typeInfo(AttributeSource).Pointer;
4521 const info = @typeInfo(AttributeSource).pointer;
45224522 return @Type(.{
4523 .Pointer = .{
4523 .pointer = .{
45244524 .size = .Slice,
45254525 .is_const = info.is_const,
45264526 .is_volatile = info.is_volatile,
......@@ -4659,7 +4659,7 @@ test "read/write(Var)PackedInt" {
46594659 try expect(diff_bits << @as(Log2T, @intCast(@bitSizeOf(BackingType) - offset)) == 0);
46604660 }
46614661
4662 const signedness = @typeInfo(PackedType).Int.signedness;
4662 const signedness = @typeInfo(PackedType).int.signedness;
46634663 const NextPowerOfTwoInt = std.meta.Int(signedness, try comptime std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType)));
46644664 const ui64 = std.meta.Int(signedness, 64);
46654665 inline for ([_]type{ PackedType, NextPowerOfTwoInt, ui64 }) |U| {
lib/std/mem/Allocator.zig+10-10
......@@ -109,7 +109,7 @@ pub fn create(self: Allocator, comptime T: type) Error!*T {
109109/// `ptr` should be the return value of `create`, or otherwise
110110/// have the same address and alignment property.
111111pub fn destroy(self: Allocator, ptr: anytype) void {
112 const info = @typeInfo(@TypeOf(ptr)).Pointer;
112 const info = @typeInfo(@TypeOf(ptr)).pointer;
113113 if (info.size != .One) @compileError("ptr must be a single item pointer");
114114 const T = info.child;
115115 if (@sizeOf(T) == 0) return;
......@@ -232,7 +232,7 @@ fn allocBytesWithAlignment(self: Allocator, comptime alignment: u29, byte_count:
232232/// the pointer, however the allocator implementation may refuse the resize
233233/// request by returning `false`.
234234pub fn resize(self: Allocator, old_mem: anytype, new_n: usize) bool {
235 const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
235 const Slice = @typeInfo(@TypeOf(old_mem)).pointer;
236236 const T = Slice.child;
237237 if (new_n == 0) {
238238 self.free(old_mem);
......@@ -253,7 +253,7 @@ pub fn resize(self: Allocator, old_mem: anytype, new_n: usize) bool {
253253/// can be larger, smaller, or the same size as the old memory allocation.
254254/// If `new_n` is 0, this is the same as `free` and it always succeeds.
255255pub fn realloc(self: Allocator, old_mem: anytype, new_n: usize) t: {
256 const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
256 const Slice = @typeInfo(@TypeOf(old_mem)).pointer;
257257 break :t Error![]align(Slice.alignment) Slice.child;
258258} {
259259 return self.reallocAdvanced(old_mem, new_n, @returnAddress());
......@@ -265,10 +265,10 @@ pub fn reallocAdvanced(
265265 new_n: usize,
266266 return_address: usize,
267267) t: {
268 const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
268 const Slice = @typeInfo(@TypeOf(old_mem)).pointer;
269269 break :t Error![]align(Slice.alignment) Slice.child;
270270} {
271 const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
271 const Slice = @typeInfo(@TypeOf(old_mem)).pointer;
272272 const T = Slice.child;
273273 if (old_mem.len == 0) {
274274 return self.allocAdvancedWithRetAddr(T, Slice.alignment, new_n, return_address);
......@@ -304,7 +304,7 @@ pub fn reallocAdvanced(
304304/// Free an array allocated with `alloc`. To free a single item,
305305/// see `destroy`.
306306pub fn free(self: Allocator, memory: anytype) void {
307 const Slice = @typeInfo(@TypeOf(memory)).Pointer;
307 const Slice = @typeInfo(@TypeOf(memory)).pointer;
308308 const bytes = mem.sliceAsBytes(memory);
309309 const bytes_len = bytes.len + if (Slice.sentinel != null) @sizeOf(Slice.child) else 0;
310310 if (bytes_len == 0) return;
......@@ -332,13 +332,13 @@ pub fn dupeZ(allocator: Allocator, comptime T: type, m: []const T) Error![:0]T {
332332/// TODO replace callsites with `@log2` after this proposal is implemented:
333333/// https://github.com/ziglang/zig/issues/13642
334334inline fn log2a(x: anytype) switch (@typeInfo(@TypeOf(x))) {
335 .Int => math.Log2Int(@TypeOf(x)),
336 .ComptimeInt => comptime_int,
335 .int => math.Log2Int(@TypeOf(x)),
336 .comptime_int => comptime_int,
337337 else => @compileError("int please"),
338338} {
339339 switch (@typeInfo(@TypeOf(x))) {
340 .Int => return math.log2_int(@TypeOf(x), x),
341 .ComptimeInt => return math.log2(x),
340 .int => return math.log2_int(@TypeOf(x), x),
341 .comptime_int => return math.log2(x),
342342 else => @compileError("bad"),
343343 }
344344}
lib/std/meta.zig+95-95
......@@ -21,11 +21,11 @@ pub fn stringToEnum(comptime T: type, str: []const u8) ?T {
2121 // TODO The '100' here is arbitrary and should be increased when possible:
2222 // - https://github.com/ziglang/zig/issues/4055
2323 // - https://github.com/ziglang/zig/issues/3863
24 if (@typeInfo(T).Enum.fields.len <= 100) {
24 if (@typeInfo(T).@"enum".fields.len <= 100) {
2525 const kvs = comptime build_kvs: {
2626 const EnumKV = struct { []const u8, T };
27 var kvs_array: [@typeInfo(T).Enum.fields.len]EnumKV = undefined;
28 for (@typeInfo(T).Enum.fields, 0..) |enumField, i| {
27 var kvs_array: [@typeInfo(T).@"enum".fields.len]EnumKV = undefined;
28 for (@typeInfo(T).@"enum".fields, 0..) |enumField, i| {
2929 kvs_array[i] = .{ enumField.name, @field(T, enumField.name) };
3030 }
3131 break :build_kvs kvs_array[0..];
......@@ -33,7 +33,7 @@ pub fn stringToEnum(comptime T: type, str: []const u8) ?T {
3333 const map = std.StaticStringMap(T).initComptime(kvs);
3434 return map.get(str);
3535 } else {
36 inline for (@typeInfo(T).Enum.fields) |enumField| {
36 inline for (@typeInfo(T).@"enum".fields) |enumField| {
3737 if (mem.eql(u8, str, enumField.name)) {
3838 return @field(T, enumField.name);
3939 }
......@@ -58,11 +58,11 @@ test stringToEnum {
5858/// If T is a pointer type the alignment of the type it points to is returned.
5959pub fn alignment(comptime T: type) comptime_int {
6060 return switch (@typeInfo(T)) {
61 .Optional => |info| switch (@typeInfo(info.child)) {
62 .Pointer, .Fn => alignment(info.child),
61 .optional => |info| switch (@typeInfo(info.child)) {
62 .pointer, .@"fn" => alignment(info.child),
6363 else => @alignOf(T),
6464 },
65 .Pointer => |info| info.alignment,
65 .pointer => |info| info.alignment,
6666 else => @alignOf(T),
6767 };
6868}
......@@ -81,10 +81,10 @@ test alignment {
8181/// Given a parameterized type (array, vector, pointer, optional), returns the "child type".
8282pub fn Child(comptime T: type) type {
8383 return switch (@typeInfo(T)) {
84 .Array => |info| info.child,
85 .Vector => |info| info.child,
86 .Pointer => |info| info.child,
87 .Optional => |info| info.child,
84 .array => |info| info.child,
85 .vector => |info| info.child,
86 .pointer => |info| info.child,
87 .optional => |info| info.child,
8888 else => @compileError("Expected pointer, optional, array or vector type, found '" ++ @typeName(T) ++ "'"),
8989 };
9090}
......@@ -100,17 +100,17 @@ test Child {
100100/// Given a "memory span" type (array, slice, vector, or pointer to such), returns the "element type".
101101pub fn Elem(comptime T: type) type {
102102 switch (@typeInfo(T)) {
103 .Array => |info| return info.child,
104 .Vector => |info| return info.child,
105 .Pointer => |info| switch (info.size) {
103 .array => |info| return info.child,
104 .vector => |info| return info.child,
105 .pointer => |info| switch (info.size) {
106106 .One => switch (@typeInfo(info.child)) {
107 .Array => |array_info| return array_info.child,
108 .Vector => |vector_info| return vector_info.child,
107 .array => |array_info| return array_info.child,
108 .vector => |vector_info| return vector_info.child,
109109 else => {},
110110 },
111111 .Many, .C, .Slice => return info.child,
112112 },
113 .Optional => |info| return Elem(info.child),
113 .optional => |info| return Elem(info.child),
114114 else => {},
115115 }
116116 @compileError("Expected pointer, slice, array or vector type, found '" ++ @typeName(T) ++ "'");
......@@ -132,18 +132,18 @@ test Elem {
132132/// Result is always comptime-known.
133133pub inline fn sentinel(comptime T: type) ?Elem(T) {
134134 switch (@typeInfo(T)) {
135 .Array => |info| {
135 .array => |info| {
136136 const sentinel_ptr = info.sentinel orelse return null;
137137 return @as(*const info.child, @ptrCast(sentinel_ptr)).*;
138138 },
139 .Pointer => |info| {
139 .pointer => |info| {
140140 switch (info.size) {
141141 .Many, .Slice => {
142142 const sentinel_ptr = info.sentinel orelse return null;
143143 return @as(*align(1) const info.child, @ptrCast(sentinel_ptr)).*;
144144 },
145145 .One => switch (@typeInfo(info.child)) {
146 .Array => |array_info| {
146 .array => |array_info| {
147147 const sentinel_ptr = array_info.sentinel orelse return null;
148148 return @as(*align(1) const array_info.child, @ptrCast(sentinel_ptr)).*;
149149 },
......@@ -177,17 +177,17 @@ fn testSentinel() !void {
177177/// Given a "memory span" type, returns the same type except with the given sentinel value.
178178pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
179179 switch (@typeInfo(T)) {
180 .Pointer => |info| switch (info.size) {
180 .pointer => |info| switch (info.size) {
181181 .One => switch (@typeInfo(info.child)) {
182 .Array => |array_info| return @Type(.{
183 .Pointer = .{
182 .array => |array_info| return @Type(.{
183 .pointer = .{
184184 .size = info.size,
185185 .is_const = info.is_const,
186186 .is_volatile = info.is_volatile,
187187 .alignment = info.alignment,
188188 .address_space = info.address_space,
189189 .child = @Type(.{
190 .Array = .{
190 .array = .{
191191 .len = array_info.len,
192192 .child = array_info.child,
193193 .sentinel = @as(?*const anyopaque, @ptrCast(&sentinel_val)),
......@@ -200,7 +200,7 @@ pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
200200 else => {},
201201 },
202202 .Many, .Slice => return @Type(.{
203 .Pointer = .{
203 .pointer = .{
204204 .size = info.size,
205205 .is_const = info.is_const,
206206 .is_volatile = info.is_volatile,
......@@ -213,12 +213,12 @@ pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
213213 }),
214214 else => {},
215215 },
216 .Optional => |info| switch (@typeInfo(info.child)) {
217 .Pointer => |ptr_info| switch (ptr_info.size) {
216 .optional => |info| switch (@typeInfo(info.child)) {
217 .pointer => |ptr_info| switch (ptr_info.size) {
218218 .Many => return @Type(.{
219 .Optional = .{
219 .optional = .{
220220 .child = @Type(.{
221 .Pointer = .{
221 .pointer = .{
222222 .size = ptr_info.size,
223223 .is_const = ptr_info.is_const,
224224 .is_volatile = ptr_info.is_volatile,
......@@ -244,8 +244,8 @@ pub const assumeSentinel = @compileError("This function has been removed, consid
244244
245245pub fn containerLayout(comptime T: type) Type.ContainerLayout {
246246 return switch (@typeInfo(T)) {
247 .Struct => |info| info.layout,
248 .Union => |info| info.layout,
247 .@"struct" => |info| info.layout,
248 .@"union" => |info| info.layout,
249249 else => @compileError("expected struct or union type, found '" ++ @typeName(T) ++ "'"),
250250 };
251251}
......@@ -276,10 +276,10 @@ test containerLayout {
276276/// directly when you know what kind of type it is.
277277pub fn declarations(comptime T: type) []const Type.Declaration {
278278 return switch (@typeInfo(T)) {
279 .Struct => |info| info.decls,
280 .Enum => |info| info.decls,
281 .Union => |info| info.decls,
282 .Opaque => |info| info.decls,
279 .@"struct" => |info| info.decls,
280 .@"enum" => |info| info.decls,
281 .@"union" => |info| info.decls,
282 .@"opaque" => |info| info.decls,
283283 else => @compileError("Expected struct, enum, union, or opaque type, found '" ++ @typeName(T) ++ "'"),
284284 };
285285}
......@@ -350,17 +350,17 @@ test declarationInfo {
350350 }
351351}
352352pub fn fields(comptime T: type) switch (@typeInfo(T)) {
353 .Struct => []const Type.StructField,
354 .Union => []const Type.UnionField,
355 .ErrorSet => []const Type.Error,
356 .Enum => []const Type.EnumField,
353 .@"struct" => []const Type.StructField,
354 .@"union" => []const Type.UnionField,
355 .@"enum" => []const Type.EnumField,
356 .error_set => []const Type.Error,
357357 else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"),
358358} {
359359 return switch (@typeInfo(T)) {
360 .Struct => |info| info.fields,
361 .Union => |info| info.fields,
362 .Enum => |info| info.fields,
363 .ErrorSet => |errors| errors.?, // must be non global error set
360 .@"struct" => |info| info.fields,
361 .@"union" => |info| info.fields,
362 .@"enum" => |info| info.fields,
363 .error_set => |errors| errors.?, // must be non global error set
364364 else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"),
365365 };
366366}
......@@ -395,10 +395,10 @@ test fields {
395395}
396396
397397pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeInfo(T)) {
398 .Struct => Type.StructField,
399 .Union => Type.UnionField,
400 .ErrorSet => Type.Error,
401 .Enum => Type.EnumField,
398 .@"struct" => Type.StructField,
399 .@"union" => Type.UnionField,
400 .@"enum" => Type.EnumField,
401 .error_set => Type.Error,
402402 else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"),
403403} {
404404 return fields(T)[@intFromEnum(field)];
......@@ -430,7 +430,7 @@ test fieldInfo {
430430}
431431
432432pub fn FieldType(comptime T: type, comptime field: FieldEnum(T)) type {
433 if (@typeInfo(T) != .Struct and @typeInfo(T) != .Union) {
433 if (@typeInfo(T) != .@"struct" and @typeInfo(T) != .@"union") {
434434 @compileError("Expected struct or union, found '" ++ @typeName(T) ++ "'");
435435 }
436436
......@@ -528,7 +528,7 @@ pub fn FieldEnum(comptime T: type) type {
528528
529529 if (field_infos.len == 0) {
530530 return @Type(.{
531 .Enum = .{
531 .@"enum" = .{
532532 .tag_type = u0,
533533 .fields = &.{},
534534 .decls = &.{},
......@@ -537,8 +537,8 @@ pub fn FieldEnum(comptime T: type) type {
537537 });
538538 }
539539
540 if (@typeInfo(T) == .Union) {
541 if (@typeInfo(T).Union.tag_type) |tag_type| {
540 if (@typeInfo(T) == .@"union") {
541 if (@typeInfo(T).@"union".tag_type) |tag_type| {
542542 for (std.enums.values(tag_type), 0..) |v, i| {
543543 if (@intFromEnum(v) != i) break; // enum values not consecutive
544544 if (!std.mem.eql(u8, @tagName(v), field_infos[i].name)) break; // fields out of order
......@@ -557,7 +557,7 @@ pub fn FieldEnum(comptime T: type) type {
557557 };
558558 }
559559 return @Type(.{
560 .Enum = .{
560 .@"enum" = .{
561561 .tag_type = std.math.IntFittingRange(0, field_infos.len - 1),
562562 .fields = &enumFields,
563563 .decls = &decls,
......@@ -568,17 +568,17 @@ pub fn FieldEnum(comptime T: type) type {
568568
569569fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
570570 // TODO: https://github.com/ziglang/zig/issues/7419
571 // testing.expectEqual(@typeInfo(expected).Enum, @typeInfo(actual).Enum);
571 // testing.expectEqual(@typeInfo(expected).@"enum", @typeInfo(actual).@"enum");
572572 try testing.expectEqual(
573 @typeInfo(expected).Enum.tag_type,
574 @typeInfo(actual).Enum.tag_type,
573 @typeInfo(expected).@"enum".tag_type,
574 @typeInfo(actual).@"enum".tag_type,
575575 );
576576 // For comparing decls and fields, we cannot use the meta eql function here
577577 // because the language does not guarantee that the slice pointers for field names
578578 // and decl names will be the same.
579579 comptime {
580 const expected_fields = @typeInfo(expected).Enum.fields;
581 const actual_fields = @typeInfo(actual).Enum.fields;
580 const expected_fields = @typeInfo(expected).@"enum".fields;
581 const actual_fields = @typeInfo(actual).@"enum".fields;
582582 if (expected_fields.len != actual_fields.len) return error.FailedTest;
583583 for (expected_fields, 0..) |expected_field, i| {
584584 const actual_field = actual_fields[i];
......@@ -587,8 +587,8 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
587587 }
588588 }
589589 comptime {
590 const expected_decls = @typeInfo(expected).Enum.decls;
591 const actual_decls = @typeInfo(actual).Enum.decls;
590 const expected_decls = @typeInfo(expected).@"enum".decls;
591 const actual_decls = @typeInfo(actual).@"enum".decls;
592592 if (expected_decls.len != actual_decls.len) return error.FailedTest;
593593 for (expected_decls, 0..) |expected_decl, i| {
594594 const actual_decl = actual_decls[i];
......@@ -596,8 +596,8 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
596596 }
597597 }
598598 try testing.expectEqual(
599 @typeInfo(expected).Enum.is_exhaustive,
600 @typeInfo(actual).Enum.is_exhaustive,
599 @typeInfo(expected).@"enum".is_exhaustive,
600 @typeInfo(actual).@"enum".is_exhaustive,
601601 );
602602}
603603
......@@ -627,7 +627,7 @@ pub fn DeclEnum(comptime T: type) type {
627627 enumDecls[i] = .{ .name = field.name ++ "", .value = i };
628628 }
629629 return @Type(.{
630 .Enum = .{
630 .@"enum" = .{
631631 .tag_type = std.math.IntFittingRange(0, fieldInfos.len - 1),
632632 .fields = &enumDecls,
633633 .decls = &decls,
......@@ -661,8 +661,8 @@ test DeclEnum {
661661
662662pub fn Tag(comptime T: type) type {
663663 return switch (@typeInfo(T)) {
664 .Enum => |info| info.tag_type,
665 .Union => |info| info.tag_type orelse @compileError(@typeName(T) ++ " has no tag type"),
664 .@"enum" => |info| info.tag_type,
665 .@"union" => |info| info.tag_type orelse @compileError(@typeName(T) ++ " has no tag type"),
666666 else => @compileError("expected enum or union type, found '" ++ @typeName(T) ++ "'"),
667667 };
668668}
......@@ -708,7 +708,7 @@ test activeTag {
708708const TagPayloadType = TagPayload;
709709
710710pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type {
711 const info = @typeInfo(U).Union;
711 const info = @typeInfo(U).@"union";
712712
713713 inline for (info.fields) |field_info| {
714714 if (comptime mem.eql(u8, field_info.name, tag_name))
......@@ -742,20 +742,20 @@ pub fn eql(a: anytype, b: @TypeOf(a)) bool {
742742 const T = @TypeOf(a);
743743
744744 switch (@typeInfo(T)) {
745 .Struct => |info| {
745 .@"struct" => |info| {
746746 inline for (info.fields) |field_info| {
747747 if (!eql(@field(a, field_info.name), @field(b, field_info.name))) return false;
748748 }
749749 return true;
750750 },
751 .ErrorUnion => {
751 .error_union => {
752752 if (a) |a_p| {
753753 if (b) |b_p| return eql(a_p, b_p) else |_| return false;
754754 } else |a_e| {
755755 if (b) |_| return false else |b_e| return a_e == b_e;
756756 }
757757 },
758 .Union => |info| {
758 .@"union" => |info| {
759759 if (info.tag_type) |UnionTag| {
760760 const tag_a: UnionTag = a;
761761 const tag_b: UnionTag = b;
......@@ -768,26 +768,26 @@ pub fn eql(a: anytype, b: @TypeOf(a)) bool {
768768
769769 @compileError("cannot compare untagged union type " ++ @typeName(T));
770770 },
771 .Array => {
771 .array => {
772772 if (a.len != b.len) return false;
773773 for (a, 0..) |e, i|
774774 if (!eql(e, b[i])) return false;
775775 return true;
776776 },
777 .Vector => |info| {
777 .vector => |info| {
778778 var i: usize = 0;
779779 while (i < info.len) : (i += 1) {
780780 if (!eql(a[i], b[i])) return false;
781781 }
782782 return true;
783783 },
784 .Pointer => |info| {
784 .pointer => |info| {
785785 return switch (info.size) {
786786 .One, .Many, .C => a == b,
787787 .Slice => a.ptr == b.ptr and a.len == b.len,
788788 };
789789 },
790 .Optional => {
790 .optional => {
791791 if (a == null and b == null) return true;
792792 if (a == null or b == null) return false;
793793 return eql(a.?, b.?);
......@@ -893,7 +893,7 @@ test intToEnum {
893893pub const IntToEnumError = error{InvalidEnumTag};
894894
895895pub fn intToEnum(comptime EnumTag: type, tag_int: anytype) IntToEnumError!EnumTag {
896 const enum_info = @typeInfo(EnumTag).Enum;
896 const enum_info = @typeInfo(EnumTag).@"enum";
897897
898898 if (!enum_info.is_exhaustive) {
899899 if (std.math.cast(enum_info.tag_type, tag_int)) |tag| {
......@@ -955,7 +955,7 @@ pub const IntType = @compileError("replaced by std.meta.Int");
955955
956956pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) type {
957957 return @Type(.{
958 .Int = .{
958 .int = .{
959959 .signedness = signedness,
960960 .bits = bit_count,
961961 },
......@@ -964,7 +964,7 @@ pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16)
964964
965965pub fn Float(comptime bit_count: u8) type {
966966 return @Type(.{
967 .Float = .{ .bits = bit_count },
967 .float = .{ .bits = bit_count },
968968 });
969969}
970970
......@@ -984,10 +984,10 @@ test Float {
984984/// - `ArgsTuple(fn (a: u32, b: f16) noreturn)` ⇒ `tuple { u32, f16 }`
985985pub fn ArgsTuple(comptime Function: type) type {
986986 const info = @typeInfo(Function);
987 if (info != .Fn)
987 if (info != .@"fn")
988988 @compileError("ArgsTuple expects a function type");
989989
990 const function_info = info.Fn;
990 const function_info = info.@"fn";
991991 if (function_info.is_var_args)
992992 @compileError("Cannot create ArgsTuple for variadic function");
993993
......@@ -1026,7 +1026,7 @@ fn CreateUniqueTuple(comptime N: comptime_int, comptime types: [N]type) type {
10261026 }
10271027
10281028 return @Type(.{
1029 .Struct = .{
1029 .@"struct" = .{
10301030 .is_tuple = true,
10311031 .layout = .auto,
10321032 .decls = &.{},
......@@ -1043,9 +1043,9 @@ const TupleTester = struct {
10431043
10441044 fn assertTuple(comptime expected: anytype, comptime Actual: type) void {
10451045 const info = @typeInfo(Actual);
1046 if (info != .Struct)
1046 if (info != .@"struct")
10471047 @compileError("Expected struct type");
1048 if (!info.Struct.is_tuple)
1048 if (!info.@"struct".is_tuple)
10491049 @compileError("Struct type must be a tuple type");
10501050
10511051 const fields_list = std.meta.fields(Actual);
......@@ -1115,13 +1115,13 @@ test isError {
11151115/// `false` otherwise. Result is always comptime-known.
11161116pub inline fn hasFn(comptime T: type, comptime name: []const u8) bool {
11171117 switch (@typeInfo(T)) {
1118 .Struct, .Union, .Enum, .Opaque => {},
1118 .@"struct", .@"union", .@"enum", .@"opaque" => {},
11191119 else => return false,
11201120 }
11211121 if (!@hasDecl(T, name))
11221122 return false;
11231123
1124 return @typeInfo(@TypeOf(@field(T, name))) == .Fn;
1124 return @typeInfo(@TypeOf(@field(T, name))) == .@"fn";
11251125}
11261126
11271127test hasFn {
......@@ -1144,7 +1144,7 @@ test hasFn {
11441144/// Result is always comptime-known.
11451145pub inline fn hasMethod(comptime T: type, comptime name: []const u8) bool {
11461146 return switch (@typeInfo(T)) {
1147 .Pointer => |P| switch (P.size) {
1147 .pointer => |P| switch (P.size) {
11481148 .One => hasFn(P.child, name),
11491149 .Many, .Slice, .C => false,
11501150 },
......@@ -1191,29 +1191,29 @@ pub inline fn hasUniqueRepresentation(comptime T: type) bool {
11911191 return switch (@typeInfo(T)) {
11921192 else => false, // TODO can we know if it's true for some of these types ?
11931193
1194 .AnyFrame,
1195 .Enum,
1196 .ErrorSet,
1197 .Fn,
1194 .@"anyframe",
1195 .@"enum",
1196 .error_set,
1197 .@"fn",
11981198 => true,
11991199
1200 .Bool => false,
1200 .bool => false,
12011201
1202 .Int => |info| @sizeOf(T) * 8 == info.bits,
1202 .int => |info| @sizeOf(T) * 8 == info.bits,
12031203
1204 .Pointer => |info| info.size != .Slice,
1204 .pointer => |info| info.size != .Slice,
12051205
1206 .Optional => |info| switch (@typeInfo(info.child)) {
1207 .Pointer => |ptr| !ptr.is_allowzero and switch (ptr.size) {
1206 .optional => |info| switch (@typeInfo(info.child)) {
1207 .pointer => |ptr| !ptr.is_allowzero and switch (ptr.size) {
12081208 .Slice, .C => false,
12091209 .One, .Many => true,
12101210 },
12111211 else => false,
12121212 },
12131213
1214 .Array => |info| hasUniqueRepresentation(info.child),
1214 .array => |info| hasUniqueRepresentation(info.child),
12151215
1216 .Struct => |info| {
1216 .@"struct" => |info| {
12171217 if (info.layout == .@"packed") return @sizeOf(T) * 8 == @bitSizeOf(T);
12181218
12191219 var sum_size = @as(usize, 0);
......@@ -1226,7 +1226,7 @@ pub inline fn hasUniqueRepresentation(comptime T: type) bool {
12261226 return @sizeOf(T) == sum_size;
12271227 },
12281228
1229 .Vector => |info| hasUniqueRepresentation(info.child) and
1229 .vector => |info| hasUniqueRepresentation(info.child) and
12301230 @sizeOf(T) == @sizeOf(info.child) * info.len,
12311231 };
12321232}
lib/std/meta/trailer_flags.zig+8-8
......@@ -14,14 +14,14 @@ pub fn TrailerFlags(comptime Fields: type) type {
1414 bits: Int,
1515
1616 pub const Int = meta.Int(.unsigned, bit_count);
17 pub const bit_count = @typeInfo(Fields).Struct.fields.len;
17 pub const bit_count = @typeInfo(Fields).@"struct".fields.len;
1818
1919 pub const FieldEnum = std.meta.FieldEnum(Fields);
2020
2121 pub const ActiveFields = std.enums.EnumFieldStruct(FieldEnum, bool, false);
2222 pub const FieldValues = blk: {
2323 var fields: [bit_count]Type.StructField = undefined;
24 for (@typeInfo(Fields).Struct.fields, 0..) |struct_field, i| {
24 for (@typeInfo(Fields).@"struct".fields, 0..) |struct_field, i| {
2525 fields[i] = Type.StructField{
2626 .name = struct_field.name,
2727 .type = ?struct_field.type,
......@@ -31,7 +31,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
3131 };
3232 }
3333 break :blk @Type(.{
34 .Struct = .{
34 .@"struct" = .{
3535 .layout = .auto,
3636 .fields = &fields,
3737 .decls = &.{},
......@@ -61,7 +61,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
6161 /// `fields` is a boolean struct where each active field is set to `true`
6262 pub fn init(fields: ActiveFields) Self {
6363 var self: Self = .{ .bits = 0 };
64 inline for (@typeInfo(Fields).Struct.fields, 0..) |field, i| {
64 inline for (@typeInfo(Fields).@"struct".fields, 0..) |field, i| {
6565 if (@field(fields, field.name))
6666 self.bits |= 1 << i;
6767 }
......@@ -70,7 +70,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
7070
7171 /// `fields` is a struct with each field set to an optional value
7272 pub fn setMany(self: Self, p: [*]align(@alignOf(Fields)) u8, fields: FieldValues) void {
73 inline for (@typeInfo(Fields).Struct.fields, 0..) |field, i| {
73 inline for (@typeInfo(Fields).@"struct".fields, 0..) |field, i| {
7474 if (@field(fields, field.name)) |value|
7575 self.set(p, @as(FieldEnum, @enumFromInt(i)), value);
7676 }
......@@ -101,7 +101,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
101101
102102 pub fn offset(self: Self, comptime field: FieldEnum) usize {
103103 var off: usize = 0;
104 inline for (@typeInfo(Fields).Struct.fields, 0..) |field_info, i| {
104 inline for (@typeInfo(Fields).@"struct".fields, 0..) |field_info, i| {
105105 const active = (self.bits & (1 << i)) != 0;
106106 if (i == @intFromEnum(field)) {
107107 assert(active);
......@@ -114,12 +114,12 @@ pub fn TrailerFlags(comptime Fields: type) type {
114114 }
115115
116116 pub fn Field(comptime field: FieldEnum) type {
117 return @typeInfo(Fields).Struct.fields[@intFromEnum(field)].type;
117 return @typeInfo(Fields).@"struct".fields[@intFromEnum(field)].type;
118118 }
119119
120120 pub fn sizeInBytes(self: Self) usize {
121121 var off: usize = 0;
122 inline for (@typeInfo(Fields).Struct.fields, 0..) |field, i| {
122 inline for (@typeInfo(Fields).@"struct".fields, 0..) |field, i| {
123123 if (@sizeOf(field.type) == 0)
124124 continue;
125125 if ((self.bits & (1 << i)) != 0) {
lib/std/multi_array_list.zig+10-11
......@@ -24,10 +24,9 @@ pub fn MultiArrayList(comptime T: type) type {
2424 capacity: usize = 0,
2525
2626 const Elem = switch (@typeInfo(T)) {
27 .Struct => T,
28 .Union => |u| struct {
29 pub const Bare =
30 @Type(.{ .Union = .{
27 .@"struct" => T,
28 .@"union" => |u| struct {
29 pub const Bare = @Type(.{ .@"union" = .{
3130 .layout = u.layout,
3231 .tag_type = null,
3332 .fields = u.fields,
......@@ -84,8 +83,8 @@ pub fn MultiArrayList(comptime T: type) type {
8483
8584 pub fn set(self: *Slice, index: usize, elem: T) void {
8685 const e = switch (@typeInfo(T)) {
87 .Struct => elem,
88 .Union => Elem.fromT(elem),
86 .@"struct" => elem,
87 .@"union" => Elem.fromT(elem),
8988 else => unreachable,
9089 };
9190 inline for (fields, 0..) |field_info, i| {
......@@ -99,8 +98,8 @@ pub fn MultiArrayList(comptime T: type) type {
9998 @field(result, field_info.name) = self.items(@as(Field, @enumFromInt(i)))[index];
10099 }
101100 return switch (@typeInfo(T)) {
102 .Struct => result,
103 .Union => Elem.toT(result.tags, result.data),
101 .@"struct" => result,
102 .@"union" => Elem.toT(result.tags, result.data),
104103 else => unreachable,
105104 };
106105 }
......@@ -287,8 +286,8 @@ pub fn MultiArrayList(comptime T: type) type {
287286 assert(index <= self.len);
288287 self.len += 1;
289288 const entry = switch (@typeInfo(T)) {
290 .Struct => elem,
291 .Union => Elem.fromT(elem),
289 .@"struct" => elem,
290 .@"union" => Elem.fromT(elem),
292291 else => unreachable,
293292 };
294293 const slices = self.slice();
......@@ -557,7 +556,7 @@ pub fn MultiArrayList(comptime T: type) type {
557556 .is_comptime = fields[i].is_comptime,
558557 .alignment = fields[i].alignment,
559558 };
560 break :entry @Type(.{ .Struct = .{
559 break :entry @Type(.{ .@"struct" = .{
561560 .layout = .@"extern",
562561 .fields = &entry_fields,
563562 .decls = &.{},
lib/std/os/emscripten.zig+1-1
......@@ -560,7 +560,7 @@ pub const Sigaction = extern struct {
560560};
561561
562562pub const sigset_t = [1024 / 32]u32;
563pub const empty_sigset = [_]u32{0} ** @typeInfo(sigset_t).Array.len;
563pub const empty_sigset = [_]u32{0} ** @typeInfo(sigset_t).array.len;
564564pub const siginfo_t = extern struct {
565565 signo: i32,
566566 errno: i32,
lib/std/os/linux.zig+7-7
......@@ -1547,7 +1547,7 @@ pub fn seteuid(euid: uid_t) usize {
15471547 // The setresuid(2) man page says that if -1 is passed the corresponding
15481548 // id will not be changed. Since uid_t is unsigned, this wraps around to the
15491549 // max value in C.
1550 comptime assert(@typeInfo(uid_t) == .Int and @typeInfo(uid_t).Int.signedness == .unsigned);
1550 comptime assert(@typeInfo(uid_t) == .int and @typeInfo(uid_t).int.signedness == .unsigned);
15511551 return setresuid(std.math.maxInt(uid_t), euid, std.math.maxInt(uid_t));
15521552}
15531553
......@@ -1558,7 +1558,7 @@ pub fn setegid(egid: gid_t) usize {
15581558 // The setresgid(2) man page says that if -1 is passed the corresponding
15591559 // id will not be changed. Since gid_t is unsigned, this wraps around to the
15601560 // max value in C.
1561 comptime assert(@typeInfo(uid_t) == .Int and @typeInfo(uid_t).Int.signedness == .unsigned);
1561 comptime assert(@typeInfo(uid_t) == .int and @typeInfo(uid_t).int.signedness == .unsigned);
15621562 return setresgid(std.math.maxInt(gid_t), egid, std.math.maxInt(gid_t));
15631563}
15641564
......@@ -1673,7 +1673,7 @@ pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigact
16731673 return 0;
16741674}
16751675
1676const usize_bits = @typeInfo(usize).Int.bits;
1676const usize_bits = @typeInfo(usize).int.bits;
16771677
16781678pub fn sigaddset(set: *sigset_t, sig: u6) void {
16791679 const s = sig - 1;
......@@ -1734,7 +1734,7 @@ pub fn sendmsg(fd: i32, msg: *const msghdr_const, flags: u32) usize {
17341734}
17351735
17361736pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize {
1737 if (@typeInfo(usize).Int.bits > @typeInfo(@typeInfo(mmsghdr).Struct.fields[1].type).Int.bits) {
1737 if (@typeInfo(usize).int.bits > @typeInfo(@typeInfo(mmsghdr).@"struct".fields[1].type).int.bits) {
17381738 // workaround kernel brokenness:
17391739 // if adding up all iov_len overflows a i32 then split into multiple calls
17401740 // see https://www.openwall.com/lists/musl/2014/06/07/5
......@@ -4904,7 +4904,7 @@ pub const NSIG = if (is_mips) 128 else 65;
49044904
49054905pub const sigset_t = [1024 / 32]u32;
49064906
4907pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).Array.len;
4907pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).array.len;
49084908pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30;
49094909
49104910const k_sigaction_funcs = struct {
......@@ -4947,7 +4947,7 @@ pub const Sigaction = extern struct {
49474947 restorer: ?*const fn () callconv(.C) void = null,
49484948};
49494949
4950const sigset_len = @typeInfo(sigset_t).Array.len;
4950const sigset_len = @typeInfo(sigset_t).array.len;
49514951pub const empty_sigset = [_]u32{0} ** sigset_len;
49524952pub const filled_sigset = [_]u32{(1 << (31 & (usize_bits - 1))) - 1} ++ [_]u32{0} ** (sigset_len - 1);
49534953
......@@ -7420,7 +7420,7 @@ pub const MADV = struct {
74207420};
74217421
74227422pub const POSIX_FADV = switch (native_arch) {
7423 .s390x => if (@typeInfo(usize).Int.bits == 64) struct {
7423 .s390x => if (@typeInfo(usize).int.bits == 64) struct {
74247424 pub const NORMAL = 0;
74257425 pub const RANDOM = 1;
74267426 pub const SEQUENTIAL = 2;
lib/std/os/linux/bpf.zig+1-1
......@@ -459,7 +459,7 @@ pub const Insn = packed struct {
459459 };
460460
461461 fn imm_reg(code: u8, dst: Reg, src: anytype, off: i16) Insn {
462 const imm_or_reg = if (@TypeOf(src) == Reg or @typeInfo(@TypeOf(src)) == .EnumLiteral)
462 const imm_or_reg = if (@TypeOf(src) == Reg or @typeInfo(@TypeOf(src)) == .enum_literal)
463463 ImmOrReg{ .reg = @as(Reg, src) }
464464 else
465465 ImmOrReg{ .imm = src };
lib/std/os/uefi/protocol/device_path.zig+2-2
......@@ -76,7 +76,7 @@ pub const DevicePath = extern struct {
7676 }
7777
7878 pub fn getDevicePath(self: *const DevicePath) ?uefi.DevicePath {
79 inline for (@typeInfo(uefi.DevicePath).Union.fields) |ufield| {
79 inline for (@typeInfo(uefi.DevicePath).@"union".fields) |ufield| {
8080 const enum_value = std.meta.stringToEnum(uefi.DevicePath.Type, ufield.name);
8181
8282 // Got the associated union type for self.type, now
......@@ -94,7 +94,7 @@ pub const DevicePath = extern struct {
9494 }
9595
9696 pub fn initSubtype(self: *const DevicePath, comptime TUnion: type) ?TUnion {
97 const type_info = @typeInfo(TUnion).Union;
97 const type_info = @typeInfo(TUnion).@"union";
9898 const TTag = type_info.tag_type.?;
9999
100100 inline for (type_info.fields) |subtype| {
lib/std/os/uefi/status.zig+2-2
......@@ -1,6 +1,6 @@
11const testing = @import("std").testing;
22
3const high_bit = 1 << @typeInfo(usize).Int.bits - 1;
3const high_bit = 1 << @typeInfo(usize).int.bits - 1;
44
55pub const Status = enum(usize) {
66 /// The operation completed successfully.
......@@ -186,7 +186,7 @@ pub const Status = enum(usize) {
186186 };
187187
188188 pub fn err(self: Status) EfiError!void {
189 inline for (@typeInfo(EfiError).ErrorSet.?) |efi_err| {
189 inline for (@typeInfo(EfiError).error_set.?) |efi_err| {
190190 if (self == @field(Status, efi_err.name)) {
191191 return @field(EfiError, efi_err.name);
192192 }
lib/std/posix.zig+2-2
......@@ -6181,7 +6181,7 @@ pub fn sendfile(
61816181 var total_written: usize = 0;
61826182
61836183 // Prevents EOVERFLOW.
6184 const size_t = std.meta.Int(.unsigned, @typeInfo(usize).Int.bits - 1);
6184 const size_t = std.meta.Int(.unsigned, @typeInfo(usize).int.bits - 1);
61856185 const max_count = switch (native_os) {
61866186 .linux => 0x7ffff000,
61876187 .macos, .ios, .watchos, .tvos, .visionos => maxInt(i32),
......@@ -6988,7 +6988,7 @@ pub const PrctlError = error{
69886988} || UnexpectedError;
69896989
69906990pub fn prctl(option: PR, args: anytype) PrctlError!u31 {
6991 if (@typeInfo(@TypeOf(args)) != .Struct)
6991 if (@typeInfo(@TypeOf(args)) != .@"struct")
69926992 @compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(args)));
69936993 if (args.len > 4)
69946994 @compileError("prctl takes a maximum of 4 optional arguments");
lib/std/posix/test.zig+1-1
......@@ -782,7 +782,7 @@ test "fsync" {
782782test "getrlimit and setrlimit" {
783783 if (posix.system.rlimit_resource == void) return error.SkipZigTest;
784784
785 inline for (@typeInfo(posix.rlimit_resource).Enum.fields) |field| {
785 inline for (@typeInfo(posix.rlimit_resource).@"enum".fields) |field| {
786786 const resource: posix.rlimit_resource = @enumFromInt(field.value);
787787 const limit = try posix.getrlimit(resource);
788788
lib/std/process/Child.zig+1-1
......@@ -1112,7 +1112,7 @@ fn windowsCreateProcessPathExt(
11121112 }
11131113 var io_status: windows.IO_STATUS_BLOCK = undefined;
11141114
1115 const num_supported_pathext = @typeInfo(WindowsExtension).Enum.fields.len;
1115 const num_supported_pathext = @typeInfo(WindowsExtension).@"enum".fields.len;
11161116 var pathext_seen = [_]bool{false} ** num_supported_pathext;
11171117 var any_pathext_seen = false;
11181118 var unappended_exists = false;
lib/std/segmented_list.zig+1-1
......@@ -99,7 +99,7 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type
9999 pub const prealloc_count = prealloc_item_count;
100100
101101 fn AtType(comptime SelfType: type) type {
102 if (@typeInfo(SelfType).Pointer.is_const) {
102 if (@typeInfo(SelfType).pointer.is_const) {
103103 return *const T;
104104 } else {
105105 return *T;
lib/std/simd.zig+7-7
......@@ -105,8 +105,8 @@ test "suggestVectorLengthForCpu works with signed and unsigned values" {
105105
106106fn vectorLength(comptime VectorType: type) comptime_int {
107107 return switch (@typeInfo(VectorType)) {
108 .Vector => |info| info.len,
109 .Array => |info| info.len,
108 .vector => |info| info.len,
109 .array => |info| info.len,
110110 else => @compileError("Invalid type " ++ @typeName(VectorType)),
111111 };
112112}
......@@ -128,8 +128,8 @@ pub inline fn iota(comptime T: type, comptime len: usize) @Vector(len, T) {
128128 var out: [len]T = undefined;
129129 for (&out, 0..) |*element, i| {
130130 element.* = switch (@typeInfo(T)) {
131 .Int => @as(T, @intCast(i)),
132 .Float => @as(T, @floatFromInt(i)),
131 .int => @as(T, @intCast(i)),
132 .float => @as(T, @floatFromInt(i)),
133133 else => @compileError("Can't use type " ++ @typeName(T) ++ " in iota."),
134134 };
135135 }
......@@ -417,18 +417,18 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a
417417 const Child = std.meta.Child(VecType);
418418
419419 const identity = comptime switch (@typeInfo(Child)) {
420 .Bool => switch (op) {
420 .bool => switch (op) {
421421 .Or, .Xor => false,
422422 .And => true,
423423 else => @compileError("Invalid prefixScan operation " ++ @tagName(op) ++ " for vector of booleans."),
424424 },
425 .Int => switch (op) {
425 .int => switch (op) {
426426 .Max => std.math.minInt(Child),
427427 .Add, .Or, .Xor => 0,
428428 .Mul => 1,
429429 .And, .Min => std.math.maxInt(Child),
430430 },
431 .Float => switch (op) {
431 .float => switch (op) {
432432 .Max => -std.math.inf(Child),
433433 .Add => 0,
434434 .Mul => 1,
lib/std/start.zig+6-6
......@@ -30,7 +30,7 @@ comptime {
3030 if (simplified_logic) {
3131 if (builtin.output_mode == .Exe) {
3232 if ((builtin.link_libc or builtin.object_format == .c) and @hasDecl(root, "main")) {
33 if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) {
33 if (@typeInfo(@TypeOf(root.main)).@"fn".calling_convention != .C) {
3434 @export(&main2, .{ .name = "main" });
3535 }
3636 } else if (builtin.os.tag == .windows) {
......@@ -55,7 +55,7 @@ comptime {
5555 if (builtin.link_libc and @hasDecl(root, "main")) {
5656 if (native_arch.isWasm()) {
5757 @export(&mainWithoutEnv, .{ .name = "main" });
58 } else if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) {
58 } else if (@typeInfo(@TypeOf(root.main)).@"fn".calling_convention != .C) {
5959 @export(&main, .{ .name = "main" });
6060 }
6161 } else if (native_os == .windows) {
......@@ -205,7 +205,7 @@ fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv
205205 uefi.handle = handle;
206206 uefi.system_table = system_table;
207207
208 switch (@typeInfo(@TypeOf(root.main)).Fn.return_type.?) {
208 switch (@typeInfo(@TypeOf(root.main)).@"fn".return_type.?) {
209209 noreturn => {
210210 root.main();
211211 },
......@@ -599,7 +599,7 @@ fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.C) c_int {
599599const bad_main_ret = "expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'";
600600
601601pub inline fn callMain() u8 {
602 const ReturnType = @typeInfo(@TypeOf(root.main)).Fn.return_type.?;
602 const ReturnType = @typeInfo(@TypeOf(root.main)).@"fn".return_type.?;
603603
604604 switch (ReturnType) {
605605 void => {
......@@ -610,7 +610,7 @@ pub inline fn callMain() u8 {
610610 return root.main();
611611 },
612612 else => {
613 if (@typeInfo(ReturnType) != .ErrorUnion) @compileError(bad_main_ret);
613 if (@typeInfo(ReturnType) != .error_union) @compileError(bad_main_ret);
614614
615615 const result = root.main() catch |err| {
616616 if (builtin.zig_backend == .stage2_riscv64) {
......@@ -635,7 +635,7 @@ pub inline fn callMain() u8 {
635635
636636pub fn call_wWinMain() std.os.windows.INT {
637637 const peb = std.os.windows.peb();
638 const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).Fn.params[0].type.?;
638 const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).@"fn".params[0].type.?;
639639 const hInstance = @as(MAIN_HINSTANCE, @ptrCast(peb.ImageBaseAddress));
640640 const lpCmdLine: [*:0]u16 = @ptrCast(peb.ProcessParameters.CommandLine.Buffer);
641641
lib/std/testing.zig+66-66
......@@ -64,33 +64,33 @@ pub inline fn expectEqual(expected: anytype, actual: anytype) !void {
6464
6565fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
6666 switch (@typeInfo(@TypeOf(actual))) {
67 .NoReturn,
68 .Opaque,
69 .Frame,
70 .AnyFrame,
67 .noreturn,
68 .@"opaque",
69 .frame,
70 .@"anyframe",
7171 => @compileError("value of type " ++ @typeName(@TypeOf(actual)) ++ " encountered"),
7272
73 .Undefined,
74 .Null,
75 .Void,
73 .undefined,
74 .null,
75 .void,
7676 => return,
7777
78 .Type => {
78 .type => {
7979 if (actual != expected) {
8080 print("expected type {s}, found type {s}\n", .{ @typeName(expected), @typeName(actual) });
8181 return error.TestExpectedEqual;
8282 }
8383 },
8484
85 .Bool,
86 .Int,
87 .Float,
88 .ComptimeFloat,
89 .ComptimeInt,
90 .EnumLiteral,
91 .Enum,
92 .Fn,
93 .ErrorSet,
85 .bool,
86 .int,
87 .float,
88 .comptime_float,
89 .comptime_int,
90 .enum_literal,
91 .@"enum",
92 .@"fn",
93 .error_set,
9494 => {
9595 if (actual != expected) {
9696 print("expected {}, found {}\n", .{ expected, actual });
......@@ -98,7 +98,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
9898 }
9999 },
100100
101 .Pointer => |pointer| {
101 .pointer => |pointer| {
102102 switch (pointer.size) {
103103 .One, .Many, .C => {
104104 if (actual != expected) {
......@@ -119,9 +119,9 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
119119 }
120120 },
121121
122 .Array => |array| try expectEqualSlices(array.child, &expected, &actual),
122 .array => |array| try expectEqualSlices(array.child, &expected, &actual),
123123
124 .Vector => |info| {
124 .vector => |info| {
125125 var i: usize = 0;
126126 while (i < info.len) : (i += 1) {
127127 if (!std.meta.eql(expected[i], actual[i])) {
......@@ -133,13 +133,13 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
133133 }
134134 },
135135
136 .Struct => |structType| {
136 .@"struct" => |structType| {
137137 inline for (structType.fields) |field| {
138138 try expectEqual(@field(expected, field.name), @field(actual, field.name));
139139 }
140140 },
141141
142 .Union => |union_info| {
142 .@"union" => |union_info| {
143143 if (union_info.tag_type == null) {
144144 @compileError("Unable to compare untagged union values");
145145 }
......@@ -157,7 +157,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
157157 }
158158 },
159159
160 .Optional => {
160 .optional => {
161161 if (expected) |expected_payload| {
162162 if (actual) |actual_payload| {
163163 try expectEqual(expected_payload, actual_payload);
......@@ -173,7 +173,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
173173 }
174174 },
175175
176 .ErrorUnion => {
176 .error_union => {
177177 if (expected) |expected_payload| {
178178 if (actual) |actual_payload| {
179179 try expectEqual(expected_payload, actual_payload);
......@@ -237,12 +237,12 @@ pub inline fn expectApproxEqAbs(expected: anytype, actual: anytype, tolerance: a
237237
238238fn expectApproxEqAbsInner(comptime T: type, expected: T, actual: T, tolerance: T) !void {
239239 switch (@typeInfo(T)) {
240 .Float => if (!math.approxEqAbs(T, expected, actual, tolerance)) {
240 .float => if (!math.approxEqAbs(T, expected, actual, tolerance)) {
241241 print("actual {}, not within absolute tolerance {} of expected {}\n", .{ actual, tolerance, expected });
242242 return error.TestExpectedApproxEqAbs;
243243 },
244244
245 .ComptimeFloat => @compileError("Cannot approximately compare two comptime_float values"),
245 .comptime_float => @compileError("Cannot approximately compare two comptime_float values"),
246246
247247 else => @compileError("Unable to compare non floating point values"),
248248 }
......@@ -273,12 +273,12 @@ pub inline fn expectApproxEqRel(expected: anytype, actual: anytype, tolerance: a
273273
274274fn expectApproxEqRelInner(comptime T: type, expected: T, actual: T, tolerance: T) !void {
275275 switch (@typeInfo(T)) {
276 .Float => if (!math.approxEqRel(T, expected, actual, tolerance)) {
276 .float => if (!math.approxEqRel(T, expected, actual, tolerance)) {
277277 print("actual {}, not within relative tolerance {} of expected {}\n", .{ actual, tolerance, expected });
278278 return error.TestExpectedApproxEqRel;
279279 },
280280
281 .ComptimeFloat => @compileError("Cannot approximately compare two comptime_float values"),
281 .comptime_float => @compileError("Cannot approximately compare two comptime_float values"),
282282
283283 else => @compileError("Unable to compare non floating point values"),
284284 }
......@@ -415,7 +415,7 @@ fn SliceDiffer(comptime T: type) type {
415415 const full_index = self.start_index + i;
416416 const diff = if (i < self.actual.len) !std.meta.eql(self.actual[i], value) else true;
417417 if (diff) try self.ttyconf.setColor(writer, .red);
418 if (@typeInfo(T) == .Pointer) {
418 if (@typeInfo(T) == .pointer) {
419419 try writer.print("[{}]{*}: {any}\n", .{ full_index, value, value });
420420 } else {
421421 try writer.print("[{}]: {any}\n", .{ full_index, value });
......@@ -505,10 +505,10 @@ pub fn expectEqualSentinel(comptime T: type, comptime sentinel: T, expected: [:s
505505
506506 const expected_value_sentinel = blk: {
507507 switch (@typeInfo(@TypeOf(expected))) {
508 .Pointer => {
508 .pointer => {
509509 break :blk expected[expected.len];
510510 },
511 .Array => |array_info| {
511 .array => |array_info| {
512512 const indexable_outside_of_bounds = @as([]const array_info.child, &expected);
513513 break :blk indexable_outside_of_bounds[indexable_outside_of_bounds.len];
514514 },
......@@ -518,10 +518,10 @@ pub fn expectEqualSentinel(comptime T: type, comptime sentinel: T, expected: [:s
518518
519519 const actual_value_sentinel = blk: {
520520 switch (@typeInfo(@TypeOf(actual))) {
521 .Pointer => {
521 .pointer => {
522522 break :blk actual[actual.len];
523523 },
524 .Array => |array_info| {
524 .array => |array_info| {
525525 const indexable_outside_of_bounds = @as([]const array_info.child, &actual);
526526 break :blk indexable_outside_of_bounds[indexable_outside_of_bounds.len];
527527 },
......@@ -689,33 +689,33 @@ pub inline fn expectEqualDeep(expected: anytype, actual: anytype) error{TestExpe
689689
690690fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpectedEqual}!void {
691691 switch (@typeInfo(@TypeOf(actual))) {
692 .NoReturn,
693 .Opaque,
694 .Frame,
695 .AnyFrame,
692 .noreturn,
693 .@"opaque",
694 .frame,
695 .@"anyframe",
696696 => @compileError("value of type " ++ @typeName(@TypeOf(actual)) ++ " encountered"),
697697
698 .Undefined,
699 .Null,
700 .Void,
698 .undefined,
699 .null,
700 .void,
701701 => return,
702702
703 .Type => {
703 .type => {
704704 if (actual != expected) {
705705 print("expected type {s}, found type {s}\n", .{ @typeName(expected), @typeName(actual) });
706706 return error.TestExpectedEqual;
707707 }
708708 },
709709
710 .Bool,
711 .Int,
712 .Float,
713 .ComptimeFloat,
714 .ComptimeInt,
715 .EnumLiteral,
716 .Enum,
717 .Fn,
718 .ErrorSet,
710 .bool,
711 .int,
712 .float,
713 .comptime_float,
714 .comptime_int,
715 .enum_literal,
716 .@"enum",
717 .@"fn",
718 .error_set,
719719 => {
720720 if (actual != expected) {
721721 print("expected {}, found {}\n", .{ expected, actual });
......@@ -723,7 +723,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
723723 }
724724 },
725725
726 .Pointer => |pointer| {
726 .pointer => |pointer| {
727727 switch (pointer.size) {
728728 // We have no idea what is behind those pointers, so the best we can do is `==` check.
729729 .C, .Many => {
......@@ -735,7 +735,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
735735 .One => {
736736 // Length of those pointers are runtime value, so the best we can do is `==` check.
737737 switch (@typeInfo(pointer.child)) {
738 .Fn, .Opaque => {
738 .@"fn", .@"opaque" => {
739739 if (actual != expected) {
740740 print("expected {*}, found {*}\n", .{ expected, actual });
741741 return error.TestExpectedEqual;
......@@ -762,7 +762,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
762762 }
763763 },
764764
765 .Array => |_| {
765 .array => |_| {
766766 if (expected.len != actual.len) {
767767 print("Array len not the same, expected {d}, found {d}\n", .{ expected.len, actual.len });
768768 return error.TestExpectedEqual;
......@@ -778,9 +778,9 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
778778 }
779779 },
780780
781 .Vector => |info| {
782 if (info.len != @typeInfo(@TypeOf(actual)).Vector.len) {
783 print("Vector len not the same, expected {d}, found {d}\n", .{ info.len, @typeInfo(@TypeOf(actual)).Vector.len });
781 .vector => |info| {
782 if (info.len != @typeInfo(@TypeOf(actual)).vector.len) {
783 print("Vector len not the same, expected {d}, found {d}\n", .{ info.len, @typeInfo(@TypeOf(actual)).vector.len });
784784 return error.TestExpectedEqual;
785785 }
786786 var i: usize = 0;
......@@ -794,7 +794,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
794794 }
795795 },
796796
797 .Struct => |structType| {
797 .@"struct" => |structType| {
798798 inline for (structType.fields) |field| {
799799 expectEqualDeep(@field(expected, field.name), @field(actual, field.name)) catch |e| {
800800 print("Field {s} incorrect. expected {any}, found {any}\n", .{ field.name, @field(expected, field.name), @field(actual, field.name) });
......@@ -803,7 +803,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
803803 }
804804 },
805805
806 .Union => |union_info| {
806 .@"union" => |union_info| {
807807 if (union_info.tag_type == null) {
808808 @compileError("Unable to compare untagged union values");
809809 }
......@@ -823,7 +823,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
823823 }
824824 },
825825
826 .Optional => {
826 .optional => {
827827 if (expected) |expected_payload| {
828828 if (actual) |actual_payload| {
829829 try expectEqualDeep(expected_payload, actual_payload);
......@@ -839,7 +839,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
839839 }
840840 },
841841
842 .ErrorUnion => {
842 .error_union => {
843843 if (expected) |expected_payload| {
844844 if (actual) |actual_payload| {
845845 try expectEqualDeep(expected_payload, actual_payload);
......@@ -1036,20 +1036,20 @@ test {
10361036/// }
10371037/// ```
10381038pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime test_fn: anytype, extra_args: anytype) !void {
1039 switch (@typeInfo(@typeInfo(@TypeOf(test_fn)).Fn.return_type.?)) {
1040 .ErrorUnion => |info| {
1039 switch (@typeInfo(@typeInfo(@TypeOf(test_fn)).@"fn".return_type.?)) {
1040 .error_union => |info| {
10411041 if (info.payload != void) {
10421042 @compileError("Return type must be !void");
10431043 }
10441044 },
10451045 else => @compileError("Return type must be !void"),
10461046 }
1047 if (@typeInfo(@TypeOf(extra_args)) != .Struct) {
1047 if (@typeInfo(@TypeOf(extra_args)) != .@"struct") {
10481048 @compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(extra_args)));
10491049 }
10501050
10511051 const ArgsTuple = std.meta.ArgsTuple(@TypeOf(test_fn));
1052 const fn_args_fields = @typeInfo(ArgsTuple).Struct.fields;
1052 const fn_args_fields = @typeInfo(ArgsTuple).@"struct".fields;
10531053 if (fn_args_fields.len == 0 or fn_args_fields[0].type != std.mem.Allocator) {
10541054 @compileError("The provided function must have an " ++ @typeName(std.mem.Allocator) ++ " as its first argument");
10551055 }
......@@ -1061,7 +1061,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
10611061 // Setup the tuple that will actually be used with @call (we'll need to insert
10621062 // the failing allocator in field @"0" before each @call)
10631063 var args: ArgsTuple = undefined;
1064 inline for (@typeInfo(@TypeOf(extra_args)).Struct.fields, 0..) |field, i| {
1064 inline for (@typeInfo(@TypeOf(extra_args)).@"struct".fields, 0..) |field, i| {
10651065 const arg_i_str = comptime str: {
10661066 var str_buf: [100]u8 = undefined;
10671067 const args_i = i + 1;
......@@ -1129,7 +1129,7 @@ pub fn refAllDeclsRecursive(comptime T: type) void {
11291129 inline for (comptime std.meta.declarations(T)) |decl| {
11301130 if (@TypeOf(@field(T, decl.name)) == type) {
11311131 switch (@typeInfo(@field(T, decl.name))) {
1132 .Struct, .Enum, .Union, .Opaque => refAllDeclsRecursive(@field(T, decl.name)),
1132 .@"struct", .@"enum", .@"union", .@"opaque" => refAllDeclsRecursive(@field(T, decl.name)),
11331133 else => {},
11341134 }
11351135 }
lib/std/zig.zig+2-2
......@@ -246,7 +246,7 @@ pub const BuildId = union(enum) {
246246 hexstring: HexString,
247247
248248 pub fn eql(a: BuildId, b: BuildId) bool {
249 const Tag = @typeInfo(BuildId).Union.tag_type.?;
249 const Tag = @typeInfo(BuildId).@"union".tag_type.?;
250250 const a_tag: Tag = a;
251251 const b_tag: Tag = b;
252252 if (a_tag != b_tag) return false;
......@@ -654,7 +654,7 @@ pub fn parseTargetQueryOrReportFatalError(
654654 help: {
655655 var help_text = std.ArrayList(u8).init(allocator);
656656 defer help_text.deinit();
657 inline for (@typeInfo(std.Target.ObjectFormat).Enum.fields) |field| {
657 inline for (@typeInfo(std.Target.ObjectFormat).@"enum".fields) |field| {
658658 help_text.writer().print(" {s}\n", .{field.name}) catch break :help;
659659 }
660660 std.log.info("available object formats:\n{s}", .{help_text.items});
lib/std/zig/AstGen.zig+39-39
......@@ -153,7 +153,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir {
153153 try astgen.instructions.ensureTotalCapacity(gpa, tree.nodes.len);
154154
155155 // First few indexes of extra are reserved and set at the end.
156 const reserved_count = @typeInfo(Zir.ExtraIndex).Enum.fields.len;
156 const reserved_count = @typeInfo(Zir.ExtraIndex).@"enum".fields.len;
157157 try astgen.extra.ensureTotalCapacity(gpa, tree.nodes.len + reserved_count);
158158 astgen.extra.items.len += reserved_count;
159159
......@@ -197,7 +197,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir {
197197 astgen.extra.items[err_index] = 0;
198198 } else {
199199 try astgen.extra.ensureUnusedCapacity(gpa, 1 + astgen.compile_errors.items.len *
200 @typeInfo(Zir.Inst.CompileErrors.Item).Struct.fields.len);
200 @typeInfo(Zir.Inst.CompileErrors.Item).@"struct".fields.len);
201201
202202 astgen.extra.items[err_index] = astgen.addExtraAssumeCapacity(Zir.Inst.CompileErrors{
203203 .items_len = @intCast(astgen.compile_errors.items.len),
......@@ -212,8 +212,8 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir {
212212 if (astgen.imports.count() == 0) {
213213 astgen.extra.items[imports_index] = 0;
214214 } else {
215 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Imports).Struct.fields.len +
216 astgen.imports.count() * @typeInfo(Zir.Inst.Imports.Item).Struct.fields.len);
215 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Imports).@"struct".fields.len +
216 astgen.imports.count() * @typeInfo(Zir.Inst.Imports.Item).@"struct".fields.len);
217217
218218 astgen.extra.items[imports_index] = astgen.addExtraAssumeCapacity(Zir.Inst.Imports{
219219 .imports_len = @intCast(astgen.imports.count()),
......@@ -1885,7 +1885,7 @@ fn structInitExprAnon(
18851885 const payload_index = try addExtra(astgen, Zir.Inst.StructInitAnon{
18861886 .fields_len = @intCast(struct_init.ast.fields.len),
18871887 });
1888 const field_size = @typeInfo(Zir.Inst.StructInitAnon.Item).Struct.fields.len;
1888 const field_size = @typeInfo(Zir.Inst.StructInitAnon.Item).@"struct".fields.len;
18891889 var extra_index: usize = try reserveExtra(astgen, struct_init.ast.fields.len * field_size);
18901890
18911891 for (struct_init.ast.fields) |field_init| {
......@@ -1916,7 +1916,7 @@ fn structInitExprTyped(
19161916 const payload_index = try addExtra(astgen, Zir.Inst.StructInit{
19171917 .fields_len = @intCast(struct_init.ast.fields.len),
19181918 });
1919 const field_size = @typeInfo(Zir.Inst.StructInit.Item).Struct.fields.len;
1919 const field_size = @typeInfo(Zir.Inst.StructInit.Item).@"struct".fields.len;
19201920 var extra_index: usize = try reserveExtra(astgen, struct_init.ast.fields.len * field_size);
19211921
19221922 for (struct_init.ast.fields) |field_init| {
......@@ -2464,7 +2464,7 @@ fn labeledBlockExpr(
24642464 };
24652465 // We need to call `rvalue` to write through to the pointer only if we had a
24662466 // result pointer and aren't forwarding it.
2467 const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
2467 const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
24682468 const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
24692469
24702470 // Reserve the Block ZIR instruction index so that we can put it into the GenZir struct
......@@ -3864,7 +3864,7 @@ fn ptrType(
38643864 const gpa = gz.astgen.gpa;
38653865 try gz.instructions.ensureUnusedCapacity(gpa, 1);
38663866 try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1);
3867 try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.PtrType).Struct.fields.len +
3867 try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.PtrType).@"struct".fields.len +
38683868 trailing_count);
38693869
38703870 const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.PtrType{
......@@ -5939,7 +5939,7 @@ fn errorSetDecl(gz: *GenZir, ri: ResultInfo, node: Ast.Node.Index) InnerError!Zi
59395939 const main_tokens = tree.nodes.items(.main_token);
59405940 const token_tags = tree.tokens.items(.tag);
59415941
5942 const payload_index = try reserveExtra(astgen, @typeInfo(Zir.Inst.ErrorSetDecl).Struct.fields.len);
5942 const payload_index = try reserveExtra(astgen, @typeInfo(Zir.Inst.ErrorSetDecl).@"struct".fields.len);
59435943 var fields_len: usize = 0;
59445944 {
59455945 var idents: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .{};
......@@ -6078,7 +6078,7 @@ fn orelseCatchExpr(
60786078 };
60796079 // We need to call `rvalue` to write through to the pointer only if we had a
60806080 // result pointer and aren't forwarding it.
6081 const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
6081 const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
60826082 const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
60836083
60846084 const do_err_trace = astgen.fn_block != null and (cond_op == .is_non_err or cond_op == .is_non_err_ptr);
......@@ -6347,7 +6347,7 @@ fn ifExpr(
63476347 };
63486348 // We need to call `rvalue` to write through to the pointer only if we had a
63496349 // result pointer and aren't forwarding it.
6350 const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
6350 const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
63516351 const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
63526352
63536353 var block_scope = parent_gz.makeSubBlock(scope);
......@@ -6537,7 +6537,7 @@ fn setCondBrPayload(
65376537 const else_body_len = astgen.countBodyLenAfterFixups(else_body);
65386538 try astgen.extra.ensureUnusedCapacity(
65396539 astgen.gpa,
6540 @typeInfo(Zir.Inst.CondBr).Struct.fields.len + then_body_len + else_body_len,
6540 @typeInfo(Zir.Inst.CondBr).@"struct".fields.len + then_body_len + else_body_len,
65416541 );
65426542
65436543 const zir_datas = astgen.instructions.items(.data);
......@@ -6573,7 +6573,7 @@ fn whileExpr(
65736573 };
65746574 // We need to call `rvalue` to write through to the pointer only if we had a
65756575 // result pointer and aren't forwarding it.
6576 const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
6576 const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
65776577 const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
65786578
65796579 if (while_full.label_token) |label_token| {
......@@ -6853,7 +6853,7 @@ fn forExpr(
68536853 };
68546854 // We need to call `rvalue` to write through to the pointer only if we had a
68556855 // result pointer and aren't forwarding it.
6856 const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
6856 const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
68576857 const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
68586858
68596859 const is_inline = for_full.inline_token != null;
......@@ -6951,7 +6951,7 @@ fn forExpr(
69516951 // nicer error reporting as well as fewer ZIR bytes emitted.
69526952 const len: Zir.Inst.Ref = len: {
69536953 const lens_len: u32 = @intCast(lens.len);
6954 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.MultiOp).Struct.fields.len + lens_len);
6954 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.MultiOp).@"struct".fields.len + lens_len);
69556955 const len = try parent_gz.addPlNode(.for_len, node, Zir.Inst.MultiOp{
69566956 .operands_len = lens_len,
69576957 });
......@@ -7188,7 +7188,7 @@ fn switchExprErrUnion(
71887188
71897189 // We need to call `rvalue` to write through to the pointer only if we had a
71907190 // result pointer and aren't forwarding it.
7191 const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
7191 const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
71927192 const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
71937193 var scalar_cases_len: u32 = 0;
71947194 var multi_cases_len: u32 = 0;
......@@ -7622,10 +7622,10 @@ fn switchExprErrUnion(
76227622 // Now that the item expressions are generated we can add this.
76237623 try parent_gz.instructions.append(gpa, switch_block);
76247624
7625 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.SwitchBlockErrUnion).Struct.fields.len +
7625 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.SwitchBlockErrUnion).@"struct".fields.len +
76267626 @intFromBool(multi_cases_len != 0) +
76277627 payloads.items.len - case_table_end +
7628 (case_table_end - case_table_start) * @typeInfo(Zir.Inst.As).Struct.fields.len);
7628 (case_table_end - case_table_start) * @typeInfo(Zir.Inst.As).@"struct".fields.len);
76297629
76307630 const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.SwitchBlockErrUnion{
76317631 .operand = raw_operand,
......@@ -7705,7 +7705,7 @@ fn switchExpr(
77057705 };
77067706 // We need to call `rvalue` to write through to the pointer only if we had a
77077707 // result pointer and aren't forwarding it.
7708 const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
7708 const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
77097709 const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
77107710
77117711 // We perform two passes over the AST. This first pass is to collect information
......@@ -8068,11 +8068,11 @@ fn switchExpr(
80688068 // Now that the item expressions are generated we can add this.
80698069 try parent_gz.instructions.append(gpa, switch_block);
80708070
8071 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.SwitchBlock).Struct.fields.len +
8071 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.SwitchBlock).@"struct".fields.len +
80728072 @intFromBool(multi_cases_len != 0) +
80738073 @intFromBool(any_has_tag_capture) +
80748074 payloads.items.len - case_table_end +
8075 (case_table_end - case_table_start) * @typeInfo(Zir.Inst.As).Struct.fields.len);
8075 (case_table_end - case_table_start) * @typeInfo(Zir.Inst.As).@"struct".fields.len);
80768076
80778077 const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.SwitchBlock{
80788078 .operand = raw_operand,
......@@ -8971,7 +8971,7 @@ fn ptrCast(
89718971 const node_datas = tree.nodes.items(.data);
89728972 const node_tags = tree.nodes.items(.tag);
89738973
8974 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
8974 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
89758975 var flags: Zir.Inst.FullPtrCastFlags = .{};
89768976
89778977 // Note that all pointer cast builtins have one parameter, so we only need
......@@ -12080,7 +12080,7 @@ const GenZir = struct {
1208012080 const body_len = astgen.countBodyLenAfterFixups(body);
1208112081 try astgen.extra.ensureUnusedCapacity(
1208212082 gpa,
12083 @typeInfo(Zir.Inst.BoolBr).Struct.fields.len + body_len,
12083 @typeInfo(Zir.Inst.BoolBr).@"struct".fields.len + body_len,
1208412084 );
1208512085 const zir_datas = astgen.instructions.items(.data);
1208612086 zir_datas[@intFromEnum(bool_br)].pl_node.payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.BoolBr{
......@@ -12099,7 +12099,7 @@ const GenZir = struct {
1209912099 const body_len = astgen.countBodyLenAfterFixups(body);
1210012100 try astgen.extra.ensureUnusedCapacity(
1210112101 gpa,
12102 @typeInfo(Zir.Inst.Block).Struct.fields.len + body_len,
12102 @typeInfo(Zir.Inst.Block).@"struct".fields.len + body_len,
1210312103 );
1210412104 const zir_datas = astgen.instructions.items(.data);
1210512105 zir_datas[@intFromEnum(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity(
......@@ -12117,7 +12117,7 @@ const GenZir = struct {
1211712117 const body_len = astgen.countBodyLenAfterFixups(body);
1211812118 try astgen.extra.ensureUnusedCapacity(
1211912119 gpa,
12120 @typeInfo(Zir.Inst.Try).Struct.fields.len + body_len,
12120 @typeInfo(Zir.Inst.Try).@"struct".fields.len + body_len,
1212112121 );
1212212122 const zir_datas = astgen.instructions.items(.data);
1212312123 zir_datas[@intFromEnum(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity(
......@@ -12235,7 +12235,7 @@ const GenZir = struct {
1223512235
1223612236 try astgen.extra.ensureUnusedCapacity(
1223712237 gpa,
12238 @typeInfo(Zir.Inst.FuncFancy).Struct.fields.len +
12238 @typeInfo(Zir.Inst.FuncFancy).@"struct".fields.len +
1223912239 fancyFnExprExtraLen(astgen, align_body, args.align_ref) +
1224012240 fancyFnExprExtraLen(astgen, addrspace_body, args.addrspace_ref) +
1224112241 fancyFnExprExtraLen(astgen, section_body, args.section_ref) +
......@@ -12354,7 +12354,7 @@ const GenZir = struct {
1235412354 } else {
1235512355 try astgen.extra.ensureUnusedCapacity(
1235612356 gpa,
12357 @typeInfo(Zir.Inst.Func).Struct.fields.len + 1 +
12357 @typeInfo(Zir.Inst.Func).@"struct".fields.len + 1 +
1235812358 fancyFnExprExtraLen(astgen, ret_body, ret_ref) +
1235912359 body_len + src_locs_and_hash.len,
1236012360 );
......@@ -12428,7 +12428,7 @@ const GenZir = struct {
1242812428
1242912429 try astgen.extra.ensureUnusedCapacity(
1243012430 gpa,
12431 @typeInfo(Zir.Inst.ExtendedVar).Struct.fields.len +
12431 @typeInfo(Zir.Inst.ExtendedVar).@"struct".fields.len +
1243212432 @intFromBool(args.lib_name != .empty) +
1243312433 @intFromBool(args.align_inst != .none) +
1243412434 @intFromBool(args.init != .none),
......@@ -12590,7 +12590,7 @@ const GenZir = struct {
1259012590 const param_body = param_gz.instructionsSlice();
1259112591 const body_len = gz.astgen.countBodyLenAfterFixups(param_body);
1259212592 try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1);
12593 try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Param).Struct.fields.len + body_len);
12593 try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Param).@"struct".fields.len + body_len);
1259412594
1259512595 const doc_comment_index = if (first_doc_comment) |first|
1259612596 try gz.astgen.docCommentAsStringFromFirst(abs_tok_index, first)
......@@ -12663,7 +12663,7 @@ const GenZir = struct {
1266312663 try astgen.instructions.ensureUnusedCapacity(gpa, 1);
1266412664 try astgen.extra.ensureUnusedCapacity(
1266512665 gpa,
12666 @typeInfo(Zir.Inst.NodeMultiOp).Struct.fields.len + operands.len,
12666 @typeInfo(Zir.Inst.NodeMultiOp).@"struct".fields.len + operands.len,
1266712667 );
1266812668
1266912669 const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.NodeMultiOp{
......@@ -12904,7 +12904,7 @@ const GenZir = struct {
1290412904 ) !Zir.Inst.Index {
1290512905 const gpa = gz.astgen.gpa;
1290612906 try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1);
12907 try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Break).Struct.fields.len);
12907 try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Break).@"struct".fields.len);
1290812908
1290912909 const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len);
1291012910 gz.astgen.instructions.appendAssumeCapacity(.{
......@@ -13027,7 +13027,7 @@ const GenZir = struct {
1302713027 try astgen.instructions.ensureUnusedCapacity(gpa, 1);
1302813028 try astgen.extra.ensureUnusedCapacity(
1302913029 gpa,
13030 @typeInfo(Zir.Inst.AllocExtended).Struct.fields.len +
13030 @typeInfo(Zir.Inst.AllocExtended).@"struct".fields.len +
1303113031 @intFromBool(args.type_inst != .none) +
1303213032 @intFromBool(args.align_inst != .none),
1303313033 );
......@@ -13079,9 +13079,9 @@ const GenZir = struct {
1307913079
1308013080 try gz.instructions.ensureUnusedCapacity(gpa, 1);
1308113081 try astgen.instructions.ensureUnusedCapacity(gpa, 1);
13082 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Asm).Struct.fields.len +
13083 args.outputs.len * @typeInfo(Zir.Inst.Asm.Output).Struct.fields.len +
13084 args.inputs.len * @typeInfo(Zir.Inst.Asm.Input).Struct.fields.len +
13082 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Asm).@"struct".fields.len +
13083 args.outputs.len * @typeInfo(Zir.Inst.Asm.Output).@"struct".fields.len +
13084 args.inputs.len * @typeInfo(Zir.Inst.Asm.Input).@"struct".fields.len +
1308513085 args.clobbers.len);
1308613086
1308713087 const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.Asm{
......@@ -13190,7 +13190,7 @@ const GenZir = struct {
1319013190
1319113191 const fields_hash_arr: [4]u32 = @bitCast(args.fields_hash);
1319213192
13193 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.StructDecl).Struct.fields.len + 3);
13193 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.StructDecl).@"struct".fields.len + 3);
1319413194 const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.StructDecl{
1319513195 .fields_hash_0 = fields_hash_arr[0],
1319613196 .fields_hash_1 = fields_hash_arr[1],
......@@ -13251,7 +13251,7 @@ const GenZir = struct {
1325113251
1325213252 const fields_hash_arr: [4]u32 = @bitCast(args.fields_hash);
1325313253
13254 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.UnionDecl).Struct.fields.len + 5);
13254 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.UnionDecl).@"struct".fields.len + 5);
1325513255 const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.UnionDecl{
1325613256 .fields_hash_0 = fields_hash_arr[0],
1325713257 .fields_hash_1 = fields_hash_arr[1],
......@@ -13313,7 +13313,7 @@ const GenZir = struct {
1331313313
1331413314 const fields_hash_arr: [4]u32 = @bitCast(args.fields_hash);
1331513315
13316 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.EnumDecl).Struct.fields.len + 5);
13316 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.EnumDecl).@"struct".fields.len + 5);
1331713317 const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.EnumDecl{
1331813318 .fields_hash_0 = fields_hash_arr[0],
1331913319 .fields_hash_1 = fields_hash_arr[1],
......@@ -13366,7 +13366,7 @@ const GenZir = struct {
1336613366
1336713367 assert(args.src_node != 0);
1336813368
13369 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.OpaqueDecl).Struct.fields.len + 2);
13369 try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.OpaqueDecl).@"struct".fields.len + 2);
1337013370 const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.OpaqueDecl{
1337113371 .src_line = astgen.source_line,
1337213372 .src_node = args.src_node,
lib/std/zig/ErrorBundle.zig+6-6
......@@ -108,7 +108,7 @@ pub fn getSourceLocation(eb: ErrorBundle, index: SourceLocationIndex) SourceLoca
108108
109109pub fn getNotes(eb: ErrorBundle, index: MessageIndex) []const MessageIndex {
110110 const notes_len = eb.getErrorMessage(index).notes_len;
111 const start = @intFromEnum(index) + @typeInfo(ErrorMessage).Struct.fields.len;
111 const start = @intFromEnum(index) + @typeInfo(ErrorMessage).@"struct".fields.len;
112112 return @as([]const MessageIndex, @ptrCast(eb.extra[start..][0..notes_len]));
113113}
114114
......@@ -119,7 +119,7 @@ pub fn getCompileLogOutput(eb: ErrorBundle) [:0]const u8 {
119119/// Returns the requested data, as well as the new index which is at the start of the
120120/// trailers for the object.
121121fn extraData(eb: ErrorBundle, comptime T: type, index: usize) struct { data: T, end: usize } {
122 const fields = @typeInfo(T).Struct.fields;
122 const fields = @typeInfo(T).@"struct".fields;
123123 var i: usize = index;
124124 var result: T = undefined;
125125 inline for (fields) |field| {
......@@ -456,7 +456,7 @@ pub const Wip = struct {
456456
457457 pub fn reserveNotes(wip: *Wip, notes_len: u32) !u32 {
458458 try wip.extra.ensureUnusedCapacity(wip.gpa, notes_len +
459 notes_len * @typeInfo(ErrorBundle.ErrorMessage).Struct.fields.len);
459 notes_len * @typeInfo(ErrorBundle.ErrorMessage).@"struct".fields.len);
460460 wip.extra.items.len += notes_len;
461461 return @intCast(wip.extra.items.len - notes_len);
462462 }
......@@ -616,13 +616,13 @@ pub const Wip = struct {
616616
617617 fn addExtra(wip: *Wip, extra: anytype) Allocator.Error!u32 {
618618 const gpa = wip.gpa;
619 const fields = @typeInfo(@TypeOf(extra)).Struct.fields;
619 const fields = @typeInfo(@TypeOf(extra)).@"struct".fields;
620620 try wip.extra.ensureUnusedCapacity(gpa, fields.len);
621621 return addExtraAssumeCapacity(wip, extra);
622622 }
623623
624624 fn addExtraAssumeCapacity(wip: *Wip, extra: anytype) u32 {
625 const fields = @typeInfo(@TypeOf(extra)).Struct.fields;
625 const fields = @typeInfo(@TypeOf(extra)).@"struct".fields;
626626 const result: u32 = @intCast(wip.extra.items.len);
627627 wip.extra.items.len += fields.len;
628628 setExtra(wip, result, extra);
......@@ -630,7 +630,7 @@ pub const Wip = struct {
630630 }
631631
632632 fn setExtra(wip: *Wip, index: usize, extra: anytype) void {
633 const fields = @typeInfo(@TypeOf(extra)).Struct.fields;
633 const fields = @typeInfo(@TypeOf(extra)).@"struct".fields;
634634 var i = index;
635635 inline for (fields) |field| {
636636 wip.extra.items[i] = switch (field.type) {
lib/std/zig/Server.zig+3-3
......@@ -282,9 +282,9 @@ fn bswap(x: anytype) @TypeOf(x) {
282282
283283 const T = @TypeOf(x);
284284 switch (@typeInfo(T)) {
285 .Enum => return @as(T, @enumFromInt(@byteSwap(@intFromEnum(x)))),
286 .Int => return @byteSwap(x),
287 .Struct => |info| switch (info.layout) {
285 .@"enum" => return @as(T, @enumFromInt(@byteSwap(@intFromEnum(x)))),
286 .int => return @byteSwap(x),
287 .@"struct" => |info| switch (info.layout) {
288288 .@"extern" => {
289289 var result: T = undefined;
290290 inline for (info.fields) |field| {
lib/std/zig/Zir.zig+8-8
......@@ -68,7 +68,7 @@ fn ExtraData(comptime T: type) type {
6868/// Returns the requested data, as well as the new index which is at the start of the
6969/// trailers for the object.
7070pub fn extraData(code: Zir, comptime T: type, index: usize) ExtraData(T) {
71 const fields = @typeInfo(T).Struct.fields;
71 const fields = @typeInfo(T).@"struct".fields;
7272 var i: usize = index;
7373 var result: T = undefined;
7474 inline for (fields) |field| {
......@@ -1823,7 +1823,7 @@ pub const Inst = struct {
18231823
18241824 // Uncomment to view how many tag slots are available.
18251825 //comptime {
1826 // @compileLog("ZIR tags left: ", 256 - @typeInfo(Tag).Enum.fields.len);
1826 // @compileLog("ZIR tags left: ", 256 - @typeInfo(Tag).@"enum".fields.len);
18271827 //}
18281828 };
18291829
......@@ -3551,7 +3551,7 @@ pub fn declIterator(zir: Zir, decl_inst: Zir.Inst.Index) DeclIterator {
35513551 },
35523552 .struct_decl => {
35533553 const small: Inst.StructDecl.Small = @bitCast(extended.small);
3554 var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.StructDecl).Struct.fields.len);
3554 var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.StructDecl).@"struct".fields.len);
35553555 const captures_len = if (small.has_captures_len) captures_len: {
35563556 const captures_len = zir.extra[extra_index];
35573557 extra_index += 1;
......@@ -3584,7 +3584,7 @@ pub fn declIterator(zir: Zir, decl_inst: Zir.Inst.Index) DeclIterator {
35843584 },
35853585 .enum_decl => {
35863586 const small: Inst.EnumDecl.Small = @bitCast(extended.small);
3587 var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.EnumDecl).Struct.fields.len);
3587 var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.EnumDecl).@"struct".fields.len);
35883588 extra_index += @intFromBool(small.has_tag_type);
35893589 const captures_len = if (small.has_captures_len) captures_len: {
35903590 const captures_len = zir.extra[extra_index];
......@@ -3609,7 +3609,7 @@ pub fn declIterator(zir: Zir, decl_inst: Zir.Inst.Index) DeclIterator {
36093609 },
36103610 .union_decl => {
36113611 const small: Inst.UnionDecl.Small = @bitCast(extended.small);
3612 var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.UnionDecl).Struct.fields.len);
3612 var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.UnionDecl).@"struct".fields.len);
36133613 extra_index += @intFromBool(small.has_tag_type);
36143614 const captures_len = if (small.has_captures_len) captures_len: {
36153615 const captures_len = zir.extra[extra_index];
......@@ -3634,7 +3634,7 @@ pub fn declIterator(zir: Zir, decl_inst: Zir.Inst.Index) DeclIterator {
36343634 },
36353635 .opaque_decl => {
36363636 const small: Inst.OpaqueDecl.Small = @bitCast(extended.small);
3637 var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.OpaqueDecl).Struct.fields.len);
3637 var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.OpaqueDecl).@"struct".fields.len);
36383638 const decls_len = if (small.has_decls_len) decls_len: {
36393639 const decls_len = zir.extra[extra_index];
36403640 extra_index += 1;
......@@ -4607,7 +4607,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash {
46074607 const extra_index = extra.end +
46084608 extra.data.ret_body_len +
46094609 extra.data.body_len +
4610 @typeInfo(Inst.Func.SrcLocs).Struct.fields.len;
4610 @typeInfo(Inst.Func.SrcLocs).@"struct".fields.len;
46114611 return @bitCast([4]u32{
46124612 zir.extra[extra_index + 0],
46134613 zir.extra[extra_index + 1],
......@@ -4647,7 +4647,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash {
46474647 } else extra_index += @intFromBool(bits.has_ret_ty_ref);
46484648 extra_index += @intFromBool(bits.has_any_noalias);
46494649 extra_index += extra.data.body_len;
4650 extra_index += @typeInfo(Zir.Inst.Func.SrcLocs).Struct.fields.len;
4650 extra_index += @typeInfo(Zir.Inst.Func.SrcLocs).@"struct".fields.len;
46514651 return @bitCast([4]u32{
46524652 zir.extra[extra_index + 0],
46534653 zir.extra[extra_index + 1],
lib/std/zig/c_translation.zig+59-59
......@@ -9,60 +9,60 @@ pub fn cast(comptime DestType: type, target: anytype) DestType {
99 // this function should behave like transCCast in translate-c, except it's for macros
1010 const SourceType = @TypeOf(target);
1111 switch (@typeInfo(DestType)) {
12 .Fn => return castToPtr(*const DestType, SourceType, target),
13 .Pointer => return castToPtr(DestType, SourceType, target),
14 .Optional => |dest_opt| {
15 if (@typeInfo(dest_opt.child) == .Pointer) {
12 .@"fn" => return castToPtr(*const DestType, SourceType, target),
13 .pointer => return castToPtr(DestType, SourceType, target),
14 .optional => |dest_opt| {
15 if (@typeInfo(dest_opt.child) == .pointer) {
1616 return castToPtr(DestType, SourceType, target);
17 } else if (@typeInfo(dest_opt.child) == .Fn) {
17 } else if (@typeInfo(dest_opt.child) == .@"fn") {
1818 return castToPtr(?*const dest_opt.child, SourceType, target);
1919 }
2020 },
21 .Int => {
21 .int => {
2222 switch (@typeInfo(SourceType)) {
23 .Pointer => {
23 .pointer => {
2424 return castInt(DestType, @intFromPtr(target));
2525 },
26 .Optional => |opt| {
27 if (@typeInfo(opt.child) == .Pointer) {
26 .optional => |opt| {
27 if (@typeInfo(opt.child) == .pointer) {
2828 return castInt(DestType, @intFromPtr(target));
2929 }
3030 },
31 .Int => {
31 .int => {
3232 return castInt(DestType, target);
3333 },
34 .Fn => {
34 .@"fn" => {
3535 return castInt(DestType, @intFromPtr(&target));
3636 },
37 .Bool => {
37 .bool => {
3838 return @intFromBool(target);
3939 },
4040 else => {},
4141 }
4242 },
43 .Float => {
43 .float => {
4444 switch (@typeInfo(SourceType)) {
45 .Int => return @as(DestType, @floatFromInt(target)),
46 .Float => return @as(DestType, @floatCast(target)),
47 .Bool => return @as(DestType, @floatFromInt(@intFromBool(target))),
45 .int => return @as(DestType, @floatFromInt(target)),
46 .float => return @as(DestType, @floatCast(target)),
47 .bool => return @as(DestType, @floatFromInt(@intFromBool(target))),
4848 else => {},
4949 }
5050 },
51 .Union => |info| {
51 .@"union" => |info| {
5252 inline for (info.fields) |field| {
5353 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 },
57 .Bool => return cast(usize, target) != 0,
57 .bool => return cast(usize, target) != 0,
5858 else => {},
5959 }
6060 return @as(DestType, target);
6161}
6262
6363fn castInt(comptime DestType: type, target: anytype) DestType {
64 const dest = @typeInfo(DestType).Int;
65 const source = @typeInfo(@TypeOf(target)).Int;
64 const dest = @typeInfo(DestType).int;
65 const source = @typeInfo(@TypeOf(target)).int;
6666
6767 if (dest.bits < source.bits)
6868 return @as(DestType, @bitCast(@as(std.meta.Int(source.signedness, dest.bits), @truncate(target))))
......@@ -76,20 +76,20 @@ fn castPtr(comptime DestType: type, target: anytype) DestType {
7676
7777fn castToPtr(comptime DestType: type, comptime SourceType: type, target: anytype) DestType {
7878 switch (@typeInfo(SourceType)) {
79 .Int => {
79 .int => {
8080 return @as(DestType, @ptrFromInt(castInt(usize, target)));
8181 },
82 .ComptimeInt => {
82 .comptime_int => {
8383 if (target < 0)
8484 return @as(DestType, @ptrFromInt(@as(usize, @bitCast(@as(isize, @intCast(target))))))
8585 else
8686 return @as(DestType, @ptrFromInt(@as(usize, @intCast(target))));
8787 },
88 .Pointer => {
88 .pointer => {
8989 return castPtr(DestType, target);
9090 },
91 .Optional => |target_opt| {
92 if (@typeInfo(target_opt.child) == .Pointer) {
91 .optional => |target_opt| {
92 if (@typeInfo(target_opt.child) == .pointer) {
9393 return castPtr(DestType, target);
9494 }
9595 },
......@@ -100,8 +100,8 @@ fn castToPtr(comptime DestType: type, comptime SourceType: type, target: anytype
100100
101101fn ptrInfo(comptime PtrType: type) std.builtin.Type.Pointer {
102102 return switch (@typeInfo(PtrType)) {
103 .Optional => |opt_info| @typeInfo(opt_info.child).Pointer,
104 .Pointer => |ptr_info| ptr_info,
103 .optional => |opt_info| @typeInfo(opt_info.child).pointer,
104 .pointer => |ptr_info| ptr_info,
105105 else => unreachable,
106106 };
107107}
......@@ -144,17 +144,17 @@ test "cast" {
144144pub fn sizeof(target: anytype) usize {
145145 const T: type = if (@TypeOf(target) == type) target else @TypeOf(target);
146146 switch (@typeInfo(T)) {
147 .Float, .Int, .Struct, .Union, .Array, .Bool, .Vector => return @sizeOf(T),
148 .Fn => {
147 .float, .int, .@"struct", .@"union", .array, .bool, .vector => return @sizeOf(T),
148 .@"fn" => {
149149 // sizeof(main) in C returns 1
150150 return 1;
151151 },
152 .Null => return @sizeOf(*anyopaque),
153 .Void => {
152 .null => return @sizeOf(*anyopaque),
153 .void => {
154154 // Note: sizeof(void) is 1 on clang/gcc and 0 on MSVC.
155155 return 1;
156156 },
157 .Opaque => {
157 .@"opaque" => {
158158 if (T == anyopaque) {
159159 // Note: sizeof(void) is 1 on clang/gcc and 0 on MSVC.
160160 return 1;
......@@ -162,24 +162,24 @@ pub fn sizeof(target: anytype) usize {
162162 @compileError("Cannot use C sizeof on opaque type " ++ @typeName(T));
163163 }
164164 },
165 .Optional => |opt| {
166 if (@typeInfo(opt.child) == .Pointer) {
165 .optional => |opt| {
166 if (@typeInfo(opt.child) == .pointer) {
167167 return sizeof(opt.child);
168168 } else {
169169 @compileError("Cannot use C sizeof on non-pointer optional " ++ @typeName(T));
170170 }
171171 },
172 .Pointer => |ptr| {
172 .pointer => |ptr| {
173173 if (ptr.size == .Slice) {
174174 @compileError("Cannot use C sizeof on slice type " ++ @typeName(T));
175175 }
176176 // for strings, sizeof("a") returns 2.
177177 // normal pointer decay scenarios from C are handled
178 // in the .Array case above, but strings remain literals
178 // in the .array case above, but strings remain literals
179179 // and are therefore always pointers, so they need to be
180180 // specially handled here.
181 if (ptr.size == .One and ptr.is_const and @typeInfo(ptr.child) == .Array) {
182 const array_info = @typeInfo(ptr.child).Array;
181 if (ptr.size == .One and ptr.is_const and @typeInfo(ptr.child) == .array) {
182 const array_info = @typeInfo(ptr.child).array;
183183 if ((array_info.child == u8 or array_info.child == u16) and
184184 array_info.sentinel != null and
185185 @as(*align(1) const array_info.child, @ptrCast(array_info.sentinel.?)).* == 0)
......@@ -195,8 +195,8 @@ pub fn sizeof(target: anytype) usize {
195195 }
196196 return @sizeOf(T);
197197 },
198 .ComptimeFloat => return @sizeOf(f64), // TODO c_double #3999
199 .ComptimeInt => {
198 .comptime_float => return @sizeOf(f64), // TODO c_double #3999
199 .comptime_int => {
200200 // TODO to get the correct result we have to translate
201201 // `1073741824 * 4` as `int(1073741824) *% int(4)` since
202202 // sizeof(1073741824 * 4) != sizeof(4294967296).
......@@ -262,7 +262,7 @@ fn PromoteIntLiteralReturnType(comptime SuffixType: type, comptime number: compt
262262 const signed_oct_hex = [_]type{ c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong };
263263 const unsigned = [_]type{ c_uint, c_ulong, c_ulonglong };
264264
265 const list: []const type = if (@typeInfo(SuffixType).Int.signedness == .unsigned)
265 const list: []const type = if (@typeInfo(SuffixType).int.signedness == .unsigned)
266266 &unsigned
267267 else if (base == .decimal)
268268 &signed_decimal
......@@ -339,8 +339,8 @@ test "shuffleVectorIndex" {
339339/// from SelfType for pointing to a C flexible array of ElementType.
340340pub fn FlexibleArrayType(comptime SelfType: type, comptime ElementType: type) type {
341341 switch (@typeInfo(SelfType)) {
342 .Pointer => |ptr| {
343 return @Type(.{ .Pointer = .{
342 .pointer => |ptr| {
343 return @Type(.{ .pointer = .{
344344 .size = .C,
345345 .is_const = ptr.is_const,
346346 .is_volatile = ptr.is_volatile,
......@@ -372,7 +372,7 @@ test "Flexible Array Type" {
372372/// the type and denominator is -1. C has undefined behavior for those two cases; this function has safety
373373/// checked undefined behavior
374374pub fn signedRemainder(numerator: anytype, denominator: anytype) @TypeOf(numerator, denominator) {
375 std.debug.assert(@typeInfo(@TypeOf(numerator, denominator)).Int.signedness == .signed);
375 std.debug.assert(@typeInfo(@TypeOf(numerator, denominator)).int.signedness == .signed);
376376 if (denominator > 0) return @rem(numerator, denominator);
377377 return numerator - @divTrunc(numerator, denominator) * denominator;
378378}
......@@ -384,15 +384,15 @@ pub const Macros = struct {
384384
385385 fn L_SUFFIX_ReturnType(comptime number: anytype) type {
386386 switch (@typeInfo(@TypeOf(number))) {
387 .Int, .ComptimeInt => return @TypeOf(promoteIntLiteral(c_long, number, .decimal)),
388 .Float, .ComptimeFloat => return c_longdouble,
387 .int, .comptime_int => return @TypeOf(promoteIntLiteral(c_long, number, .decimal)),
388 .float, .comptime_float => return c_longdouble,
389389 else => @compileError("Invalid value for L suffix"),
390390 }
391391 }
392392 pub fn L_SUFFIX(comptime number: anytype) L_SUFFIX_ReturnType(number) {
393393 switch (@typeInfo(@TypeOf(number))) {
394 .Int, .ComptimeInt => return promoteIntLiteral(c_long, number, .decimal),
395 .Float, .ComptimeFloat => @compileError("TODO: c_longdouble initialization from comptime_float not supported"),
394 .int, .comptime_int => return promoteIntLiteral(c_long, number, .decimal),
395 .float, .comptime_float => @compileError("TODO: c_longdouble initialization from comptime_float not supported"),
396396 else => @compileError("Invalid value for L suffix"),
397397 }
398398 }
......@@ -420,13 +420,13 @@ pub const Macros = struct {
420420 /// A 2-argument function-like macro defined as #define FOO(A, B) (A)(B)
421421 /// could be either: cast B to A, or call A with the value B.
422422 pub fn CAST_OR_CALL(a: anytype, b: anytype) switch (@typeInfo(@TypeOf(a))) {
423 .Type => a,
424 .Fn => |fn_info| fn_info.return_type orelse void,
423 .type => a,
424 .@"fn" => |fn_info| fn_info.return_type orelse void,
425425 else => |info| @compileError("Unexpected argument type: " ++ @tagName(info)),
426426 } {
427427 switch (@typeInfo(@TypeOf(a))) {
428 .Type => return cast(a, b),
429 .Fn => return a(b),
428 .type => return cast(a, b),
429 .@"fn" => return a(b),
430430 else => unreachable, // return type will be a compile error otherwise
431431 }
432432 }
......@@ -444,7 +444,7 @@ fn PromotedIntType(comptime T: type) type {
444444 c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong => T,
445445 else => if (T == comptime_int) {
446446 @compileError("Cannot promote `" ++ @typeName(T) ++ "`; a fixed-size number type is required");
447 } else if (@typeInfo(T) == .Int) {
447 } else if (@typeInfo(T) == .int) {
448448 @compileError("Cannot promote `" ++ @typeName(T) ++ "`; a C ABI type is required");
449449 } else {
450450 @compileError("Attempted to promote invalid type `" ++ @typeName(T) ++ "`");
......@@ -490,8 +490,8 @@ fn ArithmeticConversion(comptime A: type, comptime B: type) type {
490490
491491 if (A_Promoted == B_Promoted) return A_Promoted;
492492
493 const a_signed = @typeInfo(A_Promoted).Int.signedness == .signed;
494 const b_signed = @typeInfo(B_Promoted).Int.signedness == .signed;
493 const a_signed = @typeInfo(A_Promoted).int.signedness == .signed;
494 const b_signed = @typeInfo(B_Promoted).int.signedness == .signed;
495495
496496 if (a_signed == b_signed) {
497497 return if (integerRank(A_Promoted) > integerRank(B_Promoted)) A_Promoted else B_Promoted;
......@@ -544,8 +544,8 @@ pub const MacroArithmetic = struct {
544544 const a_casted = cast(ResType, a);
545545 const b_casted = cast(ResType, b);
546546 switch (@typeInfo(ResType)) {
547 .Float => return a_casted / b_casted,
548 .Int => return @divTrunc(a_casted, b_casted),
547 .float => return a_casted / b_casted,
548 .int => return @divTrunc(a_casted, b_casted),
549549 else => unreachable,
550550 }
551551 }
......@@ -555,8 +555,8 @@ pub const MacroArithmetic = struct {
555555 const a_casted = cast(ResType, a);
556556 const b_casted = cast(ResType, b);
557557 switch (@typeInfo(ResType)) {
558 .Int => {
559 if (@typeInfo(ResType).Int.signedness == .signed) {
558 .int => {
559 if (@typeInfo(ResType).int.signedness == .signed) {
560560 return signedRemainder(a_casted, b_casted);
561561 } else {
562562 return a_casted % b_casted;
lib/std/zig/parser_test.zig+1-1
......@@ -2548,7 +2548,7 @@ test "zig fmt: same-line comment after non-block if expression" {
25482548test "zig fmt: same-line comment on comptime expression" {
25492549 try testCanonical(
25502550 \\test "" {
2551 \\ comptime assert(@typeInfo(T) == .Int); // must pass an integer to absInt
2551 \\ comptime assert(@typeInfo(T) == .int); // must pass an integer to absInt
25522552 \\}
25532553 \\
25542554 );
lib/std/zig/system/windows.zig+2-2
......@@ -56,11 +56,11 @@ fn getCpuInfoFromRegistry(core: usize, args: anytype) !void {
5656 const ArgsType = @TypeOf(args);
5757 const args_type_info = @typeInfo(ArgsType);
5858
59 if (args_type_info != .Struct) {
59 if (args_type_info != .@"struct") {
6060 @compileError("expected tuple or struct argument, found " ++ @typeName(ArgsType));
6161 }
6262
63 const fields_info = args_type_info.Struct.fields;
63 const fields_info = args_type_info.@"struct".fields;
6464
6565 // Originally, I wanted to issue a single call with a more complex table structure such that we
6666 // would sequentially visit each CPU#d subkey in the registry and pull the value of interest into
src/Air/types_resolved.zig+25-25
......@@ -272,7 +272,7 @@ fn checkBody(air: Air, body: []const Air.Inst.Index, zcu: *Zcu) bool {
272272 const elems_len: usize = @intCast(ty.arrayLen(zcu));
273273 const elems: []const Air.Inst.Ref = @ptrCast(air.extra[data.ty_pl.payload..][0..elems_len]);
274274 if (!checkType(ty, zcu)) return false;
275 if (ty.zigTypeTag(zcu) == .Struct) {
275 if (ty.zigTypeTag(zcu) == .@"struct") {
276276 for (elems, 0..) |elem, elem_idx| {
277277 if (ty.structFieldIsComptime(elem_idx, zcu)) continue;
278278 if (!checkRef(elem, zcu)) return false;
......@@ -453,35 +453,35 @@ pub fn checkType(ty: Type, zcu: *Zcu) bool {
453453 return switch (ty.zigTypeTagOrPoison(zcu) catch |err| switch (err) {
454454 error.GenericPoison => return true,
455455 }) {
456 .Type,
457 .Void,
458 .Bool,
459 .NoReturn,
460 .Int,
461 .Float,
462 .ErrorSet,
463 .Enum,
464 .Opaque,
465 .Vector,
456 .type,
457 .void,
458 .bool,
459 .noreturn,
460 .int,
461 .float,
462 .error_set,
463 .@"enum",
464 .@"opaque",
465 .vector,
466466 // These types can appear due to some dummy instructions Sema introduces and expects to be omitted by Liveness.
467467 // It's a little silly -- but fine, we'll return `true`.
468 .ComptimeFloat,
469 .ComptimeInt,
470 .Undefined,
471 .Null,
472 .EnumLiteral,
468 .comptime_float,
469 .comptime_int,
470 .undefined,
471 .null,
472 .enum_literal,
473473 => true,
474474
475 .Frame,
476 .AnyFrame,
475 .frame,
476 .@"anyframe",
477477 => @panic("TODO Air.types_resolved.checkType async frames"),
478478
479 .Optional => checkType(ty.childType(zcu), zcu),
480 .ErrorUnion => checkType(ty.errorUnionPayload(zcu), zcu),
481 .Pointer => checkType(ty.childType(zcu), zcu),
482 .Array => checkType(ty.childType(zcu), zcu),
479 .optional => checkType(ty.childType(zcu), zcu),
480 .error_union => checkType(ty.errorUnionPayload(zcu), zcu),
481 .pointer => checkType(ty.childType(zcu), zcu),
482 .array => checkType(ty.childType(zcu), zcu),
483483
484 .Fn => {
484 .@"fn" => {
485485 const info = zcu.typeToFunc(ty).?;
486486 for (0..info.param_types.len) |i| {
487487 const param_ty = info.param_types.get(ip)[i];
......@@ -489,7 +489,7 @@ pub fn checkType(ty: Type, zcu: *Zcu) bool {
489489 }
490490 return checkType(Type.fromInterned(info.return_type), zcu);
491491 },
492 .Struct => switch (ip.indexToKey(ty.toIntern())) {
492 .@"struct" => switch (ip.indexToKey(ty.toIntern())) {
493493 .struct_type => {
494494 const struct_obj = zcu.typeToStruct(ty).?;
495495 return switch (struct_obj.layout) {
......@@ -508,6 +508,6 @@ pub fn checkType(ty: Type, zcu: *Zcu) bool {
508508 },
509509 else => unreachable,
510510 },
511 .Union => return zcu.typeToUnion(ty).?.flagsUnordered(ip).status == .fully_resolved,
511 .@"union" => return zcu.typeToUnion(ty).?.flagsUnordered(ip).status == .fully_resolved,
512512 };
513513}
src/Compilation.zig+5-5
......@@ -384,7 +384,7 @@ const Job = union(enum) {
384384 /// The value is the index into `system_libs`.
385385 windows_import_lib: usize,
386386
387 const Tag = @typeInfo(Job).Union.tag_type.?;
387 const Tag = @typeInfo(Job).@"union".tag_type.?;
388388 fn stage(tag: Tag) usize {
389389 return switch (tag) {
390390 // Prioritize functions so that codegen can get to work on them on a
......@@ -911,7 +911,7 @@ pub const cache_helpers = struct {
911911 }
912912
913913 pub fn addDebugFormat(hh: *Cache.HashHelper, x: Config.DebugFormat) void {
914 const tag: @typeInfo(Config.DebugFormat).Union.tag_type.? = x;
914 const tag: @typeInfo(Config.DebugFormat).@"union".tag_type.? = x;
915915 hh.add(tag);
916916 switch (x) {
917917 .strip, .code_view => {},
......@@ -1486,7 +1486,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
14861486 .emit_asm = options.emit_asm,
14871487 .emit_llvm_ir = options.emit_llvm_ir,
14881488 .emit_llvm_bc = options.emit_llvm_bc,
1489 .work_queues = .{std.fifo.LinearFifo(Job, .Dynamic).init(gpa)} ** @typeInfo(std.meta.FieldType(Compilation, .work_queues)).Array.len,
1489 .work_queues = .{std.fifo.LinearFifo(Job, .Dynamic).init(gpa)} ** @typeInfo(std.meta.FieldType(Compilation, .work_queues)).array.len,
14901490 .codegen_work = if (InternPool.single_threaded) {} else .{
14911491 .mutex = .{},
14921492 .cond = .{},
......@@ -3113,8 +3113,8 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle {
31133113 err: *?Error,
31143114
31153115 const Error = @typeInfo(
3116 @typeInfo(@TypeOf(Zcu.SrcLoc.span)).Fn.return_type.?,
3117 ).ErrorUnion.error_set;
3116 @typeInfo(@TypeOf(Zcu.SrcLoc.span)).@"fn".return_type.?,
3117 ).error_union.error_set;
31183118
31193119 pub fn lessThan(ctx: @This(), lhs_index: usize, rhs_index: usize) bool {
31203120 if (ctx.err.*) |_| return lhs_index < rhs_index;
src/InternPool.zig+93-93
......@@ -893,7 +893,7 @@ const Local = struct {
893893 };
894894
895895 fn List(comptime Elem: type) type {
896 assert(@typeInfo(Elem) == .Struct);
896 assert(@typeInfo(Elem) == .@"struct");
897897 return struct {
898898 bytes: [*]align(@alignOf(Elem)) u8,
899899
......@@ -907,7 +907,7 @@ const Local = struct {
907907 const fields = std.enums.values(std.meta.FieldEnum(Elem));
908908
909909 fn PtrArrayElem(comptime len: usize) type {
910 const elem_info = @typeInfo(Elem).Struct;
910 const elem_info = @typeInfo(Elem).@"struct";
911911 const elem_fields = elem_info.fields;
912912 var new_fields: [elem_fields.len]std.builtin.Type.StructField = undefined;
913913 for (&new_fields, elem_fields) |*new_field, elem_field| new_field.* = .{
......@@ -917,7 +917,7 @@ const Local = struct {
917917 .is_comptime = false,
918918 .alignment = 0,
919919 };
920 return @Type(.{ .Struct = .{
920 return @Type(.{ .@"struct" = .{
921921 .layout = .auto,
922922 .fields = &new_fields,
923923 .decls = &.{},
......@@ -928,12 +928,12 @@ const Local = struct {
928928 size: std.builtin.Type.Pointer.Size,
929929 is_const: bool = false,
930930 }) type {
931 const elem_info = @typeInfo(Elem).Struct;
931 const elem_info = @typeInfo(Elem).@"struct";
932932 const elem_fields = elem_info.fields;
933933 var new_fields: [elem_fields.len]std.builtin.Type.StructField = undefined;
934934 for (&new_fields, elem_fields) |*new_field, elem_field| new_field.* = .{
935935 .name = elem_field.name,
936 .type = @Type(.{ .Pointer = .{
936 .type = @Type(.{ .pointer = .{
937937 .size = opts.size,
938938 .is_const = opts.is_const,
939939 .is_volatile = false,
......@@ -947,7 +947,7 @@ const Local = struct {
947947 .is_comptime = false,
948948 .alignment = 0,
949949 };
950 return @Type(.{ .Struct = .{
950 return @Type(.{ .@"struct" = .{
951951 .layout = .auto,
952952 .fields = &new_fields,
953953 .decls = &.{},
......@@ -1306,7 +1306,7 @@ const Shard = struct {
13061306 };
13071307
13081308 fn Map(comptime Value: type) type {
1309 comptime assert(@typeInfo(Value).Enum.tag_type == u32);
1309 comptime assert(@typeInfo(Value).@"enum".tag_type == u32);
13101310 _ = @as(Value, .none); // expected .none key
13111311 return struct {
13121312 /// header: Header,
......@@ -2254,7 +2254,7 @@ pub const Key = union(enum) {
22542254 byte_offset: u64,
22552255
22562256 pub const BaseAddr = union(enum) {
2257 const Tag = @typeInfo(BaseAddr).Union.tag_type.?;
2257 const Tag = @typeInfo(BaseAddr).@"union".tag_type.?;
22582258
22592259 /// Points to the value of a single `Nav`, which may be constant or a `variable`.
22602260 nav: Nav.Index,
......@@ -2411,7 +2411,7 @@ pub const Key = union(enum) {
24112411
24122412 pub fn hash64(key: Key, ip: *const InternPool) u64 {
24132413 const asBytes = std.mem.asBytes;
2414 const KeyTag = @typeInfo(Key).Union.tag_type.?;
2414 const KeyTag = @typeInfo(Key).@"union".tag_type.?;
24152415 const seed = @intFromEnum(@as(KeyTag, key));
24162416 return switch (key) {
24172417 // TODO: assert no padding in these types
......@@ -2487,7 +2487,7 @@ pub const Key = union(enum) {
24872487 .lazy_align, .lazy_size => |lazy_ty| {
24882488 std.hash.autoHash(
24892489 &hasher,
2490 @as(@typeInfo(Key.Int.Storage).Union.tag_type.?, int.storage),
2490 @as(@typeInfo(Key.Int.Storage).@"union".tag_type.?, int.storage),
24912491 );
24922492 std.hash.autoHash(&hasher, lazy_ty);
24932493 },
......@@ -2651,7 +2651,7 @@ pub const Key = union(enum) {
26512651 }
26522652
26532653 pub fn eql(a: Key, b: Key, ip: *const InternPool) bool {
2654 const KeyTag = @typeInfo(Key).Union.tag_type.?;
2654 const KeyTag = @typeInfo(Key).@"union".tag_type.?;
26552655 const a_tag: KeyTag = a;
26562656 const b_tag: KeyTag = b;
26572657 if (a_tag != b_tag) return false;
......@@ -2861,7 +2861,7 @@ pub const Key = union(enum) {
28612861 return a_val == b_val;
28622862 }
28632863
2864 const StorageTag = @typeInfo(Key.Float.Storage).Union.tag_type.?;
2864 const StorageTag = @typeInfo(Key.Float.Storage).@"union".tag_type.?;
28652865 assert(@as(StorageTag, a_info.storage) == @as(StorageTag, b_info.storage));
28662866
28672867 switch (a_info.storage) {
......@@ -2905,7 +2905,7 @@ pub const Key = union(enum) {
29052905 if (a_info.ty != b_info.ty) return false;
29062906
29072907 const len = ip.aggregateTypeLen(a_info.ty);
2908 const StorageTag = @typeInfo(Key.Aggregate.Storage).Union.tag_type.?;
2908 const StorageTag = @typeInfo(Key.Aggregate.Storage).@"union".tag_type.?;
29092909 if (@as(StorageTag, a_info.storage) != @as(StorageTag, b_info.storage)) {
29102910 for (0..@intCast(len)) |elem_index| {
29112911 const a_elem = switch (a_info.storage) {
......@@ -4000,7 +4000,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
40004000 const zir_index: TrackedInst.Index = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "zir_index").?]);
40014001 const fields_len = extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "fields_len").?];
40024002 const flags: Tag.TypeStruct.Flags = @bitCast(@atomicLoad(u32, &extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "flags").?], .unordered));
4003 var extra_index = item.data + @as(u32, @typeInfo(Tag.TypeStruct).Struct.fields.len);
4003 var extra_index = item.data + @as(u32, @typeInfo(Tag.TypeStruct).@"struct".fields.len);
40044004 const captures_len = if (flags.any_captures) c: {
40054005 const len = extra_list.view().items(.@"0")[extra_index];
40064006 extra_index += 1;
......@@ -4105,7 +4105,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
41054105 const namespace: NamespaceIndex = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "namespace").?]);
41064106 const names_map: MapIndex = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "names_map").?]);
41074107 const flags: Tag.TypeStructPacked.Flags = @bitCast(@atomicLoad(u32, &extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "flags").?], .unordered));
4108 var extra_index = item.data + @as(u32, @typeInfo(Tag.TypeStructPacked).Struct.fields.len);
4108 var extra_index = item.data + @as(u32, @typeInfo(Tag.TypeStructPacked).@"struct".fields.len);
41094109 const has_inits = item.tag == .type_struct_packed_inits;
41104110 const captures_len = if (flags.any_captures) c: {
41114111 const len = extra_list.view().items(.@"0")[extra_index];
......@@ -4711,9 +4711,9 @@ pub const Index = enum(u32) {
47114711 },
47124712 }) void {
47134713 _ = self;
4714 const map_fields = @typeInfo(@typeInfo(@TypeOf(tag_to_encoding_map)).Pointer.child).Struct.fields;
4714 const map_fields = @typeInfo(@typeInfo(@TypeOf(tag_to_encoding_map)).pointer.child).@"struct".fields;
47154715 @setEvalBranchQuota(2_000);
4716 inline for (@typeInfo(Tag).Enum.fields, 0..) |tag, start| {
4716 inline for (@typeInfo(Tag).@"enum".fields, 0..) |tag, start| {
47174717 inline for (0..map_fields.len) |offset| {
47184718 if (comptime std.mem.eql(u8, tag.name, map_fields[(start + offset) % map_fields.len].name)) break;
47194719 } else {
......@@ -6384,7 +6384,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key {
63846384 const extra_items = extra_list.view().items(.@"0");
63856385 const zir_index: TrackedInst.Index = @enumFromInt(extra_items[data + std.meta.fieldIndex(Tag.TypeStruct, "zir_index").?]);
63866386 const flags: Tag.TypeStruct.Flags = @bitCast(@atomicLoad(u32, &extra_items[data + std.meta.fieldIndex(Tag.TypeStruct, "flags").?], .unordered));
6387 const end_extra_index = data + @as(u32, @typeInfo(Tag.TypeStruct).Struct.fields.len);
6387 const end_extra_index = data + @as(u32, @typeInfo(Tag.TypeStruct).@"struct".fields.len);
63886388 if (flags.is_reified) {
63896389 assert(!flags.any_captures);
63906390 break :ns .{ .reified = .{
......@@ -6407,7 +6407,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key {
64076407 const extra_items = extra_list.view().items(.@"0");
64086408 const zir_index: TrackedInst.Index = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "zir_index").?]);
64096409 const flags: Tag.TypeStructPacked.Flags = @bitCast(@atomicLoad(u32, &extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "flags").?], .unordered));
6410 const end_extra_index = data + @as(u32, @typeInfo(Tag.TypeStructPacked).Struct.fields.len);
6410 const end_extra_index = data + @as(u32, @typeInfo(Tag.TypeStructPacked).@"struct".fields.len);
64116411 if (flags.is_reified) {
64126412 assert(!flags.any_captures);
64136413 break :ns .{ .reified = .{
......@@ -6922,7 +6922,7 @@ fn extraFuncInstance(ip: *const InternPool, tid: Zcu.PerThread.Id, extra: Local.
69226922 const ty: Index = @enumFromInt(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "ty").?]);
69236923 const generic_owner: Index = @enumFromInt(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "generic_owner").?]);
69246924 const func_decl = ip.funcDeclInfo(generic_owner);
6925 const end_extra_index = extra_index + @as(u32, @typeInfo(Tag.FuncInstance).Struct.fields.len);
6925 const end_extra_index = extra_index + @as(u32, @typeInfo(Tag.FuncInstance).@"struct".fields.len);
69266926 return .{
69276927 .tid = tid,
69286928 .ty = ty,
......@@ -7288,7 +7288,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
72887288 const names_map = try ip.addMap(gpa, tid, names.len);
72897289 ip.addStringsToMap(names_map, names);
72907290 const names_len = error_set_type.names.len;
7291 try extra.ensureUnusedCapacity(@typeInfo(Tag.ErrorSet).Struct.fields.len + names_len);
7291 try extra.ensureUnusedCapacity(@typeInfo(Tag.ErrorSet).@"struct".fields.len + names_len);
72927292 items.appendAssumeCapacity(.{
72937293 .tag = .type_error_set,
72947294 .data = addExtraAssumeCapacity(extra, Tag.ErrorSet{
......@@ -7883,7 +7883,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
78837883 .repeated_elem => |elem| elem,
78847884 };
78857885
7886 try extra.ensureUnusedCapacity(@typeInfo(Repeated).Struct.fields.len);
7886 try extra.ensureUnusedCapacity(@typeInfo(Repeated).@"struct".fields.len);
78877887 items.appendAssumeCapacity(.{
78887888 .tag = .repeated,
78897889 .data = addExtraAssumeCapacity(extra, Repeated{
......@@ -7898,7 +7898,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
78987898 const strings = ip.getLocal(tid).getMutableStrings(gpa);
78997899 const start = strings.mutate.len;
79007900 try strings.ensureUnusedCapacity(@intCast(len_including_sentinel + 1));
7901 try extra.ensureUnusedCapacity(@typeInfo(Bytes).Struct.fields.len);
7901 try extra.ensureUnusedCapacity(@typeInfo(Bytes).@"struct".fields.len);
79027902 switch (aggregate.storage) {
79037903 .bytes => |bytes| strings.appendSliceAssumeCapacity(.{bytes.toSlice(len, ip)}),
79047904 .elems => |elems| for (elems[0..@intCast(len)]) |elem| switch (ip.indexToKey(elem)) {
......@@ -7938,7 +7938,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
79387938 }
79397939
79407940 try extra.ensureUnusedCapacity(
7941 @typeInfo(Tag.Aggregate).Struct.fields.len + @as(usize, @intCast(len_including_sentinel + 1)),
7941 @typeInfo(Tag.Aggregate).@"struct".fields.len + @as(usize, @intCast(len_including_sentinel + 1)),
79427942 );
79437943 items.appendAssumeCapacity(.{
79447944 .tag = .aggregate,
......@@ -7961,7 +7961,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
79617961
79627962 .memoized_call => |memoized_call| {
79637963 for (memoized_call.arg_values) |arg| assert(arg != .none);
7964 try extra.ensureUnusedCapacity(@typeInfo(MemoizedCall).Struct.fields.len +
7964 try extra.ensureUnusedCapacity(@typeInfo(MemoizedCall).@"struct".fields.len +
79657965 memoized_call.arg_values.len);
79667966 items.appendAssumeCapacity(.{
79677967 .tag = .memoized_call,
......@@ -8050,7 +8050,7 @@ pub fn getUnionType(
80508050
80518051 const align_elements_len = if (ini.flags.any_aligned_fields) (ini.fields_len + 3) / 4 else 0;
80528052 const align_element: u32 = @bitCast([1]u8{@intFromEnum(Alignment.none)} ** 4);
8053 try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeUnion).Struct.fields.len +
8053 try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeUnion).@"struct".fields.len +
80548054 // TODO: fmt bug
80558055 // zig fmt: off
80568056 switch (ini.key) {
......@@ -8259,7 +8259,7 @@ pub fn getStructType(
82598259 .auto => false,
82608260 .@"extern" => true,
82618261 .@"packed" => {
8262 try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeStructPacked).Struct.fields.len +
8262 try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeStructPacked).@"struct".fields.len +
82638263 // TODO: fmt bug
82648264 // zig fmt: off
82658265 switch (ini.key) {
......@@ -8327,7 +8327,7 @@ pub fn getStructType(
83278327 const align_element: u32 = @bitCast([1]u8{@intFromEnum(Alignment.none)} ** 4);
83288328 const comptime_elements_len = if (ini.any_comptime_fields) (ini.fields_len + 31) / 32 else 0;
83298329
8330 try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeStruct).Struct.fields.len +
8330 try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeStruct).@"struct".fields.len +
83318331 // TODO: fmt bug
83328332 // zig fmt: off
83338333 switch (ini.key) {
......@@ -8443,7 +8443,7 @@ pub fn getAnonStructType(
84438443
84448444 try items.ensureUnusedCapacity(1);
84458445 try extra.ensureUnusedCapacity(
8446 @typeInfo(TypeStructAnon).Struct.fields.len + (fields_len * 3),
8446 @typeInfo(TypeStructAnon).@"struct".fields.len + (fields_len * 3),
84478447 );
84488448
84498449 const extra_index = addExtraAssumeCapacity(extra, TypeStructAnon{
......@@ -8509,7 +8509,7 @@ pub fn getFuncType(
85098509 const prev_extra_len = extra.mutate.len;
85108510 const params_len: u32 = @intCast(key.param_types.len);
85118511
8512 try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeFunction).Struct.fields.len +
8512 try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeFunction).@"struct".fields.len +
85138513 @intFromBool(key.comptime_bits != 0) +
85148514 @intFromBool(key.noalias_bits != 0) +
85158515 params_len);
......@@ -8575,7 +8575,7 @@ pub fn getExtern(
85758575 const items = local.getMutableItems(gpa);
85768576 const extra = local.getMutableExtra(gpa);
85778577 try items.ensureUnusedCapacity(1);
8578 try extra.ensureUnusedCapacity(@typeInfo(Tag.Extern).Struct.fields.len);
8578 try extra.ensureUnusedCapacity(@typeInfo(Tag.Extern).@"struct".fields.len);
85798579 try local.getMutableNavs(gpa).ensureUnusedCapacity(1);
85808580
85818581 // Predict the index the `@"extern" will live at, so we can construct the owner `Nav` before releasing the shard's mutex.
......@@ -8642,7 +8642,7 @@ pub fn getFuncDecl(
86428642 // arrays. This is similar to what `getOrPutTrailingString` does.
86438643 const prev_extra_len = extra.mutate.len;
86448644
8645 try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncDecl).Struct.fields.len);
8645 try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncDecl).@"struct".fields.len);
86468646
86478647 const func_decl_extra_index = addExtraAssumeCapacity(extra, Tag.FuncDecl{
86488648 .analysis = .{
......@@ -8723,10 +8723,10 @@ pub fn getFuncDeclIes(
87238723 const prev_extra_len = extra.mutate.len;
87248724 const params_len: u32 = @intCast(key.param_types.len);
87258725
8726 try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncDecl).Struct.fields.len +
8726 try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncDecl).@"struct".fields.len +
87278727 1 + // inferred_error_set
8728 @typeInfo(Tag.ErrorUnionType).Struct.fields.len +
8729 @typeInfo(Tag.TypeFunction).Struct.fields.len +
8728 @typeInfo(Tag.ErrorUnionType).@"struct".fields.len +
8729 @typeInfo(Tag.TypeFunction).@"struct".fields.len +
87308730 @intFromBool(key.comptime_bits != 0) +
87318731 @intFromBool(key.noalias_bits != 0) +
87328732 params_len);
......@@ -8855,7 +8855,7 @@ pub fn getErrorSetType(
88558855 const local = ip.getLocal(tid);
88568856 const items = local.getMutableItems(gpa);
88578857 const extra = local.getMutableExtra(gpa);
8858 try extra.ensureUnusedCapacity(@typeInfo(Tag.ErrorSet).Struct.fields.len + names.len);
8858 try extra.ensureUnusedCapacity(@typeInfo(Tag.ErrorSet).@"struct".fields.len + names.len);
88598859
88608860 const names_map = try ip.addMap(gpa, tid, names.len);
88618861 errdefer local.mutate.maps.len -= 1;
......@@ -8930,7 +8930,7 @@ pub fn getFuncInstance(
89308930 const local = ip.getLocal(tid);
89318931 const items = local.getMutableItems(gpa);
89328932 const extra = local.getMutableExtra(gpa);
8933 try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncInstance).Struct.fields.len +
8933 try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncInstance).@"struct".fields.len +
89348934 arg.comptime_args.len);
89358935
89368936 const generic_owner = unwrapCoercedFunc(ip, arg.generic_owner);
......@@ -9015,11 +9015,11 @@ pub fn getFuncInstanceIes(
90159015 const prev_extra_len = extra.mutate.len;
90169016 const params_len: u32 = @intCast(arg.param_types.len);
90179017
9018 try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncInstance).Struct.fields.len +
9018 try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncInstance).@"struct".fields.len +
90199019 1 + // inferred_error_set
90209020 arg.comptime_args.len +
9021 @typeInfo(Tag.ErrorUnionType).Struct.fields.len +
9022 @typeInfo(Tag.TypeFunction).Struct.fields.len +
9021 @typeInfo(Tag.ErrorUnionType).@"struct".fields.len +
9022 @typeInfo(Tag.TypeFunction).@"struct".fields.len +
90239023 @intFromBool(arg.noalias_bits != 0) +
90249024 params_len);
90259025
......@@ -9324,7 +9324,7 @@ pub fn getEnumType(
93249324 switch (ini.tag_mode) {
93259325 .auto => {
93269326 assert(!ini.has_values);
9327 try extra.ensureUnusedCapacity(@typeInfo(EnumAuto).Struct.fields.len +
9327 try extra.ensureUnusedCapacity(@typeInfo(EnumAuto).@"struct".fields.len +
93289328 // TODO: fmt bug
93299329 // zig fmt: off
93309330 switch (ini.key) {
......@@ -9384,7 +9384,7 @@ pub fn getEnumType(
93849384 local.mutate.maps.len -= 1;
93859385 };
93869386
9387 try extra.ensureUnusedCapacity(@typeInfo(EnumExplicit).Struct.fields.len +
9387 try extra.ensureUnusedCapacity(@typeInfo(EnumExplicit).@"struct".fields.len +
93889388 // TODO: fmt bug
93899389 // zig fmt: off
93909390 switch (ini.key) {
......@@ -9499,7 +9499,7 @@ pub fn getGeneratedTagEnumType(
94999499 const prev_extra_len = extra.mutate.len;
95009500 switch (ini.tag_mode) {
95019501 .auto => {
9502 try extra.ensureUnusedCapacity(@typeInfo(EnumAuto).Struct.fields.len +
9502 try extra.ensureUnusedCapacity(@typeInfo(EnumAuto).@"struct".fields.len +
95039503 1 + // owner_union
95049504 fields_len); // field names
95059505 items.appendAssumeCapacity(.{
......@@ -9518,7 +9518,7 @@ pub fn getGeneratedTagEnumType(
95189518 extra.appendSliceAssumeCapacity(.{@ptrCast(ini.names)});
95199519 },
95209520 .explicit, .nonexhaustive => {
9521 try extra.ensureUnusedCapacity(@typeInfo(EnumExplicit).Struct.fields.len +
9521 try extra.ensureUnusedCapacity(@typeInfo(EnumExplicit).@"struct".fields.len +
95229522 1 + // owner_union
95239523 fields_len + // field names
95249524 ini.values.len); // field values
......@@ -9606,7 +9606,7 @@ pub fn getOpaqueType(
96069606 const extra = local.getMutableExtra(gpa);
96079607 try items.ensureUnusedCapacity(1);
96089608
9609 try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeOpaque).Struct.fields.len + switch (ini.key) {
9609 try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeOpaque).@"struct".fields.len + switch (ini.key) {
96109610 .declared => |d| d.captures.len,
96119611 .reified => 0,
96129612 });
......@@ -9740,14 +9740,14 @@ fn addInt(
97409740}
97419741
97429742fn addExtra(extra: Local.Extra.Mutable, item: anytype) Allocator.Error!u32 {
9743 const fields = @typeInfo(@TypeOf(item)).Struct.fields;
9743 const fields = @typeInfo(@TypeOf(item)).@"struct".fields;
97449744 try extra.ensureUnusedCapacity(fields.len);
97459745 return addExtraAssumeCapacity(extra, item);
97469746}
97479747
97489748fn addExtraAssumeCapacity(extra: Local.Extra.Mutable, item: anytype) u32 {
97499749 const result: u32 = extra.mutate.len;
9750 inline for (@typeInfo(@TypeOf(item)).Struct.fields) |field| {
9750 inline for (@typeInfo(@TypeOf(item)).@"struct".fields) |field| {
97519751 extra.appendAssumeCapacity(.{switch (field.type) {
97529752 Index,
97539753 Cau.Index,
......@@ -9791,7 +9791,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 {
97919791 else => @compileError("unsupported host"),
97929792 }
97939793 const result: u32 = @intCast(ip.limbs.items.len);
9794 inline for (@typeInfo(@TypeOf(extra)).Struct.fields, 0..) |field, i| {
9794 inline for (@typeInfo(@TypeOf(extra)).@"struct".fields, 0..) |field, i| {
97959795 const new: u32 = switch (field.type) {
97969796 u32 => @field(extra, field.name),
97979797 Index => @intFromEnum(@field(extra, field.name)),
......@@ -9809,7 +9809,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 {
98099809fn extraDataTrail(extra: Local.Extra, comptime T: type, index: u32) struct { data: T, end: u32 } {
98109810 const extra_items = extra.view().items(.@"0");
98119811 var result: T = undefined;
9812 const fields = @typeInfo(T).Struct.fields;
9812 const fields = @typeInfo(T).@"struct".fields;
98139813 inline for (fields, index..) |field, extra_index| {
98149814 const extra_item = extra_items[extra_index];
98159815 @field(result, field.name) = switch (field.type) {
......@@ -10268,7 +10268,7 @@ fn getCoercedFunc(
1026810268 const extra = local.getMutableExtra(gpa);
1026910269
1027010270 const prev_extra_len = extra.mutate.len;
10271 try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncCoerced).Struct.fields.len);
10271 try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncCoerced).@"struct".fields.len);
1027210272
1027310273 const extra_index = addExtraAssumeCapacity(extra, Tag.FuncCoerced{
1027410274 .ty = ty,
......@@ -10480,31 +10480,31 @@ fn dumpStatsFallible(ip: *const InternPool, arena: Allocator) anyerror!void {
1048010480 .type_inferred_error_set => 0,
1048110481 .type_enum_explicit, .type_enum_nonexhaustive => b: {
1048210482 const info = extraData(extra_list, EnumExplicit, data);
10483 var ints = @typeInfo(EnumExplicit).Struct.fields.len;
10483 var ints = @typeInfo(EnumExplicit).@"struct".fields.len;
1048410484 if (info.zir_index == .none) ints += 1;
1048510485 ints += if (info.captures_len != std.math.maxInt(u32))
1048610486 info.captures_len
1048710487 else
10488 @typeInfo(PackedU64).Struct.fields.len;
10488 @typeInfo(PackedU64).@"struct".fields.len;
1048910489 ints += info.fields_len;
1049010490 if (info.values_map != .none) ints += info.fields_len;
1049110491 break :b @sizeOf(u32) * ints;
1049210492 },
1049310493 .type_enum_auto => b: {
1049410494 const info = extraData(extra_list, EnumAuto, data);
10495 const ints = @typeInfo(EnumAuto).Struct.fields.len + info.captures_len + info.fields_len;
10495 const ints = @typeInfo(EnumAuto).@"struct".fields.len + info.captures_len + info.fields_len;
1049610496 break :b @sizeOf(u32) * ints;
1049710497 },
1049810498 .type_opaque => b: {
1049910499 const info = extraData(extra_list, Tag.TypeOpaque, data);
10500 const ints = @typeInfo(Tag.TypeOpaque).Struct.fields.len + info.captures_len;
10500 const ints = @typeInfo(Tag.TypeOpaque).@"struct".fields.len + info.captures_len;
1050110501 break :b @sizeOf(u32) * ints;
1050210502 },
1050310503 .type_struct => b: {
1050410504 if (data == 0) break :b 0;
1050510505 const extra = extraDataTrail(extra_list, Tag.TypeStruct, data);
1050610506 const info = extra.data;
10507 var ints: usize = @typeInfo(Tag.TypeStruct).Struct.fields.len;
10507 var ints: usize = @typeInfo(Tag.TypeStruct).@"struct".fields.len;
1050810508 if (info.flags.any_captures) {
1050910509 const captures_len = extra_items[extra.end];
1051010510 ints += 1 + captures_len;
......@@ -10535,7 +10535,7 @@ fn dumpStatsFallible(ip: *const InternPool, arena: Allocator) anyerror!void {
1053510535 extra_items[extra.end]
1053610536 else
1053710537 0;
10538 break :b @sizeOf(u32) * (@typeInfo(Tag.TypeStructPacked).Struct.fields.len +
10538 break :b @sizeOf(u32) * (@typeInfo(Tag.TypeStructPacked).@"struct".fields.len +
1053910539 @intFromBool(extra.data.flags.any_captures) + captures_len +
1054010540 extra.data.fields_len * 2);
1054110541 },
......@@ -10545,7 +10545,7 @@ fn dumpStatsFallible(ip: *const InternPool, arena: Allocator) anyerror!void {
1054510545 extra_items[extra.end]
1054610546 else
1054710547 0;
10548 break :b @sizeOf(u32) * (@typeInfo(Tag.TypeStructPacked).Struct.fields.len +
10548 break :b @sizeOf(u32) * (@typeInfo(Tag.TypeStructPacked).@"struct".fields.len +
1054910549 @intFromBool(extra.data.flags.any_captures) + captures_len +
1055010550 extra.data.fields_len * 3);
1055110551 },
......@@ -11627,7 +11627,7 @@ pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPois
1162711627 .c_ulong_type,
1162811628 .c_longlong_type,
1162911629 .c_ulonglong_type,
11630 => .Int,
11630 => .int,
1163111631
1163211632 .c_longdouble_type,
1163311633 .f16_type,
......@@ -11635,20 +11635,20 @@ pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPois
1163511635 .f64_type,
1163611636 .f80_type,
1163711637 .f128_type,
11638 => .Float,
11639
11640 .anyopaque_type => .Opaque,
11641 .bool_type => .Bool,
11642 .void_type => .Void,
11643 .type_type => .Type,
11644 .anyerror_type, .adhoc_inferred_error_set_type => .ErrorSet,
11645 .comptime_int_type => .ComptimeInt,
11646 .comptime_float_type => .ComptimeFloat,
11647 .noreturn_type => .NoReturn,
11648 .anyframe_type => .AnyFrame,
11649 .null_type => .Null,
11650 .undefined_type => .Undefined,
11651 .enum_literal_type => .EnumLiteral,
11638 => .float,
11639
11640 .anyopaque_type => .@"opaque",
11641 .bool_type => .bool,
11642 .void_type => .void,
11643 .type_type => .type,
11644 .anyerror_type, .adhoc_inferred_error_set_type => .error_set,
11645 .comptime_int_type => .comptime_int,
11646 .comptime_float_type => .comptime_float,
11647 .noreturn_type => .noreturn,
11648 .anyframe_type => .@"anyframe",
11649 .null_type => .null,
11650 .undefined_type => .undefined,
11651 .enum_literal_type => .enum_literal,
1165211652
1165311653 .manyptr_u8_type,
1165411654 .manyptr_const_u8_type,
......@@ -11656,11 +11656,11 @@ pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPois
1165611656 .single_const_pointer_to_comptime_int_type,
1165711657 .slice_const_u8_type,
1165811658 .slice_const_u8_sentinel_0_type,
11659 => .Pointer,
11659 => .pointer,
1166011660
11661 .optional_noreturn_type => .Optional,
11662 .anyerror_void_error_union_type => .ErrorUnion,
11663 .empty_struct_type => .Struct,
11661 .optional_noreturn_type => .optional,
11662 .anyerror_void_error_union_type => .error_union,
11663 .empty_struct_type => .@"struct",
1166411664
1166511665 .generic_poison_type => return error.GenericPoison,
1166611666
......@@ -11687,48 +11687,48 @@ pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPois
1168711687
1168811688 .type_int_signed,
1168911689 .type_int_unsigned,
11690 => .Int,
11690 => .int,
1169111691
1169211692 .type_array_big,
1169311693 .type_array_small,
11694 => .Array,
11694 => .array,
1169511695
11696 .type_vector => .Vector,
11696 .type_vector => .vector,
1169711697
1169811698 .type_pointer,
1169911699 .type_slice,
11700 => .Pointer,
11700 => .pointer,
1170111701
11702 .type_optional => .Optional,
11703 .type_anyframe => .AnyFrame,
11702 .type_optional => .optional,
11703 .type_anyframe => .@"anyframe",
1170411704
1170511705 .type_error_union,
1170611706 .type_anyerror_union,
11707 => .ErrorUnion,
11707 => .error_union,
1170811708
1170911709 .type_error_set,
1171011710 .type_inferred_error_set,
11711 => .ErrorSet,
11711 => .error_set,
1171211712
1171311713 .type_enum_auto,
1171411714 .type_enum_explicit,
1171511715 .type_enum_nonexhaustive,
11716 => .Enum,
11716 => .@"enum",
1171711717
1171811718 .simple_type => unreachable, // handled via Index tag above
1171911719
11720 .type_opaque => .Opaque,
11720 .type_opaque => .@"opaque",
1172111721
1172211722 .type_struct,
1172311723 .type_struct_anon,
1172411724 .type_struct_packed,
1172511725 .type_struct_packed_inits,
1172611726 .type_tuple_anon,
11727 => .Struct,
11727 => .@"struct",
1172811728
11729 .type_union => .Union,
11729 .type_union => .@"union",
1173011730
11731 .type_function => .Fn,
11731 .type_function => .@"fn",
1173211732
1173311733 // values, not types
1173411734 .undef,
......@@ -11919,8 +11919,8 @@ fn funcIesResolvedPtr(ip: *InternPool, func_index: Index) *Index {
1191911919 const func_extra = unwrapped_func.getExtra(ip);
1192011920 const func_item = unwrapped_func.getItem(ip);
1192111921 const extra_index = switch (func_item.tag) {
11922 .func_decl => func_item.data + @typeInfo(Tag.FuncDecl).Struct.fields.len,
11923 .func_instance => func_item.data + @typeInfo(Tag.FuncInstance).Struct.fields.len,
11922 .func_decl => func_item.data + @typeInfo(Tag.FuncDecl).@"struct".fields.len,
11923 .func_instance => func_item.data + @typeInfo(Tag.FuncInstance).@"struct".fields.len,
1192411924 .func_coerced => {
1192511925 const uncoerced_func_index: Index = @enumFromInt(func_extra.view().items(.@"0")[
1192611926 func_item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").?
......@@ -11929,8 +11929,8 @@ fn funcIesResolvedPtr(ip: *InternPool, func_index: Index) *Index {
1192911929 const uncoerced_func_item = unwrapped_uncoerced_func.getItem(ip);
1193011930 return @ptrCast(&unwrapped_uncoerced_func.getExtra(ip).view().items(.@"0")[
1193111931 switch (uncoerced_func_item.tag) {
11932 .func_decl => uncoerced_func_item.data + @typeInfo(Tag.FuncDecl).Struct.fields.len,
11933 .func_instance => uncoerced_func_item.data + @typeInfo(Tag.FuncInstance).Struct.fields.len,
11932 .func_decl => uncoerced_func_item.data + @typeInfo(Tag.FuncDecl).@"struct".fields.len,
11933 .func_instance => uncoerced_func_item.data + @typeInfo(Tag.FuncInstance).@"struct".fields.len,
1193411934 else => unreachable,
1193511935 }
1193611936 ]);
src/Package/Fetch.zig+2-2
......@@ -325,7 +325,7 @@ pub fn run(f: *Fetch) RunError!void {
325325 // "p/$hash/foo", with possibly more directories after "foo".
326326 // We want to fail unless the resolved relative path has a
327327 // prefix of "p/$hash/".
328 const digest_len = @typeInfo(Manifest.MultiHashHexDigest).Array.len;
328 const digest_len = @typeInfo(Manifest.MultiHashHexDigest).array.len;
329329 const prefix_len: usize = if (f.job_queue.read_only) 0 else "p/".len;
330330 const expected_prefix = f.parent_package_root.sub_path[0 .. prefix_len + digest_len];
331331 if (!std.mem.startsWith(u8, pkg_root.sub_path, expected_prefix)) {
......@@ -670,7 +670,7 @@ fn queueJobsForDeps(f: *Fetch) RunError!void {
670670 .url = url,
671671 .hash = h: {
672672 const h = dep.hash orelse break :h null;
673 const digest_len = @typeInfo(Manifest.MultiHashHexDigest).Array.len;
673 const digest_len = @typeInfo(Manifest.MultiHashHexDigest).array.len;
674674 const multihash_digest = h[0..digest_len].*;
675675 const gop = f.job_queue.table.getOrPutAssumeCapacity(multihash_digest);
676676 if (gop.found_existing) continue;
src/Sema.zig+971-971
......@@ -1783,7 +1783,7 @@ fn analyzeBodyInner(
17831783 const inline_body = sema.code.bodySlice(extra.end, extra.data.body_len);
17841784 const err_union = try sema.resolveInst(extra.data.operand);
17851785 const err_union_ty = sema.typeOf(err_union);
1786 if (err_union_ty.zigTypeTag(zcu) != .ErrorUnion) {
1786 if (err_union_ty.zigTypeTag(zcu) != .error_union) {
17871787 return sema.fail(block, operand_src, "expected error union type, found '{}'", .{
17881788 err_union_ty.fmt(pt),
17891789 });
......@@ -1985,14 +1985,14 @@ fn resolveDestType(
19851985 else => |e| return e,
19861986 };
19871987
1988 if (remove_eu and raw_ty.zigTypeTag(zcu) == .ErrorUnion) {
1988 if (remove_eu and raw_ty.zigTypeTag(zcu) == .error_union) {
19891989 const eu_child = raw_ty.errorUnionPayload(zcu);
1990 if (remove_opt and eu_child.zigTypeTag(zcu) == .Optional) {
1990 if (remove_opt and eu_child.zigTypeTag(zcu) == .optional) {
19911991 return eu_child.childType(zcu);
19921992 }
19931993 return eu_child;
19941994 }
1995 if (remove_opt and raw_ty.zigTypeTag(zcu) == .Optional) {
1995 if (remove_opt and raw_ty.zigTypeTag(zcu) == .optional) {
19961996 return raw_ty.childType(zcu);
19971997 }
19981998 return raw_ty;
......@@ -2280,7 +2280,7 @@ fn failWithExpectedOptionalType(sema: *Sema, block: *Block, src: LazySrcLoc, non
22802280 non_optional_ty.fmt(pt),
22812281 });
22822282 errdefer msg.destroy(sema.gpa);
2283 if (non_optional_ty.zigTypeTag(pt.zcu) == .ErrorUnion) {
2283 if (non_optional_ty.zigTypeTag(pt.zcu) == .error_union) {
22842284 try sema.errNote(src, msg, "consider using 'try', 'catch', or 'if'", .{});
22852285 }
22862286 try addDeclaredHereNote(sema, msg, non_optional_ty);
......@@ -2327,7 +2327,7 @@ fn failWithErrorSetCodeMissing(
23272327fn failWithIntegerOverflow(sema: *Sema, block: *Block, src: LazySrcLoc, int_ty: Type, val: Value, vector_index: usize) CompileError {
23282328 const pt = sema.pt;
23292329 const zcu = pt.zcu;
2330 if (int_ty.zigTypeTag(zcu) == .Vector) {
2330 if (int_ty.zigTypeTag(zcu) == .vector) {
23312331 const msg = msg: {
23322332 const msg = try sema.errMsg(src, "overflow of vector type '{}' with value '{}'", .{
23332333 int_ty.fmt(pt), val.fmtValueSema(pt, sema),
......@@ -2380,7 +2380,7 @@ fn failWithInvalidFieldAccess(
23802380 const zcu = pt.zcu;
23812381 const inner_ty = if (object_ty.isSinglePointer(zcu)) object_ty.childType(zcu) else object_ty;
23822382
2383 if (inner_ty.zigTypeTag(zcu) == .Optional) opt: {
2383 if (inner_ty.zigTypeTag(zcu) == .optional) opt: {
23842384 const child_ty = inner_ty.optionalChild(zcu);
23852385 if (!typeSupportsFieldAccess(zcu, child_ty, field_name)) break :opt;
23862386 const msg = msg: {
......@@ -2390,7 +2390,7 @@ fn failWithInvalidFieldAccess(
23902390 break :msg msg;
23912391 };
23922392 return sema.failWithOwnedErrorMsg(block, msg);
2393 } else if (inner_ty.zigTypeTag(zcu) == .ErrorUnion) err: {
2393 } else if (inner_ty.zigTypeTag(zcu) == .error_union) err: {
23942394 const child_ty = inner_ty.errorUnionPayload(zcu);
23952395 if (!typeSupportsFieldAccess(zcu, child_ty, field_name)) break :err;
23962396 const msg = msg: {
......@@ -2407,16 +2407,16 @@ fn failWithInvalidFieldAccess(
24072407fn typeSupportsFieldAccess(zcu: *const Zcu, ty: Type, field_name: InternPool.NullTerminatedString) bool {
24082408 const ip = &zcu.intern_pool;
24092409 switch (ty.zigTypeTag(zcu)) {
2410 .Array => return field_name.eqlSlice("len", ip),
2411 .Pointer => {
2410 .array => return field_name.eqlSlice("len", ip),
2411 .pointer => {
24122412 const ptr_info = ty.ptrInfo(zcu);
24132413 if (ptr_info.flags.size == .Slice) {
24142414 return field_name.eqlSlice("ptr", ip) or field_name.eqlSlice("len", ip);
2415 } else if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .Array) {
2415 } else if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .array) {
24162416 return field_name.eqlSlice("len", ip);
24172417 } else return false;
24182418 },
2419 .Type, .Struct, .Union => return true,
2419 .type, .@"struct", .@"union" => return true,
24202420 else => return false,
24212421 }
24222422}
......@@ -3384,9 +3384,9 @@ fn ensureResultUsed(
33843384 const pt = sema.pt;
33853385 const zcu = pt.zcu;
33863386 switch (ty.zigTypeTag(zcu)) {
3387 .Void, .NoReturn => return,
3388 .ErrorSet => return sema.fail(block, src, "error set is ignored", .{}),
3389 .ErrorUnion => {
3387 .void, .noreturn => return,
3388 .error_set => return sema.fail(block, src, "error set is ignored", .{}),
3389 .error_union => {
33903390 const msg = msg: {
33913391 const msg = try sema.errMsg(src, "error union is ignored", .{});
33923392 errdefer msg.destroy(sema.gpa);
......@@ -3419,8 +3419,8 @@ fn zirEnsureResultNonError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
34193419 const src = block.nodeOffset(inst_data.src_node);
34203420 const operand_ty = sema.typeOf(operand);
34213421 switch (operand_ty.zigTypeTag(zcu)) {
3422 .ErrorSet => return sema.fail(block, src, "error set is discarded", .{}),
3423 .ErrorUnion => {
3422 .error_set => return sema.fail(block, src, "error set is discarded", .{}),
3423 .error_union => {
34243424 const msg = msg: {
34253425 const msg = try sema.errMsg(src, "error union is discarded", .{});
34263426 errdefer msg.destroy(sema.gpa);
......@@ -3443,13 +3443,13 @@ fn zirEnsureErrUnionPayloadVoid(sema: *Sema, block: *Block, inst: Zir.Inst.Index
34433443 const src = block.nodeOffset(inst_data.src_node);
34443444 const operand = try sema.resolveInst(inst_data.operand);
34453445 const operand_ty = sema.typeOf(operand);
3446 const err_union_ty = if (operand_ty.zigTypeTag(zcu) == .Pointer)
3446 const err_union_ty = if (operand_ty.zigTypeTag(zcu) == .pointer)
34473447 operand_ty.childType(zcu)
34483448 else
34493449 operand_ty;
3450 if (err_union_ty.zigTypeTag(zcu) != .ErrorUnion) return;
3450 if (err_union_ty.zigTypeTag(zcu) != .error_union) return;
34513451 const payload_ty = err_union_ty.errorUnionPayload(zcu).zigTypeTag(zcu);
3452 if (payload_ty != .Void and payload_ty != .NoReturn) {
3452 if (payload_ty != .void and payload_ty != .noreturn) {
34533453 const msg = msg: {
34543454 const msg = try sema.errMsg(src, "error union payload is ignored", .{});
34553455 errdefer msg.destroy(sema.gpa);
......@@ -4198,7 +4198,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
41984198 _ = try replacement_block.addBr(placeholder_inst, .void_value);
41994199 try sema.air_extra.ensureUnusedCapacity(
42004200 gpa,
4201 @typeInfo(Air.Block).Struct.fields.len + replacement_block.instructions.items.len,
4201 @typeInfo(Air.Block).@"struct".fields.len + replacement_block.instructions.items.len,
42024202 );
42034203 sema.air_instructions.set(@intFromEnum(placeholder_inst), .{
42044204 .tag = .block,
......@@ -4244,7 +4244,7 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
42444244 // Each arg could be an indexable, or a range, in which case the length
42454245 // is passed directly as an integer.
42464246 const is_int = switch (object_ty.zigTypeTag(zcu)) {
4247 .Int, .ComptimeInt => true,
4247 .int, .comptime_int => true,
42484248 else => false,
42494249 };
42504250 const arg_src = block.src(.{ .for_input = .{
......@@ -4259,7 +4259,7 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
42594259 errdefer msg.destroy(sema.gpa);
42604260 try sema.errNote(arg_src, msg, "for loop operand must be a range, array, slice, tuple, or vector", .{});
42614261
4262 if (object_ty.zigTypeTag(zcu) == .ErrorUnion) {
4262 if (object_ty.zigTypeTag(zcu) == .error_union) {
42634263 try sema.errNote(arg_src, msg, "consider using 'try', 'catch', or 'if'", .{});
42644264 }
42654265
......@@ -4319,7 +4319,7 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
43194319 // Each arg could be an indexable, or a range, in which case the length
43204320 // is passed directly as an integer.
43214321 switch (object_ty.zigTypeTag(zcu)) {
4322 .Int, .ComptimeInt => continue,
4322 .int, .comptime_int => continue,
43234323 else => {},
43244324 }
43254325 const arg_src = block.src(.{ .for_input = .{
......@@ -4357,8 +4357,8 @@ fn optEuBasePtrInit(sema: *Sema, block: *Block, ptr: Air.Inst.Ref, src: LazySrcL
43574357 const zcu = pt.zcu;
43584358 var base_ptr = ptr;
43594359 while (true) switch (sema.typeOf(base_ptr).childType(zcu).zigTypeTag(zcu)) {
4360 .ErrorUnion => base_ptr = try sema.analyzeErrUnionPayloadPtr(block, src, base_ptr, false, true),
4361 .Optional => base_ptr = try sema.analyzeOptionalPayloadPtr(block, src, base_ptr, false, true),
4360 .error_union => base_ptr = try sema.analyzeErrUnionPayloadPtr(block, src, base_ptr, false, true),
4361 .optional => base_ptr = try sema.analyzeOptionalPayloadPtr(block, src, base_ptr, false, true),
43624362 else => break,
43634363 };
43644364 try sema.checkKnownAllocPtr(block, ptr, base_ptr);
......@@ -4383,12 +4383,12 @@ fn zirCoercePtrElemTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE
43834383 else => |e| return e,
43844384 };
43854385 const ptr_ty = maybe_wrapped_ptr_ty.optEuBaseType(zcu);
4386 assert(ptr_ty.zigTypeTag(zcu) == .Pointer); // validated by a previous instruction
4386 assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction
43874387 const elem_ty = ptr_ty.childType(zcu);
43884388 switch (ptr_ty.ptrSize(zcu)) {
43894389 .One => {
43904390 const uncoerced_ty = sema.typeOf(uncoerced_val);
4391 if (elem_ty.zigTypeTag(zcu) == .Array and elem_ty.childType(zcu).toIntern() == uncoerced_ty.toIntern()) {
4391 if (elem_ty.zigTypeTag(zcu) == .array and elem_ty.childType(zcu).toIntern() == uncoerced_ty.toIntern()) {
43924392 // We're trying to initialize a *[1]T with a reference to a T - don't perform any coercion.
43934393 return uncoerced_val;
43944394 }
......@@ -4403,7 +4403,7 @@ fn zirCoercePtrElemTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE
44034403 // Our goal is to coerce `uncoerced_val` to an array of `elem_ty`.
44044404 const val_ty = sema.typeOf(uncoerced_val);
44054405 switch (val_ty.zigTypeTag(zcu)) {
4406 .Array, .Vector => {},
4406 .array, .vector => {},
44074407 else => if (!val_ty.isTuple(zcu)) {
44084408 return sema.fail(block, src, "expected array of '{}', found '{}'", .{ elem_ty.fmt(pt), val_ty.fmt(pt) });
44094409 },
......@@ -4439,7 +4439,7 @@ fn zirValidateRefTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr
44394439 else => |e| return e,
44404440 };
44414441 if (ty_operand.isGenericPoison()) return;
4442 if (ty_operand.optEuBaseType(zcu).zigTypeTag(zcu) != .Pointer) {
4442 if (ty_operand.optEuBaseType(zcu).zigTypeTag(zcu) != .pointer) {
44434443 return sema.failWithOwnedErrorMsg(block, msg: {
44444444 const msg = try sema.errMsg(src, "expected type '{}', found pointer", .{ty_operand.fmt(pt)});
44454445 errdefer msg.destroy(sema.gpa);
......@@ -4464,7 +4464,7 @@ fn zirValidateArrayInitRefTy(
44644464 else => |e| return e,
44654465 };
44664466 const ptr_ty = maybe_wrapped_ptr_ty.optEuBaseType(zcu);
4467 assert(ptr_ty.zigTypeTag(zcu) == .Pointer); // validated by a previous instruction
4467 assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction
44684468 switch (zcu.intern_pool.indexToKey(ptr_ty.toIntern())) {
44694469 .ptr_type => |ptr_type| switch (ptr_type.flags.size) {
44704470 .Slice, .Many => {
......@@ -4523,7 +4523,7 @@ fn validateArrayInitTy(
45234523 const pt = sema.pt;
45244524 const zcu = pt.zcu;
45254525 switch (ty.zigTypeTag(zcu)) {
4526 .Array => {
4526 .array => {
45274527 const array_len = ty.arrayLen(zcu);
45284528 if (init_count != array_len) {
45294529 return sema.fail(block, src, "expected {d} array elements; found {d}", .{
......@@ -4532,7 +4532,7 @@ fn validateArrayInitTy(
45324532 }
45334533 return;
45344534 },
4535 .Vector => {
4535 .vector => {
45364536 const array_len = ty.arrayLen(zcu);
45374537 if (init_count != array_len) {
45384538 return sema.fail(block, src, "expected {d} vector elements; found {d}", .{
......@@ -4541,7 +4541,7 @@ fn validateArrayInitTy(
45414541 }
45424542 return;
45434543 },
4544 .Struct => if (ty.isTuple(zcu)) {
4544 .@"struct" => if (ty.isTuple(zcu)) {
45454545 try ty.resolveFields(pt);
45464546 const array_len = ty.arrayLen(zcu);
45474547 if (init_count > array_len) {
......@@ -4574,7 +4574,7 @@ fn zirValidateStructInitTy(
45744574 const struct_ty = if (is_result_ty) ty.optEuBaseType(zcu) else ty;
45754575
45764576 switch (struct_ty.zigTypeTag(zcu)) {
4577 .Struct, .Union => return,
4577 .@"struct", .@"union" => return,
45784578 else => {},
45794579 }
45804580 return sema.failWithStructInitNotSupported(block, src, struct_ty);
......@@ -4599,13 +4599,13 @@ fn zirValidatePtrStructInit(
45994599 const object_ptr = try sema.resolveInst(field_ptr_extra.lhs);
46004600 const agg_ty = sema.typeOf(object_ptr).childType(zcu).optEuBaseType(zcu);
46014601 switch (agg_ty.zigTypeTag(zcu)) {
4602 .Struct => return sema.validateStructInit(
4602 .@"struct" => return sema.validateStructInit(
46034603 block,
46044604 agg_ty,
46054605 init_src,
46064606 instrs,
46074607 ),
4608 .Union => return sema.validateUnionInit(
4608 .@"union" => return sema.validateUnionInit(
46094609 block,
46104610 agg_ty,
46114611 init_src,
......@@ -5084,7 +5084,7 @@ fn zirValidatePtrArrayInit(
50845084 );
50855085
50865086 if (instrs.len != array_len) switch (array_ty.zigTypeTag(zcu)) {
5087 .Struct => {
5087 .@"struct" => {
50885088 var root_msg: ?*Zcu.ErrorMsg = null;
50895089 errdefer if (root_msg) |msg| msg.destroy(sema.gpa);
50905090
......@@ -5110,12 +5110,12 @@ fn zirValidatePtrArrayInit(
51105110 return sema.failWithOwnedErrorMsg(block, msg);
51115111 }
51125112 },
5113 .Array => {
5113 .array => {
51145114 return sema.fail(block, init_src, "expected {d} array elements; found {d}", .{
51155115 array_len, instrs.len,
51165116 });
51175117 },
5118 .Vector => {
5118 .vector => {
51195119 return sema.fail(block, init_src, "expected {d} vector elements; found {d}", .{
51205120 array_len, instrs.len,
51215121 });
......@@ -5277,7 +5277,7 @@ fn zirValidateDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr
52775277 const operand = try sema.resolveInst(inst_data.operand);
52785278 const operand_ty = sema.typeOf(operand);
52795279
5280 if (operand_ty.zigTypeTag(zcu) != .Pointer) {
5280 if (operand_ty.zigTypeTag(zcu) != .pointer) {
52815281 return sema.fail(block, src, "cannot dereference non-pointer type '{}'", .{operand_ty.fmt(pt)});
52825282 } else switch (operand_ty.ptrSize(zcu)) {
52835283 .One, .C => {},
......@@ -5322,8 +5322,8 @@ fn zirValidateDestructure(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp
53225322 const operand_ty = sema.typeOf(operand);
53235323
53245324 const can_destructure = switch (operand_ty.zigTypeTag(zcu)) {
5325 .Array, .Vector => true,
5326 .Struct => operand_ty.isTuple(zcu),
5325 .array, .vector => true,
5326 .@"struct" => operand_ty.isTuple(zcu),
53275327 else => false,
53285328 };
53295329
......@@ -5360,10 +5360,10 @@ fn failWithBadMemberAccess(
53605360 const zcu = pt.zcu;
53615361 const ip = &zcu.intern_pool;
53625362 const kw_name = switch (agg_ty.zigTypeTag(zcu)) {
5363 .Union => "union",
5364 .Struct => "struct",
5365 .Opaque => "opaque",
5366 .Enum => "enum",
5363 .@"union" => "union",
5364 .@"struct" => "struct",
5365 .@"opaque" => "opaque",
5366 .@"enum" => "enum",
53675367 else => unreachable,
53685368 };
53695369 if (agg_ty.typeDeclInst(zcu)) |inst| if ((inst.resolve(ip) orelse return error.AnalysisFail) == .main_struct_inst) {
......@@ -5432,10 +5432,10 @@ fn addDeclaredHereNote(sema: *Sema, parent: *Zcu.ErrorMsg, decl_ty: Type) !void
54325432 const zcu = sema.pt.zcu;
54335433 const src_loc = decl_ty.srcLocOrNull(zcu) orelse return;
54345434 const category = switch (decl_ty.zigTypeTag(zcu)) {
5435 .Union => "union",
5436 .Struct => "struct",
5437 .Enum => "enum",
5438 .Opaque => "opaque",
5435 .@"union" => "union",
5436 .@"struct" => "struct",
5437 .@"enum" => "enum",
5438 .@"opaque" => "opaque",
54395439 else => unreachable,
54405440 };
54415441 try sema.errNote(src_loc, parent, "{s} declared here", .{category});
......@@ -5562,7 +5562,7 @@ fn zirStoreNode(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!v
55625562 // Where %c is an error union or error set. In such case we need to add
55635563 // to the current function's inferred error set, if any.
55645564 if (is_ret and sema.fn_ret_ty_ies != null) switch (sema.typeOf(operand).zigTypeTag(zcu)) {
5565 .ErrorUnion, .ErrorSet => try sema.addToInferredErrorSet(operand),
5565 .error_union, .error_set => try sema.addToInferredErrorSet(operand),
55665566 else => {},
55675567 };
55685568
......@@ -5819,7 +5819,7 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError
58195819 } else {
58205820 try child_block.instructions.append(gpa, loop_inst);
58215821
5822 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len + loop_block_len);
5822 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len + loop_block_len);
58235823 sema.air_instructions.items(.data)[@intFromEnum(loop_inst)].ty_pl.payload = sema.addExtraAssumeCapacity(
58245824 Air.Block{ .body_len = @intCast(loop_block_len) },
58255825 );
......@@ -6035,7 +6035,7 @@ fn resolveBlockBody(
60356035 // We need a runtime block for scoping reasons.
60366036 _ = try child_block.addBr(merges.block_inst, .void_value);
60376037 try parent_block.instructions.append(sema.gpa, merges.block_inst);
6038 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Block).Struct.fields.len +
6038 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Block).@"struct".fields.len +
60396039 child_block.instructions.items.len);
60406040 sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
60416041 .ty = .void_type,
......@@ -6111,7 +6111,7 @@ fn resolveAnalyzedBlock(
61116111 .dbg_inline_block => {
61126112 // Create a block containing all instruction from the body.
61136113 try parent_block.instructions.append(gpa, merges.block_inst);
6114 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).Struct.fields.len +
6114 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".fields.len +
61156115 child_block.instructions.items.len);
61166116 sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
61176117 .ty = .noreturn_type,
......@@ -6149,7 +6149,7 @@ fn resolveAnalyzedBlock(
61496149 try parent_block.instructions.append(gpa, merges.block_inst);
61506150 switch (block_tag) {
61516151 .block => {
6152 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len +
6152 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len +
61536153 child_block.instructions.items.len);
61546154 sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
61556155 .ty = .void_type,
......@@ -6159,7 +6159,7 @@ fn resolveAnalyzedBlock(
61596159 } };
61606160 },
61616161 .dbg_inline_block => {
6162 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).Struct.fields.len +
6162 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".fields.len +
61636163 child_block.instructions.items.len);
61646164 sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
61656165 .ty = .void_type,
......@@ -6210,7 +6210,7 @@ fn resolveAnalyzedBlock(
62106210 const ty_inst = Air.internedToRef(resolved_ty.toIntern());
62116211 switch (block_tag) {
62126212 .block => {
6213 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len +
6213 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len +
62146214 child_block.instructions.items.len);
62156215 sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
62166216 .ty = ty_inst,
......@@ -6220,7 +6220,7 @@ fn resolveAnalyzedBlock(
62206220 } };
62216221 },
62226222 .dbg_inline_block => {
6223 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).Struct.fields.len +
6223 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".fields.len +
62246224 child_block.instructions.items.len);
62256225 sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
62266226 .ty = ty_inst,
......@@ -6257,7 +6257,7 @@ fn resolveAnalyzedBlock(
62576257 // Convert the br instruction to a block instruction that has the coercion
62586258 // and then a new br inside that returns the coerced instruction.
62596259 const sub_block_len: u32 = @intCast(coerce_block.instructions.items.len + 1);
6260 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len +
6260 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len +
62616261 sub_block_len);
62626262 try sema.air_instructions.ensureUnusedCapacity(gpa, 1);
62636263 const sub_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len);
......@@ -6306,7 +6306,7 @@ fn zirExport(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
63066306 const options = try sema.resolveExportOptions(block, options_src, extra.options);
63076307
63086308 {
6309 if (ptr_ty.zigTypeTag(zcu) != .Pointer) {
6309 if (ptr_ty.zigTypeTag(zcu) != .pointer) {
63106310 return sema.fail(block, ptr_src, "expected pointer type, found '{}'", .{ptr_ty.fmt(pt)});
63116311 }
63126312 const ptr_ty_info = ptr_ty.ptrInfo(zcu);
......@@ -6856,7 +6856,7 @@ fn popErrorReturnTrace(
68566856 // The result might be an error. If it is, we leave the error trace alone. If it isn't, we need
68576857 // to pop any error trace that may have been propagated from our arguments.
68586858
6859 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len);
6859 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len);
68606860 const cond_block_inst = try block.addInstAsIndex(.{
68616861 .tag = .block,
68626862 .data = .{
......@@ -6885,9 +6885,9 @@ fn popErrorReturnTrace(
68856885 defer else_block.instructions.deinit(gpa);
68866886 _ = try else_block.addBr(cond_block_inst, .void_value);
68876887
6888 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len +
6888 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).@"struct".fields.len +
68896889 then_block.instructions.items.len + else_block.instructions.items.len +
6890 @typeInfo(Air.Block).Struct.fields.len + 1); // +1 for the sole .cond_br instruction in the .block
6890 @typeInfo(Air.Block).@"struct".fields.len + 1); // +1 for the sole .cond_br instruction in the .block
68916891
68926892 const cond_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len);
68936893 try sema.air_instructions.append(gpa, .{
......@@ -7046,17 +7046,17 @@ fn checkCallArgumentCount(
70467046 const zcu = pt.zcu;
70477047 const func_ty = func_ty: {
70487048 switch (callee_ty.zigTypeTag(zcu)) {
7049 .Fn => break :func_ty callee_ty,
7050 .Pointer => {
7049 .@"fn" => break :func_ty callee_ty,
7050 .pointer => {
70517051 const ptr_info = callee_ty.ptrInfo(zcu);
7052 if (ptr_info.flags.size == .One and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .Fn) {
7052 if (ptr_info.flags.size == .One and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .@"fn") {
70537053 break :func_ty Type.fromInterned(ptr_info.child);
70547054 }
70557055 },
7056 .Optional => {
7056 .optional => {
70577057 const opt_child = callee_ty.optionalChild(zcu);
7058 if (opt_child.zigTypeTag(zcu) == .Fn or (opt_child.isSinglePointer(zcu) and
7059 opt_child.childType(zcu).zigTypeTag(zcu) == .Fn))
7058 if (opt_child.zigTypeTag(zcu) == .@"fn" or (opt_child.isSinglePointer(zcu) and
7059 opt_child.childType(zcu).zigTypeTag(zcu) == .@"fn"))
70607060 {
70617061 const msg = msg: {
70627062 const msg = try sema.errMsg(func_src, "cannot call optional type '{}'", .{
......@@ -7125,10 +7125,10 @@ fn callBuiltin(
71257125 const callee_ty = sema.typeOf(builtin_fn);
71267126 const func_ty = func_ty: {
71277127 switch (callee_ty.zigTypeTag(zcu)) {
7128 .Fn => break :func_ty callee_ty,
7129 .Pointer => {
7128 .@"fn" => break :func_ty callee_ty,
7129 .pointer => {
71307130 const ptr_info = callee_ty.ptrInfo(zcu);
7131 if (ptr_info.flags.size == .One and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .Fn) {
7131 if (ptr_info.flags.size == .One and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .@"fn") {
71327132 break :func_ty Type.fromInterned(ptr_info.child);
71337133 }
71347134 },
......@@ -7276,7 +7276,7 @@ const CallArgsInfo = union(enum) {
72767276 // Resolve the arg!
72777277 const uncoerced_arg = try sema.resolveInlineBody(block, arg_body, zir_call.call_inst);
72787278
7279 if (sema.typeOf(uncoerced_arg).zigTypeTag(zcu) == .NoReturn) {
7279 if (sema.typeOf(uncoerced_arg).zigTypeTag(zcu) == .noreturn) {
72807280 // This terminates resolution of arguments. The caller should
72817281 // propagate this.
72827282 return uncoerced_arg;
......@@ -7863,7 +7863,7 @@ fn analyzeCall(
78637863 if (param_ty) |t| assert(!t.isGenericPoison());
78647864 arg_out.* = try args_info.analyzeArg(sema, block, arg_idx, param_ty, func_ty_info, func);
78657865 try sema.validateRuntimeValue(block, args_info.argSrc(block, arg_idx), arg_out.*);
7866 if (sema.typeOf(arg_out.*).zigTypeTag(zcu) == .NoReturn) {
7866 if (sema.typeOf(arg_out.*).zigTypeTag(zcu) == .noreturn) {
78677867 return arg_out.*;
78687868 }
78697869 }
......@@ -7884,7 +7884,7 @@ fn analyzeCall(
78847884 }
78857885 }
78867886
7887 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Call).Struct.fields.len +
7887 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Call).@"struct".fields.len +
78887888 args.len);
78897889 const func_inst = try block.addInst(.{
78907890 .tag = call_tag,
......@@ -7991,7 +7991,7 @@ fn analyzeInlineCallArg(
79917991 };
79927992 new_param_types[arg_i.*] = param_ty;
79937993 const casted_arg = try args_info.analyzeArg(ics.caller(), arg_block, arg_i.*, Type.fromInterned(param_ty), func_ty_info, func_inst);
7994 if (ics.caller().typeOf(casted_arg).zigTypeTag(zcu) == .NoReturn) {
7994 if (ics.caller().typeOf(casted_arg).zigTypeTag(zcu) == .noreturn) {
79957995 return casted_arg;
79967996 }
79977997 const arg_src = args_info.argSrc(arg_block, arg_i.*);
......@@ -8039,7 +8039,7 @@ fn analyzeInlineCallArg(
80398039 .param_anytype, .param_anytype_comptime => {
80408040 // No coercion needed.
80418041 const uncasted_arg = try args_info.analyzeArg(ics.caller(), arg_block, arg_i.*, Type.generic_poison, func_ty_info, func_inst);
8042 if (ics.caller().typeOf(uncasted_arg).zigTypeTag(zcu) == .NoReturn) {
8042 if (ics.caller().typeOf(uncasted_arg).zigTypeTag(zcu) == .noreturn) {
80438043 return uncasted_arg;
80448044 }
80458045 const arg_src = args_info.argSrc(arg_block, arg_i.*);
......@@ -8228,7 +8228,7 @@ fn instantiateGenericCall(
82288228 const arg_ref = try args_info.analyzeArg(sema, block, arg_index, param_ty, generic_owner_ty_info, func);
82298229 try sema.validateRuntimeValue(block, args_info.argSrc(block, arg_index), arg_ref);
82308230 const arg_ty = sema.typeOf(arg_ref);
8231 if (arg_ty.zigTypeTag(zcu) == .NoReturn) {
8231 if (arg_ty.zigTypeTag(zcu) == .noreturn) {
82328232 // This terminates argument analysis.
82338233 return arg_ref;
82348234 }
......@@ -8345,7 +8345,7 @@ fn instantiateGenericCall(
83458345 try sema.addReferenceEntry(call_src, AnalUnit.wrap(.{ .func = callee_index }));
83468346 try zcu.ensureFuncBodyAnalysisQueued(callee_index);
83478347
8348 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Call).Struct.fields.len + runtime_args.items.len);
8348 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Call).@"struct".fields.len + runtime_args.items.len);
83498349 const result = try block.addInst(.{
83508350 .tag = call_tag,
83518351 .data = .{ .pl_op = .{
......@@ -8404,9 +8404,9 @@ fn zirOptionalType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
84048404 const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node;
84058405 const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node });
84068406 const child_type = try sema.resolveType(block, operand_src, inst_data.operand);
8407 if (child_type.zigTypeTag(zcu) == .Opaque) {
8407 if (child_type.zigTypeTag(zcu) == .@"opaque") {
84088408 return sema.fail(block, operand_src, "opaque type '{}' cannot be optional", .{child_type.fmt(pt)});
8409 } else if (child_type.zigTypeTag(zcu) == .Null) {
8409 } else if (child_type.zigTypeTag(zcu) == .null) {
84108410 return sema.fail(block, operand_src, "type '{}' cannot be optional", .{child_type.fmt(pt)});
84118411 }
84128412 const opt_type = try pt.optionalType(child_type.toIntern());
......@@ -8429,7 +8429,7 @@ fn zirArrayInitElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil
84298429 const indexable_ty = maybe_wrapped_indexable_ty.optEuBaseType(zcu);
84308430 try indexable_ty.resolveFields(pt);
84318431 assert(indexable_ty.isIndexable(zcu)); // validated by a previous instruction
8432 if (indexable_ty.zigTypeTag(zcu) == .Struct) {
8432 if (indexable_ty.zigTypeTag(zcu) == .@"struct") {
84338433 const elem_type = indexable_ty.fieldType(@intFromEnum(bin.rhs), zcu);
84348434 return Air.internedToRef(elem_type.toIntern());
84358435 } else {
......@@ -8447,7 +8447,7 @@ fn zirElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
84478447 else => |e| return e,
84488448 };
84498449 const ptr_ty = maybe_wrapped_ptr_ty.optEuBaseType(zcu);
8450 assert(ptr_ty.zigTypeTag(zcu) == .Pointer); // validated by a previous instruction
8450 assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction
84518451 const elem_ty = ptr_ty.childType(zcu);
84528452 if (elem_ty.toIntern() == .anyopaque_type) {
84538453 // The pointer's actual child type is effectively unknown, so it makes
......@@ -8561,9 +8561,9 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil
85618561fn validateArrayElemType(sema: *Sema, block: *Block, elem_type: Type, elem_src: LazySrcLoc) !void {
85628562 const pt = sema.pt;
85638563 const zcu = pt.zcu;
8564 if (elem_type.zigTypeTag(zcu) == .Opaque) {
8564 if (elem_type.zigTypeTag(zcu) == .@"opaque") {
85658565 return sema.fail(block, elem_src, "array of opaque type '{}' not allowed", .{elem_type.fmt(pt)});
8566 } else if (elem_type.zigTypeTag(zcu) == .NoReturn) {
8566 } else if (elem_type.zigTypeTag(zcu) == .noreturn) {
85678567 return sema.fail(block, elem_src, "array of 'noreturn' not allowed", .{});
85688568 }
85698569}
......@@ -8597,7 +8597,7 @@ fn zirErrorUnionType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
85978597 const error_set = try sema.resolveType(block, lhs_src, extra.lhs);
85988598 const payload = try sema.resolveType(block, rhs_src, extra.rhs);
85998599
8600 if (error_set.zigTypeTag(zcu) != .ErrorSet) {
8600 if (error_set.zigTypeTag(zcu) != .error_set) {
86018601 return sema.fail(block, lhs_src, "expected error set type, found '{}'", .{
86028602 error_set.fmt(pt),
86038603 });
......@@ -8610,11 +8610,11 @@ fn zirErrorUnionType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
86108610fn validateErrorUnionPayloadType(sema: *Sema, block: *Block, payload_ty: Type, payload_src: LazySrcLoc) !void {
86118611 const pt = sema.pt;
86128612 const zcu = pt.zcu;
8613 if (payload_ty.zigTypeTag(zcu) == .Opaque) {
8613 if (payload_ty.zigTypeTag(zcu) == .@"opaque") {
86148614 return sema.fail(block, payload_src, "error union with payload of opaque type '{}' not allowed", .{
86158615 payload_ty.fmt(pt),
86168616 });
8617 } else if (payload_ty.zigTypeTag(zcu) == .ErrorSet) {
8617 } else if (payload_ty.zigTypeTag(zcu) == .error_set) {
86188618 return sema.fail(block, payload_src, "error union with payload of error set type '{}' not allowed", .{
86198619 payload_ty.fmt(pt),
86208620 });
......@@ -8741,7 +8741,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
87418741 const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node });
87428742 const lhs = try sema.resolveInst(extra.lhs);
87438743 const rhs = try sema.resolveInst(extra.rhs);
8744 if (sema.typeOf(lhs).zigTypeTag(zcu) == .Bool and sema.typeOf(rhs).zigTypeTag(zcu) == .Bool) {
8744 if (sema.typeOf(lhs).zigTypeTag(zcu) == .bool and sema.typeOf(rhs).zigTypeTag(zcu) == .bool) {
87458745 const msg = msg: {
87468746 const msg = try sema.errMsg(lhs_src, "expected error set type, found 'bool'", .{});
87478747 errdefer msg.destroy(sema.gpa);
......@@ -8752,9 +8752,9 @@ fn zirMergeErrorSets(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
87528752 }
87538753 const lhs_ty = try sema.analyzeAsType(block, lhs_src, lhs);
87548754 const rhs_ty = try sema.analyzeAsType(block, rhs_src, rhs);
8755 if (lhs_ty.zigTypeTag(zcu) != .ErrorSet)
8755 if (lhs_ty.zigTypeTag(zcu) != .error_set)
87568756 return sema.fail(block, lhs_src, "expected error set type, found '{}'", .{lhs_ty.fmt(pt)});
8757 if (rhs_ty.zigTypeTag(zcu) != .ErrorSet)
8757 if (rhs_ty.zigTypeTag(zcu) != .error_set)
87588758 return sema.fail(block, rhs_src, "expected error set type, found '{}'", .{rhs_ty.fmt(pt)});
87598759
87608760 // Anything merged with anyerror is anyerror.
......@@ -8807,8 +8807,8 @@ fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
88078807 const operand_ty = sema.typeOf(operand);
88088808
88098809 const enum_tag: Air.Inst.Ref = switch (operand_ty.zigTypeTag(zcu)) {
8810 .Enum => operand,
8811 .Union => blk: {
8810 .@"enum" => operand,
8811 .@"union" => blk: {
88128812 try operand_ty.resolveFields(pt);
88138813 const tag_ty = operand_ty.unionTagType(zcu) orelse {
88148814 return sema.fail(
......@@ -8865,7 +8865,7 @@ fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
88658865 const dest_ty = try sema.resolveDestType(block, src, extra.lhs, .remove_eu_opt, "@enumFromInt");
88668866 const operand = try sema.resolveInst(extra.rhs);
88678867
8868 if (dest_ty.zigTypeTag(zcu) != .Enum) {
8868 if (dest_ty.zigTypeTag(zcu) != .@"enum") {
88698869 return sema.fail(block, src, "expected enum, found '{}'", .{dest_ty.fmt(pt)});
88708870 }
88718871 _ = try sema.checkIntType(block, operand_src, sema.typeOf(operand));
......@@ -8891,7 +8891,7 @@ fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
88918891 return Air.internedToRef((try pt.getCoerced(int_val, dest_ty)).toIntern());
88928892 }
88938893
8894 if (dest_ty.intTagType(zcu).zigTypeTag(zcu) == .ComptimeInt) {
8894 if (dest_ty.intTagType(zcu).zigTypeTag(zcu) == .comptime_int) {
88958895 return sema.failWithNeededComptime(block, operand_src, .{
88968896 .needed_comptime_reason = "value being casted to enum with 'comptime_int' tag type must be comptime-known",
88978897 });
......@@ -8945,10 +8945,10 @@ fn analyzeOptionalPayloadPtr(
89458945 const pt = sema.pt;
89468946 const zcu = pt.zcu;
89478947 const optional_ptr_ty = sema.typeOf(optional_ptr);
8948 assert(optional_ptr_ty.zigTypeTag(zcu) == .Pointer);
8948 assert(optional_ptr_ty.zigTypeTag(zcu) == .pointer);
89498949
89508950 const opt_type = optional_ptr_ty.childType(zcu);
8951 if (opt_type.zigTypeTag(zcu) != .Optional) {
8951 if (opt_type.zigTypeTag(zcu) != .optional) {
89528952 return sema.failWithExpectedOptionalType(block, src, opt_type);
89538953 }
89548954
......@@ -9019,8 +9019,8 @@ fn zirOptionalPayload(
90199019 const operand = try sema.resolveInst(inst_data.operand);
90209020 const operand_ty = sema.typeOf(operand);
90219021 const result_ty = switch (operand_ty.zigTypeTag(zcu)) {
9022 .Optional => operand_ty.optionalChild(zcu),
9023 .Pointer => t: {
9022 .optional => operand_ty.optionalChild(zcu),
9023 .pointer => t: {
90249024 if (operand_ty.ptrSize(zcu) != .C) {
90259025 return sema.failWithExpectedOptionalType(block, src, operand_ty);
90269026 }
......@@ -9072,7 +9072,7 @@ fn zirErrUnionPayload(
90729072 const operand = try sema.resolveInst(inst_data.operand);
90739073 const operand_src = src;
90749074 const err_union_ty = sema.typeOf(operand);
9075 if (err_union_ty.zigTypeTag(zcu) != .ErrorUnion) {
9075 if (err_union_ty.zigTypeTag(zcu) != .error_union) {
90769076 return sema.fail(block, operand_src, "expected error union type, found '{}'", .{
90779077 err_union_ty.fmt(pt),
90789078 });
......@@ -9138,9 +9138,9 @@ fn analyzeErrUnionPayloadPtr(
91389138 const pt = sema.pt;
91399139 const zcu = pt.zcu;
91409140 const operand_ty = sema.typeOf(operand);
9141 assert(operand_ty.zigTypeTag(zcu) == .Pointer);
9141 assert(operand_ty.zigTypeTag(zcu) == .pointer);
91429142
9143 if (operand_ty.childType(zcu).zigTypeTag(zcu) != .ErrorUnion) {
9143 if (operand_ty.childType(zcu).zigTypeTag(zcu) != .error_union) {
91449144 return sema.fail(block, src, "expected error union type, found '{}'", .{
91459145 operand_ty.childType(zcu).fmt(pt),
91469146 });
......@@ -9216,7 +9216,7 @@ fn analyzeErrUnionCode(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air
92169216 const pt = sema.pt;
92179217 const zcu = pt.zcu;
92189218 const operand_ty = sema.typeOf(operand);
9219 if (operand_ty.zigTypeTag(zcu) != .ErrorUnion) {
9219 if (operand_ty.zigTypeTag(zcu) != .error_union) {
92209220 return sema.fail(block, src, "expected error union type, found '{}'", .{
92219221 operand_ty.fmt(pt),
92229222 });
......@@ -9250,9 +9250,9 @@ fn analyzeErrUnionCodePtr(sema: *Sema, block: *Block, src: LazySrcLoc, operand:
92509250 const pt = sema.pt;
92519251 const zcu = pt.zcu;
92529252 const operand_ty = sema.typeOf(operand);
9253 assert(operand_ty.zigTypeTag(zcu) == .Pointer);
9253 assert(operand_ty.zigTypeTag(zcu) == .pointer);
92549254
9255 if (operand_ty.childType(zcu).zigTypeTag(zcu) != .ErrorUnion) {
9255 if (operand_ty.childType(zcu).zigTypeTag(zcu) != .error_union) {
92569256 return sema.fail(block, src, "expected error union type, found '{}'", .{
92579257 operand_ty.childType(zcu).fmt(pt),
92589258 });
......@@ -9587,7 +9587,7 @@ fn funcCommon(
95879587 return sema.fail(block, param_src, "generic parameters not allowed in function with calling convention '{s}'", .{@tagName(cc_resolved)});
95889588 }
95899589 if (!param_ty.isValidParamType(zcu)) {
9590 const opaque_str = if (param_ty.zigTypeTag(zcu) == .Opaque) "opaque " else "";
9590 const opaque_str = if (param_ty.zigTypeTag(zcu) == .@"opaque") "opaque " else "";
95919591 return sema.fail(block, param_src, "parameter of {s}type '{}' not allowed", .{
95929592 opaque_str, param_ty.fmt(pt),
95939593 });
......@@ -9621,7 +9621,7 @@ fn funcCommon(
96219621 return sema.failWithOwnedErrorMsg(block, msg);
96229622 }
96239623 if (is_source_decl and !this_generic and is_noalias and
9624 !(param_ty.zigTypeTag(zcu) == .Pointer or param_ty.isPtrLikeOptional(zcu)))
9624 !(param_ty.zigTypeTag(zcu) == .pointer or param_ty.isPtrLikeOptional(zcu)))
96259625 {
96269626 return sema.fail(block, param_src, "non-pointer parameter declared noalias", .{});
96279627 }
......@@ -9629,7 +9629,7 @@ fn funcCommon(
96299629 .Interrupt => if (target.cpu.arch.isX86()) {
96309630 const err_code_size = target.ptrBitWidth();
96319631 switch (i) {
9632 0 => if (param_ty.zigTypeTag(zcu) != .Pointer) return sema.fail(block, param_src, "first parameter of function with 'Interrupt' calling convention must be a pointer type", .{}),
9632 0 => if (param_ty.zigTypeTag(zcu) != .pointer) return sema.fail(block, param_src, "first parameter of function with 'Interrupt' calling convention must be a pointer type", .{}),
96339633 1 => if (param_ty.bitSize(zcu) != err_code_size) return sema.fail(block, param_src, "second parameter of function with 'Interrupt' calling convention must be a {d}-bit integer", .{err_code_size}),
96349634 else => return sema.fail(block, param_src, "'Interrupt' calling convention supports up to 2 parameters, found {d}", .{i + 1}),
96359635 }
......@@ -9891,7 +9891,7 @@ fn finishFunc(
98919891 Type.fromInterned(ip.funcTypeReturnType(ip.typeOf(opt_func_index)));
98929892
98939893 if (!return_type.isValidReturnType(zcu)) {
9894 const opaque_str = if (return_type.zigTypeTag(zcu) == .Opaque) "opaque " else "";
9894 const opaque_str = if (return_type.zigTypeTag(zcu) == .@"opaque") "opaque " else "";
98959895 return sema.fail(block, ret_ty_src, "{s}return type '{}' not allowed", .{
98969896 opaque_str, return_type.fmt(pt),
98979897 });
......@@ -9953,7 +9953,7 @@ fn finishFunc(
99539953 }
99549954
99559955 switch (cc_resolved) {
9956 .Interrupt, .Signal => if (return_type.zigTypeTag(zcu) != .Void and return_type.zigTypeTag(zcu) != .NoReturn) {
9956 .Interrupt, .Signal => if (return_type.zigTypeTag(zcu) != .void and return_type.zigTypeTag(zcu) != .noreturn) {
99579957 return sema.fail(block, ret_ty_src, "function with calling convention '{s}' must return 'void' or 'noreturn'", .{@tagName(cc_resolved)});
99589958 },
99599959 .Inline => if (is_noinline) {
......@@ -10154,11 +10154,11 @@ fn analyzeAs(
1015410154 error.GenericPoison => return operand,
1015510155 };
1015610156
10157 if (dest_ty_tag == .Opaque) {
10157 if (dest_ty_tag == .@"opaque") {
1015810158 return sema.fail(block, src, "cannot cast to opaque type '{}'", .{dest_ty.fmt(pt)});
1015910159 }
1016010160
10161 if (dest_ty_tag == .NoReturn) {
10161 if (dest_ty_tag == .noreturn) {
1016210162 return sema.fail(block, src, "cannot cast to noreturn", .{});
1016310163 }
1016410164
......@@ -10183,7 +10183,7 @@ fn zirIntFromPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
1018310183 const operand = try sema.resolveInst(inst_data.operand);
1018410184 const operand_ty = sema.typeOf(operand);
1018510185 const ptr_ty = operand_ty.scalarType(zcu);
10186 const is_vector = operand_ty.zigTypeTag(zcu) == .Vector;
10186 const is_vector = operand_ty.zigTypeTag(zcu) == .vector;
1018710187 if (!ptr_ty.isPtrAtRuntime(zcu)) {
1018810188 return sema.fail(block, ptr_src, "expected pointer, found '{}'", .{ptr_ty.fmt(pt)});
1018910189 }
......@@ -10305,7 +10305,7 @@ fn zirStructInitFieldPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi
1030510305 const object_ptr = try sema.resolveInst(extra.lhs);
1030610306 const struct_ty = sema.typeOf(object_ptr).childType(zcu);
1030710307 switch (struct_ty.zigTypeTag(zcu)) {
10308 .Struct, .Union => {
10308 .@"struct", .@"union" => {
1030910309 return sema.fieldPtr(block, src, object_ptr, field_name, field_name_src, true);
1031010310 },
1031110311 else => {
......@@ -10377,12 +10377,12 @@ fn intCast(
1037710377
1037810378 if (try sema.isComptimeKnown(operand)) {
1037910379 return sema.coerce(block, dest_ty, operand, operand_src);
10380 } else if (dest_scalar_ty.zigTypeTag(zcu) == .ComptimeInt) {
10380 } else if (dest_scalar_ty.zigTypeTag(zcu) == .comptime_int) {
1038110381 return sema.fail(block, operand_src, "unable to cast runtime value to 'comptime_int'", .{});
1038210382 }
1038310383
1038410384 try sema.checkVectorizableBinaryOperands(block, operand_src, dest_ty, operand_ty, dest_ty_src, operand_src);
10385 const is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
10385 const is_vector = dest_ty.zigTypeTag(zcu) == .vector;
1038610386
1038710387 if ((try sema.typeHasOnePossibleValue(dest_ty))) |opv| {
1038810388 // requirement: intCast(u0, input) iff input == 0
......@@ -10529,29 +10529,29 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1052910529 const operand = try sema.resolveInst(extra.rhs);
1053010530 const operand_ty = sema.typeOf(operand);
1053110531 switch (dest_ty.zigTypeTag(zcu)) {
10532 .AnyFrame,
10533 .ComptimeFloat,
10534 .ComptimeInt,
10535 .EnumLiteral,
10536 .ErrorSet,
10537 .ErrorUnion,
10538 .Fn,
10539 .Frame,
10540 .NoReturn,
10541 .Null,
10542 .Opaque,
10543 .Optional,
10544 .Type,
10545 .Undefined,
10546 .Void,
10532 .@"anyframe",
10533 .comptime_float,
10534 .comptime_int,
10535 .enum_literal,
10536 .error_set,
10537 .error_union,
10538 .@"fn",
10539 .frame,
10540 .noreturn,
10541 .null,
10542 .@"opaque",
10543 .optional,
10544 .type,
10545 .undefined,
10546 .void,
1054710547 => return sema.fail(block, src, "cannot @bitCast to '{}'", .{dest_ty.fmt(pt)}),
1054810548
10549 .Enum => {
10549 .@"enum" => {
1055010550 const msg = msg: {
1055110551 const msg = try sema.errMsg(src, "cannot @bitCast to '{}'", .{dest_ty.fmt(pt)});
1055210552 errdefer msg.destroy(sema.gpa);
1055310553 switch (operand_ty.zigTypeTag(zcu)) {
10554 .Int, .ComptimeInt => try sema.errNote(src, msg, "use @enumFromInt to cast from '{}'", .{operand_ty.fmt(pt)}),
10554 .int, .comptime_int => try sema.errNote(src, msg, "use @enumFromInt to cast from '{}'", .{operand_ty.fmt(pt)}),
1055510555 else => {},
1055610556 }
1055710557
......@@ -10560,13 +10560,13 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1056010560 return sema.failWithOwnedErrorMsg(block, msg);
1056110561 },
1056210562
10563 .Pointer => {
10563 .pointer => {
1056410564 const msg = msg: {
1056510565 const msg = try sema.errMsg(src, "cannot @bitCast to '{}'", .{dest_ty.fmt(pt)});
1056610566 errdefer msg.destroy(sema.gpa);
1056710567 switch (operand_ty.zigTypeTag(zcu)) {
10568 .Int, .ComptimeInt => try sema.errNote(src, msg, "use @ptrFromInt to cast from '{}'", .{operand_ty.fmt(pt)}),
10569 .Pointer => try sema.errNote(src, msg, "use @ptrCast to cast from '{}'", .{operand_ty.fmt(pt)}),
10568 .int, .comptime_int => try sema.errNote(src, msg, "use @ptrFromInt to cast from '{}'", .{operand_ty.fmt(pt)}),
10569 .pointer => try sema.errNote(src, msg, "use @ptrCast to cast from '{}'", .{operand_ty.fmt(pt)}),
1057010570 else => {},
1057110571 }
1057210572
......@@ -10574,10 +10574,10 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1057410574 };
1057510575 return sema.failWithOwnedErrorMsg(block, msg);
1057610576 },
10577 .Struct, .Union => if (dest_ty.containerLayout(zcu) == .auto) {
10577 .@"struct", .@"union" => if (dest_ty.containerLayout(zcu) == .auto) {
1057810578 const container = switch (dest_ty.zigTypeTag(zcu)) {
10579 .Struct => "struct",
10580 .Union => "union",
10579 .@"struct" => "struct",
10580 .@"union" => "union",
1058110581 else => unreachable,
1058210582 };
1058310583 return sema.fail(block, src, "cannot @bitCast to '{}'; {s} does not have a guaranteed in-memory layout", .{
......@@ -10585,37 +10585,37 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1058510585 });
1058610586 },
1058710587
10588 .Array,
10589 .Bool,
10590 .Float,
10591 .Int,
10592 .Vector,
10588 .array,
10589 .bool,
10590 .float,
10591 .int,
10592 .vector,
1059310593 => {},
1059410594 }
1059510595 switch (operand_ty.zigTypeTag(zcu)) {
10596 .AnyFrame,
10597 .ComptimeFloat,
10598 .ComptimeInt,
10599 .EnumLiteral,
10600 .ErrorSet,
10601 .ErrorUnion,
10602 .Fn,
10603 .Frame,
10604 .NoReturn,
10605 .Null,
10606 .Opaque,
10607 .Optional,
10608 .Type,
10609 .Undefined,
10610 .Void,
10596 .@"anyframe",
10597 .comptime_float,
10598 .comptime_int,
10599 .enum_literal,
10600 .error_set,
10601 .error_union,
10602 .@"fn",
10603 .frame,
10604 .noreturn,
10605 .null,
10606 .@"opaque",
10607 .optional,
10608 .type,
10609 .undefined,
10610 .void,
1061110611 => return sema.fail(block, operand_src, "cannot @bitCast from '{}'", .{operand_ty.fmt(pt)}),
1061210612
10613 .Enum => {
10613 .@"enum" => {
1061410614 const msg = msg: {
1061510615 const msg = try sema.errMsg(operand_src, "cannot @bitCast from '{}'", .{operand_ty.fmt(pt)});
1061610616 errdefer msg.destroy(sema.gpa);
1061710617 switch (dest_ty.zigTypeTag(zcu)) {
10618 .Int, .ComptimeInt => try sema.errNote(operand_src, msg, "use @intFromEnum to cast to '{}'", .{dest_ty.fmt(pt)}),
10618 .int, .comptime_int => try sema.errNote(operand_src, msg, "use @intFromEnum to cast to '{}'", .{dest_ty.fmt(pt)}),
1061910619 else => {},
1062010620 }
1062110621
......@@ -10623,13 +10623,13 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1062310623 };
1062410624 return sema.failWithOwnedErrorMsg(block, msg);
1062510625 },
10626 .Pointer => {
10626 .pointer => {
1062710627 const msg = msg: {
1062810628 const msg = try sema.errMsg(operand_src, "cannot @bitCast from '{}'", .{operand_ty.fmt(pt)});
1062910629 errdefer msg.destroy(sema.gpa);
1063010630 switch (dest_ty.zigTypeTag(zcu)) {
10631 .Int, .ComptimeInt => try sema.errNote(operand_src, msg, "use @intFromPtr to cast to '{}'", .{dest_ty.fmt(pt)}),
10632 .Pointer => try sema.errNote(operand_src, msg, "use @ptrCast to cast to '{}'", .{dest_ty.fmt(pt)}),
10631 .int, .comptime_int => try sema.errNote(operand_src, msg, "use @intFromPtr to cast to '{}'", .{dest_ty.fmt(pt)}),
10632 .pointer => try sema.errNote(operand_src, msg, "use @ptrCast to cast to '{}'", .{dest_ty.fmt(pt)}),
1063310633 else => {},
1063410634 }
1063510635
......@@ -10637,10 +10637,10 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1063710637 };
1063810638 return sema.failWithOwnedErrorMsg(block, msg);
1063910639 },
10640 .Struct, .Union => if (operand_ty.containerLayout(zcu) == .auto) {
10640 .@"struct", .@"union" => if (operand_ty.containerLayout(zcu) == .auto) {
1064110641 const container = switch (operand_ty.zigTypeTag(zcu)) {
10642 .Struct => "struct",
10643 .Union => "union",
10642 .@"struct" => "struct",
10643 .@"union" => "union",
1064410644 else => unreachable,
1064510645 };
1064610646 return sema.fail(block, operand_src, "cannot @bitCast from '{}'; {s} does not have a guaranteed in-memory layout", .{
......@@ -10648,11 +10648,11 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1064810648 });
1064910649 },
1065010650
10651 .Array,
10652 .Bool,
10653 .Float,
10654 .Int,
10655 .Vector,
10651 .array,
10652 .bool,
10653 .float,
10654 .int,
10655 .vector,
1065610656 => {},
1065710657 }
1065810658 return sema.bitCast(block, dest_ty, operand, block.nodeOffset(inst_data.src_node), operand_src);
......@@ -10677,12 +10677,12 @@ fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
1067710677 const operand_scalar_ty = operand_ty.scalarType(zcu);
1067810678
1067910679 try sema.checkVectorizableBinaryOperands(block, operand_src, dest_ty, operand_ty, src, operand_src);
10680 const is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
10680 const is_vector = dest_ty.zigTypeTag(zcu) == .vector;
1068110681
1068210682 const target = zcu.getTarget();
1068310683 const dest_is_comptime_float = switch (dest_scalar_ty.zigTypeTag(zcu)) {
10684 .ComptimeFloat => true,
10685 .Float => false,
10684 .comptime_float => true,
10685 .float => false,
1068610686 else => return sema.fail(
1068710687 block,
1068810688 src,
......@@ -10692,7 +10692,7 @@ fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
1069210692 };
1069310693
1069410694 switch (operand_scalar_ty.zigTypeTag(zcu)) {
10695 .ComptimeFloat, .Float, .ComptimeInt => {},
10695 .comptime_float, .float, .comptime_int => {},
1069610696 else => return sema.fail(
1069710697 block,
1069810698 operand_src,
......@@ -10787,7 +10787,7 @@ fn zirElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
1078710787 const array_ptr = try sema.resolveInst(extra.lhs);
1078810788 const elem_index = try sema.resolveInst(extra.rhs);
1078910789 const indexable_ty = sema.typeOf(array_ptr);
10790 if (indexable_ty.zigTypeTag(zcu) != .Pointer) {
10790 if (indexable_ty.zigTypeTag(zcu) != .pointer) {
1079110791 const capture_src = block.src(.{ .for_capture_from_input = inst_data.src_node });
1079210792 const msg = msg: {
1079310793 const msg = try sema.errMsg(capture_src, "pointer capture of non pointer type '{}'", .{
......@@ -10831,7 +10831,7 @@ fn zirArrayInitElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compile
1083110831 const elem_index = try pt.intRef(Type.usize, extra.index);
1083210832 const array_ty = sema.typeOf(array_ptr).childType(zcu);
1083310833 switch (array_ty.zigTypeTag(zcu)) {
10834 .Array, .Vector => {},
10834 .array, .vector => {},
1083510835 else => if (!array_ty.isTuple(zcu)) {
1083610836 return sema.failWithArrayInitNotSupported(block, src, array_ty);
1083710837 },
......@@ -11066,7 +11066,7 @@ const SwitchProngAnalysis = struct {
1106611066 const pt = sema.pt;
1106711067 const zcu = pt.zcu;
1106811068 const operand_ty = sema.typeOf(spa.operand);
11069 if (operand_ty.zigTypeTag(zcu) != .Union) {
11069 if (operand_ty.zigTypeTag(zcu) != .@"union") {
1107011070 const tag_capture_src: LazySrcLoc = .{
1107111071 .base_node_inst = capture_src.base_node_inst,
1107211072 .offset = .{ .switch_tag_capture = capture_src.offset.switch_capture },
......@@ -11102,7 +11102,7 @@ const SwitchProngAnalysis = struct {
1110211102
1110311103 if (inline_case_capture != .none) {
1110411104 const item_val = sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, inline_case_capture, undefined) catch unreachable;
11105 if (operand_ty.zigTypeTag(zcu) == .Union) {
11105 if (operand_ty.zigTypeTag(zcu) == .@"union") {
1110611106 const field_index: u32 = @intCast(operand_ty.unionTagFieldIndex(item_val, zcu).?);
1110711107 const union_obj = zcu.typeToUnion(operand_ty).?;
1110811108 const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[field_index]);
......@@ -11139,7 +11139,7 @@ const SwitchProngAnalysis = struct {
1113911139 }
1114011140
1114111141 switch (operand_ty.zigTypeTag(zcu)) {
11142 .ErrorSet => if (spa.else_error_ty) |ty| {
11142 .error_set => if (spa.else_error_ty) |ty| {
1114311143 return sema.bitCast(block, ty, spa.operand, operand_src, null);
1114411144 } else {
1114511145 try sema.analyzeUnreachable(block, operand_src, false);
......@@ -11150,7 +11150,7 @@ const SwitchProngAnalysis = struct {
1115011150 }
1115111151
1115211152 switch (operand_ty.zigTypeTag(zcu)) {
11153 .Union => {
11153 .@"union" => {
1115411154 const union_obj = zcu.typeToUnion(operand_ty).?;
1115511155 const first_item_val = sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, case_vals[0], undefined) catch unreachable;
1115611156
......@@ -11370,9 +11370,9 @@ const SwitchProngAnalysis = struct {
1137011370 break :len coerce_block.instructions.items.len;
1137111371 };
1137211372
11373 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.SwitchBr).Struct.fields.len +
11373 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.SwitchBr).@"struct".fields.len +
1137411374 cases_extra.items.len +
11375 @typeInfo(Air.Block).Struct.fields.len +
11375 @typeInfo(Air.Block).@"struct".fields.len +
1137611376 1);
1137711377
1137811378 const switch_br_inst: u32 = @intCast(sema.air_instructions.len);
......@@ -11396,7 +11396,7 @@ const SwitchProngAnalysis = struct {
1139611396
1139711397 return capture_block_inst.toRef();
1139811398 },
11399 .ErrorSet => {
11399 .error_set => {
1140011400 if (capture_byref) {
1140111401 return sema.fail(
1140211402 block,
......@@ -11444,18 +11444,18 @@ fn switchCond(
1144411444 const zcu = pt.zcu;
1144511445 const operand_ty = sema.typeOf(operand);
1144611446 switch (operand_ty.zigTypeTag(zcu)) {
11447 .Type,
11448 .Void,
11449 .Bool,
11450 .Int,
11451 .Float,
11452 .ComptimeFloat,
11453 .ComptimeInt,
11454 .EnumLiteral,
11455 .Pointer,
11456 .Fn,
11457 .ErrorSet,
11458 .Enum,
11447 .type,
11448 .void,
11449 .bool,
11450 .int,
11451 .float,
11452 .comptime_float,
11453 .comptime_int,
11454 .enum_literal,
11455 .pointer,
11456 .@"fn",
11457 .error_set,
11458 .@"enum",
1145911459 => {
1146011460 if (operand_ty.isSlice(zcu)) {
1146111461 return sema.fail(block, src, "switch on type '{}'", .{operand_ty.fmt(pt)});
......@@ -11466,7 +11466,7 @@ fn switchCond(
1146611466 return operand;
1146711467 },
1146811468
11469 .Union => {
11469 .@"union" => {
1147011470 try operand_ty.resolveFields(pt);
1147111471 const enum_ty = operand_ty.unionTagType(zcu) orelse {
1147211472 const msg = msg: {
......@@ -11482,17 +11482,17 @@ fn switchCond(
1148211482 return sema.unionToTag(block, enum_ty, operand, src);
1148311483 },
1148411484
11485 .ErrorUnion,
11486 .NoReturn,
11487 .Array,
11488 .Struct,
11489 .Undefined,
11490 .Null,
11491 .Optional,
11492 .Opaque,
11493 .Vector,
11494 .Frame,
11495 .AnyFrame,
11485 .error_union,
11486 .noreturn,
11487 .array,
11488 .@"struct",
11489 .undefined,
11490 .null,
11491 .optional,
11492 .@"opaque",
11493 .vector,
11494 .frame,
11495 .@"anyframe",
1149611496 => return sema.fail(block, src, "switch on type '{}'", .{operand_ty.fmt(pt)}),
1149711497 }
1149811498}
......@@ -11593,7 +11593,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp
1159311593 else
1159411594 operand_ty;
1159511595
11596 if (operand_err_set.zigTypeTag(zcu) != .ErrorUnion) {
11596 if (operand_err_set.zigTypeTag(zcu) != .error_union) {
1159711597 return sema.fail(block, switch_src, "expected error union type, found '{}'", .{
1159811598 operand_ty.fmt(pt),
1159911599 });
......@@ -11791,7 +11791,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp
1179111791 true,
1179211792 );
1179311793
11794 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len +
11794 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).@"struct".fields.len +
1179511795 true_instructions.len + sub_block.instructions.items.len);
1179611796
1179711797 _ = try child_block.addInst(.{
......@@ -11886,7 +11886,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
1188611886 };
1188711887
1188811888 const maybe_union_ty = sema.typeOf(raw_operand_val);
11889 const union_originally = maybe_union_ty.zigTypeTag(zcu) == .Union;
11889 const union_originally = maybe_union_ty.zigTypeTag(zcu) == .@"union";
1189011890
1189111891 // Duplicate checking variables later also used for `inline else`.
1189211892 var seen_enum_fields: []?LazySrcLoc = &.{};
......@@ -11904,7 +11904,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
1190411904 var empty_enum = false;
1190511905
1190611906 const operand_ty = sema.typeOf(operand);
11907 const err_set = operand_ty.zigTypeTag(zcu) == .ErrorSet;
11907 const err_set = operand_ty.zigTypeTag(zcu) == .error_set;
1190811908
1190911909 var else_error_ty: ?Type = null;
1191011910
......@@ -11936,8 +11936,8 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
1193611936
1193711937 // Validate for duplicate items, missing else prong, and invalid range.
1193811938 switch (operand_ty.zigTypeTag(zcu)) {
11939 .Union => unreachable, // handled in `switchCond`
11940 .Enum => {
11939 .@"union" => unreachable, // handled in `switchCond`
11940 .@"enum" => {
1194111941 seen_enum_fields = try gpa.alloc(?LazySrcLoc, operand_ty.enumFieldCount(zcu));
1194211942 empty_enum = seen_enum_fields.len == 0 and !operand_ty.isNonexhaustiveEnum(zcu);
1194311943 @memset(seen_enum_fields, null);
......@@ -12046,7 +12046,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
1204612046 );
1204712047 }
1204812048 },
12049 .ErrorSet => else_error_ty = try validateErrSetSwitch(
12049 .error_set => else_error_ty = try validateErrSetSwitch(
1205012050 sema,
1205112051 block,
1205212052 &seen_errors,
......@@ -12058,7 +12058,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
1205812058 .{ .body = special.body, .end = special.end, .src = special_prong_src },
1205912059 special_prong == .@"else",
1206012060 ),
12061 .Int, .ComptimeInt => {
12061 .int, .comptime_int => {
1206212062 var extra_index: usize = special.end;
1206312063 {
1206412064 var scalar_i: u32 = 0;
......@@ -12137,7 +12137,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
1213712137 }
1213812138
1213912139 check_range: {
12140 if (operand_ty.zigTypeTag(zcu) == .Int) {
12140 if (operand_ty.zigTypeTag(zcu) == .int) {
1214112141 const min_int = try operand_ty.minInt(pt, operand_ty);
1214212142 const max_int = try operand_ty.maxInt(pt, operand_ty);
1214312143 if (try range_set.spans(min_int.toIntern(), max_int.toIntern())) {
......@@ -12162,7 +12162,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
1216212162 }
1216312163 }
1216412164 },
12165 .Bool => {
12165 .bool => {
1216612166 var extra_index: usize = special.end;
1216712167 {
1216812168 var scalar_i: u32 = 0;
......@@ -12238,7 +12238,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
1223812238 },
1223912239 }
1224012240 },
12241 .EnumLiteral, .Void, .Fn, .Pointer, .Type => {
12241 .enum_literal, .void, .@"fn", .pointer, .type => {
1224212242 if (special_prong != .@"else") {
1224312243 return sema.fail(
1224412244 block,
......@@ -12306,19 +12306,19 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
1230612306 }
1230712307 },
1230812308
12309 .ErrorUnion,
12310 .NoReturn,
12311 .Array,
12312 .Struct,
12313 .Undefined,
12314 .Null,
12315 .Optional,
12316 .Opaque,
12317 .Vector,
12318 .Frame,
12319 .AnyFrame,
12320 .ComptimeFloat,
12321 .Float,
12309 .error_union,
12310 .noreturn,
12311 .array,
12312 .@"struct",
12313 .undefined,
12314 .null,
12315 .optional,
12316 .@"opaque",
12317 .vector,
12318 .frame,
12319 .@"anyframe",
12320 .comptime_float,
12321 .float,
1232212322 => return sema.fail(block, operand_src, "invalid switch operand type '{}'", .{
1232312323 operand_ty.fmt(pt),
1232412324 }),
......@@ -12401,7 +12401,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
1240112401 if (err_set and try sema.maybeErrorUnwrap(block, special.body, operand, operand_src, false)) {
1240212402 return .unreachable_value;
1240312403 }
12404 if (zcu.backendSupportsFeature(.is_named_enum_value) and block.wantSafety() and operand_ty.zigTypeTag(zcu) == .Enum and
12404 if (zcu.backendSupportsFeature(.is_named_enum_value) and block.wantSafety() and operand_ty.zigTypeTag(zcu) == .@"enum" and
1240512405 (!operand_ty.isNonexhaustiveEnum(zcu) or union_originally))
1240612406 {
1240712407 try sema.zirDbgStmt(block, cond_dbg_node_index);
......@@ -12502,7 +12502,7 @@ fn analyzeSwitchRuntimeBlock(
1250212502 const block = child_block.parent.?;
1250312503
1250412504 const estimated_cases_extra = (scalar_cases_len + multi_cases_len) *
12505 @typeInfo(Air.SwitchBr.Case).Struct.fields.len + 2;
12505 @typeInfo(Air.SwitchBr.Case).@"struct".fields.len + 2;
1250612506 var cases_extra = try std.ArrayListUnmanaged(u32).initCapacity(gpa, estimated_cases_extra);
1250712507 defer cases_extra.deinit(gpa);
1250812508
......@@ -12536,7 +12536,7 @@ fn analyzeSwitchRuntimeBlock(
1253612536 const unresolved_item_val = sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, item, undefined) catch unreachable;
1253712537 const item_val = sema.resolveLazyValue(unresolved_item_val) catch unreachable;
1253812538 const field_ty = maybe_union_ty.unionFieldType(item_val, zcu).?;
12539 break :blk field_ty.zigTypeTag(zcu) != .NoReturn;
12539 break :blk field_ty.zigTypeTag(zcu) != .noreturn;
1254012540 } else true;
1254112541
1254212542 const prong_hint: std.builtin.BranchHint = if (err_set and
......@@ -12669,7 +12669,7 @@ fn analyzeSwitchRuntimeBlock(
1266912669 const analyze_body = if (union_originally) blk: {
1267012670 const item_val = sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, item, undefined) catch unreachable;
1267112671 const field_ty = maybe_union_ty.unionFieldType(item_val, zcu).?;
12672 break :blk field_ty.zigTypeTag(zcu) != .NoReturn;
12672 break :blk field_ty.zigTypeTag(zcu) != .noreturn;
1267312673 } else true;
1267412674
1267512675 if (emit_bb) try sema.emitBackwardBranch(block, block.src(.{ .switch_case_item = .{
......@@ -12722,7 +12722,7 @@ fn analyzeSwitchRuntimeBlock(
1272212722 for (items) |item| {
1272312723 const item_val = sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, item, undefined) catch unreachable;
1272412724 const field_ty = maybe_union_ty.unionFieldType(item_val, zcu).?;
12725 if (field_ty.zigTypeTag(zcu) != .NoReturn) break true;
12725 if (field_ty.zigTypeTag(zcu) != .noreturn) break true;
1272612726 } else false
1272712727 else
1272812728 true;
......@@ -12847,7 +12847,7 @@ fn analyzeSwitchRuntimeBlock(
1284712847 } else {
1284812848 try sema.air_extra.ensureUnusedCapacity(
1284912849 gpa,
12850 @typeInfo(Air.CondBr).Struct.fields.len + prev_then_body.len + cond_body.len,
12850 @typeInfo(Air.CondBr).@"struct".fields.len + prev_then_body.len + cond_body.len,
1285112851 );
1285212852
1285312853 sema.air_instructions.items(.data)[@intFromEnum(prev_cond_br)].pl_op.payload = sema.addExtraAssumeCapacity(Air.CondBr{
......@@ -12869,7 +12869,7 @@ fn analyzeSwitchRuntimeBlock(
1286912869 if (special.body.len != 0 or !is_first or case_block.wantSafety()) {
1287012870 var emit_bb = false;
1287112871 if (special.is_inline) switch (operand_ty.zigTypeTag(zcu)) {
12872 .Enum => {
12872 .@"enum" => {
1287312873 if (operand_ty.isNonexhaustiveEnum(zcu) and !union_originally) {
1287412874 return sema.fail(block, special_prong_src, "cannot enumerate values of type '{}' for 'inline else'", .{
1287512875 operand_ty.fmt(pt),
......@@ -12887,7 +12887,7 @@ fn analyzeSwitchRuntimeBlock(
1288712887
1288812888 const analyze_body = if (union_originally) blk: {
1288912889 const field_ty = maybe_union_ty.unionFieldType(item_val, zcu).?;
12890 break :blk field_ty.zigTypeTag(zcu) != .NoReturn;
12890 break :blk field_ty.zigTypeTag(zcu) != .noreturn;
1289112891 } else true;
1289212892
1289312893 if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src);
......@@ -12920,7 +12920,7 @@ fn analyzeSwitchRuntimeBlock(
1292012920 cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items));
1292112921 }
1292212922 },
12923 .ErrorSet => {
12923 .error_set => {
1292412924 if (operand_ty.isAnyError(zcu)) {
1292512925 return sema.fail(block, special_prong_src, "cannot enumerate values of type '{}' for 'inline else'", .{
1292612926 operand_ty.fmt(pt),
......@@ -12966,7 +12966,7 @@ fn analyzeSwitchRuntimeBlock(
1296612966 cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items));
1296712967 }
1296812968 },
12969 .Int => {
12969 .int => {
1297012970 var it = try RangeSetUnhandledIterator.init(sema, operand_ty, range_set);
1297112971 while (try it.next()) |cur| {
1297212972 cases_len += 1;
......@@ -13001,7 +13001,7 @@ fn analyzeSwitchRuntimeBlock(
1300113001 cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items));
1300213002 }
1300313003 },
13004 .Bool => {
13004 .bool => {
1300513005 if (true_count == 0) {
1300613006 cases_len += 1;
1300713007
......@@ -13073,7 +13073,7 @@ fn analyzeSwitchRuntimeBlock(
1307313073
1307413074 if (zcu.backendSupportsFeature(.is_named_enum_value) and
1307513075 special.body.len != 0 and block.wantSafety() and
13076 operand_ty.zigTypeTag(zcu) == .Enum and
13076 operand_ty.zigTypeTag(zcu) == .@"enum" and
1307713077 (!operand_ty.isNonexhaustiveEnum(zcu) or union_originally))
1307813078 {
1307913079 try sema.zirDbgStmt(&case_block, cond_dbg_node_index);
......@@ -13086,7 +13086,7 @@ fn analyzeSwitchRuntimeBlock(
1308613086 if (seen_field != null) continue;
1308713087 const union_obj = zcu.typeToUnion(maybe_union_ty).?;
1308813088 const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[index]);
13089 if (field_ty.zigTypeTag(zcu) != .NoReturn) break true;
13089 if (field_ty.zigTypeTag(zcu) != .noreturn) break true;
1309013090 } else false
1309113091 else
1309213092 true;
......@@ -13128,7 +13128,7 @@ fn analyzeSwitchRuntimeBlock(
1312813128 } else {
1312913129 try branch_hints.append(gpa, .none); // we have the range conditionals first
1313013130 try sema.air_extra.ensureUnusedCapacity(gpa, prev_then_body.len +
13131 @typeInfo(Air.CondBr).Struct.fields.len + case_block.instructions.items.len);
13131 @typeInfo(Air.CondBr).@"struct".fields.len + case_block.instructions.items.len);
1313213132
1313313133 sema.air_instructions.items(.data)[@intFromEnum(prev_cond_br)].pl_op.payload = sema.addExtraAssumeCapacity(Air.CondBr{
1313413134 .then_body_len = @intCast(prev_then_body.len),
......@@ -13145,7 +13145,7 @@ fn analyzeSwitchRuntimeBlock(
1314513145
1314613146 assert(branch_hints.items.len == cases_len + 1);
1314713147
13148 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.SwitchBr).Struct.fields.len +
13148 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.SwitchBr).@"struct".fields.len +
1314913149 cases_extra.items.len + final_else_body.len +
1315013150 (std.math.divCeil(usize, branch_hints.items.len, 10) catch unreachable)); // branch hints
1315113151
......@@ -13847,7 +13847,7 @@ fn maybeErrorUnwrapCondbr(sema: *Sema, block: *Block, body: []const Zir.Inst.Ind
1384713847 const err_inst_data = sema.code.instructions.items(.data)[@intFromEnum(index)].un_node;
1384813848 const err_operand = try sema.resolveInst(err_inst_data.operand);
1384913849 const operand_ty = sema.typeOf(err_operand);
13850 if (operand_ty.zigTypeTag(zcu) == .ErrorSet) {
13850 if (operand_ty.zigTypeTag(zcu) == .error_set) {
1385113851 try sema.maybeErrorUnwrapComptime(block, body, err_operand);
1385213852 return;
1385313853 }
......@@ -14076,9 +14076,9 @@ fn zirShl(
1407614076 if (try rhs_val.compareAllWithZeroSema(.eq, pt)) {
1407714077 return lhs;
1407814078 }
14079 if (scalar_ty.zigTypeTag(zcu) != .ComptimeInt and air_tag != .shl_sat) {
14079 if (scalar_ty.zigTypeTag(zcu) != .comptime_int and air_tag != .shl_sat) {
1408014080 const bit_value = try pt.intValue(Type.comptime_int, scalar_ty.intInfo(zcu).bits);
14081 if (rhs_ty.zigTypeTag(zcu) == .Vector) {
14081 if (rhs_ty.zigTypeTag(zcu) == .vector) {
1408214082 var i: usize = 0;
1408314083 while (i < rhs_ty.vectorLen(zcu)) : (i += 1) {
1408414084 const rhs_elem = try rhs_val.elemValue(pt, i);
......@@ -14097,7 +14097,7 @@ fn zirShl(
1409714097 });
1409814098 }
1409914099 }
14100 if (rhs_ty.zigTypeTag(zcu) == .Vector) {
14100 if (rhs_ty.zigTypeTag(zcu) == .vector) {
1410114101 var i: usize = 0;
1410214102 while (i < rhs_ty.vectorLen(zcu)) : (i += 1) {
1410314103 const rhs_elem = try rhs_val.elemValue(pt, i);
......@@ -14118,12 +14118,12 @@ fn zirShl(
1411814118 const runtime_src = if (maybe_lhs_val) |lhs_val| rs: {
1411914119 if (lhs_val.isUndef(zcu)) return pt.undefRef(lhs_ty);
1412014120 const rhs_val = maybe_rhs_val orelse {
14121 if (scalar_ty.zigTypeTag(zcu) == .ComptimeInt) {
14121 if (scalar_ty.zigTypeTag(zcu) == .comptime_int) {
1412214122 return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be comptime-known", .{});
1412314123 }
1412414124 break :rs rhs_src;
1412514125 };
14126 const val = if (scalar_ty.zigTypeTag(zcu) == .ComptimeInt)
14126 const val = if (scalar_ty.zigTypeTag(zcu) == .comptime_int)
1412714127 try lhs_val.shl(rhs_val, lhs_ty, sema.arena, pt)
1412814128 else switch (air_tag) {
1412914129 .shl_exact => val: {
......@@ -14158,7 +14158,7 @@ fn zirShl(
1415814158 const bit_count = scalar_ty.intInfo(zcu).bits;
1415914159 if (!std.math.isPowerOfTwo(bit_count)) {
1416014160 const bit_count_val = try pt.intValue(scalar_rhs_ty, bit_count);
14161 const ok = if (rhs_ty.zigTypeTag(zcu) == .Vector) ok: {
14161 const ok = if (rhs_ty.zigTypeTag(zcu) == .vector) ok: {
1416214162 const bit_count_inst = Air.internedToRef((try sema.splat(rhs_ty, bit_count_val)).toIntern());
1416314163 const lt = try block.addCmpVector(rhs, bit_count_inst, .lt);
1416414164 break :ok try block.addInst(.{
......@@ -14188,7 +14188,7 @@ fn zirShl(
1418814188 } },
1418914189 });
1419014190 const ov_bit = try sema.tupleFieldValByIndex(block, src, op_ov, 1, op_ov_tuple_ty);
14191 const any_ov_bit = if (lhs_ty.zigTypeTag(zcu) == .Vector)
14191 const any_ov_bit = if (lhs_ty.zigTypeTag(zcu) == .vector)
1419214192 try block.addInst(.{
1419314193 .tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
1419414194 .data = .{ .reduce = .{
......@@ -14242,9 +14242,9 @@ fn zirShr(
1424214242 if (try rhs_val.compareAllWithZeroSema(.eq, pt)) {
1424314243 return lhs;
1424414244 }
14245 if (scalar_ty.zigTypeTag(zcu) != .ComptimeInt) {
14245 if (scalar_ty.zigTypeTag(zcu) != .comptime_int) {
1424614246 const bit_value = try pt.intValue(Type.comptime_int, scalar_ty.intInfo(zcu).bits);
14247 if (rhs_ty.zigTypeTag(zcu) == .Vector) {
14247 if (rhs_ty.zigTypeTag(zcu) == .vector) {
1424814248 var i: usize = 0;
1424914249 while (i < rhs_ty.vectorLen(zcu)) : (i += 1) {
1425014250 const rhs_elem = try rhs_val.elemValue(pt, i);
......@@ -14263,7 +14263,7 @@ fn zirShr(
1426314263 });
1426414264 }
1426514265 }
14266 if (rhs_ty.zigTypeTag(zcu) == .Vector) {
14266 if (rhs_ty.zigTypeTag(zcu) == .vector) {
1426714267 var i: usize = 0;
1426814268 while (i < rhs_ty.vectorLen(zcu)) : (i += 1) {
1426914269 const rhs_elem = try rhs_val.elemValue(pt, i);
......@@ -14297,7 +14297,7 @@ fn zirShr(
1429714297 }
1429814298 } else rhs_src;
1429914299
14300 if (maybe_rhs_val == null and scalar_ty.zigTypeTag(zcu) == .ComptimeInt) {
14300 if (maybe_rhs_val == null and scalar_ty.zigTypeTag(zcu) == .comptime_int) {
1430114301 return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be comptime-known", .{});
1430214302 }
1430314303
......@@ -14308,7 +14308,7 @@ fn zirShr(
1430814308 if (!std.math.isPowerOfTwo(bit_count)) {
1430914309 const bit_count_val = try pt.intValue(rhs_ty.scalarType(zcu), bit_count);
1431014310
14311 const ok = if (rhs_ty.zigTypeTag(zcu) == .Vector) ok: {
14311 const ok = if (rhs_ty.zigTypeTag(zcu) == .vector) ok: {
1431214312 const bit_count_inst = Air.internedToRef((try sema.splat(rhs_ty, bit_count_val)).toIntern());
1431314313 const lt = try block.addCmpVector(rhs, bit_count_inst, .lt);
1431414314 break :ok try block.addInst(.{
......@@ -14328,7 +14328,7 @@ fn zirShr(
1432814328 if (air_tag == .shr_exact) {
1432914329 const back = try block.addBinOp(.shl, result, rhs);
1433014330
14331 const ok = if (rhs_ty.zigTypeTag(zcu) == .Vector) ok: {
14331 const ok = if (rhs_ty.zigTypeTag(zcu) == .vector) ok: {
1433214332 const eql = try block.addCmpVector(lhs, back, .eq);
1433314333 break :ok try block.addInst(.{
1433414334 .tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
......@@ -14374,7 +14374,7 @@ fn zirBitwise(
1437414374 const casted_lhs = try sema.coerce(block, resolved_type, lhs, lhs_src);
1437514375 const casted_rhs = try sema.coerce(block, resolved_type, rhs, rhs_src);
1437614376
14377 const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
14377 const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
1437814378
1437914379 if (!is_int) {
1438014380 return sema.fail(block, src, "invalid operands to binary bitwise expression: '{s}' and '{s}'", .{ @tagName(lhs_ty.zigTypeTag(zcu)), @tagName(rhs_ty.zigTypeTag(zcu)) });
......@@ -14418,7 +14418,7 @@ fn zirBitNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
1441814418 const operand_type = sema.typeOf(operand);
1441914419 const scalar_type = operand_type.scalarType(zcu);
1442014420
14421 if (scalar_type.zigTypeTag(zcu) != .Int) {
14421 if (scalar_type.zigTypeTag(zcu) != .int) {
1442214422 return sema.fail(block, src, "unable to perform binary not operation on type '{}'", .{
1442314423 operand_type.fmt(pt),
1442414424 });
......@@ -14427,7 +14427,7 @@ fn zirBitNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
1442714427 if (try sema.resolveValue(operand)) |val| {
1442814428 if (val.isUndef(zcu)) {
1442914429 return pt.undefRef(operand_type);
14430 } else if (operand_type.zigTypeTag(zcu) == .Vector) {
14430 } else if (operand_type.zigTypeTag(zcu) == .vector) {
1443114431 const vec_len = try sema.usizeCast(block, operand_src, operand_type.vectorLen(zcu));
1443214432 const elems = try sema.arena.alloc(InternPool.Index, vec_len);
1443314433 for (elems, 0..) |*elem, i| {
......@@ -14647,19 +14647,19 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1464714647 .child = resolved_elem_ty.toIntern(),
1464814648 });
1464914649 const ptr_addrspace = p: {
14650 if (lhs_ty.zigTypeTag(zcu) == .Pointer) break :p lhs_ty.ptrAddressSpace(zcu);
14651 if (rhs_ty.zigTypeTag(zcu) == .Pointer) break :p rhs_ty.ptrAddressSpace(zcu);
14650 if (lhs_ty.zigTypeTag(zcu) == .pointer) break :p lhs_ty.ptrAddressSpace(zcu);
14651 if (rhs_ty.zigTypeTag(zcu) == .pointer) break :p rhs_ty.ptrAddressSpace(zcu);
1465214652 break :p null;
1465314653 };
1465414654
1465514655 const runtime_src = if (switch (lhs_ty.zigTypeTag(zcu)) {
14656 .Array, .Struct => try sema.resolveValue(lhs),
14657 .Pointer => try sema.resolveDefinedValue(block, lhs_src, lhs),
14656 .array, .@"struct" => try sema.resolveValue(lhs),
14657 .pointer => try sema.resolveDefinedValue(block, lhs_src, lhs),
1465814658 else => unreachable,
1465914659 }) |lhs_val| rs: {
1466014660 if (switch (rhs_ty.zigTypeTag(zcu)) {
14661 .Array, .Struct => try sema.resolveValue(rhs),
14662 .Pointer => try sema.resolveDefinedValue(block, rhs_src, rhs),
14661 .array, .@"struct" => try sema.resolveValue(rhs),
14662 .pointer => try sema.resolveDefinedValue(block, rhs_src, rhs),
1466314663 else => unreachable,
1466414664 }) |rhs_val| {
1466514665 const lhs_sub_val = if (lhs_ty.isSinglePointer(zcu))
......@@ -14789,8 +14789,8 @@ fn getArrayCatInfo(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air.Ins
1478914789 const zcu = pt.zcu;
1479014790 const operand_ty = sema.typeOf(operand);
1479114791 switch (operand_ty.zigTypeTag(zcu)) {
14792 .Array => return operand_ty.arrayInfo(zcu),
14793 .Pointer => {
14792 .array => return operand_ty.arrayInfo(zcu),
14793 .pointer => {
1479414794 const ptr_info = operand_ty.ptrInfo(zcu);
1479514795 switch (ptr_info.flags.size) {
1479614796 .Slice => {
......@@ -14807,14 +14807,14 @@ fn getArrayCatInfo(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air.Ins
1480714807 };
1480814808 },
1480914809 .One => {
14810 if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .Array) {
14810 if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .array) {
1481114811 return Type.fromInterned(ptr_info.child).arrayInfo(zcu);
1481214812 }
1481314813 },
1481414814 .C, .Many => {},
1481514815 }
1481614816 },
14817 .Struct => {
14817 .@"struct" => {
1481814818 if (operand_ty.isTuple(zcu) and peer_ty.isIndexable(zcu)) {
1481914819 assert(!peer_ty.isTuple(zcu));
1482014820 return .{
......@@ -14934,12 +14934,12 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1493414934 const lhs_len = uncoerced_lhs_ty.structFieldCount(zcu);
1493514935 const lhs_dest_ty = switch (res_ty.zigTypeTag(zcu)) {
1493614936 else => break :no_coerce,
14937 .Array => try pt.arrayType(.{
14937 .array => try pt.arrayType(.{
1493814938 .child = res_ty.childType(zcu).toIntern(),
1493914939 .len = lhs_len,
1494014940 .sentinel = if (res_ty.sentinel(zcu)) |s| s.toIntern() else .none,
1494114941 }),
14942 .Vector => try pt.vectorType(.{
14942 .vector => try pt.vectorType(.{
1494314943 .child = res_ty.childType(zcu).toIntern(),
1494414944 .len = lhs_len,
1494514945 }),
......@@ -14971,7 +14971,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1497114971 const msg = try sema.errMsg(lhs_src, "expected indexable; found '{}'", .{lhs_ty.fmt(pt)});
1497214972 errdefer msg.destroy(sema.gpa);
1497314973 switch (lhs_ty.zigTypeTag(zcu)) {
14974 .Int, .Float, .ComptimeFloat, .ComptimeInt, .Vector => {
14974 .int, .float, .comptime_float, .comptime_int, .vector => {
1497514975 try sema.errNote(operator_src, msg, "this operator multiplies arrays; use std.math.pow for exponentiation", .{});
1497614976 },
1497714977 else => {},
......@@ -14996,7 +14996,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1499614996 .child = lhs_info.elem_type.toIntern(),
1499714997 });
1499814998
14999 const ptr_addrspace = if (lhs_ty.zigTypeTag(zcu) == .Pointer) lhs_ty.ptrAddressSpace(zcu) else null;
14999 const ptr_addrspace = if (lhs_ty.zigTypeTag(zcu) == .pointer) lhs_ty.ptrAddressSpace(zcu) else null;
1500015000 const lhs_len = try sema.usizeCast(block, lhs_src, lhs_info.len);
1500115001
1500215002 if (try sema.resolveDefinedValue(block, lhs_src, lhs)) |lhs_val| ct: {
......@@ -15096,7 +15096,7 @@ fn zirNegate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
1509615096 const rhs_scalar_ty = rhs_ty.scalarType(zcu);
1509715097
1509815098 if (rhs_scalar_ty.isUnsignedInt(zcu) or switch (rhs_scalar_ty.zigTypeTag(zcu)) {
15099 .Int, .ComptimeInt, .Float, .ComptimeFloat => false,
15099 .int, .comptime_int, .float, .comptime_float => false,
1510015100 else => true,
1510115101 }) {
1510215102 return sema.fail(block, src, "negation of type '{}'", .{rhs_ty.fmt(pt)});
......@@ -15129,7 +15129,7 @@ fn zirNegateWrap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
1512915129 const rhs_scalar_ty = rhs_ty.scalarType(zcu);
1513015130
1513115131 switch (rhs_scalar_ty.zigTypeTag(zcu)) {
15132 .Int, .ComptimeInt, .Float, .ComptimeFloat => {},
15132 .int, .comptime_int, .float, .comptime_float => {},
1513315133 else => return sema.fail(block, src, "negation of type '{}'", .{rhs_ty.fmt(pt)}),
1513415134 }
1513515135
......@@ -15187,15 +15187,15 @@ fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins
1518715187 const rhs_scalar_ty = rhs_ty.scalarType(zcu);
1518815188 const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
1518915189
15190 const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
15190 const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
1519115191
1519215192 try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .div);
1519315193
1519415194 const maybe_lhs_val = try sema.resolveValueIntable(casted_lhs);
1519515195 const maybe_rhs_val = try sema.resolveValueIntable(casted_rhs);
1519615196
15197 if ((lhs_ty.zigTypeTag(zcu) == .ComptimeFloat and rhs_ty.zigTypeTag(zcu) == .ComptimeInt) or
15198 (lhs_ty.zigTypeTag(zcu) == .ComptimeInt and rhs_ty.zigTypeTag(zcu) == .ComptimeFloat))
15197 if ((lhs_ty.zigTypeTag(zcu) == .comptime_float and rhs_ty.zigTypeTag(zcu) == .comptime_int) or
15198 (lhs_ty.zigTypeTag(zcu) == .comptime_int and rhs_ty.zigTypeTag(zcu) == .comptime_float))
1519915199 {
1520015200 // If it makes a difference whether we coerce to ints or floats before doing the division, error.
1520115201 // If lhs % rhs is 0, it doesn't matter.
......@@ -15240,13 +15240,13 @@ fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins
1524015240 // * other float type: result is undefined
1524115241 // If the lhs is undefined, result is undefined.
1524215242 switch (scalar_tag) {
15243 .Int, .ComptimeInt, .ComptimeFloat => {
15243 .int, .comptime_int, .comptime_float => {
1524415244 if (maybe_lhs_val) |lhs_val| {
1524515245 if (!lhs_val.isUndef(zcu)) {
1524615246 if (try lhs_val.compareAllWithZeroSema(.eq, pt)) {
1524715247 const scalar_zero = switch (scalar_tag) {
15248 .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15249 .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
15248 .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15249 .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
1525015250 else => unreachable,
1525115251 };
1525215252 const zero_val = try sema.splat(resolved_type, scalar_zero);
......@@ -15352,7 +15352,7 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1535215352 const lhs_scalar_ty = lhs_ty.scalarType(zcu);
1535315353 const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
1535415354
15355 const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
15355 const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
1535615356
1535715357 try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .div_exact);
1535815358
......@@ -15382,8 +15382,8 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1538215382 } else {
1538315383 if (try lhs_val.compareAllWithZeroSema(.eq, pt)) {
1538415384 const scalar_zero = switch (scalar_tag) {
15385 .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15386 .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
15385 .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15386 .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
1538715387 else => unreachable,
1538815388 };
1538915389 const zero_val = try sema.splat(resolved_type, scalar_zero);
......@@ -15439,7 +15439,7 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1543915439 const ok = if (!is_int) ok: {
1544015440 const floored = try block.addUnOp(.floor, result);
1544115441
15442 if (resolved_type.zigTypeTag(zcu) == .Vector) {
15442 if (resolved_type.zigTypeTag(zcu) == .vector) {
1544315443 const eql = try block.addCmpVector(result, floored, .eq);
1544415444 break :ok try block.addInst(.{
1544515445 .tag = switch (block.float_mode) {
......@@ -15462,11 +15462,11 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1546215462 const remainder = try block.addBinOp(.rem, casted_lhs, casted_rhs);
1546315463
1546415464 const scalar_zero = switch (scalar_tag) {
15465 .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15466 .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
15465 .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15466 .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
1546715467 else => unreachable,
1546815468 };
15469 if (resolved_type.zigTypeTag(zcu) == .Vector) {
15469 if (resolved_type.zigTypeTag(zcu) == .vector) {
1547015470 const zero_val = try sema.splat(resolved_type, scalar_zero);
1547115471 const zero = Air.internedToRef(zero_val.toIntern());
1547215472 const eql = try block.addCmpVector(remainder, zero, .eq);
......@@ -15519,7 +15519,7 @@ fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1551915519 const rhs_scalar_ty = rhs_ty.scalarType(zcu);
1552015520 const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
1552115521
15522 const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
15522 const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
1552315523
1552415524 try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .div_floor);
1552515525
......@@ -15550,8 +15550,8 @@ fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1555015550 if (!lhs_val.isUndef(zcu)) {
1555115551 if (try lhs_val.compareAllWithZeroSema(.eq, pt)) {
1555215552 const scalar_zero = switch (scalar_tag) {
15553 .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15554 .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
15553 .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15554 .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
1555515555 else => unreachable,
1555615556 };
1555715557 const zero_val = try sema.splat(resolved_type, scalar_zero);
......@@ -15630,7 +15630,7 @@ fn zirDivTrunc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1563015630 const rhs_scalar_ty = rhs_ty.scalarType(zcu);
1563115631 const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
1563215632
15633 const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
15633 const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
1563415634
1563515635 try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .div_trunc);
1563615636
......@@ -15661,8 +15661,8 @@ fn zirDivTrunc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1566115661 if (!lhs_val.isUndef(zcu)) {
1566215662 if (try lhs_val.compareAllWithZeroSema(.eq, pt)) {
1566315663 const scalar_zero = switch (scalar_tag) {
15664 .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15665 .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
15664 .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15665 .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
1566615666 else => unreachable,
1566715667 };
1566815668 const zero_val = try sema.splat(resolved_type, scalar_zero);
......@@ -15756,7 +15756,7 @@ fn addDivIntOverflowSafety(
1575615756 }
1575715757
1575815758 var ok: Air.Inst.Ref = .none;
15759 if (resolved_type.zigTypeTag(zcu) == .Vector) {
15759 if (resolved_type.zigTypeTag(zcu) == .vector) {
1576015760 if (maybe_lhs_val == null) {
1576115761 const min_int_ref = Air.internedToRef(min_int.toIntern());
1576215762 ok = try block.addCmpVector(casted_lhs, min_int_ref, .neq);
......@@ -15819,7 +15819,7 @@ fn addDivByZeroSafety(
1581915819 try pt.intValue(resolved_type.scalarType(zcu), 0)
1582015820 else
1582115821 try pt.floatValue(resolved_type.scalarType(zcu), 0.0);
15822 const ok = if (resolved_type.zigTypeTag(zcu) == .Vector) ok: {
15822 const ok = if (resolved_type.zigTypeTag(zcu) == .vector) ok: {
1582315823 const zero_val = try sema.splat(resolved_type, scalar_zero);
1582415824 const zero = Air.internedToRef(zero_val.toIntern());
1582515825 const ok = try block.addCmpVector(casted_rhs, zero, .neq);
......@@ -15867,7 +15867,7 @@ fn zirModRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
1586715867 .override = &[_]?LazySrcLoc{ lhs_src, rhs_src },
1586815868 });
1586915869
15870 const is_vector = resolved_type.zigTypeTag(zcu) == .Vector;
15870 const is_vector = resolved_type.zigTypeTag(zcu) == .vector;
1587115871
1587215872 const casted_lhs = try sema.coerce(block, resolved_type, lhs, lhs_src);
1587315873 const casted_rhs = try sema.coerce(block, resolved_type, rhs, rhs_src);
......@@ -15876,7 +15876,7 @@ fn zirModRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
1587615876 const rhs_scalar_ty = rhs_ty.scalarType(zcu);
1587715877 const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
1587815878
15879 const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
15879 const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
1588015880
1588115881 try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .mod_rem);
1588215882
......@@ -15904,8 +15904,8 @@ fn zirModRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
1590415904 }
1590515905 if (try lhs_val.compareAllWithZeroSema(.eq, pt)) {
1590615906 const scalar_zero = switch (scalar_tag) {
15907 .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15908 .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
15907 .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
15908 .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
1590915909 else => unreachable,
1591015910 };
1591115911 const zero_val = if (is_vector) Value.fromInterned(try pt.intern(.{ .aggregate = .{
......@@ -15987,7 +15987,7 @@ fn intRem(
1598715987) CompileError!Value {
1598815988 const pt = sema.pt;
1598915989 const zcu = pt.zcu;
15990 if (ty.zigTypeTag(zcu) == .Vector) {
15990 if (ty.zigTypeTag(zcu) == .vector) {
1599115991 const result_data = try sema.arena.alloc(InternPool.Index, ty.vectorLen(zcu));
1599215992 const scalar_ty = ty.scalarType(zcu);
1599315993 for (result_data, 0..) |*scalar, i| {
......@@ -16058,7 +16058,7 @@ fn zirMod(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins
1605816058
1605916059 const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
1606016060
16061 const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
16061 const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
1606216062
1606316063 try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .mod);
1606416064
......@@ -16154,7 +16154,7 @@ fn zirRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins
1615416154
1615516155 const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
1615616156
16157 const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
16157 const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
1615816158
1615916159 try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .rem);
1616016160
......@@ -16265,7 +16265,7 @@ fn zirOverflowArithmetic(
1626516265 const lhs = try sema.coerce(block, dest_ty, uncasted_lhs, lhs_src);
1626616266 const rhs = try sema.coerce(block, rhs_dest_ty, uncasted_rhs, rhs_src);
1626716267
16268 if (dest_ty.scalarType(zcu).zigTypeTag(zcu) != .Int) {
16268 if (dest_ty.scalarType(zcu).zigTypeTag(zcu) != .int) {
1626916269 return sema.fail(block, src, "expected vector of integers or integer tag type, found '{}'", .{dest_ty.fmt(pt)});
1627016270 }
1627116271
......@@ -16438,7 +16438,7 @@ fn zirOverflowArithmetic(
1643816438fn splat(sema: *Sema, ty: Type, val: Value) !Value {
1643916439 const pt = sema.pt;
1644016440 const zcu = pt.zcu;
16441 if (ty.zigTypeTag(zcu) != .Vector) return val;
16441 if (ty.zigTypeTag(zcu) != .vector) return val;
1644216442 const repeated = try pt.intern(.{ .aggregate = .{
1644316443 .ty = ty.toIntern(),
1644416444 .storage = .{ .repeated_elem = val.toIntern() },
......@@ -16450,7 +16450,7 @@ fn overflowArithmeticTupleType(sema: *Sema, ty: Type) !Type {
1645016450 const pt = sema.pt;
1645116451 const zcu = pt.zcu;
1645216452 const ip = &zcu.intern_pool;
16453 const ov_ty = if (ty.zigTypeTag(zcu) == .Vector) try pt.vectorType(.{
16453 const ov_ty = if (ty.zigTypeTag(zcu) == .vector) try pt.vectorType(.{
1645416454 .len = ty.vectorLen(zcu),
1645516455 .child = .u1_type,
1645616456 }) else Type.u1;
......@@ -16485,8 +16485,8 @@ fn analyzeArithmetic(
1648516485 const rhs_zig_ty_tag = try rhs_ty.zigTypeTagOrPoison(zcu);
1648616486 try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src);
1648716487
16488 if (lhs_zig_ty_tag == .Pointer) {
16489 if (rhs_zig_ty_tag == .Pointer) {
16488 if (lhs_zig_ty_tag == .pointer) {
16489 if (rhs_zig_ty_tag == .pointer) {
1649016490 if (lhs_ty.ptrSize(zcu) != .Slice and rhs_ty.ptrSize(zcu) != .Slice) {
1649116491 if (zir_tag != .sub) {
1649216492 return sema.failWithInvalidPtrArithmetic(block, src, "pointer-pointer", "subtraction");
......@@ -16569,7 +16569,7 @@ fn analyzeArithmetic(
1656916569 const scalar_type = resolved_type.scalarType(zcu);
1657016570 const scalar_tag = scalar_type.zigTypeTag(zcu);
1657116571
16572 const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
16572 const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
1657316573
1657416574 try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, zir_tag);
1657516575
......@@ -16667,7 +16667,7 @@ fn analyzeArithmetic(
1666716667 return pt.undefRef(resolved_type);
1666816668 }
1666916669
16670 const val = if (scalar_tag == .ComptimeInt)
16670 const val = if (scalar_tag == .comptime_int)
1667116671 try sema.intAdd(lhs_val, rhs_val, resolved_type, undefined)
1667216672 else
1667316673 try lhs_val.intAddSat(rhs_val, resolved_type, sema.arena, pt);
......@@ -16765,7 +16765,7 @@ fn analyzeArithmetic(
1676516765 return pt.undefRef(resolved_type);
1676616766 }
1676716767 if (maybe_rhs_val) |rhs_val| {
16768 const val = if (scalar_tag == .ComptimeInt)
16768 const val = if (scalar_tag == .comptime_int)
1676916769 try sema.intSub(lhs_val, rhs_val, resolved_type, undefined)
1677016770 else
1677116771 try lhs_val.intSubSat(rhs_val, resolved_type, sema.arena, pt);
......@@ -16789,13 +16789,13 @@ fn analyzeArithmetic(
1678916789 // the result is nan.
1679016790 // If either of the operands are nan, the result is nan.
1679116791 const scalar_zero = switch (scalar_tag) {
16792 .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 0.0),
16793 .ComptimeInt, .Int => try pt.intValue(scalar_type, 0),
16792 .comptime_float, .float => try pt.floatValue(scalar_type, 0.0),
16793 .comptime_int, .int => try pt.intValue(scalar_type, 0),
1679416794 else => unreachable,
1679516795 };
1679616796 const scalar_one = switch (scalar_tag) {
16797 .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 1.0),
16798 .ComptimeInt, .Int => try pt.intValue(scalar_type, 1),
16797 .comptime_float, .float => try pt.floatValue(scalar_type, 1.0),
16798 .comptime_int, .int => try pt.intValue(scalar_type, 1),
1679916799 else => unreachable,
1680016800 };
1680116801 if (maybe_lhs_val) |lhs_val| {
......@@ -16875,13 +16875,13 @@ fn analyzeArithmetic(
1687516875 // If either of the operands are one, result is the other operand.
1687616876 // If either of the operands are undefined, result is undefined.
1687716877 const scalar_zero = switch (scalar_tag) {
16878 .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 0.0),
16879 .ComptimeInt, .Int => try pt.intValue(scalar_type, 0),
16878 .comptime_float, .float => try pt.floatValue(scalar_type, 0.0),
16879 .comptime_int, .int => try pt.intValue(scalar_type, 0),
1688016880 else => unreachable,
1688116881 };
1688216882 const scalar_one = switch (scalar_tag) {
16883 .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 1.0),
16884 .ComptimeInt, .Int => try pt.intValue(scalar_type, 1),
16883 .comptime_float, .float => try pt.floatValue(scalar_type, 1.0),
16884 .comptime_int, .int => try pt.intValue(scalar_type, 1),
1688516885 else => unreachable,
1688616886 };
1688716887 if (maybe_lhs_val) |lhs_val| {
......@@ -16920,13 +16920,13 @@ fn analyzeArithmetic(
1692016920 // If either of the operands are one, result is the other operand.
1692116921 // If either of the operands are undefined, result is undefined.
1692216922 const scalar_zero = switch (scalar_tag) {
16923 .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 0.0),
16924 .ComptimeInt, .Int => try pt.intValue(scalar_type, 0),
16923 .comptime_float, .float => try pt.floatValue(scalar_type, 0.0),
16924 .comptime_int, .int => try pt.intValue(scalar_type, 0),
1692516925 else => unreachable,
1692616926 };
1692716927 const scalar_one = switch (scalar_tag) {
16928 .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 1.0),
16929 .ComptimeInt, .Int => try pt.intValue(scalar_type, 1),
16928 .comptime_float, .float => try pt.floatValue(scalar_type, 1.0),
16929 .comptime_int, .int => try pt.intValue(scalar_type, 1),
1693016930 else => unreachable,
1693116931 };
1693216932 if (maybe_lhs_val) |lhs_val| {
......@@ -16956,7 +16956,7 @@ fn analyzeArithmetic(
1695616956 return pt.undefRef(resolved_type);
1695716957 }
1695816958
16959 const val = if (scalar_tag == .ComptimeInt)
16959 const val = if (scalar_tag == .comptime_int)
1696016960 try lhs_val.intMul(rhs_val, resolved_type, undefined, sema.arena, pt)
1696116961 else
1696216962 try lhs_val.intMulSat(rhs_val, resolved_type, sema.arena, pt);
......@@ -16971,7 +16971,7 @@ fn analyzeArithmetic(
1697116971
1697216972 try sema.requireRuntimeBlock(block, src, runtime_src);
1697316973
16974 if (block.wantSafety() and want_safety and scalar_tag == .Int) {
16974 if (block.wantSafety() and want_safety and scalar_tag == .int) {
1697516975 if (zcu.backendSupportsFeature(.safety_checked_instructions)) {
1697616976 if (air_tag != air_tag_safe) {
1697716977 _ = try sema.preparePanicId(block, src, .integer_overflow);
......@@ -16997,7 +16997,7 @@ fn analyzeArithmetic(
1699716997 } },
1699816998 });
1699916999 const ov_bit = try sema.tupleFieldValByIndex(block, src, op_ov, 1, op_ov_tuple_ty);
17000 const any_ov_bit = if (resolved_type.zigTypeTag(zcu) == .Vector)
17000 const any_ov_bit = if (resolved_type.zigTypeTag(zcu) == .vector)
1700117001 try block.addInst(.{
1700217002 .tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
1700317003 .data = .{ .reduce = .{
......@@ -17170,7 +17170,7 @@ fn zirAsm(
1717017170
1717117171 var extra_i = extra.end;
1717217172 var output_type_bits = extra.data.output_type_bits;
17173 var needed_capacity: usize = @typeInfo(Air.Asm).Struct.fields.len + outputs_len + inputs_len;
17173 var needed_capacity: usize = @typeInfo(Air.Asm).@"struct".fields.len + outputs_len + inputs_len;
1717417174
1717517175 const ConstraintName = struct { c: []const u8, n: []const u8 };
1717617176 const out_args = try sema.arena.alloc(Air.Inst.Ref, outputs_len);
......@@ -17217,8 +17217,8 @@ fn zirAsm(
1721717217 const uncasted_arg = try sema.resolveInst(input.data.operand);
1721817218 const uncasted_arg_ty = sema.typeOf(uncasted_arg);
1721917219 switch (uncasted_arg_ty.zigTypeTag(zcu)) {
17220 .ComptimeInt => arg.* = try sema.coerce(block, Type.usize, uncasted_arg, src),
17221 .ComptimeFloat => arg.* = try sema.coerce(block, Type.f64, uncasted_arg, src),
17220 .comptime_int => arg.* = try sema.coerce(block, Type.usize, uncasted_arg, src),
17221 .comptime_float => arg.* = try sema.coerce(block, Type.f64, uncasted_arg, src),
1722217222 else => {
1722317223 arg.* = uncasted_arg;
1722417224 },
......@@ -17312,32 +17312,32 @@ fn zirCmpEq(
1731217312 const rhs_ty = sema.typeOf(rhs);
1731317313 const lhs_ty_tag = lhs_ty.zigTypeTag(zcu);
1731417314 const rhs_ty_tag = rhs_ty.zigTypeTag(zcu);
17315 if (lhs_ty_tag == .Null and rhs_ty_tag == .Null) {
17315 if (lhs_ty_tag == .null and rhs_ty_tag == .null) {
1731617316 // null == null, null != null
1731717317 return if (op == .eq) .bool_true else .bool_false;
1731817318 }
1731917319
1732017320 // comparing null with optionals
17321 if (lhs_ty_tag == .Null and (rhs_ty_tag == .Optional or rhs_ty.isCPtr(zcu))) {
17321 if (lhs_ty_tag == .null and (rhs_ty_tag == .optional or rhs_ty.isCPtr(zcu))) {
1732217322 return sema.analyzeIsNull(block, src, rhs, op == .neq);
1732317323 }
17324 if (rhs_ty_tag == .Null and (lhs_ty_tag == .Optional or lhs_ty.isCPtr(zcu))) {
17324 if (rhs_ty_tag == .null and (lhs_ty_tag == .optional or lhs_ty.isCPtr(zcu))) {
1732517325 return sema.analyzeIsNull(block, src, lhs, op == .neq);
1732617326 }
1732717327
17328 if (lhs_ty_tag == .Null or rhs_ty_tag == .Null) {
17329 const non_null_type = if (lhs_ty_tag == .Null) rhs_ty else lhs_ty;
17328 if (lhs_ty_tag == .null or rhs_ty_tag == .null) {
17329 const non_null_type = if (lhs_ty_tag == .null) rhs_ty else lhs_ty;
1733017330 return sema.fail(block, src, "comparison of '{}' with null", .{non_null_type.fmt(pt)});
1733117331 }
1733217332
17333 if (lhs_ty_tag == .Union and (rhs_ty_tag == .EnumLiteral or rhs_ty_tag == .Enum)) {
17333 if (lhs_ty_tag == .@"union" and (rhs_ty_tag == .enum_literal or rhs_ty_tag == .@"enum")) {
1733417334 return sema.analyzeCmpUnionTag(block, src, lhs, lhs_src, rhs, rhs_src, op);
1733517335 }
17336 if (rhs_ty_tag == .Union and (lhs_ty_tag == .EnumLiteral or lhs_ty_tag == .Enum)) {
17336 if (rhs_ty_tag == .@"union" and (lhs_ty_tag == .enum_literal or lhs_ty_tag == .@"enum")) {
1733717337 return sema.analyzeCmpUnionTag(block, src, rhs, rhs_src, lhs, lhs_src, op);
1733817338 }
1733917339
17340 if (lhs_ty_tag == .ErrorSet and rhs_ty_tag == .ErrorSet) {
17340 if (lhs_ty_tag == .error_set and rhs_ty_tag == .error_set) {
1734117341 const runtime_src: LazySrcLoc = src: {
1734217342 if (try sema.resolveValue(lhs)) |lval| {
1734317343 if (try sema.resolveValue(rhs)) |rval| {
......@@ -17360,7 +17360,7 @@ fn zirCmpEq(
1736017360 try sema.requireRuntimeBlock(block, src, runtime_src);
1736117361 return block.addBinOp(air_tag, lhs, rhs);
1736217362 }
17363 if (lhs_ty_tag == .Type and rhs_ty_tag == .Type) {
17363 if (lhs_ty_tag == .type and rhs_ty_tag == .type) {
1736417364 const lhs_as_type = try sema.analyzeAsType(block, lhs_src, lhs);
1736517365 const rhs_as_type = try sema.analyzeAsType(block, rhs_src, rhs);
1736617366 return if (lhs_as_type.eql(rhs_as_type, zcu) == (op == .eq)) .bool_true else .bool_false;
......@@ -17399,7 +17399,7 @@ fn analyzeCmpUnionTag(
1739917399 if (try sema.resolveValue(coerced_tag)) |enum_val| {
1740017400 if (enum_val.isUndef(zcu)) return pt.undefRef(Type.bool);
1740117401 const field_ty = union_ty.unionFieldType(enum_val, zcu).?;
17402 if (field_ty.zigTypeTag(zcu) == .NoReturn) {
17402 if (field_ty.zigTypeTag(zcu) == .noreturn) {
1740317403 return .bool_false;
1740417404 }
1740517405 }
......@@ -17442,11 +17442,11 @@ fn analyzeCmp(
1744217442 const zcu = pt.zcu;
1744317443 const lhs_ty = sema.typeOf(lhs);
1744417444 const rhs_ty = sema.typeOf(rhs);
17445 if (lhs_ty.zigTypeTag(zcu) != .Optional and rhs_ty.zigTypeTag(zcu) != .Optional) {
17445 if (lhs_ty.zigTypeTag(zcu) != .optional and rhs_ty.zigTypeTag(zcu) != .optional) {
1744617446 try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src);
1744717447 }
1744817448
17449 if (lhs_ty.zigTypeTag(zcu) == .Vector and rhs_ty.zigTypeTag(zcu) == .Vector) {
17449 if (lhs_ty.zigTypeTag(zcu) == .vector and rhs_ty.zigTypeTag(zcu) == .vector) {
1745017450 return sema.cmpVector(block, src, lhs, rhs, op, lhs_src, rhs_src);
1745117451 }
1745217452 if (lhs_ty.isNumeric(zcu) and rhs_ty.isNumeric(zcu)) {
......@@ -17455,11 +17455,11 @@ fn analyzeCmp(
1745517455 // numeric types.
1745617456 return sema.cmpNumeric(block, src, lhs, rhs, op, lhs_src, rhs_src);
1745717457 }
17458 if (is_equality_cmp and lhs_ty.zigTypeTag(zcu) == .ErrorUnion and rhs_ty.zigTypeTag(zcu) == .ErrorSet) {
17458 if (is_equality_cmp and lhs_ty.zigTypeTag(zcu) == .error_union and rhs_ty.zigTypeTag(zcu) == .error_set) {
1745917459 const casted_lhs = try sema.analyzeErrUnionCode(block, lhs_src, lhs);
1746017460 return sema.cmpSelf(block, src, casted_lhs, rhs, op, lhs_src, rhs_src);
1746117461 }
17462 if (is_equality_cmp and lhs_ty.zigTypeTag(zcu) == .ErrorSet and rhs_ty.zigTypeTag(zcu) == .ErrorUnion) {
17462 if (is_equality_cmp and lhs_ty.zigTypeTag(zcu) == .error_set and rhs_ty.zigTypeTag(zcu) == .error_union) {
1746317463 const casted_rhs = try sema.analyzeErrUnionCode(block, rhs_src, rhs);
1746417464 return sema.cmpSelf(block, src, lhs, casted_rhs, op, lhs_src, rhs_src);
1746517465 }
......@@ -17505,7 +17505,7 @@ fn cmpSelf(
1750517505 if (try sema.resolveValue(casted_rhs)) |rhs_val| {
1750617506 if (rhs_val.isUndef(zcu)) return pt.undefRef(Type.bool);
1750717507
17508 if (resolved_type.zigTypeTag(zcu) == .Vector) {
17508 if (resolved_type.zigTypeTag(zcu) == .vector) {
1750917509 const cmp_val = try sema.compareVector(lhs_val, op, rhs_val, resolved_type);
1751017510 return Air.internedToRef(cmp_val.toIntern());
1751117511 }
......@@ -17515,7 +17515,7 @@ fn cmpSelf(
1751517515 else
1751617516 .bool_false;
1751717517 } else {
17518 if (resolved_type.zigTypeTag(zcu) == .Bool) {
17518 if (resolved_type.zigTypeTag(zcu) == .bool) {
1751917519 // We can lower bool eq/neq more efficiently.
1752017520 return sema.runtimeBoolCmp(block, src, op, casted_rhs, lhs_val.toBool(), rhs_src);
1752117521 }
......@@ -17524,7 +17524,7 @@ fn cmpSelf(
1752417524 } else {
1752517525 // For bools, we still check the other operand, because we can lower
1752617526 // bool eq/neq more efficiently.
17527 if (resolved_type.zigTypeTag(zcu) == .Bool) {
17527 if (resolved_type.zigTypeTag(zcu) == .bool) {
1752817528 if (try sema.resolveValue(casted_rhs)) |rhs_val| {
1752917529 if (rhs_val.isUndef(zcu)) return pt.undefRef(Type.bool);
1753017530 return sema.runtimeBoolCmp(block, src, op, casted_lhs, rhs_val.toBool(), lhs_src);
......@@ -17534,7 +17534,7 @@ fn cmpSelf(
1753417534 }
1753517535 };
1753617536 try sema.requireRuntimeBlock(block, src, runtime_src);
17537 if (resolved_type.zigTypeTag(zcu) == .Vector) {
17537 if (resolved_type.zigTypeTag(zcu) == .vector) {
1753817538 return block.addCmpVector(casted_lhs, casted_rhs, op);
1753917539 }
1754017540 const tag = Air.Inst.Tag.fromCmpOp(op, block.float_mode == .optimized);
......@@ -17568,34 +17568,34 @@ fn zirSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
1756817568 const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0);
1756917569 const ty = try sema.resolveType(block, operand_src, inst_data.operand);
1757017570 switch (ty.zigTypeTag(pt.zcu)) {
17571 .Fn,
17572 .NoReturn,
17573 .Undefined,
17574 .Null,
17575 .Opaque,
17571 .@"fn",
17572 .noreturn,
17573 .undefined,
17574 .null,
17575 .@"opaque",
1757617576 => return sema.fail(block, operand_src, "no size available for type '{}'", .{ty.fmt(pt)}),
1757717577
17578 .Type,
17579 .EnumLiteral,
17580 .ComptimeFloat,
17581 .ComptimeInt,
17582 .Void,
17578 .type,
17579 .enum_literal,
17580 .comptime_float,
17581 .comptime_int,
17582 .void,
1758317583 => return pt.intRef(Type.comptime_int, 0),
1758417584
17585 .Bool,
17586 .Int,
17587 .Float,
17588 .Pointer,
17589 .Array,
17590 .Struct,
17591 .Optional,
17592 .ErrorUnion,
17593 .ErrorSet,
17594 .Enum,
17595 .Union,
17596 .Vector,
17597 .Frame,
17598 .AnyFrame,
17585 .bool,
17586 .int,
17587 .float,
17588 .pointer,
17589 .array,
17590 .@"struct",
17591 .optional,
17592 .error_union,
17593 .error_set,
17594 .@"enum",
17595 .@"union",
17596 .vector,
17597 .frame,
17598 .@"anyframe",
1759917599 => {},
1760017600 }
1760117601 const val = try ty.abiSizeLazy(pt);
......@@ -17609,34 +17609,34 @@ fn zirBitSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
1760917609 const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0);
1761017610 const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand);
1761117611 switch (operand_ty.zigTypeTag(zcu)) {
17612 .Fn,
17613 .NoReturn,
17614 .Undefined,
17615 .Null,
17616 .Opaque,
17612 .@"fn",
17613 .noreturn,
17614 .undefined,
17615 .null,
17616 .@"opaque",
1761717617 => return sema.fail(block, operand_src, "no size available for type '{}'", .{operand_ty.fmt(pt)}),
1761817618
17619 .Type,
17620 .EnumLiteral,
17621 .ComptimeFloat,
17622 .ComptimeInt,
17623 .Void,
17619 .type,
17620 .enum_literal,
17621 .comptime_float,
17622 .comptime_int,
17623 .void,
1762417624 => return pt.intRef(Type.comptime_int, 0),
1762517625
17626 .Bool,
17627 .Int,
17628 .Float,
17629 .Pointer,
17630 .Array,
17631 .Struct,
17632 .Optional,
17633 .ErrorUnion,
17634 .ErrorSet,
17635 .Enum,
17636 .Union,
17637 .Vector,
17638 .Frame,
17639 .AnyFrame,
17626 .bool,
17627 .int,
17628 .float,
17629 .pointer,
17630 .array,
17631 .@"struct",
17632 .optional,
17633 .error_union,
17634 .error_set,
17635 .@"enum",
17636 .@"union",
17637 .vector,
17638 .frame,
17639 .@"anyframe",
1764017640 => {},
1764117641 }
1764217642 const bit_size = try operand_ty.bitSizeSema(pt);
......@@ -17893,21 +17893,21 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1789317893 }
1789417894
1789517895 switch (ty.zigTypeTag(zcu)) {
17896 .Type,
17897 .Void,
17898 .Bool,
17899 .NoReturn,
17900 .ComptimeFloat,
17901 .ComptimeInt,
17902 .Undefined,
17903 .Null,
17904 .EnumLiteral,
17896 .type,
17897 .void,
17898 .bool,
17899 .noreturn,
17900 .comptime_float,
17901 .comptime_int,
17902 .undefined,
17903 .null,
17904 .enum_literal,
1790517905 => |type_info_tag| return Air.internedToRef((try pt.intern(.{ .un = .{
1790617906 .ty = type_info_ty.toIntern(),
1790717907 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(type_info_tag))).toIntern(),
1790817908 .val = .void_value,
1790917909 } }))),
17910 .Fn => {
17910 .@"fn" => {
1791117911 const fn_info_nav = try sema.namespaceLookup(
1791217912 block,
1791317913 src,
......@@ -18010,14 +18010,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1801018010 };
1801118011 return Air.internedToRef((try pt.intern(.{ .un = .{
1801218012 .ty = type_info_ty.toIntern(),
18013 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Fn))).toIntern(),
18013 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"fn"))).toIntern(),
1801418014 .val = try pt.intern(.{ .aggregate = .{
1801518015 .ty = fn_info_ty.toIntern(),
1801618016 .storage = .{ .elems = &field_values },
1801718017 } }),
1801818018 } })));
1801918019 },
18020 .Int => {
18020 .int => {
1802118021 const int_info_nav = try sema.namespaceLookup(
1802218022 block,
1802318023 src,
......@@ -18037,14 +18037,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1803718037 };
1803818038 return Air.internedToRef((try pt.intern(.{ .un = .{
1803918039 .ty = type_info_ty.toIntern(),
18040 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Int))).toIntern(),
18040 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.int))).toIntern(),
1804118041 .val = try pt.intern(.{ .aggregate = .{
1804218042 .ty = int_info_ty.toIntern(),
1804318043 .storage = .{ .elems = &field_values },
1804418044 } }),
1804518045 } })));
1804618046 },
18047 .Float => {
18047 .float => {
1804818048 const float_info_nav = try sema.namespaceLookup(
1804918049 block,
1805018050 src,
......@@ -18060,14 +18060,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1806018060 };
1806118061 return Air.internedToRef((try pt.intern(.{ .un = .{
1806218062 .ty = type_info_ty.toIntern(),
18063 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Float))).toIntern(),
18063 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.float))).toIntern(),
1806418064 .val = try pt.intern(.{ .aggregate = .{
1806518065 .ty = float_info_ty.toIntern(),
1806618066 .storage = .{ .elems = &field_vals },
1806718067 } }),
1806818068 } })));
1806918069 },
18070 .Pointer => {
18070 .pointer => {
1807118071 const info = ty.ptrInfo(zcu);
1807218072 const alignment = if (info.flags.alignment.toByteUnits()) |alignment|
1807318073 try pt.intValue(Type.comptime_int, alignment)
......@@ -18119,14 +18119,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1811918119 };
1812018120 return Air.internedToRef((try pt.intern(.{ .un = .{
1812118121 .ty = type_info_ty.toIntern(),
18122 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Pointer))).toIntern(),
18122 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.pointer))).toIntern(),
1812318123 .val = try pt.intern(.{ .aggregate = .{
1812418124 .ty = pointer_ty.toIntern(),
1812518125 .storage = .{ .elems = &field_values },
1812618126 } }),
1812718127 } })));
1812818128 },
18129 .Array => {
18129 .array => {
1813018130 const array_field_ty = t: {
1813118131 const nav = try sema.namespaceLookup(
1813218132 block,
......@@ -18149,14 +18149,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1814918149 };
1815018150 return Air.internedToRef((try pt.intern(.{ .un = .{
1815118151 .ty = type_info_ty.toIntern(),
18152 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Array))).toIntern(),
18152 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.array))).toIntern(),
1815318153 .val = try pt.intern(.{ .aggregate = .{
1815418154 .ty = array_field_ty.toIntern(),
1815518155 .storage = .{ .elems = &field_values },
1815618156 } }),
1815718157 } })));
1815818158 },
18159 .Vector => {
18159 .vector => {
1816018160 const vector_field_ty = t: {
1816118161 const nav = try sema.namespaceLookup(
1816218162 block,
......@@ -18177,14 +18177,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1817718177 };
1817818178 return Air.internedToRef((try pt.intern(.{ .un = .{
1817918179 .ty = type_info_ty.toIntern(),
18180 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Vector))).toIntern(),
18180 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.vector))).toIntern(),
1818118181 .val = try pt.intern(.{ .aggregate = .{
1818218182 .ty = vector_field_ty.toIntern(),
1818318183 .storage = .{ .elems = &field_values },
1818418184 } }),
1818518185 } })));
1818618186 },
18187 .Optional => {
18187 .optional => {
1818818188 const optional_field_ty = t: {
1818918189 const nav = try sema.namespaceLookup(
1819018190 block,
......@@ -18202,14 +18202,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1820218202 };
1820318203 return Air.internedToRef((try pt.intern(.{ .un = .{
1820418204 .ty = type_info_ty.toIntern(),
18205 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Optional))).toIntern(),
18205 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.optional))).toIntern(),
1820618206 .val = try pt.intern(.{ .aggregate = .{
1820718207 .ty = optional_field_ty.toIntern(),
1820818208 .storage = .{ .elems = &field_values },
1820918209 } }),
1821018210 } })));
1821118211 },
18212 .ErrorSet => {
18212 .error_set => {
1821318213 // Get the Error type
1821418214 const error_field_ty = t: {
1821518215 const nav = try sema.namespaceLookup(
......@@ -18308,14 +18308,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1830818308 .val = errors_payload_val,
1830918309 } });
1831018310
18311 // Construct Type{ .ErrorSet = errors_val }
18311 // Construct Type{ .error_set = errors_val }
1831218312 return Air.internedToRef((try pt.intern(.{ .un = .{
1831318313 .ty = type_info_ty.toIntern(),
18314 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.ErrorSet))).toIntern(),
18314 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.error_set))).toIntern(),
1831518315 .val = errors_val,
1831618316 } })));
1831718317 },
18318 .ErrorUnion => {
18318 .error_union => {
1831918319 const error_union_field_ty = t: {
1832018320 const nav = try sema.namespaceLookup(
1832118321 block,
......@@ -18335,14 +18335,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1833518335 };
1833618336 return Air.internedToRef((try pt.intern(.{ .un = .{
1833718337 .ty = type_info_ty.toIntern(),
18338 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.ErrorUnion))).toIntern(),
18338 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.error_union))).toIntern(),
1833918339 .val = try pt.intern(.{ .aggregate = .{
1834018340 .ty = error_union_field_ty.toIntern(),
1834118341 .storage = .{ .elems = &field_values },
1834218342 } }),
1834318343 } })));
1834418344 },
18345 .Enum => {
18345 .@"enum" => {
1834618346 const is_exhaustive = Value.makeBool(ip.loadEnumType(ty.toIntern()).tag_mode != .nonexhaustive);
1834718347
1834818348 const enum_field_ty = t: {
......@@ -18464,14 +18464,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1846418464 };
1846518465 return Air.internedToRef((try pt.intern(.{ .un = .{
1846618466 .ty = type_info_ty.toIntern(),
18467 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Enum))).toIntern(),
18467 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"enum"))).toIntern(),
1846818468 .val = try pt.intern(.{ .aggregate = .{
1846918469 .ty = type_enum_ty.toIntern(),
1847018470 .storage = .{ .elems = &field_values },
1847118471 } }),
1847218472 } })));
1847318473 },
18474 .Union => {
18474 .@"union" => {
1847518475 const type_union_ty = t: {
1847618476 const nav = try sema.namespaceLookup(
1847718477 block,
......@@ -18611,14 +18611,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1861118611 };
1861218612 return Air.internedToRef((try pt.intern(.{ .un = .{
1861318613 .ty = type_info_ty.toIntern(),
18614 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Union))).toIntern(),
18614 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"union"))).toIntern(),
1861518615 .val = try pt.intern(.{ .aggregate = .{
1861618616 .ty = type_union_ty.toIntern(),
1861718617 .storage = .{ .elems = &field_values },
1861818618 } }),
1861918619 } })));
1862018620 },
18621 .Struct => {
18621 .@"struct" => {
1862218622 const type_struct_ty = t: {
1862318623 const nav = try sema.namespaceLookup(
1862418624 block,
......@@ -18843,14 +18843,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1884318843 };
1884418844 return Air.internedToRef((try pt.intern(.{ .un = .{
1884518845 .ty = type_info_ty.toIntern(),
18846 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Struct))).toIntern(),
18846 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"struct"))).toIntern(),
1884718847 .val = try pt.intern(.{ .aggregate = .{
1884818848 .ty = type_struct_ty.toIntern(),
1884918849 .storage = .{ .elems = &field_values },
1885018850 } }),
1885118851 } })));
1885218852 },
18853 .Opaque => {
18853 .@"opaque" => {
1885418854 const type_opaque_ty = t: {
1885518855 const nav = try sema.namespaceLookup(
1885618856 block,
......@@ -18871,15 +18871,15 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
1887118871 };
1887218872 return Air.internedToRef((try pt.intern(.{ .un = .{
1887318873 .ty = type_info_ty.toIntern(),
18874 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Opaque))).toIntern(),
18874 .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"opaque"))).toIntern(),
1887518875 .val = try pt.intern(.{ .aggregate = .{
1887618876 .ty = type_opaque_ty.toIntern(),
1887718877 .storage = .{ .elems = &field_values },
1887818878 } }),
1887918879 } })));
1888018880 },
18881 .Frame => return sema.failWithUseOfAsync(block, src),
18882 .AnyFrame => return sema.failWithUseOfAsync(block, src),
18881 .frame => return sema.failWithUseOfAsync(block, src),
18882 .@"anyframe" => return sema.failWithUseOfAsync(block, src),
1888318883 }
1888418884}
1888518885
......@@ -19064,8 +19064,8 @@ fn log2IntType(sema: *Sema, block: *Block, operand: Type, src: LazySrcLoc) Compi
1906419064 const pt = sema.pt;
1906519065 const zcu = pt.zcu;
1906619066 switch (operand.zigTypeTag(zcu)) {
19067 .ComptimeInt => return Type.comptime_int,
19068 .Int => {
19067 .comptime_int => return Type.comptime_int,
19068 .int => {
1906919069 const bits = operand.bitSize(zcu);
1907019070 const count = if (bits == 0)
1907119071 0
......@@ -19079,7 +19079,7 @@ fn log2IntType(sema: *Sema, block: *Block, operand: Type, src: LazySrcLoc) Compi
1907919079 };
1908019080 return pt.intType(.unsigned, count);
1908119081 },
19082 .Vector => {
19082 .vector => {
1908319083 const elem_ty = operand.elemType2(zcu);
1908419084 const log2_elem_ty = try sema.log2IntType(block, elem_ty, src);
1908519085 return pt.vectorType(.{
......@@ -19277,9 +19277,9 @@ fn finishCondBr(
1927719277) !Air.Inst.Ref {
1927819278 const gpa = sema.gpa;
1927919279
19280 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len +
19280 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).@"struct".fields.len +
1928119281 then_block.instructions.items.len + else_block.instructions.items.len +
19282 @typeInfo(Air.Block).Struct.fields.len + child_block.instructions.items.len + 1);
19282 @typeInfo(Air.Block).@"struct".fields.len + child_block.instructions.items.len + 1);
1928319283
1928419284 const cond_br_payload = sema.addExtraAssumeCapacity(Air.CondBr{
1928519285 .then_body_len = @intCast(then_block.instructions.items.len),
......@@ -19307,8 +19307,8 @@ fn checkNullableType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !voi
1930719307 const pt = sema.pt;
1930819308 const zcu = pt.zcu;
1930919309 switch (ty.zigTypeTag(zcu)) {
19310 .Optional, .Null, .Undefined => return,
19311 .Pointer => if (ty.isPtrLikeOptional(zcu)) return,
19310 .optional, .null, .undefined => return,
19311 .pointer => if (ty.isPtrLikeOptional(zcu)) return,
1931219312 else => {},
1931319313 }
1931419314 return sema.failWithExpectedOptionalType(block, src, ty);
......@@ -19354,7 +19354,7 @@ fn checkErrorType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !void {
1935419354 const pt = sema.pt;
1935519355 const zcu = pt.zcu;
1935619356 switch (ty.zigTypeTag(zcu)) {
19357 .ErrorSet, .ErrorUnion, .Undefined => return,
19357 .error_set, .error_union, .undefined => return,
1935819358 else => return sema.fail(block, src, "expected error union type, found '{}'", .{
1935919359 ty.fmt(pt),
1936019360 }),
......@@ -19451,7 +19451,7 @@ fn zirCondbr(
1945119451 const err_inst_data = sema.code.instructions.items(.data)[@intFromEnum(index)].un_node;
1945219452 const err_operand = try sema.resolveInst(err_inst_data.operand);
1945319453 const operand_ty = sema.typeOf(err_operand);
19454 assert(operand_ty.zigTypeTag(zcu) == .ErrorUnion);
19454 assert(operand_ty.zigTypeTag(zcu) == .error_union);
1945519455 const result_ty = operand_ty.errorUnionSet(zcu);
1945619456 break :blk try sub_block.addTyOp(.unwrap_errunion_err, result_ty, err_operand);
1945719457 };
......@@ -19463,7 +19463,7 @@ fn zirCondbr(
1946319463 break :h .unlikely;
1946419464 } else try sema.analyzeBodyRuntimeBreak(&sub_block, else_body);
1946519465
19466 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len +
19466 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).@"struct".fields.len +
1946719467 true_instructions.len + sub_block.instructions.items.len);
1946819468 _ = try parent_block.addInst(.{
1946919469 .tag = .cond_br,
......@@ -19490,7 +19490,7 @@ fn zirTry(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!
1949019490 const err_union_ty = sema.typeOf(err_union);
1949119491 const pt = sema.pt;
1949219492 const zcu = pt.zcu;
19493 if (err_union_ty.zigTypeTag(zcu) != .ErrorUnion) {
19493 if (err_union_ty.zigTypeTag(zcu) != .error_union) {
1949419494 return sema.fail(parent_block, operand_src, "expected error union type, found '{}'", .{
1949519495 err_union_ty.fmt(pt),
1949619496 });
......@@ -19524,7 +19524,7 @@ fn zirTry(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!
1952419524 // The only interesting hint here is `.cold`, which can come from e.g. `errdefer @panic`.
1952519525 const is_cold = sema.branch_hint == .cold;
1952619526
19527 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Try).Struct.fields.len +
19527 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Try).@"struct".fields.len +
1952819528 sub_block.instructions.items.len);
1952919529 const try_inst = try parent_block.addInst(.{
1953019530 .tag = if (is_cold) .try_cold else .@"try",
......@@ -19550,7 +19550,7 @@ fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErr
1955019550 const err_union_ty = sema.typeOf(err_union);
1955119551 const pt = sema.pt;
1955219552 const zcu = pt.zcu;
19553 if (err_union_ty.zigTypeTag(zcu) != .ErrorUnion) {
19553 if (err_union_ty.zigTypeTag(zcu) != .error_union) {
1955419554 return sema.fail(parent_block, operand_src, "expected error union type, found '{}'", .{
1955519555 err_union_ty.fmt(pt),
1955619556 });
......@@ -19596,7 +19596,7 @@ fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErr
1959619596 },
1959719597 });
1959819598 const res_ty_ref = Air.internedToRef(res_ty.toIntern());
19599 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.TryPtr).Struct.fields.len +
19599 try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.TryPtr).@"struct".fields.len +
1960019600 sub_block.instructions.items.len);
1960119601 const try_inst = try parent_block.addInst(.{
1960219602 .tag = if (is_cold) .try_ptr_cold else .try_ptr,
......@@ -19747,7 +19747,7 @@ fn zirRetImplicit(
1974719747 const operand = try sema.resolveInst(inst_data.operand);
1974819748 const ret_ty_src = block.src(.{ .node_offset_fn_type_ret_ty = 0 });
1974919749 const base_tag = sema.fn_ret_ty.baseZigTypeTag(zcu);
19750 if (base_tag == .NoReturn) {
19750 if (base_tag == .noreturn) {
1975119751 const msg = msg: {
1975219752 const msg = try sema.errMsg(ret_ty_src, "function declared '{}' implicitly returns", .{
1975319753 sema.fn_ret_ty.fmt(pt),
......@@ -19757,7 +19757,7 @@ fn zirRetImplicit(
1975719757 break :msg msg;
1975819758 };
1975919759 return sema.failWithOwnedErrorMsg(block, msg);
19760 } else if (base_tag != .Void) {
19760 } else if (base_tag != .void) {
1976119761 const msg = msg: {
1976219762 const msg = try sema.errMsg(ret_ty_src, "function with non-void return type '{}' implicitly returns", .{
1976319763 sema.fn_ret_ty.fmt(pt),
......@@ -19844,9 +19844,9 @@ fn retWithErrTracing(
1984419844 try sema.callBuiltin(&else_block, src, return_err_fn, .never_inline, &args, .@"error return");
1984519845 _ = try else_block.addUnOp(ret_tag, operand);
1984619846
19847 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len +
19847 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).@"struct".fields.len +
1984819848 then_block.instructions.items.len + else_block.instructions.items.len +
19849 @typeInfo(Air.Block).Struct.fields.len + 1);
19849 @typeInfo(Air.Block).@"struct".fields.len + 1);
1985019850
1985119851 const cond_br_payload = sema.addExtraAssumeCapacity(Air.CondBr{
1985219852 .then_body_len = @intCast(then_block.instructions.items.len),
......@@ -19958,7 +19958,7 @@ fn addToInferredErrorSet(sema: *Sema, uncasted_operand: Air.Inst.Ref) !void {
1995819958 const pt = sema.pt;
1995919959 const zcu = pt.zcu;
1996019960 const ip = &zcu.intern_pool;
19961 assert(sema.fn_ret_ty.zigTypeTag(zcu) == .ErrorUnion);
19961 assert(sema.fn_ret_ty.zigTypeTag(zcu) == .error_union);
1996219962 const err_set_ty = sema.fn_ret_ty.errorUnionSet(zcu).toIntern();
1996319963 switch (err_set_ty) {
1996419964 .adhoc_inferred_error_set_type => {
......@@ -19980,8 +19980,8 @@ fn addToInferredErrorSetPtr(sema: *Sema, ies: *InferredErrorSet, op_ty: Type) !v
1998019980 const zcu = pt.zcu;
1998119981 const ip = &zcu.intern_pool;
1998219982 switch (op_ty.zigTypeTag(zcu)) {
19983 .ErrorSet => try ies.addErrorSet(op_ty, ip, arena),
19984 .ErrorUnion => try ies.addErrorSet(op_ty.errorUnionSet(zcu), ip, arena),
19983 .error_set => try ies.addErrorSet(op_ty, ip, arena),
19984 .error_union => try ies.addErrorSet(op_ty.errorUnionSet(zcu), ip, arena),
1998519985 else => {},
1998619986 }
1998719987}
......@@ -19998,7 +19998,7 @@ fn analyzeRet(
1999819998 // that the coercion below works correctly.
1999919999 const pt = sema.pt;
2000020000 const zcu = pt.zcu;
20001 if (sema.fn_ret_ty_ies != null and sema.fn_ret_ty.zigTypeTag(zcu) == .ErrorUnion) {
20001 if (sema.fn_ret_ty_ies != null and sema.fn_ret_ty.zigTypeTag(zcu) == .error_union) {
2000220002 try sema.addToInferredErrorSet(uncasted_operand);
2000320003 }
2000420004 const operand = sema.coerceExtra(block, sema.fn_ret_ty, uncasted_operand, operand_src, .{ .is_ret = true }) catch |err| switch (err) {
......@@ -20087,7 +20087,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
2008720087 break :blk ty;
2008820088 };
2008920089
20090 if (elem_ty.zigTypeTag(zcu) == .NoReturn)
20090 if (elem_ty.zigTypeTag(zcu) == .noreturn)
2009120091 return sema.fail(block, elem_ty_src, "pointer to noreturn not allowed", .{});
2009220092
2009320093 const target = zcu.getTarget();
......@@ -20128,7 +20128,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
2012820128 const ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_i]);
2012920129 extra_i += 1;
2013020130 break :blk try sema.resolveAddressSpace(block, addrspace_src, ref, .pointer);
20131 } else if (elem_ty.zigTypeTag(zcu) == .Fn and target.cpu.arch == .avr) .flash else .generic;
20131 } else if (elem_ty.zigTypeTag(zcu) == .@"fn" and target.cpu.arch == .avr) .flash else .generic;
2013220132
2013320133 const bit_offset: u16 = if (inst_data.flags.has_bit_range) blk: {
2013420134 const ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_i]);
......@@ -20162,11 +20162,11 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
2016220162 }
2016320163 }
2016420164
20165 if (elem_ty.zigTypeTag(zcu) == .Fn) {
20165 if (elem_ty.zigTypeTag(zcu) == .@"fn") {
2016620166 if (inst_data.size != .One) {
2016720167 return sema.fail(block, elem_ty_src, "function pointers must be single pointers", .{});
2016820168 }
20169 } else if (inst_data.size == .Many and elem_ty.zigTypeTag(zcu) == .Opaque) {
20169 } else if (inst_data.size == .Many and elem_ty.zigTypeTag(zcu) == .@"opaque") {
2017020170 return sema.fail(block, elem_ty_src, "unknown-length pointer to opaque not allowed", .{});
2017120171 } else if (inst_data.size == .C) {
2017220172 if (!try sema.validateExternType(elem_ty, .other)) {
......@@ -20181,7 +20181,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
2018120181 };
2018220182 return sema.failWithOwnedErrorMsg(block, msg);
2018320183 }
20184 if (elem_ty.zigTypeTag(zcu) == .Opaque) {
20184 if (elem_ty.zigTypeTag(zcu) == .@"opaque") {
2018520185 return sema.fail(block, elem_ty_src, "C pointers cannot point to opaque types", .{});
2018620186 }
2018720187 }
......@@ -20226,10 +20226,10 @@ fn zirStructInitEmpty(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE
2022620226 const zcu = pt.zcu;
2022720227
2022820228 switch (obj_ty.zigTypeTag(zcu)) {
20229 .Struct => return sema.structInitEmpty(block, obj_ty, src, src),
20230 .Array, .Vector => return sema.arrayInitEmpty(block, src, obj_ty),
20231 .Void => return Air.internedToRef(Value.void.toIntern()),
20232 .Union => return sema.fail(block, src, "union initializer must initialize one field", .{}),
20229 .@"struct" => return sema.structInitEmpty(block, obj_ty, src, src),
20230 .array, .vector => return sema.arrayInitEmpty(block, src, obj_ty),
20231 .void => return Air.internedToRef(Value.void.toIntern()),
20232 .@"union" => return sema.fail(block, src, "union initializer must initialize one field", .{}),
2023320233 else => return sema.failWithArrayInitNotSupported(block, src, obj_ty),
2023420234 }
2023520235}
......@@ -20249,7 +20249,7 @@ fn zirStructInitEmptyResult(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is
2024920249 };
2025020250 const init_ty = if (is_byref) ty: {
2025120251 const ptr_ty = ty_operand.optEuBaseType(zcu);
20252 assert(ptr_ty.zigTypeTag(zcu) == .Pointer); // validated by a previous instruction
20252 assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction
2025320253 if (!ptr_ty.isSlice(zcu)) {
2025420254 break :ty ptr_ty.childType(zcu);
2025520255 }
......@@ -20263,9 +20263,9 @@ fn zirStructInitEmptyResult(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is
2026320263 const obj_ty = init_ty.optEuBaseType(zcu);
2026420264
2026520265 const empty_ref = switch (obj_ty.zigTypeTag(zcu)) {
20266 .Struct => try sema.structInitEmpty(block, obj_ty, src, src),
20267 .Array, .Vector => try sema.arrayInitEmpty(block, src, obj_ty),
20268 .Union => return sema.fail(block, src, "union initializer must initialize one field", .{}),
20266 .@"struct" => try sema.structInitEmpty(block, obj_ty, src, src),
20267 .array, .vector => try sema.arrayInitEmpty(block, src, obj_ty),
20268 .@"union" => return sema.fail(block, src, "union initializer must initialize one field", .{}),
2026920269 else => return sema.failWithArrayInitNotSupported(block, src, obj_ty),
2027020270 };
2027120271 const init_ref = try sema.coerce(block, init_ty, empty_ref, src);
......@@ -20304,7 +20304,7 @@ fn arrayInitEmpty(sema: *Sema, block: *Block, src: LazySrcLoc, obj_ty: Type) Com
2030420304 const zcu = pt.zcu;
2030520305 const arr_len = obj_ty.arrayLen(zcu);
2030620306 if (arr_len != 0) {
20307 if (obj_ty.zigTypeTag(zcu) == .Array) {
20307 if (obj_ty.zigTypeTag(zcu) == .array) {
2030820308 return sema.fail(block, src, "expected {d} array elements; found 0", .{arr_len});
2030920309 } else {
2031020310 return sema.fail(block, src, "expected {d} vector elements; found 0", .{arr_len});
......@@ -20324,7 +20324,7 @@ fn zirUnionInit(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
2032420324 const init_src = block.builtinCallArgSrc(inst_data.src_node, 2);
2032520325 const extra = sema.code.extraData(Zir.Inst.UnionInit, inst_data.payload_index).data;
2032620326 const union_ty = try sema.resolveType(block, ty_src, extra.union_type);
20327 if (union_ty.zigTypeTag(pt.zcu) != .Union) {
20327 if (union_ty.zigTypeTag(pt.zcu) != .@"union") {
2032820328 return sema.fail(block, ty_src, "expected union type, found '{}'", .{union_ty.fmt(pt)});
2032920329 }
2033020330 const field_name = try sema.resolveConstStringIntern(block, field_src, extra.field_name, .{
......@@ -20394,7 +20394,7 @@ fn zirStructInit(
2039420394 const resolved_ty = result_ty.optEuBaseType(zcu);
2039520395 try resolved_ty.resolveLayout(pt);
2039620396
20397 if (resolved_ty.zigTypeTag(zcu) == .Struct) {
20397 if (resolved_ty.zigTypeTag(zcu) == .@"struct") {
2039820398 // This logic must be synchronized with that in `zirStructInitEmpty`.
2039920399
2040020400 // Maps field index to field_type index of where it was already initialized.
......@@ -20450,7 +20450,7 @@ fn zirStructInit(
2045020450 }
2045120451
2045220452 return sema.finishStructInit(block, src, src, field_inits, resolved_ty, result_ty, is_ref);
20453 } else if (resolved_ty.zigTypeTag(zcu) == .Union) {
20453 } else if (resolved_ty.zigTypeTag(zcu) == .@"union") {
2045420454 if (extra.data.fields_len != 1) {
2045520455 return sema.fail(block, src, "union initialization expects exactly one field", .{});
2045620456 }
......@@ -20471,7 +20471,7 @@ fn zirStructInit(
2047120471 const tag_val = try pt.enumValueFieldIndex(tag_ty, field_index);
2047220472 const field_ty = Type.fromInterned(zcu.typeToUnion(resolved_ty).?.field_types.get(ip)[field_index]);
2047320473
20474 if (field_ty.zigTypeTag(zcu) == .NoReturn) {
20474 if (field_ty.zigTypeTag(zcu) == .noreturn) {
2047520475 return sema.failWithOwnedErrorMsg(block, msg: {
2047620476 const msg = try sema.errMsg(src, "cannot initialize 'noreturn' field of union", .{});
2047720477 errdefer msg.destroy(sema.gpa);
......@@ -20756,7 +20756,7 @@ fn structInitAnon(
2075620756
2075720757 const init = try sema.resolveInst(item.data.init);
2075820758 field_ty.* = sema.typeOf(init).toIntern();
20759 if (Type.fromInterned(field_ty.*).zigTypeTag(zcu) == .Opaque) {
20759 if (Type.fromInterned(field_ty.*).zigTypeTag(zcu) == .@"opaque") {
2076020760 const msg = msg: {
2076120761 const field_src = block.src(.{ .init_elem = .{
2076220762 .init_node_offset = src.offset.node_offset.x,
......@@ -20867,7 +20867,7 @@ fn zirArrayInit(
2086720867 else => |e| return e,
2086820868 };
2086920869 const array_ty = result_ty.optEuBaseType(zcu);
20870 const is_tuple = array_ty.zigTypeTag(zcu) == .Struct;
20870 const is_tuple = array_ty.zigTypeTag(zcu) == .@"struct";
2087120871 const sentinel_val = array_ty.sentinel(zcu);
2087220872
2087320873 var root_msg: ?*Zcu.ErrorMsg = null;
......@@ -21029,7 +21029,7 @@ fn arrayInitAnon(
2102921029 const operand_src = src; // TODO better source location
2103021030 const elem = try sema.resolveInst(operand);
2103121031 types[i] = sema.typeOf(elem).toIntern();
21032 if (Type.fromInterned(types[i]).zigTypeTag(zcu) == .Opaque) {
21032 if (Type.fromInterned(types[i]).zigTypeTag(zcu) == .@"opaque") {
2103321033 const msg = msg: {
2103421034 const msg = try sema.errMsg(operand_src, "opaque types have unknown size and therefore cannot be directly embedded in structs", .{});
2103521035 errdefer msg.destroy(gpa);
......@@ -21148,7 +21148,7 @@ fn fieldType(
2114821148 while (true) {
2114921149 try cur_ty.resolveFields(pt);
2115021150 switch (cur_ty.zigTypeTag(zcu)) {
21151 .Struct => switch (ip.indexToKey(cur_ty.toIntern())) {
21151 .@"struct" => switch (ip.indexToKey(cur_ty.toIntern())) {
2115221152 .anon_struct_type => |anon_struct| {
2115321153 const field_index = if (anon_struct.names.len == 0)
2115421154 try sema.tupleFieldIndex(block, cur_ty, field_name, field_src)
......@@ -21165,20 +21165,20 @@ fn fieldType(
2116521165 },
2116621166 else => unreachable,
2116721167 },
21168 .Union => {
21168 .@"union" => {
2116921169 const union_obj = zcu.typeToUnion(cur_ty).?;
2117021170 const field_index = union_obj.loadTagType(ip).nameIndex(ip, field_name) orelse
2117121171 return sema.failWithBadUnionFieldAccess(block, cur_ty, union_obj, field_src, field_name);
2117221172 const field_ty = union_obj.field_types.get(ip)[field_index];
2117321173 return Air.internedToRef(field_ty);
2117421174 },
21175 .Optional => {
21175 .optional => {
2117621176 // Struct/array init through optional requires the child type to not be a pointer.
2117721177 // If the child of .optional is a pointer it'll error on the next loop.
2117821178 cur_ty = Type.fromInterned(ip.indexToKey(cur_ty.toIntern()).opt_type);
2117921179 continue;
2118021180 },
21181 .ErrorUnion => {
21181 .error_union => {
2118221182 cur_ty = cur_ty.errorUnionPayload(zcu);
2118321183 continue;
2118421184 },
......@@ -21243,7 +21243,7 @@ fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
2124321243 const src = block.nodeOffset(inst_data.src_node);
2124421244 const operand = try sema.resolveInst(inst_data.operand);
2124521245 const operand_ty = sema.typeOf(operand);
21246 const is_vector = operand_ty.zigTypeTag(zcu) == .Vector;
21246 const is_vector = operand_ty.zigTypeTag(zcu) == .vector;
2124721247 const operand_scalar_ty = operand_ty.scalarType(zcu);
2124821248 if (operand_scalar_ty.toIntern() != .bool_type) {
2124921249 return sema.fail(block, src, "expected 'bool', found '{}'", .{operand_scalar_ty.zigTypeTag(zcu)});
......@@ -21317,8 +21317,8 @@ fn zirAbs(
2131721317 const scalar_ty = operand_ty.scalarType(zcu);
2131821318
2131921319 const result_ty = switch (scalar_ty.zigTypeTag(zcu)) {
21320 .ComptimeFloat, .Float, .ComptimeInt => operand_ty,
21321 .Int => if (scalar_ty.isSignedInt(zcu)) try operand_ty.toUnsigned(pt) else return operand,
21320 .comptime_float, .float, .comptime_int => operand_ty,
21321 .int => if (scalar_ty.isSignedInt(zcu)) try operand_ty.toUnsigned(pt) else return operand,
2132221322 else => return sema.fail(
2132321323 block,
2132421324 operand_src,
......@@ -21342,7 +21342,7 @@ fn maybeConstantUnaryMath(
2134221342 const pt = sema.pt;
2134321343 const zcu = pt.zcu;
2134421344 switch (result_ty.zigTypeTag(zcu)) {
21345 .Vector => if (try sema.resolveValue(operand)) |val| {
21345 .vector => if (try sema.resolveValue(operand)) |val| {
2134621346 const scalar_ty = result_ty.scalarType(zcu);
2134721347 const vec_len = result_ty.vectorLen(zcu);
2134821348 if (val.isUndef(zcu))
......@@ -21387,7 +21387,7 @@ fn zirUnaryMath(
2138721387 const scalar_ty = operand_ty.scalarType(zcu);
2138821388
2138921389 switch (scalar_ty.zigTypeTag(zcu)) {
21390 .ComptimeFloat, .Float => {},
21390 .comptime_float, .float => {},
2139121391 else => return sema.fail(
2139221392 block,
2139321393 operand_src,
......@@ -21414,13 +21414,13 @@ fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
2141421414
2141521415 try operand_ty.resolveLayout(pt);
2141621416 const enum_ty = switch (operand_ty.zigTypeTag(zcu)) {
21417 .EnumLiteral => {
21417 .enum_literal => {
2141821418 const val = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, operand, undefined);
2141921419 const tag_name = ip.indexToKey(val.toIntern()).enum_literal;
2142021420 return sema.addNullTerminatedStrLit(tag_name);
2142121421 },
21422 .Enum => operand_ty,
21423 .Union => operand_ty.unionTagType(zcu) orelse
21422 .@"enum" => operand_ty,
21423 .@"union" => operand_ty.unionTagType(zcu) orelse
2142421424 return sema.fail(block, src, "union '{}' is untagged", .{operand_ty.fmt(pt)}),
2142521425 else => return sema.fail(block, operand_src, "expected enum or union; found '{}'", .{
2142621426 operand_ty.fmt(pt),
......@@ -21500,17 +21500,17 @@ fn zirReify(
2150021500 }
2150121501 const tag_index = type_info_ty.unionTagFieldIndex(Value.fromInterned(union_val.tag), zcu).?;
2150221502 switch (@as(std.builtin.TypeId, @enumFromInt(tag_index))) {
21503 .Type => return .type_type,
21504 .Void => return .void_type,
21505 .Bool => return .bool_type,
21506 .NoReturn => return .noreturn_type,
21507 .ComptimeFloat => return .comptime_float_type,
21508 .ComptimeInt => return .comptime_int_type,
21509 .Undefined => return .undefined_type,
21510 .Null => return .null_type,
21511 .AnyFrame => return sema.failWithUseOfAsync(block, src),
21512 .EnumLiteral => return .enum_literal_type,
21513 .Int => {
21503 .type => return .type_type,
21504 .void => return .void_type,
21505 .bool => return .bool_type,
21506 .noreturn => return .noreturn_type,
21507 .comptime_float => return .comptime_float_type,
21508 .comptime_int => return .comptime_int_type,
21509 .undefined => return .undefined_type,
21510 .null => return .null_type,
21511 .@"anyframe" => return sema.failWithUseOfAsync(block, src),
21512 .enum_literal => return .enum_literal_type,
21513 .int => {
2151421514 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2151521515 const signedness_val = try Value.fromInterned(union_val.val).fieldValue(
2151621516 pt,
......@@ -21526,7 +21526,7 @@ fn zirReify(
2152621526 const ty = try pt.intType(signedness, bits);
2152721527 return Air.internedToRef(ty.toIntern());
2152821528 },
21529 .Vector => {
21529 .vector => {
2153021530 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2153121531 const len_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2153221532 ip,
......@@ -21548,7 +21548,7 @@ fn zirReify(
2154821548 });
2154921549 return Air.internedToRef(ty.toIntern());
2155021550 },
21551 .Float => {
21551 .float => {
2155221552 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2155321553 const bits_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2155421554 ip,
......@@ -21566,7 +21566,7 @@ fn zirReify(
2156621566 };
2156721567 return Air.internedToRef(ty.toIntern());
2156821568 },
21569 .Pointer => {
21569 .pointer => {
2157021570 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2157121571 const size_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2157221572 ip,
......@@ -21631,13 +21631,13 @@ fn zirReify(
2163121631 break :s .none;
2163221632 };
2163321633
21634 if (elem_ty.zigTypeTag(zcu) == .NoReturn) {
21634 if (elem_ty.zigTypeTag(zcu) == .noreturn) {
2163521635 return sema.fail(block, src, "pointer to noreturn not allowed", .{});
21636 } else if (elem_ty.zigTypeTag(zcu) == .Fn) {
21636 } else if (elem_ty.zigTypeTag(zcu) == .@"fn") {
2163721637 if (ptr_size != .One) {
2163821638 return sema.fail(block, src, "function pointers must be single pointers", .{});
2163921639 }
21640 } else if (ptr_size == .Many and elem_ty.zigTypeTag(zcu) == .Opaque) {
21640 } else if (ptr_size == .Many and elem_ty.zigTypeTag(zcu) == .@"opaque") {
2164121641 return sema.fail(block, src, "unknown-length pointer to opaque not allowed", .{});
2164221642 } else if (ptr_size == .C) {
2164321643 if (!try sema.validateExternType(elem_ty, .other)) {
......@@ -21652,7 +21652,7 @@ fn zirReify(
2165221652 };
2165321653 return sema.failWithOwnedErrorMsg(block, msg);
2165421654 }
21655 if (elem_ty.zigTypeTag(zcu) == .Opaque) {
21655 if (elem_ty.zigTypeTag(zcu) == .@"opaque") {
2165621656 return sema.fail(block, src, "C pointers cannot point to opaque types", .{});
2165721657 }
2165821658 }
......@@ -21671,7 +21671,7 @@ fn zirReify(
2167121671 });
2167221672 return Air.internedToRef(ty.toIntern());
2167321673 },
21674 .Array => {
21674 .array => {
2167521675 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2167621676 const len_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2167721677 ip,
......@@ -21700,7 +21700,7 @@ fn zirReify(
2170021700 });
2170121701 return Air.internedToRef(ty.toIntern());
2170221702 },
21703 .Optional => {
21703 .optional => {
2170421704 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2170521705 const child_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2170621706 ip,
......@@ -21712,7 +21712,7 @@ fn zirReify(
2171221712 const ty = try pt.optionalType(child_ty.toIntern());
2171321713 return Air.internedToRef(ty.toIntern());
2171421714 },
21715 .ErrorUnion => {
21715 .error_union => {
2171621716 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2171721717 const error_set_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2171821718 ip,
......@@ -21726,14 +21726,14 @@ fn zirReify(
2172621726 const error_set_ty = error_set_val.toType();
2172721727 const payload_ty = payload_val.toType();
2172821728
21729 if (error_set_ty.zigTypeTag(zcu) != .ErrorSet) {
21729 if (error_set_ty.zigTypeTag(zcu) != .error_set) {
2173021730 return sema.fail(block, src, "Type.ErrorUnion.error_set must be an error set type", .{});
2173121731 }
2173221732
2173321733 const ty = try pt.errorUnionType(error_set_ty, payload_ty);
2173421734 return Air.internedToRef(ty.toIntern());
2173521735 },
21736 .ErrorSet => {
21736 .error_set => {
2173721737 const payload_val = Value.fromInterned(union_val.val).optionalValue(zcu) orelse
2173821738 return Air.internedToRef(Type.anyerror.toIntern());
2173921739
......@@ -21767,7 +21767,7 @@ fn zirReify(
2176721767 const ty = try pt.errorSetFromUnsortedNames(names.keys());
2176821768 return Air.internedToRef(ty.toIntern());
2176921769 },
21770 .Struct => {
21770 .@"struct" => {
2177121771 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2177221772 const layout_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2177321773 ip,
......@@ -21807,7 +21807,7 @@ fn zirReify(
2180721807
2180821808 return try sema.reifyStruct(block, inst, src, layout, backing_integer_val, fields_arr, name_strategy, is_tuple_val.toBool());
2180921809 },
21810 .Enum => {
21810 .@"enum" => {
2181121811 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2181221812 const tag_type_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2181321813 ip,
......@@ -21836,7 +21836,7 @@ fn zirReify(
2183621836
2183721837 return sema.reifyEnum(block, inst, src, tag_type_val.toType(), is_exhaustive_val.toBool(), fields_arr, name_strategy);
2183821838 },
21839 .Opaque => {
21839 .@"opaque" => {
2184021840 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2184121841 const decls_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2184221842 ip,
......@@ -21879,7 +21879,7 @@ fn zirReify(
2187921879 try sema.addTypeReferenceEntry(src, wip_ty.index);
2188021880 return Air.internedToRef(wip_ty.finish(ip, .none, new_namespace_index));
2188121881 },
21882 .Union => {
21882 .@"union" => {
2188321883 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2188421884 const layout_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2188521885 ip,
......@@ -21909,7 +21909,7 @@ fn zirReify(
2190921909
2191021910 return sema.reifyUnion(block, inst, src, layout, tag_type_val, fields_arr, name_strategy);
2191121911 },
21912 .Fn => {
21912 .@"fn" => {
2191321913 const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
2191421914 const calling_convention_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
2191521915 ip,
......@@ -21996,7 +21996,7 @@ fn zirReify(
2199621996 });
2199721997 return Air.internedToRef(ty.toIntern());
2199821998 },
21999 .Frame => return sema.failWithUseOfAsync(block, src),
21999 .frame => return sema.failWithUseOfAsync(block, src),
2200022000 }
2200122001}
2200222002
......@@ -22067,7 +22067,7 @@ fn reifyEnum(
2206722067 var done = false;
2206822068 errdefer if (!done) wip_ty.cancel(ip, pt.tid);
2206922069
22070 if (tag_ty.zigTypeTag(zcu) != .Int) {
22070 if (tag_ty.zigTypeTag(zcu) != .int) {
2207122071 return sema.fail(block, src, "Type.Enum.tag_type must be an integer type", .{});
2207222072 }
2207322073
......@@ -22344,7 +22344,7 @@ fn reifyUnion(
2234422344
2234522345 for (field_types) |field_ty_ip| {
2234622346 const field_ty = Type.fromInterned(field_ty_ip);
22347 if (field_ty.zigTypeTag(zcu) == .Opaque) {
22347 if (field_ty.zigTypeTag(zcu) == .@"opaque") {
2234822348 return sema.failWithOwnedErrorMsg(block, msg: {
2234922349 const msg = try sema.errMsg(src, "opaque types have unknown size and therefore cannot be directly embedded in unions", .{});
2235022350 errdefer msg.destroy(gpa);
......@@ -22602,7 +22602,7 @@ fn reifyStruct(
2260222602 struct_type.field_inits.get(ip)[field_idx] = field_default;
2260322603 }
2260422604
22605 if (field_ty.zigTypeTag(zcu) == .Opaque) {
22605 if (field_ty.zigTypeTag(zcu) == .@"opaque") {
2260622606 return sema.failWithOwnedErrorMsg(block, msg: {
2260722607 const msg = try sema.errMsg(src, "opaque types have unknown size and therefore cannot be directly embedded in structs", .{});
2260822608 errdefer msg.destroy(gpa);
......@@ -22611,7 +22611,7 @@ fn reifyStruct(
2261122611 break :msg msg;
2261222612 });
2261322613 }
22614 if (field_ty.zigTypeTag(zcu) == .NoReturn) {
22614 if (field_ty.zigTypeTag(zcu) == .noreturn) {
2261522615 return sema.failWithOwnedErrorMsg(block, msg: {
2261622616 const msg = try sema.errMsg(src, "struct fields cannot be 'noreturn'", .{});
2261722617 errdefer msg.destroy(gpa);
......@@ -22794,7 +22794,7 @@ fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
2279422794 const operand_ty = sema.typeOf(operand);
2279522795
2279622796 try sema.checkVectorizableBinaryOperands(block, operand_src, dest_ty, operand_ty, src, operand_src);
22797 const is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
22797 const is_vector = dest_ty.zigTypeTag(zcu) == .vector;
2279822798
2279922799 const dest_scalar_ty = dest_ty.scalarType(zcu);
2280022800 const operand_scalar_ty = operand_ty.scalarType(zcu);
......@@ -22805,7 +22805,7 @@ fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
2280522805 if (try sema.resolveValue(operand)) |operand_val| {
2280622806 const result_val = try sema.intFromFloat(block, operand_src, operand_val, operand_ty, dest_ty, .truncate);
2280722807 return Air.internedToRef(result_val.toIntern());
22808 } else if (dest_scalar_ty.zigTypeTag(zcu) == .ComptimeInt) {
22808 } else if (dest_scalar_ty.zigTypeTag(zcu) == .comptime_int) {
2280922809 return sema.failWithNeededComptime(block, operand_src, .{
2281022810 .needed_comptime_reason = "value being casted to 'comptime_int' must be comptime-known",
2281122811 });
......@@ -22877,7 +22877,7 @@ fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
2287722877 const operand_ty = sema.typeOf(operand);
2287822878
2287922879 try sema.checkVectorizableBinaryOperands(block, operand_src, dest_ty, operand_ty, src, operand_src);
22880 const is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
22880 const is_vector = dest_ty.zigTypeTag(zcu) == .vector;
2288122881
2288222882 const dest_scalar_ty = dest_ty.scalarType(zcu);
2288322883 const operand_scalar_ty = operand_ty.scalarType(zcu);
......@@ -22888,7 +22888,7 @@ fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
2288822888 if (try sema.resolveValue(operand)) |operand_val| {
2288922889 const result_val = try operand_val.floatFromIntAdvanced(sema.arena, operand_ty, dest_ty, pt, .sema);
2289022890 return Air.internedToRef(result_val.toIntern());
22891 } else if (dest_scalar_ty.zigTypeTag(zcu) == .ComptimeFloat) {
22891 } else if (dest_scalar_ty.zigTypeTag(zcu) == .comptime_float) {
2289222892 return sema.failWithNeededComptime(block, operand_src, .{
2289322893 .needed_comptime_reason = "value being casted to 'comptime_float' must be comptime-known",
2289422894 });
......@@ -22923,7 +22923,7 @@ fn zirPtrFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
2292322923 const dest_ty = try sema.resolveDestType(block, src, extra.lhs, .remove_eu, "@ptrFromInt");
2292422924 try sema.checkVectorizableBinaryOperands(block, operand_src, dest_ty, uncoerced_operand_ty, src, operand_src);
2292522925
22926 const is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
22926 const is_vector = dest_ty.zigTypeTag(zcu) == .vector;
2292722927 const operand_ty = if (is_vector) operand_ty: {
2292822928 const len = dest_ty.vectorLen(zcu);
2292922929 break :operand_ty try pt.vectorType(.{ .child = .usize_type, .len = len });
......@@ -22975,7 +22975,7 @@ fn zirPtrFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
2297522975 }
2297622976 try sema.requireRuntimeBlock(block, src, operand_src);
2297722977 if (!is_vector) {
22978 if (block.wantSafety() and (try elem_ty.hasRuntimeBitsSema(pt) or elem_ty.zigTypeTag(zcu) == .Fn)) {
22978 if (block.wantSafety() and (try elem_ty.hasRuntimeBitsSema(pt) or elem_ty.zigTypeTag(zcu) == .@"fn")) {
2297922979 if (!ptr_ty.isAllowzeroPtr(zcu)) {
2298022980 const is_non_zero = try block.addBinOp(.cmp_neq, operand_coerced, .zero_usize);
2298122981 try sema.addSafetyCheck(block, src, is_non_zero, .cast_to_null);
......@@ -22992,7 +22992,7 @@ fn zirPtrFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
2299222992 }
2299322993
2299422994 const len = dest_ty.vectorLen(zcu);
22995 if (block.wantSafety() and (try elem_ty.hasRuntimeBitsSema(pt) or elem_ty.zigTypeTag(zcu) == .Fn)) {
22995 if (block.wantSafety() and (try elem_ty.hasRuntimeBitsSema(pt) or elem_ty.zigTypeTag(zcu) == .@"fn")) {
2299622996 for (0..len) |i| {
2299722997 const idx_ref = try pt.intRef(Type.usize, i);
2299822998 const elem_coerced = try block.addBinOp(.array_elem_val, operand_coerced, idx_ref);
......@@ -23042,11 +23042,11 @@ fn ptrFromIntVal(
2304223042 return sema.fail(block, operand_src, "pointer type '{}' requires aligned address", .{ptr_ty.fmt(pt)});
2304323043
2304423044 return switch (ptr_ty.zigTypeTag(zcu)) {
23045 .Optional => Value.fromInterned(try pt.intern(.{ .opt = .{
23045 .optional => Value.fromInterned(try pt.intern(.{ .opt = .{
2304623046 .ty = ptr_ty.toIntern(),
2304723047 .val = if (addr == 0) .none else (try pt.ptrIntValue(ptr_ty.childType(zcu), addr)).toIntern(),
2304823048 } })),
23049 .Pointer => try pt.ptrIntValue(ptr_ty, addr),
23049 .pointer => try pt.ptrIntValue(ptr_ty, addr),
2305023050 else => unreachable,
2305123051 };
2305223052}
......@@ -23064,16 +23064,16 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData
2306423064 const dest_tag = base_dest_ty.zigTypeTag(zcu);
2306523065 const operand_tag = base_operand_ty.zigTypeTag(zcu);
2306623066
23067 if (dest_tag != .ErrorSet and dest_tag != .ErrorUnion) {
23067 if (dest_tag != .error_set and dest_tag != .error_union) {
2306823068 return sema.fail(block, src, "expected error set or error union type, found '{s}'", .{@tagName(dest_tag)});
2306923069 }
23070 if (operand_tag != .ErrorSet and operand_tag != .ErrorUnion) {
23070 if (operand_tag != .error_set and operand_tag != .error_union) {
2307123071 return sema.fail(block, src, "expected error set or error union type, found '{s}'", .{@tagName(operand_tag)});
2307223072 }
23073 if (dest_tag == .ErrorSet and operand_tag == .ErrorUnion) {
23073 if (dest_tag == .error_set and operand_tag == .error_union) {
2307423074 return sema.fail(block, src, "cannot cast an error union type to error set", .{});
2307523075 }
23076 if (dest_tag == .ErrorUnion and operand_tag == .ErrorUnion and
23076 if (dest_tag == .error_union and operand_tag == .error_union and
2307723077 base_dest_ty.errorUnionPayload(zcu).toIntern() != base_operand_ty.errorUnionPayload(zcu).toIntern())
2307823078 {
2307923079 return sema.failWithOwnedErrorMsg(block, msg: {
......@@ -23088,8 +23088,8 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData
2308823088 break :msg msg;
2308923089 });
2309023090 }
23091 const dest_ty = if (dest_tag == .ErrorUnion) base_dest_ty.errorUnionSet(zcu) else base_dest_ty;
23092 const operand_ty = if (operand_tag == .ErrorUnion) base_operand_ty.errorUnionSet(zcu) else base_operand_ty;
23091 const dest_ty = if (dest_tag == .error_union) base_dest_ty.errorUnionSet(zcu) else base_dest_ty;
23092 const operand_ty = if (operand_tag == .error_union) base_operand_ty.errorUnionSet(zcu) else base_operand_ty;
2309323093
2309423094 // operand must be defined since it can be an invalid error value
2309523095 const maybe_operand_val = try sema.resolveDefinedValue(block, operand_src, operand);
......@@ -23121,7 +23121,7 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData
2312123121
2312223122 break :disjoint true;
2312323123 };
23124 if (disjoint and dest_tag != .ErrorUnion) {
23124 if (disjoint and dest_tag != .error_union) {
2312523125 return sema.fail(block, src, "error sets '{}' and '{}' have no common errors", .{
2312623126 operand_ty.fmt(pt), dest_ty.fmt(pt),
2312723127 });
......@@ -23131,7 +23131,7 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData
2313123131 if (!dest_ty.isAnyError(zcu)) check: {
2313223132 const operand_val = zcu.intern_pool.indexToKey(val.toIntern());
2313323133 var error_name: InternPool.NullTerminatedString = undefined;
23134 if (operand_tag == .ErrorUnion) {
23134 if (operand_tag == .error_union) {
2313523135 if (operand_val.error_union.val != .err_name) break :check;
2313623136 error_name = operand_val.error_union.val.err_name;
2313723137 } else {
......@@ -23153,7 +23153,7 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData
2315323153 dest_ty.toIntern() != .adhoc_inferred_error_set_type and
2315423154 zcu.backendSupportsFeature(.error_set_has_value))
2315523155 {
23156 if (dest_tag == .ErrorUnion) {
23156 if (dest_tag == .error_union) {
2315723157 const err_code = try sema.analyzeErrUnionCode(block, operand_src, operand);
2315823158 const err_int = try block.addBitCast(err_int_ty, err_code);
2315923159 const zero_err = try pt.intRef(try pt.errorIntType(), 0);
......@@ -23178,7 +23178,7 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData
2317823178}
2317923179
2318023180fn zirPtrCastFull(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref {
23181 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
23181 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
2318223182 const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
2318323183 const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data;
2318423184 const src = block.nodeOffset(extra.node);
......@@ -23239,10 +23239,10 @@ fn ptrCastFull(
2323923239 try Type.fromInterned(dest_info.child).resolveLayout(pt);
2324023240
2324123241 const src_slice_like = src_info.flags.size == .Slice or
23242 (src_info.flags.size == .One and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .Array);
23242 (src_info.flags.size == .One and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .array);
2324323243
2324423244 const dest_slice_like = dest_info.flags.size == .Slice or
23245 (dest_info.flags.size == .One and Type.fromInterned(dest_info.child).zigTypeTag(zcu) == .Array);
23245 (dest_info.flags.size == .One and Type.fromInterned(dest_info.child).zigTypeTag(zcu) == .array);
2324623246
2324723247 if (dest_info.flags.size == .Slice and !src_slice_like) {
2324823248 return sema.fail(block, src, "illegal pointer cast to slice", .{});
......@@ -23277,7 +23277,7 @@ fn ptrCastFull(
2327723277 errdefer msg.destroy(sema.gpa);
2327823278 if (dest_info.flags.size == .Many and
2327923279 (src_info.flags.size == .Slice or
23280 (src_info.flags.size == .One and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .Array)))
23280 (src_info.flags.size == .One and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .array)))
2328123281 {
2328223282 try sema.errNote(src, msg, "use 'ptr' field to convert slice to many pointer", .{});
2328323283 } else {
......@@ -23473,7 +23473,7 @@ fn ptrCastFull(
2347323473 }
2347423474
2347523475 const ptr = if (src_info.flags.size == .Slice and dest_info.flags.size != .Slice) ptr: {
23476 if (operand_ty.zigTypeTag(zcu) == .Optional) {
23476 if (operand_ty.zigTypeTag(zcu) == .optional) {
2347723477 break :ptr try sema.analyzeOptionalSlicePtr(block, operand_src, operand, operand_ty);
2347823478 } else {
2347923479 break :ptr try sema.analyzeSlicePtr(block, operand_src, operand, operand_ty);
......@@ -23485,7 +23485,7 @@ fn ptrCastFull(
2348523485 var info = dest_info;
2348623486 info.flags.size = .Many;
2348723487 const ty = try pt.ptrTypeSema(info);
23488 if (dest_ty.zigTypeTag(zcu) == .Optional) {
23488 if (dest_ty.zigTypeTag(zcu) == .optional) {
2348923489 break :blk try pt.optionalType(ty.toIntern());
2349023490 } else {
2349123491 break :blk ty;
......@@ -23535,7 +23535,7 @@ fn ptrCastFull(
2353523535 try sema.validateRuntimeValue(block, operand_src, ptr);
2353623536
2353723537 if (block.wantSafety() and operand_ty.ptrAllowsZero(zcu) and !dest_ty.ptrAllowsZero(zcu) and
23538 (try Type.fromInterned(dest_info.child).hasRuntimeBitsSema(pt) or Type.fromInterned(dest_info.child).zigTypeTag(zcu) == .Fn))
23538 (try Type.fromInterned(dest_info.child).hasRuntimeBitsSema(pt) or Type.fromInterned(dest_info.child).zigTypeTag(zcu) == .@"fn"))
2353923539 {
2354023540 const ptr_int = try block.addUnOp(.int_from_ptr, ptr);
2354123541 const is_non_zero = try block.addBinOp(.cmp_neq, ptr_int, .zero_usize);
......@@ -23570,7 +23570,7 @@ fn ptrCastFull(
2357023570 var intermediate_info = src_info;
2357123571 intermediate_info.flags.address_space = dest_info.flags.address_space;
2357223572 const intermediate_ptr_ty = try pt.ptrTypeSema(intermediate_info);
23573 const intermediate_ty = if (dest_ptr_ty.zigTypeTag(zcu) == .Optional) blk: {
23573 const intermediate_ty = if (dest_ptr_ty.zigTypeTag(zcu) == .optional) blk: {
2357423574 break :blk try pt.optionalType(intermediate_ptr_ty.toIntern());
2357523575 } else intermediate_ptr_ty;
2357623576 const intermediate = try block.addInst(.{
......@@ -23613,7 +23613,7 @@ fn ptrCastFull(
2361323613fn zirPtrCastNoDest(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref {
2361423614 const pt = sema.pt;
2361523615 const zcu = pt.zcu;
23616 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
23616 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
2361723617 const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
2361823618 const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;
2361923619 const src = block.nodeOffset(extra.node);
......@@ -23628,7 +23628,7 @@ fn zirPtrCastNoDest(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst
2362823628
2362923629 const dest_ty = blk: {
2363023630 const dest_ty = try pt.ptrTypeSema(ptr_info);
23631 if (operand_ty.zigTypeTag(zcu) == .Optional) {
23631 if (operand_ty.zigTypeTag(zcu) == .optional) {
2363223632 break :blk try pt.optionalType(dest_ty.toIntern());
2363323633 }
2363423634 break :blk dest_ty;
......@@ -23657,13 +23657,13 @@ fn zirTruncate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
2365723657 const operand_ty = sema.typeOf(operand);
2365823658 const operand_scalar_ty = try sema.checkIntOrVectorAllowComptime(block, operand_ty, operand_src);
2365923659
23660 const operand_is_vector = operand_ty.zigTypeTag(zcu) == .Vector;
23661 const dest_is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
23660 const operand_is_vector = operand_ty.zigTypeTag(zcu) == .vector;
23661 const dest_is_vector = dest_ty.zigTypeTag(zcu) == .vector;
2366223662 if (operand_is_vector != dest_is_vector) {
2366323663 return sema.fail(block, operand_src, "expected type '{}', found '{}'", .{ dest_ty.fmt(pt), operand_ty.fmt(pt) });
2366423664 }
2366523665
23666 if (dest_scalar_ty.zigTypeTag(zcu) == .ComptimeInt) {
23666 if (dest_scalar_ty.zigTypeTag(zcu) == .comptime_int) {
2366723667 return sema.coerce(block, dest_ty, operand, operand_src);
2366823668 }
2366923669
......@@ -23673,7 +23673,7 @@ fn zirTruncate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
2367323673 return Air.internedToRef(val.toIntern());
2367423674 }
2367523675
23676 if (operand_scalar_ty.zigTypeTag(zcu) != .ComptimeInt) {
23676 if (operand_scalar_ty.zigTypeTag(zcu) != .comptime_int) {
2367723677 const operand_info = operand_ty.intInfo(zcu);
2367823678 if (try sema.typeHasOnePossibleValue(operand_ty)) |val| {
2367923679 return Air.internedToRef(val.toIntern());
......@@ -23751,7 +23751,7 @@ fn zirBitCount(
2375123751
2375223752 const result_scalar_ty = try pt.smallestUnsignedInt(bits);
2375323753 switch (operand_ty.zigTypeTag(zcu)) {
23754 .Vector => {
23754 .vector => {
2375523755 const vec_len = operand_ty.vectorLen(zcu);
2375623756 const result_ty = try pt.vectorType(.{
2375723757 .len = vec_len,
......@@ -23776,7 +23776,7 @@ fn zirBitCount(
2377623776 return block.addTyOp(air_tag, result_ty, operand);
2377723777 }
2377823778 },
23779 .Int => {
23779 .int => {
2378023780 if (try sema.resolveValueResolveLazy(operand)) |val| {
2378123781 if (val.isUndef(zcu)) return pt.undefRef(result_scalar_ty);
2378223782 return pt.intRef(result_scalar_ty, comptimeOp(val, operand_ty, zcu));
......@@ -23813,7 +23813,7 @@ fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
2381323813 }
2381423814
2381523815 switch (operand_ty.zigTypeTag(zcu)) {
23816 .Int => {
23816 .int => {
2381723817 const runtime_src = if (try sema.resolveValue(operand)) |val| {
2381823818 if (val.isUndef(zcu)) return pt.undefRef(operand_ty);
2381923819 const result_val = try val.byteSwap(operand_ty, pt, sema.arena);
......@@ -23823,7 +23823,7 @@ fn zirByteSwap(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
2382323823 try sema.requireRuntimeBlock(block, src, runtime_src);
2382423824 return block.addTyOp(.byte_swap, operand_ty, operand);
2382523825 },
23826 .Vector => {
23826 .vector => {
2382723827 const runtime_src = if (try sema.resolveValue(operand)) |val| {
2382823828 if (val.isUndef(zcu))
2382923829 return pt.undefRef(operand_ty);
......@@ -23862,7 +23862,7 @@ fn zirBitReverse(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
2386223862 const pt = sema.pt;
2386323863 const zcu = pt.zcu;
2386423864 switch (operand_ty.zigTypeTag(zcu)) {
23865 .Int => {
23865 .int => {
2386623866 const runtime_src = if (try sema.resolveValue(operand)) |val| {
2386723867 if (val.isUndef(zcu)) return pt.undefRef(operand_ty);
2386823868 const result_val = try val.bitReverse(operand_ty, pt, sema.arena);
......@@ -23872,7 +23872,7 @@ fn zirBitReverse(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
2387223872 try sema.requireRuntimeBlock(block, src, runtime_src);
2387323873 return block.addTyOp(.bit_reverse, operand_ty, operand);
2387423874 },
23875 .Vector => {
23875 .vector => {
2387623876 const runtime_src = if (try sema.resolveValue(operand)) |val| {
2387723877 if (val.isUndef(zcu))
2387823878 return pt.undefRef(operand_ty);
......@@ -23924,7 +23924,7 @@ fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u6
2392423924 const ip = &zcu.intern_pool;
2392523925 try ty.resolveLayout(pt);
2392623926 switch (ty.zigTypeTag(zcu)) {
23927 .Struct => {},
23927 .@"struct" => {},
2392823928 else => return sema.fail(block, lhs_src, "expected struct type, found '{}'", .{ty.fmt(pt)}),
2392923929 }
2393023930
......@@ -23959,7 +23959,7 @@ fn checkNamespaceType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) Com
2395923959 const pt = sema.pt;
2396023960 const zcu = pt.zcu;
2396123961 switch (ty.zigTypeTag(zcu)) {
23962 .Struct, .Enum, .Union, .Opaque => return,
23962 .@"struct", .@"enum", .@"union", .@"opaque" => return,
2396323963 else => return sema.fail(block, src, "expected struct, enum, union, or opaque; found '{}'", .{ty.fmt(pt)}),
2396423964 }
2396523965}
......@@ -23969,8 +23969,8 @@ fn checkIntType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileEr
2396923969 const pt = sema.pt;
2397023970 const zcu = pt.zcu;
2397123971 switch (try ty.zigTypeTagOrPoison(zcu)) {
23972 .ComptimeInt => return true,
23973 .Int => return false,
23972 .comptime_int => return true,
23973 .int => return false,
2397423974 else => return sema.fail(block, src, "expected integer type, found '{}'", .{ty.fmt(pt)}),
2397523975 }
2397623976}
......@@ -23984,7 +23984,7 @@ fn checkInvalidPtrIntArithmetic(
2398423984 const pt = sema.pt;
2398523985 const zcu = pt.zcu;
2398623986 switch (try ty.zigTypeTagOrPoison(zcu)) {
23987 .Pointer => switch (ty.ptrSize(zcu)) {
23987 .pointer => switch (ty.ptrSize(zcu)) {
2398823988 .One, .Slice => return,
2398923989 .Many, .C => return sema.failWithInvalidPtrArithmetic(block, src, "pointer-integer", "addition and subtraction"),
2399023990 },
......@@ -24001,8 +24001,8 @@ fn checkArithmeticOp(
2400124001 rhs_zig_ty_tag: std.builtin.TypeId,
2400224002 zir_tag: Zir.Inst.Tag,
2400324003) CompileError!void {
24004 const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
24005 const is_float = scalar_tag == .Float or scalar_tag == .ComptimeFloat;
24004 const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
24005 const is_float = scalar_tag == .float or scalar_tag == .comptime_float;
2400624006
2400724007 if (!is_int and !(is_float and floatOpAllowed(zir_tag))) {
2400824008 return sema.fail(block, src, "invalid operands to binary expression: '{s}' and '{s}'", .{
......@@ -24020,8 +24020,8 @@ fn checkPtrOperand(
2402024020 const pt = sema.pt;
2402124021 const zcu = pt.zcu;
2402224022 switch (ty.zigTypeTag(zcu)) {
24023 .Pointer => return,
24024 .Fn => {
24023 .pointer => return,
24024 .@"fn" => {
2402524025 const msg = msg: {
2402624026 const msg = try sema.errMsg(
2402724027 ty_src,
......@@ -24036,7 +24036,7 @@ fn checkPtrOperand(
2403624036 };
2403724037 return sema.failWithOwnedErrorMsg(block, msg);
2403824038 },
24039 .Optional => if (ty.childType(zcu).zigTypeTag(zcu) == .Pointer) return,
24039 .optional => if (ty.childType(zcu).zigTypeTag(zcu) == .pointer) return,
2404024040 else => {},
2404124041 }
2404224042 return sema.fail(block, ty_src, "expected pointer type, found '{}'", .{ty.fmt(pt)});
......@@ -24052,8 +24052,8 @@ fn checkPtrType(
2405224052 const pt = sema.pt;
2405324053 const zcu = pt.zcu;
2405424054 switch (ty.zigTypeTag(zcu)) {
24055 .Pointer => if (allow_slice or !ty.isSlice(zcu)) return,
24056 .Fn => {
24055 .pointer => if (allow_slice or !ty.isSlice(zcu)) return,
24056 .@"fn" => {
2405724057 const msg = msg: {
2405824058 const msg = try sema.errMsg(
2405924059 ty_src,
......@@ -24068,7 +24068,7 @@ fn checkPtrType(
2406824068 };
2406924069 return sema.failWithOwnedErrorMsg(block, msg);
2407024070 },
24071 .Optional => if (ty.childType(zcu).zigTypeTag(zcu) == .Pointer) return,
24071 .optional => if (ty.childType(zcu).zigTypeTag(zcu) == .pointer) return,
2407224072 else => {},
2407324073 }
2407424074 return sema.fail(block, ty_src, "expected pointer type, found '{}'", .{ty.fmt(pt)});
......@@ -24083,8 +24083,8 @@ fn checkVectorElemType(
2408324083 const pt = sema.pt;
2408424084 const zcu = pt.zcu;
2408524085 switch (ty.zigTypeTag(zcu)) {
24086 .Int, .Float, .Bool => return,
24087 .Optional, .Pointer => if (ty.isPtrAtRuntime(zcu)) return,
24086 .int, .float, .bool => return,
24087 .optional, .pointer => if (ty.isPtrAtRuntime(zcu)) return,
2408824088 else => {},
2408924089 }
2409024090 return sema.fail(block, ty_src, "expected integer, float, bool, or pointer for the vector element type; found '{}'", .{ty.fmt(pt)});
......@@ -24099,7 +24099,7 @@ fn checkFloatType(
2409924099 const pt = sema.pt;
2410024100 const zcu = pt.zcu;
2410124101 switch (ty.zigTypeTag(zcu)) {
24102 .ComptimeInt, .ComptimeFloat, .Float => {},
24102 .comptime_int, .comptime_float, .float => {},
2410324103 else => return sema.fail(block, ty_src, "expected float type, found '{}'", .{ty.fmt(pt)}),
2410424104 }
2410524105}
......@@ -24113,9 +24113,9 @@ fn checkNumericType(
2411324113 const pt = sema.pt;
2411424114 const zcu = pt.zcu;
2411524115 switch (ty.zigTypeTag(zcu)) {
24116 .ComptimeFloat, .Float, .ComptimeInt, .Int => {},
24117 .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
24118 .ComptimeFloat, .Float, .ComptimeInt, .Int => {},
24116 .comptime_float, .float, .comptime_int, .int => {},
24117 .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
24118 .comptime_float, .float, .comptime_int, .int => {},
2411924119 else => |t| return sema.fail(block, ty_src, "expected number, found '{}'", .{t}),
2412024120 },
2412124121 else => return sema.fail(block, ty_src, "expected number, found '{}'", .{ty.fmt(pt)}),
......@@ -24167,7 +24167,7 @@ fn checkAtomicPtrOperand(
2416724167
2416824168 const ptr_ty = sema.typeOf(ptr);
2416924169 const ptr_data = switch (try ptr_ty.zigTypeTagOrPoison(zcu)) {
24170 .Pointer => ptr_ty.ptrInfo(zcu),
24170 .pointer => ptr_ty.ptrInfo(zcu),
2417124171 else => {
2417224172 const wanted_ptr_ty = try pt.ptrTypeSema(wanted_ptr_data);
2417324173 _ = try sema.coerce(block, wanted_ptr_ty, ptr, ptr_src);
......@@ -24208,11 +24208,11 @@ fn checkIntOrVector(
2420824208 const zcu = pt.zcu;
2420924209 const operand_ty = sema.typeOf(operand);
2421024210 switch (try operand_ty.zigTypeTagOrPoison(zcu)) {
24211 .Int => return operand_ty,
24212 .Vector => {
24211 .int => return operand_ty,
24212 .vector => {
2421324213 const elem_ty = operand_ty.childType(zcu);
2421424214 switch (try elem_ty.zigTypeTagOrPoison(zcu)) {
24215 .Int => return elem_ty,
24215 .int => return elem_ty,
2421624216 else => return sema.fail(block, operand_src, "expected vector of integers; found vector of '{}'", .{
2421724217 elem_ty.fmt(pt),
2421824218 }),
......@@ -24233,11 +24233,11 @@ fn checkIntOrVectorAllowComptime(
2423324233 const pt = sema.pt;
2423424234 const zcu = pt.zcu;
2423524235 switch (try operand_ty.zigTypeTagOrPoison(zcu)) {
24236 .Int, .ComptimeInt => return operand_ty,
24237 .Vector => {
24236 .int, .comptime_int => return operand_ty,
24237 .vector => {
2423824238 const elem_ty = operand_ty.childType(zcu);
2423924239 switch (try elem_ty.zigTypeTagOrPoison(zcu)) {
24240 .Int, .ComptimeInt => return elem_ty,
24240 .int, .comptime_int => return elem_ty,
2424124241 else => return sema.fail(block, operand_src, "expected vector of integers; found vector of '{}'", .{
2424224242 elem_ty.fmt(pt),
2424324243 }),
......@@ -24277,7 +24277,7 @@ fn checkSimdBinOp(
2427724277 const rhs_ty = sema.typeOf(uncasted_rhs);
2427824278
2427924279 try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src);
24280 const vec_len: ?usize = if (lhs_ty.zigTypeTag(zcu) == .Vector) lhs_ty.vectorLen(zcu) else null;
24280 const vec_len: ?usize = if (lhs_ty.zigTypeTag(zcu) == .vector) lhs_ty.vectorLen(zcu) else null;
2428124281 const result_ty = try sema.resolvePeerTypes(block, src, &.{ uncasted_lhs, uncasted_rhs }, .{
2428224282 .override = &[_]?LazySrcLoc{ lhs_src, rhs_src },
2428324283 });
......@@ -24308,14 +24308,14 @@ fn checkVectorizableBinaryOperands(
2430824308 const zcu = pt.zcu;
2430924309 const lhs_zig_ty_tag = try lhs_ty.zigTypeTagOrPoison(zcu);
2431024310 const rhs_zig_ty_tag = try rhs_ty.zigTypeTagOrPoison(zcu);
24311 if (lhs_zig_ty_tag != .Vector and rhs_zig_ty_tag != .Vector) return;
24311 if (lhs_zig_ty_tag != .vector and rhs_zig_ty_tag != .vector) return;
2431224312
2431324313 const lhs_is_vector = switch (lhs_zig_ty_tag) {
24314 .Vector, .Array => true,
24314 .vector, .array => true,
2431524315 else => false,
2431624316 };
2431724317 const rhs_is_vector = switch (rhs_zig_ty_tag) {
24318 .Vector, .Array => true,
24318 .vector, .array => true,
2431924319 else => false,
2432024320 };
2432124321
......@@ -24477,7 +24477,7 @@ fn zirCmpxchg(
2447724477 // zig fmt: on
2447824478 const expected_value = try sema.resolveInst(extra.expected_value);
2447924479 const elem_ty = sema.typeOf(expected_value);
24480 if (elem_ty.zigTypeTag(zcu) == .Float) {
24480 if (elem_ty.zigTypeTag(zcu) == .float) {
2448124481 return sema.fail(
2448224482 block,
2448324483 elem_ty_src,
......@@ -24602,7 +24602,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
2460224602 const pt = sema.pt;
2460324603 const zcu = pt.zcu;
2460424604
24605 if (operand_ty.zigTypeTag(zcu) != .Vector) {
24605 if (operand_ty.zigTypeTag(zcu) != .vector) {
2460624606 return sema.fail(block, operand_src, "expected vector, found '{}'", .{operand_ty.fmt(pt)});
2460724607 }
2460824608
......@@ -24611,13 +24611,13 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
2461124611 // Type-check depending on operation.
2461224612 switch (operation) {
2461324613 .And, .Or, .Xor => switch (scalar_ty.zigTypeTag(zcu)) {
24614 .Int, .Bool => {},
24614 .int, .bool => {},
2461524615 else => return sema.fail(block, operand_src, "@reduce operation '{s}' requires integer or boolean operand; found '{}'", .{
2461624616 @tagName(operation), operand_ty.fmt(pt),
2461724617 }),
2461824618 },
2461924619 .Min, .Max, .Add, .Mul => switch (scalar_ty.zigTypeTag(zcu)) {
24620 .Int, .Float => {},
24620 .int, .float => {},
2462124621 else => return sema.fail(block, operand_src, "@reduce operation '{s}' requires integer or float operand; found '{}'", .{
2462224622 @tagName(operation), operand_ty.fmt(pt),
2462324623 }),
......@@ -24677,7 +24677,7 @@ fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
2467724677 var mask_ty = sema.typeOf(mask);
2467824678
2467924679 const mask_len = switch (sema.typeOf(mask).zigTypeTag(zcu)) {
24680 .Array, .Vector => sema.typeOf(mask).arrayLen(zcu),
24680 .array, .vector => sema.typeOf(mask).arrayLen(zcu),
2468124681 else => return sema.fail(block, mask_src, "expected vector or array, found '{}'", .{sema.typeOf(mask).fmt(pt)}),
2468224682 };
2468324683 mask_ty = try pt.vectorType(.{
......@@ -24715,16 +24715,16 @@ fn analyzeShuffle(
2471524715 });
2471624716
2471724717 const maybe_a_len = switch (sema.typeOf(a).zigTypeTag(zcu)) {
24718 .Array, .Vector => sema.typeOf(a).arrayLen(zcu),
24719 .Undefined => null,
24718 .array, .vector => sema.typeOf(a).arrayLen(zcu),
24719 .undefined => null,
2472024720 else => return sema.fail(block, a_src, "expected vector or array with element type '{}', found '{}'", .{
2472124721 elem_ty.fmt(pt),
2472224722 sema.typeOf(a).fmt(pt),
2472324723 }),
2472424724 };
2472524725 const maybe_b_len = switch (sema.typeOf(b).zigTypeTag(zcu)) {
24726 .Array, .Vector => sema.typeOf(b).arrayLen(zcu),
24727 .Undefined => null,
24726 .array, .vector => sema.typeOf(b).arrayLen(zcu),
24727 .undefined => null,
2472824728 else => return sema.fail(block, b_src, "expected vector or array with element type '{}', found '{}'", .{
2472924729 elem_ty.fmt(pt),
2473024730 sema.typeOf(b).fmt(pt),
......@@ -24869,7 +24869,7 @@ fn zirSelect(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) C
2486924869 const pred_ty = sema.typeOf(pred_uncoerced);
2487024870
2487124871 const vec_len_u64 = switch (try pred_ty.zigTypeTagOrPoison(zcu)) {
24872 .Vector, .Array => pred_ty.arrayLen(zcu),
24872 .vector, .array => pred_ty.arrayLen(zcu),
2487324873 else => return sema.fail(block, pred_src, "expected vector or array, found '{}'", .{pred_ty.fmt(pt)}),
2487424874 };
2487524875 const vec_len: u32 = @intCast(try sema.usizeCast(block, pred_src, vec_len_u64));
......@@ -25011,13 +25011,13 @@ fn zirAtomicRmw(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
2501125011 const op = try sema.resolveAtomicRmwOp(block, op_src, extra.operation);
2501225012
2501325013 switch (elem_ty.zigTypeTag(zcu)) {
25014 .Enum => if (op != .Xchg) {
25014 .@"enum" => if (op != .Xchg) {
2501525015 return sema.fail(block, op_src, "@atomicRmw with enum only allowed with .Xchg", .{});
2501625016 },
25017 .Bool => if (op != .Xchg) {
25017 .bool => if (op != .Xchg) {
2501825018 return sema.fail(block, op_src, "@atomicRmw with bool only allowed with .Xchg", .{});
2501925019 },
25020 .Float => switch (op) {
25020 .float => switch (op) {
2502125021 .Xchg, .Add, .Sub, .Max, .Min => {},
2502225022 else => return sema.fail(block, op_src, "@atomicRmw with float only allowed with .Xchg, .Add, .Sub, .Max, and .Min", .{}),
2502325023 },
......@@ -25135,7 +25135,7 @@ fn zirMulAdd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
2513525135 const zcu = pt.zcu;
2513625136
2513725137 switch (ty.scalarType(zcu).zigTypeTag(zcu)) {
25138 .ComptimeFloat, .Float => {},
25138 .comptime_float, .float => {},
2513925139 else => return sema.fail(block, src, "expected vector of floats or float type, found '{}'", .{ty.fmt(pt)}),
2514025140 }
2514125141
......@@ -25281,7 +25281,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
2528125281 const ip = &zcu.intern_pool;
2528225282
2528325283 const extra = sema.code.extraData(Zir.Inst.FieldParentPtr, extended.operand).data;
25284 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
25284 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
2528525285 const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
2528625286 assert(!flags.ptr_cast);
2528725287 const inst_src = block.nodeOffset(extra.src_node);
......@@ -25296,7 +25296,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
2529625296 }
2529725297 const parent_ty = Type.fromInterned(parent_ptr_info.child);
2529825298 switch (parent_ty.zigTypeTag(zcu)) {
25299 .Struct, .Union => {},
25299 .@"struct", .@"union" => {},
2530025300 else => return sema.fail(block, inst_src, "expected pointer to struct or union type, found '{}'", .{parent_ptr_ty.fmt(pt)}),
2530125301 }
2530225302 try parent_ty.resolveLayout(pt);
......@@ -25305,7 +25305,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
2530525305 .needed_comptime_reason = "field name must be comptime-known",
2530625306 });
2530725307 const field_index = switch (parent_ty.zigTypeTag(zcu)) {
25308 .Struct => blk: {
25308 .@"struct" => blk: {
2530925309 if (parent_ty.isTuple(zcu)) {
2531025310 if (field_name.eqlSlice("len", ip)) {
2531125311 return sema.fail(block, inst_src, "cannot get @fieldParentPtr of 'len' field of tuple", .{});
......@@ -25315,10 +25315,10 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
2531525315 break :blk try sema.structFieldIndex(block, parent_ty, field_name, field_name_src);
2531625316 }
2531725317 },
25318 .Union => try sema.unionFieldIndex(block, parent_ty, field_name, field_name_src),
25318 .@"union" => try sema.unionFieldIndex(block, parent_ty, field_name, field_name_src),
2531925319 else => unreachable,
2532025320 };
25321 if (parent_ty.zigTypeTag(zcu) == .Struct and parent_ty.structFieldIsComptime(field_index, zcu)) {
25321 if (parent_ty.zigTypeTag(zcu) == .@"struct" and parent_ty.structFieldIsComptime(field_index, zcu)) {
2532225322 return sema.fail(block, field_name_src, "cannot get @fieldParentPtr of a comptime field", .{});
2532325323 }
2532425324
......@@ -25400,7 +25400,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
2540025400
2540125401 const result = if (try sema.resolveDefinedValue(block, field_ptr_src, casted_field_ptr)) |field_ptr_val| result: {
2540225402 switch (parent_ty.zigTypeTag(zcu)) {
25403 .Struct => switch (parent_ty.containerLayout(zcu)) {
25403 .@"struct" => switch (parent_ty.containerLayout(zcu)) {
2540425404 .auto => {},
2540525405 .@"extern" => {
2540625406 const byte_offset = parent_ty.structFieldOffset(field_index, zcu);
......@@ -25417,7 +25417,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
2541725417 break :result Air.internedToRef(parent_ptr_val.toIntern());
2541825418 },
2541925419 },
25420 .Union => switch (parent_ty.containerLayout(zcu)) {
25420 .@"union" => switch (parent_ty.containerLayout(zcu)) {
2542125421 .auto => {},
2542225422 .@"extern", .@"packed" => {
2542325423 // For an extern or packed union, just coerce the pointer.
......@@ -25914,7 +25914,7 @@ fn zirMemcpy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
2591425914 // lowering. The AIR instruction requires pointers with element types of
2591525915 // equal ABI size.
2591625916
25917 if (dest_ty.zigTypeTag(zcu) != .Pointer or src_ty.zigTypeTag(zcu) != .Pointer) {
25917 if (dest_ty.zigTypeTag(zcu) != .pointer or src_ty.zigTypeTag(zcu) != .pointer) {
2591825918 return sema.fail(block, src, "TODO: lower @memcpy to a for loop because the source or destination iterable is a tuple", .{});
2591925919 }
2592025920
......@@ -26034,7 +26034,7 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
2603426034 switch (ptr_info.flags.size) {
2603526035 .Slice => break :dest_elem_ty Type.fromInterned(ptr_info.child),
2603626036 .One => {
26037 if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .Array) {
26037 if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .array) {
2603826038 break :dest_elem_ty Type.fromInterned(ptr_info.child).childType(zcu);
2603926039 }
2604026040 },
......@@ -26533,7 +26533,7 @@ fn zirCDefine(
2653326533 .needed_comptime_reason = "name of macro being undefined must be comptime-known",
2653426534 });
2653526535 const rhs = try sema.resolveInst(extra.rhs);
26536 if (sema.typeOf(rhs).zigTypeTag(zcu) != .Void) {
26536 if (sema.typeOf(rhs).zigTypeTag(zcu) != .void) {
2653726537 const value = try sema.resolveConstString(block, val_src, extra.rhs, .{
2653826538 .needed_comptime_reason = "value of macro being undefined must be comptime-known",
2653926539 });
......@@ -26951,7 +26951,7 @@ fn validateVarType(
2695126951 return sema.failWithOwnedErrorMsg(block, msg);
2695226952 }
2695326953 } else {
26954 if (var_ty.zigTypeTag(zcu) == .Opaque) {
26954 if (var_ty.zigTypeTag(zcu) == .@"opaque") {
2695526955 return sema.fail(
2695626956 block,
2695726957 src,
......@@ -26968,7 +26968,7 @@ fn validateVarType(
2696826968 errdefer msg.destroy(sema.gpa);
2696926969
2697026970 try sema.explainWhyTypeIsComptime(msg, src, var_ty);
26971 if (var_ty.zigTypeTag(zcu) == .ComptimeInt or var_ty.zigTypeTag(zcu) == .ComptimeFloat) {
26971 if (var_ty.zigTypeTag(zcu) == .comptime_int or var_ty.zigTypeTag(zcu) == .comptime_float) {
2697226972 try sema.errNote(src, msg, "to modify this variable at runtime, it must be given an explicit fixed-size number type", .{});
2697326973 }
2697426974
......@@ -27003,42 +27003,42 @@ fn explainWhyTypeIsComptimeInner(
2700327003 const zcu = pt.zcu;
2700427004 const ip = &zcu.intern_pool;
2700527005 switch (ty.zigTypeTag(zcu)) {
27006 .Bool,
27007 .Int,
27008 .Float,
27009 .ErrorSet,
27010 .Enum,
27011 .Frame,
27012 .AnyFrame,
27013 .Void,
27006 .bool,
27007 .int,
27008 .float,
27009 .error_set,
27010 .@"enum",
27011 .frame,
27012 .@"anyframe",
27013 .void,
2701427014 => return,
2701527015
27016 .Fn => {
27016 .@"fn" => {
2701727017 try sema.errNote(src_loc, msg, "use '*const {}' for a function pointer type", .{ty.fmt(pt)});
2701827018 },
2701927019
27020 .Type => {
27020 .type => {
2702127021 try sema.errNote(src_loc, msg, "types are not available at runtime", .{});
2702227022 },
2702327023
27024 .ComptimeFloat,
27025 .ComptimeInt,
27026 .EnumLiteral,
27027 .NoReturn,
27028 .Undefined,
27029 .Null,
27024 .comptime_float,
27025 .comptime_int,
27026 .enum_literal,
27027 .noreturn,
27028 .undefined,
27029 .null,
2703027030 => return,
2703127031
27032 .Opaque => {
27032 .@"opaque" => {
2703327033 try sema.errNote(src_loc, msg, "opaque type '{}' has undefined size", .{ty.fmt(pt)});
2703427034 },
2703527035
27036 .Array, .Vector => {
27036 .array, .vector => {
2703727037 try sema.explainWhyTypeIsComptimeInner(msg, src_loc, ty.childType(zcu), type_set);
2703827038 },
27039 .Pointer => {
27039 .pointer => {
2704027040 const elem_ty = ty.elemType2(zcu);
27041 if (elem_ty.zigTypeTag(zcu) == .Fn) {
27041 if (elem_ty.zigTypeTag(zcu) == .@"fn") {
2704227042 const fn_info = zcu.typeToFunc(elem_ty).?;
2704327043 if (fn_info.is_generic) {
2704427044 try sema.errNote(src_loc, msg, "function is generic", .{});
......@@ -27055,14 +27055,14 @@ fn explainWhyTypeIsComptimeInner(
2705527055 try sema.explainWhyTypeIsComptimeInner(msg, src_loc, ty.childType(zcu), type_set);
2705627056 },
2705727057
27058 .Optional => {
27058 .optional => {
2705927059 try sema.explainWhyTypeIsComptimeInner(msg, src_loc, ty.optionalChild(zcu), type_set);
2706027060 },
27061 .ErrorUnion => {
27061 .error_union => {
2706227062 try sema.explainWhyTypeIsComptimeInner(msg, src_loc, ty.errorUnionPayload(zcu), type_set);
2706327063 },
2706427064
27065 .Struct => {
27065 .@"struct" => {
2706627066 if ((try type_set.getOrPut(sema.gpa, ty.toIntern())).found_existing) return;
2706727067
2706827068 if (zcu.typeToStruct(ty)) |struct_type| {
......@@ -27082,7 +27082,7 @@ fn explainWhyTypeIsComptimeInner(
2708227082 // TODO tuples
2708327083 },
2708427084
27085 .Union => {
27085 .@"union" => {
2708627086 if ((try type_set.getOrPut(sema.gpa, ty.toIntern())).found_existing) return;
2708727087
2708827088 if (zcu.typeToUnion(ty)) |union_obj| {
......@@ -27123,34 +27123,34 @@ fn validateExternType(
2712327123 const pt = sema.pt;
2712427124 const zcu = pt.zcu;
2712527125 switch (ty.zigTypeTag(zcu)) {
27126 .Type,
27127 .ComptimeFloat,
27128 .ComptimeInt,
27129 .EnumLiteral,
27130 .Undefined,
27131 .Null,
27132 .ErrorUnion,
27133 .ErrorSet,
27134 .Frame,
27126 .type,
27127 .comptime_float,
27128 .comptime_int,
27129 .enum_literal,
27130 .undefined,
27131 .null,
27132 .error_union,
27133 .error_set,
27134 .frame,
2713527135 => return false,
27136 .Void => return position == .union_field or position == .ret_ty or position == .struct_field or position == .element,
27137 .NoReturn => return position == .ret_ty,
27138 .Opaque,
27139 .Bool,
27140 .Float,
27141 .AnyFrame,
27136 .void => return position == .union_field or position == .ret_ty or position == .struct_field or position == .element,
27137 .noreturn => return position == .ret_ty,
27138 .@"opaque",
27139 .bool,
27140 .float,
27141 .@"anyframe",
2714227142 => return true,
27143 .Pointer => {
27144 if (ty.childType(zcu).zigTypeTag(zcu) == .Fn) {
27143 .pointer => {
27144 if (ty.childType(zcu).zigTypeTag(zcu) == .@"fn") {
2714527145 return ty.isConstPtr(zcu) and try sema.validateExternType(ty.childType(zcu), .other);
2714627146 }
2714727147 return !(ty.isSlice(zcu) or try ty.comptimeOnlySema(pt));
2714827148 },
27149 .Int => switch (ty.intInfo(zcu).bits) {
27149 .int => switch (ty.intInfo(zcu).bits) {
2715027150 0, 8, 16, 32, 64, 128 => return true,
2715127151 else => return false,
2715227152 },
27153 .Fn => {
27153 .@"fn" => {
2715427154 if (position != .other) return false;
2715527155 const target = zcu.getTarget();
2715627156 // For now we want to authorize PTX kernel to use zig objects, even if we end up exposing the ABI.
......@@ -27160,10 +27160,10 @@ fn validateExternType(
2716027160 }
2716127161 return !target_util.fnCallConvAllowsZigTypes(target, ty.fnCallingConvention(zcu));
2716227162 },
27163 .Enum => {
27163 .@"enum" => {
2716427164 return sema.validateExternType(ty.intTagType(zcu), position);
2716527165 },
27166 .Struct, .Union => switch (ty.containerLayout(zcu)) {
27166 .@"struct", .@"union" => switch (ty.containerLayout(zcu)) {
2716727167 .@"extern" => return true,
2716827168 .@"packed" => {
2716927169 const bit_size = try ty.bitSizeSema(pt);
......@@ -27174,12 +27174,12 @@ fn validateExternType(
2717427174 },
2717527175 .auto => return !(try ty.hasRuntimeBitsSema(pt)),
2717627176 },
27177 .Array => {
27177 .array => {
2717827178 if (position == .ret_ty or position == .param_ty) return false;
2717927179 return sema.validateExternType(ty.elemType2(zcu), .element);
2718027180 },
27181 .Vector => return sema.validateExternType(ty.elemType2(zcu), .element),
27182 .Optional => return ty.isPtrLikeOptional(zcu),
27181 .vector => return sema.validateExternType(ty.elemType2(zcu), .element),
27182 .optional => return ty.isPtrLikeOptional(zcu),
2718327183 }
2718427184}
2718527185
......@@ -27193,29 +27193,29 @@ fn explainWhyTypeIsNotExtern(
2719327193 const pt = sema.pt;
2719427194 const zcu = pt.zcu;
2719527195 switch (ty.zigTypeTag(zcu)) {
27196 .Opaque,
27197 .Bool,
27198 .Float,
27199 .AnyFrame,
27196 .@"opaque",
27197 .bool,
27198 .float,
27199 .@"anyframe",
2720027200 => return,
2720127201
27202 .Type,
27203 .ComptimeFloat,
27204 .ComptimeInt,
27205 .EnumLiteral,
27206 .Undefined,
27207 .Null,
27208 .ErrorUnion,
27209 .ErrorSet,
27210 .Frame,
27202 .type,
27203 .comptime_float,
27204 .comptime_int,
27205 .enum_literal,
27206 .undefined,
27207 .null,
27208 .error_union,
27209 .error_set,
27210 .frame,
2721127211 => return,
2721227212
27213 .Pointer => {
27213 .pointer => {
2721427214 if (ty.isSlice(zcu)) {
2721527215 try sema.errNote(src_loc, msg, "slices have no guaranteed in-memory representation", .{});
2721627216 } else {
2721727217 const pointee_ty = ty.childType(zcu);
27218 if (!ty.isConstPtr(zcu) and pointee_ty.zigTypeTag(zcu) == .Fn) {
27218 if (!ty.isConstPtr(zcu) and pointee_ty.zigTypeTag(zcu) == .@"fn") {
2721927219 try sema.errNote(src_loc, msg, "pointer to extern function must be 'const'", .{});
2722027220 } else if (try ty.comptimeOnlySema(pt)) {
2722127221 try sema.errNote(src_loc, msg, "pointer to comptime-only type '{}'", .{pointee_ty.fmt(pt)});
......@@ -27224,14 +27224,14 @@ fn explainWhyTypeIsNotExtern(
2722427224 try sema.explainWhyTypeIsNotExtern(msg, src_loc, pointee_ty, .other);
2722527225 }
2722627226 },
27227 .Void => try sema.errNote(src_loc, msg, "'void' is a zero bit type; for C 'void' use 'anyopaque'", .{}),
27228 .NoReturn => try sema.errNote(src_loc, msg, "'noreturn' is only allowed as a return type", .{}),
27229 .Int => if (!std.math.isPowerOfTwo(ty.intInfo(zcu).bits)) {
27227 .void => try sema.errNote(src_loc, msg, "'void' is a zero bit type; for C 'void' use 'anyopaque'", .{}),
27228 .noreturn => try sema.errNote(src_loc, msg, "'noreturn' is only allowed as a return type", .{}),
27229 .int => if (!std.math.isPowerOfTwo(ty.intInfo(zcu).bits)) {
2723027230 try sema.errNote(src_loc, msg, "only integers with 0 or power of two bits are extern compatible", .{});
2723127231 } else {
2723227232 try sema.errNote(src_loc, msg, "only integers with 0, 8, 16, 32, 64 and 128 bits are extern compatible", .{});
2723327233 },
27234 .Fn => {
27234 .@"fn" => {
2723527235 if (position != .other) {
2723627236 try sema.errNote(src_loc, msg, "type has no guaranteed in-memory representation", .{});
2723727237 try sema.errNote(src_loc, msg, "use '*const ' to make a function pointer type", .{});
......@@ -27244,14 +27244,14 @@ fn explainWhyTypeIsNotExtern(
2724427244 else => return,
2724527245 }
2724627246 },
27247 .Enum => {
27247 .@"enum" => {
2724827248 const tag_ty = ty.intTagType(zcu);
2724927249 try sema.errNote(src_loc, msg, "enum tag type '{}' is not extern compatible", .{tag_ty.fmt(pt)});
2725027250 try sema.explainWhyTypeIsNotExtern(msg, src_loc, tag_ty, position);
2725127251 },
27252 .Struct => try sema.errNote(src_loc, msg, "only extern structs and ABI sized packed structs are extern compatible", .{}),
27253 .Union => try sema.errNote(src_loc, msg, "only extern unions and ABI sized packed unions are extern compatible", .{}),
27254 .Array => {
27252 .@"struct" => try sema.errNote(src_loc, msg, "only extern structs and ABI sized packed structs are extern compatible", .{}),
27253 .@"union" => try sema.errNote(src_loc, msg, "only extern unions and ABI sized packed unions are extern compatible", .{}),
27254 .array => {
2725527255 if (position == .ret_ty) {
2725627256 return sema.errNote(src_loc, msg, "arrays are not allowed as a return type", .{});
2725727257 } else if (position == .param_ty) {
......@@ -27259,8 +27259,8 @@ fn explainWhyTypeIsNotExtern(
2725927259 }
2726027260 try sema.explainWhyTypeIsNotExtern(msg, src_loc, ty.elemType2(zcu), .element);
2726127261 },
27262 .Vector => try sema.explainWhyTypeIsNotExtern(msg, src_loc, ty.elemType2(zcu), .element),
27263 .Optional => try sema.errNote(src_loc, msg, "only pointer like optionals are extern compatible", .{}),
27262 .vector => try sema.explainWhyTypeIsNotExtern(msg, src_loc, ty.elemType2(zcu), .element),
27263 .optional => try sema.errNote(src_loc, msg, "only pointer like optionals are extern compatible", .{}),
2726427264 }
2726527265}
2726627266
......@@ -27270,34 +27270,34 @@ fn validatePackedType(sema: *Sema, ty: Type) !bool {
2727027270 const pt = sema.pt;
2727127271 const zcu = pt.zcu;
2727227272 return switch (ty.zigTypeTag(zcu)) {
27273 .Type,
27274 .ComptimeFloat,
27275 .ComptimeInt,
27276 .EnumLiteral,
27277 .Undefined,
27278 .Null,
27279 .ErrorUnion,
27280 .ErrorSet,
27281 .Frame,
27282 .NoReturn,
27283 .Opaque,
27284 .AnyFrame,
27285 .Fn,
27286 .Array,
27273 .type,
27274 .comptime_float,
27275 .comptime_int,
27276 .enum_literal,
27277 .undefined,
27278 .null,
27279 .error_union,
27280 .error_set,
27281 .frame,
27282 .noreturn,
27283 .@"opaque",
27284 .@"anyframe",
27285 .@"fn",
27286 .array,
2728727287 => false,
27288 .Optional => return ty.isPtrLikeOptional(zcu),
27289 .Void,
27290 .Bool,
27291 .Float,
27292 .Int,
27293 .Vector,
27288 .optional => return ty.isPtrLikeOptional(zcu),
27289 .void,
27290 .bool,
27291 .float,
27292 .int,
27293 .vector,
2729427294 => true,
27295 .Enum => switch (zcu.intern_pool.loadEnumType(ty.toIntern()).tag_mode) {
27295 .@"enum" => switch (zcu.intern_pool.loadEnumType(ty.toIntern()).tag_mode) {
2729627296 .auto => false,
2729727297 .explicit, .nonexhaustive => true,
2729827298 },
27299 .Pointer => !ty.isSlice(zcu) and !try ty.comptimeOnlySema(pt),
27300 .Struct, .Union => ty.containerLayout(zcu) == .@"packed",
27299 .pointer => !ty.isSlice(zcu) and !try ty.comptimeOnlySema(pt),
27300 .@"struct", .@"union" => ty.containerLayout(zcu) == .@"packed",
2730127301 };
2730227302}
2730327303
......@@ -27310,40 +27310,40 @@ fn explainWhyTypeIsNotPacked(
2731027310 const pt = sema.pt;
2731127311 const zcu = pt.zcu;
2731227312 switch (ty.zigTypeTag(zcu)) {
27313 .Void,
27314 .Bool,
27315 .Float,
27316 .Int,
27317 .Vector,
27318 .Enum,
27313 .void,
27314 .bool,
27315 .float,
27316 .int,
27317 .vector,
27318 .@"enum",
2731927319 => return,
27320 .Type,
27321 .ComptimeFloat,
27322 .ComptimeInt,
27323 .EnumLiteral,
27324 .Undefined,
27325 .Null,
27326 .Frame,
27327 .NoReturn,
27328 .Opaque,
27329 .ErrorUnion,
27330 .ErrorSet,
27331 .AnyFrame,
27332 .Optional,
27333 .Array,
27320 .type,
27321 .comptime_float,
27322 .comptime_int,
27323 .enum_literal,
27324 .undefined,
27325 .null,
27326 .frame,
27327 .noreturn,
27328 .@"opaque",
27329 .error_union,
27330 .error_set,
27331 .@"anyframe",
27332 .optional,
27333 .array,
2733427334 => try sema.errNote(src_loc, msg, "type has no guaranteed in-memory representation", .{}),
27335 .Pointer => if (ty.isSlice(zcu)) {
27335 .pointer => if (ty.isSlice(zcu)) {
2733627336 try sema.errNote(src_loc, msg, "slices have no guaranteed in-memory representation", .{});
2733727337 } else {
2733827338 try sema.errNote(src_loc, msg, "comptime-only pointer has no guaranteed in-memory representation", .{});
2733927339 try sema.explainWhyTypeIsComptime(msg, src_loc, ty);
2734027340 },
27341 .Fn => {
27341 .@"fn" => {
2734227342 try sema.errNote(src_loc, msg, "type has no guaranteed in-memory representation", .{});
2734327343 try sema.errNote(src_loc, msg, "use '*const ' to make a function pointer type", .{});
2734427344 },
27345 .Struct => try sema.errNote(src_loc, msg, "only packed structs layout are allowed in packed types", .{}),
27346 .Union => try sema.errNote(src_loc, msg, "only packed unions layout are allowed in packed types", .{}),
27345 .@"struct" => try sema.errNote(src_loc, msg, "only packed structs layout are allowed in packed types", .{}),
27346 .@"union" => try sema.errNote(src_loc, msg, "only packed unions layout are allowed in packed types", .{}),
2734727347 }
2734827348}
2734927349
......@@ -27356,7 +27356,7 @@ fn prepareSimplePanic(sema: *Sema, block: *Block, src: LazySrcLoc) !void {
2735627356 const fn_val = try sema.resolveConstValue(block, src, fn_ref, .{
2735727357 .needed_comptime_reason = "panic handler must be comptime-known",
2735827358 });
27359 assert(fn_val.typeOf(zcu).zigTypeTag(zcu) == .Fn);
27359 assert(fn_val.typeOf(zcu).zigTypeTag(zcu) == .@"fn");
2736027360 assert(try fn_val.typeOf(zcu).fnHasRuntimeBitsSema(pt));
2736127361 try zcu.ensureFuncBodyAnalysisQueued(fn_val.toIntern());
2736227362 zcu.panic_func_index = fn_val.toIntern();
......@@ -27444,9 +27444,9 @@ fn addSafetyCheckExtra(
2744427444
2744527445 try parent_block.instructions.ensureUnusedCapacity(gpa, 1);
2744627446
27447 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len +
27447 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len +
2744827448 1 + // The main block only needs space for the cond_br.
27449 @typeInfo(Air.CondBr).Struct.fields.len +
27449 @typeInfo(Air.CondBr).@"struct".fields.len +
2745027450 1 + // The ok branch of the cond_br only needs space for the br.
2745127451 fail_block.instructions.items.len);
2745227452
......@@ -27614,7 +27614,7 @@ fn panicSentinelMismatch(
2761427614 break :blk try parent_block.addTyOp(.load, sentinel_ty, sentinel_ptr);
2761527615 };
2761627616
27617 const ok = if (sentinel_ty.zigTypeTag(zcu) == .Vector) ok: {
27617 const ok = if (sentinel_ty.zigTypeTag(zcu) == .vector) ok: {
2761827618 const eql =
2761927619 try parent_block.addCmpVector(expected_sentinel, actual_sentinel, .eq);
2762027620 break :ok try parent_block.addInst(.{
......@@ -27727,7 +27727,7 @@ fn fieldVal(
2772727727 object_ty;
2772827728
2772927729 switch (inner_ty.zigTypeTag(zcu)) {
27730 .Array => {
27730 .array => {
2773127731 if (field_name.eqlSlice("len", ip)) {
2773227732 return Air.internedToRef((try pt.intValue(Type.usize, inner_ty.arrayLen(zcu))).toIntern());
2773327733 } else if (field_name.eqlSlice("ptr", ip) and is_pointer_to) {
......@@ -27756,7 +27756,7 @@ fn fieldVal(
2775627756 );
2775727757 }
2775827758 },
27759 .Pointer => {
27759 .pointer => {
2776027760 const ptr_info = inner_ty.ptrInfo(zcu);
2776127761 if (ptr_info.flags.size == .Slice) {
2776227762 if (field_name.eqlSlice("ptr", ip)) {
......@@ -27781,7 +27781,7 @@ fn fieldVal(
2778127781 }
2778227782 }
2778327783 },
27784 .Type => {
27784 .type => {
2778527785 const dereffed_type = if (is_pointer_to)
2778627786 try sema.analyzeLoad(block, src, object, object_src)
2778727787 else
......@@ -27791,7 +27791,7 @@ fn fieldVal(
2779127791 const child_type = val.toType();
2779227792
2779327793 switch (try child_type.zigTypeTagOrPoison(zcu)) {
27794 .ErrorSet => {
27794 .error_set => {
2779527795 switch (ip.indexToKey(child_type.toIntern())) {
2779627796 .error_set_type => |error_set_type| blk: {
2779727797 if (error_set_type.nameIndex(ip, field_name) != null) break :blk;
......@@ -27818,7 +27818,7 @@ fn fieldVal(
2781827818 .name = field_name,
2781927819 } })));
2782027820 },
27821 .Union => {
27821 .@"union" => {
2782227822 if (try sema.namespaceLookupVal(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
2782327823 return inst;
2782427824 }
......@@ -27831,7 +27831,7 @@ fn fieldVal(
2783127831 }
2783227832 return sema.failWithBadMemberAccess(block, child_type, field_name_src, field_name);
2783327833 },
27834 .Enum => {
27834 .@"enum" => {
2783527835 if (try sema.namespaceLookupVal(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
2783627836 return inst;
2783727837 }
......@@ -27841,7 +27841,7 @@ fn fieldVal(
2784127841 const enum_val = try pt.enumValueFieldIndex(child_type, field_index);
2784227842 return Air.internedToRef(enum_val.toIntern());
2784327843 },
27844 .Struct, .Opaque => {
27844 .@"struct", .@"opaque" => {
2784527845 switch (child_type.toIntern()) {
2784627846 .empty_struct_type, .anyopaque_type => {}, // no namespace
2784727847 else => if (try sema.namespaceLookupVal(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
......@@ -27854,19 +27854,19 @@ fn fieldVal(
2785427854 const msg = try sema.errMsg(src, "type '{}' has no members", .{child_type.fmt(pt)});
2785527855 errdefer msg.destroy(sema.gpa);
2785627856 if (child_type.isSlice(zcu)) try sema.errNote(src, msg, "slice values have 'len' and 'ptr' members", .{});
27857 if (child_type.zigTypeTag(zcu) == .Array) try sema.errNote(src, msg, "array values have 'len' member", .{});
27857 if (child_type.zigTypeTag(zcu) == .array) try sema.errNote(src, msg, "array values have 'len' member", .{});
2785827858 break :msg msg;
2785927859 }),
2786027860 }
2786127861 },
27862 .Struct => if (is_pointer_to) {
27862 .@"struct" => if (is_pointer_to) {
2786327863 // Avoid loading the entire struct by fetching a pointer and loading that
2786427864 const field_ptr = try sema.structFieldPtr(block, src, object, field_name, field_name_src, inner_ty, false);
2786527865 return sema.analyzeLoad(block, src, field_ptr, object_src);
2786627866 } else {
2786727867 return sema.structFieldVal(block, src, object, field_name, field_name_src, inner_ty);
2786827868 },
27869 .Union => if (is_pointer_to) {
27869 .@"union" => if (is_pointer_to) {
2787027870 // Avoid loading the entire union by fetching a pointer and loading that
2787127871 const field_ptr = try sema.unionFieldPtr(block, src, object, field_name, field_name_src, inner_ty, false);
2787227872 return sema.analyzeLoad(block, src, field_ptr, object_src);
......@@ -27896,7 +27896,7 @@ fn fieldPtr(
2789627896 const object_ptr_src = src; // TODO better source location
2789727897 const object_ptr_ty = sema.typeOf(object_ptr);
2789827898 const object_ty = switch (object_ptr_ty.zigTypeTag(zcu)) {
27899 .Pointer => object_ptr_ty.childType(zcu),
27899 .pointer => object_ptr_ty.childType(zcu),
2790027900 else => return sema.fail(block, object_ptr_src, "expected pointer, found '{}'", .{object_ptr_ty.fmt(pt)}),
2790127901 };
2790227902
......@@ -27911,7 +27911,7 @@ fn fieldPtr(
2791127911 object_ty;
2791227912
2791327913 switch (inner_ty.zigTypeTag(zcu)) {
27914 .Array => {
27914 .array => {
2791527915 if (field_name.eqlSlice("len", ip)) {
2791627916 const int_val = try pt.intValue(Type.usize, inner_ty.arrayLen(zcu));
2791727917 return uavRef(sema, int_val.toIntern());
......@@ -27955,7 +27955,7 @@ fn fieldPtr(
2795527955 );
2795627956 }
2795727957 },
27958 .Pointer => if (inner_ty.isSlice(zcu)) {
27958 .pointer => if (inner_ty.isSlice(zcu)) {
2795927959 const inner_ptr = if (is_pointer_to)
2796027960 try sema.analyzeLoad(block, src, object_ptr, object_ptr_src)
2796127961 else
......@@ -28010,7 +28010,7 @@ fn fieldPtr(
2801028010 );
2801128011 }
2801228012 },
28013 .Type => {
28013 .type => {
2801428014 _ = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, object_ptr, undefined);
2801528015 const result = try sema.analyzeLoad(block, src, object_ptr, object_ptr_src);
2801628016 const inner = if (is_pointer_to)
......@@ -28022,7 +28022,7 @@ fn fieldPtr(
2802228022 const child_type = val.toType();
2802328023
2802428024 switch (child_type.zigTypeTag(zcu)) {
28025 .ErrorSet => {
28025 .error_set => {
2802628026 switch (ip.indexToKey(child_type.toIntern())) {
2802728027 .error_set_type => |error_set_type| blk: {
2802828028 if (error_set_type.nameIndex(ip, field_name) != null) {
......@@ -28051,7 +28051,7 @@ fn fieldPtr(
2805128051 .name = field_name,
2805228052 } }));
2805328053 },
28054 .Union => {
28054 .@"union" => {
2805528055 if (try sema.namespaceLookupRef(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
2805628056 return inst;
2805728057 }
......@@ -28065,7 +28065,7 @@ fn fieldPtr(
2806528065 }
2806628066 return sema.failWithBadMemberAccess(block, child_type, field_name_src, field_name);
2806728067 },
28068 .Enum => {
28068 .@"enum" => {
2806928069 if (try sema.namespaceLookupRef(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
2807028070 return inst;
2807128071 }
......@@ -28076,7 +28076,7 @@ fn fieldPtr(
2807628076 const idx_val = try pt.enumValueFieldIndex(child_type, field_index_u32);
2807728077 return uavRef(sema, idx_val.toIntern());
2807828078 },
28079 .Struct, .Opaque => {
28079 .@"struct", .@"opaque" => {
2808028080 if (try sema.namespaceLookupRef(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
2808128081 return inst;
2808228082 }
......@@ -28085,7 +28085,7 @@ fn fieldPtr(
2808528085 else => return sema.fail(block, src, "type '{}' has no members", .{child_type.fmt(pt)}),
2808628086 }
2808728087 },
28088 .Struct => {
28088 .@"struct" => {
2808928089 const inner_ptr = if (is_pointer_to)
2809028090 try sema.analyzeLoad(block, src, object_ptr, object_ptr_src)
2809128091 else
......@@ -28094,7 +28094,7 @@ fn fieldPtr(
2809428094 try sema.checkKnownAllocPtr(block, inner_ptr, field_ptr);
2809528095 return field_ptr;
2809628096 },
28097 .Union => {
28097 .@"union" => {
2809828098 const inner_ptr = if (is_pointer_to)
2809928099 try sema.analyzeLoad(block, src, object_ptr, object_ptr_src)
2810028100 else
......@@ -28134,13 +28134,13 @@ fn fieldCallBind(
2813428134 const ip = &zcu.intern_pool;
2813528135 const raw_ptr_src = src; // TODO better source location
2813628136 const raw_ptr_ty = sema.typeOf(raw_ptr);
28137 const inner_ty = if (raw_ptr_ty.zigTypeTag(zcu) == .Pointer and (raw_ptr_ty.ptrSize(zcu) == .One or raw_ptr_ty.ptrSize(zcu) == .C))
28137 const inner_ty = if (raw_ptr_ty.zigTypeTag(zcu) == .pointer and (raw_ptr_ty.ptrSize(zcu) == .One or raw_ptr_ty.ptrSize(zcu) == .C))
2813828138 raw_ptr_ty.childType(zcu)
2813928139 else
2814028140 return sema.fail(block, raw_ptr_src, "expected single pointer, found '{}'", .{raw_ptr_ty.fmt(pt)});
2814128141
2814228142 // Optionally dereference a second pointer to get the concrete type.
28143 const is_double_ptr = inner_ty.zigTypeTag(zcu) == .Pointer and inner_ty.ptrSize(zcu) == .One;
28143 const is_double_ptr = inner_ty.zigTypeTag(zcu) == .pointer and inner_ty.ptrSize(zcu) == .One;
2814428144 const concrete_ty = if (is_double_ptr) inner_ty.childType(zcu) else inner_ty;
2814528145 const ptr_ty = if (is_double_ptr) inner_ty else raw_ptr_ty;
2814628146 const object_ptr = if (is_double_ptr)
......@@ -28150,7 +28150,7 @@ fn fieldCallBind(
2815028150
2815128151 find_field: {
2815228152 switch (concrete_ty.zigTypeTag(zcu)) {
28153 .Struct => {
28153 .@"struct" => {
2815428154 try concrete_ty.resolveFields(pt);
2815528155 if (zcu.typeToStruct(concrete_ty)) |struct_type| {
2815628156 const field_index = struct_type.nameIndex(ip, field_name) orelse
......@@ -28176,14 +28176,14 @@ fn fieldCallBind(
2817628176 }
2817728177 }
2817828178 },
28179 .Union => {
28179 .@"union" => {
2818028180 try concrete_ty.resolveFields(pt);
2818128181 const union_obj = zcu.typeToUnion(concrete_ty).?;
2818228182 _ = union_obj.loadTagType(ip).nameIndex(ip, field_name) orelse break :find_field;
2818328183 const field_ptr = try unionFieldPtr(sema, block, src, object_ptr, field_name, field_name_src, concrete_ty, false);
2818428184 return .{ .direct = try sema.analyzeLoad(block, src, field_ptr, src) };
2818528185 },
28186 .Type => {
28186 .type => {
2818728187 const namespace = try sema.analyzeLoad(block, src, object_ptr, src);
2818828188 return .{ .direct = try sema.fieldVal(block, src, namespace, field_name, field_name_src) };
2818928189 },
......@@ -28205,7 +28205,7 @@ fn fieldCallBind(
2820528205
2820628206 const first_param_type = Type.fromInterned(func_type.param_types.get(ip)[0]);
2820728207 if (first_param_type.isGenericPoison() or
28208 (first_param_type.zigTypeTag(zcu) == .Pointer and
28208 (first_param_type.zigTypeTag(zcu) == .pointer and
2820928209 (first_param_type.ptrSize(zcu) == .One or
2821028210 first_param_type.ptrSize(zcu) == .C) and
2821128211 first_param_type.childType(zcu).eql(concrete_ty, zcu)))
......@@ -28225,7 +28225,7 @@ fn fieldCallBind(
2822528225 .func_inst = decl_val,
2822628226 .arg0_inst = deref,
2822728227 } };
28228 } else if (first_param_type.zigTypeTag(zcu) == .Optional) {
28228 } else if (first_param_type.zigTypeTag(zcu) == .optional) {
2822928229 const child = first_param_type.optionalChild(zcu);
2823028230 if (child.eql(concrete_ty, zcu)) {
2823128231 const deref = try sema.analyzeLoad(block, src, object_ptr, src);
......@@ -28233,7 +28233,7 @@ fn fieldCallBind(
2823328233 .func_inst = decl_val,
2823428234 .arg0_inst = deref,
2823528235 } };
28236 } else if (child.zigTypeTag(zcu) == .Pointer and
28236 } else if (child.zigTypeTag(zcu) == .pointer and
2823728237 child.ptrSize(zcu) == .One and
2823828238 child.childType(zcu).eql(concrete_ty, zcu))
2823928239 {
......@@ -28242,7 +28242,7 @@ fn fieldCallBind(
2824228242 .arg0_inst = object_ptr,
2824328243 } };
2824428244 }
28245 } else if (first_param_type.zigTypeTag(zcu) == .ErrorUnion and
28245 } else if (first_param_type.zigTypeTag(zcu) == .error_union and
2824628246 first_param_type.errorUnionPayload(zcu).eql(concrete_ty, zcu))
2824728247 {
2824828248 const deref = try sema.analyzeLoad(block, src, object_ptr, src);
......@@ -28270,7 +28270,7 @@ fn fieldCallBind(
2827028270 .{field_name.fmt(ip)},
2827128271 );
2827228272 }
28273 if (concrete_ty.zigTypeTag(zcu) == .ErrorUnion) {
28273 if (concrete_ty.zigTypeTag(zcu) == .error_union) {
2827428274 try sema.errNote(src, msg, "consider using 'try', 'catch', or 'if'", .{});
2827528275 }
2827628276 if (is_double_ptr) {
......@@ -28302,7 +28302,7 @@ fn finishFieldCallBind(
2830228302 });
2830328303
2830428304 const container_ty = ptr_ty.childType(zcu);
28305 if (container_ty.zigTypeTag(zcu) == .Struct) {
28305 if (container_ty.zigTypeTag(zcu) == .@"struct") {
2830628306 if (container_ty.structFieldIsComptime(field_index, zcu)) {
2830728307 try container_ty.resolveStructFieldInits(pt);
2830828308 const default_val = (try container_ty.structFieldValueComptime(pt, field_index)).?;
......@@ -28382,7 +28382,7 @@ fn structFieldPtr(
2838228382 const pt = sema.pt;
2838328383 const zcu = pt.zcu;
2838428384 const ip = &zcu.intern_pool;
28385 assert(struct_ty.zigTypeTag(zcu) == .Struct);
28385 assert(struct_ty.zigTypeTag(zcu) == .@"struct");
2838628386
2838728387 try struct_ty.resolveFields(pt);
2838828388 try struct_ty.resolveLayout(pt);
......@@ -28508,7 +28508,7 @@ fn structFieldVal(
2850828508 const pt = sema.pt;
2850928509 const zcu = pt.zcu;
2851028510 const ip = &zcu.intern_pool;
28511 assert(struct_ty.zigTypeTag(zcu) == .Struct);
28511 assert(struct_ty.zigTypeTag(zcu) == .@"struct");
2851228512
2851328513 try struct_ty.resolveFields(pt);
2851428514
......@@ -28646,7 +28646,7 @@ fn unionFieldPtr(
2864628646 const zcu = pt.zcu;
2864728647 const ip = &zcu.intern_pool;
2864828648
28649 assert(union_ty.zigTypeTag(zcu) == .Union);
28649 assert(union_ty.zigTypeTag(zcu) == .@"union");
2865028650
2865128651 const union_ptr_ty = sema.typeOf(union_ptr);
2865228652 const union_ptr_info = union_ptr_ty.ptrInfo(zcu);
......@@ -28673,7 +28673,7 @@ fn unionFieldPtr(
2867328673 });
2867428674 const enum_field_index: u32 = @intCast(Type.fromInterned(union_obj.enum_tag_ty).enumFieldIndex(field_name, zcu).?);
2867528675
28676 if (initializing and field_ty.zigTypeTag(zcu) == .NoReturn) {
28676 if (initializing and field_ty.zigTypeTag(zcu) == .noreturn) {
2867728677 const msg = msg: {
2867828678 const msg = try sema.errMsg(src, "cannot initialize 'noreturn' field of union", .{});
2867928679 errdefer msg.destroy(sema.gpa);
......@@ -28736,7 +28736,7 @@ fn unionFieldPtr(
2873628736 const active_tag = try block.addTyOp(.get_union_tag, Type.fromInterned(union_obj.enum_tag_ty), union_val);
2873728737 try sema.panicInactiveUnionField(block, src, active_tag, wanted_tag);
2873828738 }
28739 if (field_ty.zigTypeTag(zcu) == .NoReturn) {
28739 if (field_ty.zigTypeTag(zcu) == .noreturn) {
2874028740 _ = try block.addNoOp(.unreach);
2874128741 return .unreachable_value;
2874228742 }
......@@ -28755,7 +28755,7 @@ fn unionFieldVal(
2875528755 const pt = sema.pt;
2875628756 const zcu = pt.zcu;
2875728757 const ip = &zcu.intern_pool;
28758 assert(union_ty.zigTypeTag(zcu) == .Union);
28758 assert(union_ty.zigTypeTag(zcu) == .@"union");
2875928759
2876028760 try union_ty.resolveFields(pt);
2876128761 const union_obj = zcu.typeToUnion(union_ty).?;
......@@ -28811,7 +28811,7 @@ fn unionFieldVal(
2881128811 const active_tag = try block.addTyOp(.get_union_tag, Type.fromInterned(union_obj.enum_tag_ty), union_byval);
2881228812 try sema.panicInactiveUnionField(block, src, active_tag, wanted_tag);
2881328813 }
28814 if (field_ty.zigTypeTag(zcu) == .NoReturn) {
28814 if (field_ty.zigTypeTag(zcu) == .noreturn) {
2881528815 _ = try block.addNoOp(.unreach);
2881628816 return .unreachable_value;
2881728817 }
......@@ -28835,14 +28835,14 @@ fn elemPtr(
2883528835 const indexable_ptr_ty = sema.typeOf(indexable_ptr);
2883628836
2883728837 const indexable_ty = switch (indexable_ptr_ty.zigTypeTag(zcu)) {
28838 .Pointer => indexable_ptr_ty.childType(zcu),
28838 .pointer => indexable_ptr_ty.childType(zcu),
2883928839 else => return sema.fail(block, indexable_ptr_src, "expected pointer, found '{}'", .{indexable_ptr_ty.fmt(pt)}),
2884028840 };
2884128841 try checkIndexable(sema, block, src, indexable_ty);
2884228842
2884328843 const elem_ptr = switch (indexable_ty.zigTypeTag(zcu)) {
28844 .Array, .Vector => try sema.elemPtrArray(block, src, indexable_ptr_src, indexable_ptr, elem_index_src, elem_index, init, oob_safety),
28845 .Struct => blk: {
28844 .array, .vector => try sema.elemPtrArray(block, src, indexable_ptr_src, indexable_ptr, elem_index_src, elem_index, init, oob_safety),
28845 .@"struct" => blk: {
2884628846 // Tuple field access.
2884728847 const index_val = try sema.resolveConstDefinedValue(block, elem_index_src, elem_index, .{
2884828848 .needed_comptime_reason = "tuple field access index must be comptime-known",
......@@ -28898,8 +28898,8 @@ fn elemPtrOneLayerOnly(
2889828898 .One => {
2889928899 const child_ty = indexable_ty.childType(zcu);
2890028900 const elem_ptr = switch (child_ty.zigTypeTag(zcu)) {
28901 .Array, .Vector => try sema.elemPtrArray(block, src, indexable_src, indexable, elem_index_src, elem_index, init, oob_safety),
28902 .Struct => blk: {
28901 .array, .vector => try sema.elemPtrArray(block, src, indexable_src, indexable, elem_index_src, elem_index, init, oob_safety),
28902 .@"struct" => blk: {
2890328903 assert(child_ty.isTuple(zcu));
2890428904 const index_val = try sema.resolveConstDefinedValue(block, elem_index_src, elem_index, .{
2890528905 .needed_comptime_reason = "tuple field access index must be comptime-known",
......@@ -28936,7 +28936,7 @@ fn elemVal(
2893628936 const elem_index = try sema.coerce(block, Type.usize, elem_index_uncasted, elem_index_src);
2893728937
2893828938 switch (indexable_ty.zigTypeTag(zcu)) {
28939 .Pointer => switch (indexable_ty.ptrSize(zcu)) {
28939 .pointer => switch (indexable_ty.ptrSize(zcu)) {
2894028940 .Slice => return sema.elemValSlice(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety),
2894128941 .Many, .C => {
2894228942 const maybe_indexable_val = try sema.resolveDefinedValue(block, indexable_src, indexable);
......@@ -28963,7 +28963,7 @@ fn elemVal(
2896328963 .One => {
2896428964 arr_sent: {
2896528965 const inner_ty = indexable_ty.childType(zcu);
28966 if (inner_ty.zigTypeTag(zcu) != .Array) break :arr_sent;
28966 if (inner_ty.zigTypeTag(zcu) != .array) break :arr_sent;
2896728967 const sentinel = inner_ty.sentinel(zcu) orelse break :arr_sent;
2896828968 const index_val = try sema.resolveDefinedValue(block, elem_index_src, elem_index) orelse break :arr_sent;
2896928969 const index = try sema.usizeCast(block, src, try index_val.toUnsignedIntSema(pt));
......@@ -28974,12 +28974,12 @@ fn elemVal(
2897428974 return sema.analyzeLoad(block, indexable_src, elem_ptr, elem_index_src);
2897528975 },
2897628976 },
28977 .Array => return sema.elemValArray(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety),
28978 .Vector => {
28977 .array => return sema.elemValArray(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety),
28978 .vector => {
2897928979 // TODO: If the index is a vector, the result should be a vector.
2898028980 return sema.elemValArray(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety);
2898128981 },
28982 .Struct => {
28982 .@"struct" => {
2898328983 // Tuple field access.
2898428984 const index_val = try sema.resolveConstDefinedValue(block, elem_index_src, elem_index, .{
2898528985 .needed_comptime_reason = "tuple field access index must be comptime-known",
......@@ -29448,7 +29448,7 @@ fn coerceExtra(
2944829448 }
2944929449
2945029450 switch (dest_ty.zigTypeTag(zcu)) {
29451 .Optional => optional: {
29451 .optional => optional: {
2945229452 if (maybe_inst_val) |val| {
2945329453 // undefined sets the optional bit also to undefined.
2945429454 if (val.toIntern() == .undef) {
......@@ -29472,7 +29472,7 @@ fn coerceExtra(
2947229472 anyopaque_check: {
2947329473 if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :optional;
2947429474 const elem_ty = inst_ty.elemType2(zcu);
29475 if (elem_ty.zigTypeTag(zcu) == .Pointer or elem_ty.isPtrLikeOptional(zcu)) {
29475 if (elem_ty.zigTypeTag(zcu) == .pointer or elem_ty.isPtrLikeOptional(zcu)) {
2947629476 in_memory_result = .{ .double_ptr_to_anyopaque = .{
2947729477 .actual = inst_ty,
2947829478 .wanted = dest_ty,
......@@ -29499,11 +29499,11 @@ fn coerceExtra(
2949929499 };
2950029500 return try sema.wrapOptional(block, dest_ty, intermediate, inst_src);
2950129501 },
29502 .Pointer => pointer: {
29502 .pointer => pointer: {
2950329503 const dest_info = dest_ty.ptrInfo(zcu);
2950429504
2950529505 // Function body to function pointer.
29506 if (inst_ty.zigTypeTag(zcu) == .Fn) {
29506 if (inst_ty.zigTypeTag(zcu) == .@"fn") {
2950729507 const fn_val = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, inst, undefined);
2950829508 const fn_nav = switch (zcu.intern_pool.indexToKey(fn_val.toIntern())) {
2950929509 .func => |f| f.owner_nav,
......@@ -29521,7 +29521,7 @@ fn coerceExtra(
2952129521 if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :pointer;
2952229522 const ptr_elem_ty = inst_ty.childType(zcu);
2952329523 const array_ty = Type.fromInterned(dest_info.child);
29524 if (array_ty.zigTypeTag(zcu) != .Array) break :single_item;
29524 if (array_ty.zigTypeTag(zcu) != .array) break :single_item;
2952529525 const array_elem_ty = array_ty.childType(zcu);
2952629526 if (array_ty.arrayLen(zcu) != 1) break :single_item;
2952729527 const dest_is_mut = !dest_info.flags.is_const;
......@@ -29537,7 +29537,7 @@ fn coerceExtra(
2953729537 if (!inst_ty.isSinglePointer(zcu)) break :src_array_ptr;
2953829538 if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :pointer;
2953929539 const array_ty = inst_ty.childType(zcu);
29540 if (array_ty.zigTypeTag(zcu) != .Array) break :src_array_ptr;
29540 if (array_ty.zigTypeTag(zcu) != .array) break :src_array_ptr;
2954129541 const array_elem_type = array_ty.childType(zcu);
2954229542 const dest_is_mut = !dest_info.flags.is_const;
2954329543
......@@ -29612,10 +29612,10 @@ fn coerceExtra(
2961229612
2961329613 // cast from *T and [*]T to *anyopaque
2961429614 // but don't do it if the source type is a double pointer
29615 if (dest_info.child == .anyopaque_type and inst_ty.zigTypeTag(zcu) == .Pointer) to_anyopaque: {
29615 if (dest_info.child == .anyopaque_type and inst_ty.zigTypeTag(zcu) == .pointer) to_anyopaque: {
2961629616 if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :pointer;
2961729617 const elem_ty = inst_ty.elemType2(zcu);
29618 if (elem_ty.zigTypeTag(zcu) == .Pointer or elem_ty.isPtrLikeOptional(zcu)) {
29618 if (elem_ty.zigTypeTag(zcu) == .pointer or elem_ty.isPtrLikeOptional(zcu)) {
2961929619 in_memory_result = .{ .double_ptr_to_anyopaque = .{
2962029620 .actual = inst_ty,
2962129621 .wanted = dest_ty,
......@@ -29636,19 +29636,19 @@ fn coerceExtra(
2963629636 switch (dest_info.flags.size) {
2963729637 // coercion to C pointer
2963829638 .C => switch (inst_ty.zigTypeTag(zcu)) {
29639 .Null => return Air.internedToRef(try pt.intern(.{ .ptr = .{
29639 .null => return Air.internedToRef(try pt.intern(.{ .ptr = .{
2964029640 .ty = dest_ty.toIntern(),
2964129641 .base_addr = .int,
2964229642 .byte_offset = 0,
2964329643 } })),
29644 .ComptimeInt => {
29644 .comptime_int => {
2964529645 const addr = sema.coerceExtra(block, Type.usize, inst, inst_src, .{ .report_err = false }) catch |err| switch (err) {
2964629646 error.NotCoercible => break :pointer,
2964729647 else => |e| return e,
2964829648 };
2964929649 return try sema.coerceCompatiblePtrs(block, dest_ty, addr, inst_src);
2965029650 },
29651 .Int => {
29651 .int => {
2965229652 const ptr_size_ty = switch (inst_ty.intInfo(zcu).signedness) {
2965329653 .signed => Type.isize,
2965429654 .unsigned => Type.usize,
......@@ -29663,7 +29663,7 @@ fn coerceExtra(
2966329663 };
2966429664 return try sema.coerceCompatiblePtrs(block, dest_ty, addr, inst_src);
2966529665 },
29666 .Pointer => p: {
29666 .pointer => p: {
2966729667 if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :p;
2966829668 const inst_info = inst_ty.ptrInfo(zcu);
2966929669 switch (try sema.coerceInMemoryAllowed(
......@@ -29693,7 +29693,7 @@ fn coerceExtra(
2969329693 else => {},
2969429694 },
2969529695 .One => switch (Type.fromInterned(dest_info.child).zigTypeTag(zcu)) {
29696 .Union => {
29696 .@"union" => {
2969729697 // pointer to anonymous struct to pointer to union
2969829698 if (inst_ty.isSinglePointer(zcu) and
2969929699 inst_ty.childType(zcu).isAnonStruct(zcu) and
......@@ -29702,7 +29702,7 @@ fn coerceExtra(
2970229702 return sema.coerceAnonStructToUnionPtrs(block, dest_ty, dest_ty_src, inst, inst_src);
2970329703 }
2970429704 },
29705 .Struct => {
29705 .@"struct" => {
2970629706 // pointer to anonymous struct to pointer to struct
2970729707 if (inst_ty.isSinglePointer(zcu) and
2970829708 inst_ty.childType(zcu).isAnonStruct(zcu) and
......@@ -29714,7 +29714,7 @@ fn coerceExtra(
2971429714 };
2971529715 }
2971629716 },
29717 .Array => {
29717 .array => {
2971829718 // pointer to tuple to pointer to array
2971929719 if (inst_ty.isSinglePointer(zcu) and
2972029720 inst_ty.childType(zcu).isTuple(zcu) and
......@@ -29726,7 +29726,7 @@ fn coerceExtra(
2972629726 else => {},
2972729727 },
2972829728 .Slice => to_slice: {
29729 if (inst_ty.zigTypeTag(zcu) == .Array) {
29729 if (inst_ty.zigTypeTag(zcu) == .array) {
2973029730 return sema.fail(
2973129731 block,
2973229732 inst_src,
......@@ -29795,10 +29795,10 @@ fn coerceExtra(
2979529795 },
2979629796 }
2979729797 },
29798 .Int, .ComptimeInt => switch (inst_ty.zigTypeTag(zcu)) {
29799 .Float, .ComptimeFloat => float: {
29798 .int, .comptime_int => switch (inst_ty.zigTypeTag(zcu)) {
29799 .float, .comptime_float => float: {
2980029800 const val = maybe_inst_val orelse {
29801 if (dest_ty.zigTypeTag(zcu) == .ComptimeInt) {
29801 if (dest_ty.zigTypeTag(zcu) == .comptime_int) {
2980229802 if (!opts.report_err) return error.NotCoercible;
2980329803 return sema.failWithNeededComptime(block, inst_src, .{
2980429804 .needed_comptime_reason = "value being casted to 'comptime_int' must be comptime-known",
......@@ -29809,7 +29809,7 @@ fn coerceExtra(
2980929809 const result_val = try sema.intFromFloat(block, inst_src, val, inst_ty, dest_ty, .exact);
2981029810 return Air.internedToRef(result_val.toIntern());
2981129811 },
29812 .Int, .ComptimeInt => {
29812 .int, .comptime_int => {
2981329813 if (maybe_inst_val) |val| {
2981429814 // comptime-known integer to other number
2981529815 if (!(try sema.intFitsInType(val, dest_ty, null))) {
......@@ -29824,7 +29824,7 @@ fn coerceExtra(
2982429824 else => unreachable,
2982529825 };
2982629826 }
29827 if (dest_ty.zigTypeTag(zcu) == .ComptimeInt) {
29827 if (dest_ty.zigTypeTag(zcu) == .comptime_int) {
2982829828 if (!opts.report_err) return error.NotCoercible;
2982929829 if (opts.no_cast_to_comptime_int) return inst;
2983029830 return sema.failWithNeededComptime(block, inst_src, .{
......@@ -29845,13 +29845,13 @@ fn coerceExtra(
2984529845 },
2984629846 else => {},
2984729847 },
29848 .Float, .ComptimeFloat => switch (inst_ty.zigTypeTag(zcu)) {
29849 .ComptimeFloat => {
29848 .float, .comptime_float => switch (inst_ty.zigTypeTag(zcu)) {
29849 .comptime_float => {
2985029850 const val = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, inst, undefined);
2985129851 const result_val = try val.floatCast(dest_ty, pt);
2985229852 return Air.internedToRef(result_val.toIntern());
2985329853 },
29854 .Float => {
29854 .float => {
2985529855 if (maybe_inst_val) |val| {
2985629856 const result_val = try val.floatCast(dest_ty, pt);
2985729857 if (!val.eql(try result_val.floatCast(inst_ty, pt), inst_ty, zcu)) {
......@@ -29863,7 +29863,7 @@ fn coerceExtra(
2986329863 );
2986429864 }
2986529865 return Air.internedToRef(result_val.toIntern());
29866 } else if (dest_ty.zigTypeTag(zcu) == .ComptimeFloat) {
29866 } else if (dest_ty.zigTypeTag(zcu) == .comptime_float) {
2986729867 if (!opts.report_err) return error.NotCoercible;
2986829868 return sema.failWithNeededComptime(block, inst_src, .{
2986929869 .needed_comptime_reason = "value being casted to 'comptime_float' must be comptime-known",
......@@ -29878,9 +29878,9 @@ fn coerceExtra(
2987829878 return block.addTyOp(.fpext, dest_ty, inst);
2987929879 }
2988029880 },
29881 .Int, .ComptimeInt => int: {
29881 .int, .comptime_int => int: {
2988229882 const val = maybe_inst_val orelse {
29883 if (dest_ty.zigTypeTag(zcu) == .ComptimeFloat) {
29883 if (dest_ty.zigTypeTag(zcu) == .comptime_float) {
2988429884 if (!opts.report_err) return error.NotCoercible;
2988529885 return sema.failWithNeededComptime(block, inst_src, .{
2988629886 .needed_comptime_reason = "value being casted to 'comptime_float' must be comptime-known",
......@@ -29903,8 +29903,8 @@ fn coerceExtra(
2990329903 },
2990429904 else => {},
2990529905 },
29906 .Enum => switch (inst_ty.zigTypeTag(zcu)) {
29907 .EnumLiteral => {
29906 .@"enum" => switch (inst_ty.zigTypeTag(zcu)) {
29907 .enum_literal => {
2990829908 // enum literal to enum
2990929909 const val = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, inst, undefined);
2991029910 const string = zcu.intern_pool.indexToKey(val.toIntern()).enum_literal;
......@@ -29915,7 +29915,7 @@ fn coerceExtra(
2991529915 };
2991629916 return Air.internedToRef((try pt.enumValueFieldIndex(dest_ty, @intCast(field_index))).toIntern());
2991729917 },
29918 .Union => blk: {
29918 .@"union" => blk: {
2991929919 // union to its own tag type
2992029920 const union_tag_ty = inst_ty.unionTagType(zcu) orelse break :blk;
2992129921 if (union_tag_ty.eql(dest_ty, zcu)) {
......@@ -29924,8 +29924,8 @@ fn coerceExtra(
2992429924 },
2992529925 else => {},
2992629926 },
29927 .ErrorUnion => switch (inst_ty.zigTypeTag(zcu)) {
29928 .ErrorUnion => eu: {
29927 .error_union => switch (inst_ty.zigTypeTag(zcu)) {
29928 .error_union => eu: {
2992929929 if (maybe_inst_val) |inst_val| {
2993029930 switch (inst_val.toIntern()) {
2993129931 .undef => return pt.undefRef(dest_ty),
......@@ -29952,7 +29952,7 @@ fn coerceExtra(
2995229952 }
2995329953 }
2995429954 },
29955 .ErrorSet => {
29955 .error_set => {
2995629956 // E to E!T
2995729957 return sema.wrapErrorUnionSet(block, dest_ty, inst, inst_src);
2995829958 },
......@@ -29971,17 +29971,17 @@ fn coerceExtra(
2997129971 };
2997229972 },
2997329973 },
29974 .Union => switch (inst_ty.zigTypeTag(zcu)) {
29975 .Enum, .EnumLiteral => return sema.coerceEnumToUnion(block, dest_ty, dest_ty_src, inst, inst_src),
29976 .Struct => {
29974 .@"union" => switch (inst_ty.zigTypeTag(zcu)) {
29975 .@"enum", .enum_literal => return sema.coerceEnumToUnion(block, dest_ty, dest_ty_src, inst, inst_src),
29976 .@"struct" => {
2997729977 if (inst_ty.isAnonStruct(zcu)) {
2997829978 return sema.coerceAnonStructToUnion(block, dest_ty, dest_ty_src, inst, inst_src);
2997929979 }
2998029980 },
2998129981 else => {},
2998229982 },
29983 .Array => switch (inst_ty.zigTypeTag(zcu)) {
29984 .Array => array_to_array: {
29983 .array => switch (inst_ty.zigTypeTag(zcu)) {
29984 .array => array_to_array: {
2998529985 // Array coercions are allowed only if the child is IMC and the sentinel is unchanged or removed.
2998629986 if (.ok != try sema.coerceInMemoryAllowed(
2998729987 block,
......@@ -30005,8 +30005,8 @@ fn coerceExtra(
3000530005
3000630006 return sema.coerceArrayLike(block, dest_ty, dest_ty_src, inst, inst_src);
3000730007 },
30008 .Vector => return sema.coerceArrayLike(block, dest_ty, dest_ty_src, inst, inst_src),
30009 .Struct => {
30008 .vector => return sema.coerceArrayLike(block, dest_ty, dest_ty_src, inst, inst_src),
30009 .@"struct" => {
3001030010 if (inst == .empty_struct) {
3001130011 return sema.arrayInitEmpty(block, inst_src, dest_ty);
3001230012 }
......@@ -30016,16 +30016,16 @@ fn coerceExtra(
3001630016 },
3001730017 else => {},
3001830018 },
30019 .Vector => switch (inst_ty.zigTypeTag(zcu)) {
30020 .Array, .Vector => return sema.coerceArrayLike(block, dest_ty, dest_ty_src, inst, inst_src),
30021 .Struct => {
30019 .vector => switch (inst_ty.zigTypeTag(zcu)) {
30020 .array, .vector => return sema.coerceArrayLike(block, dest_ty, dest_ty_src, inst, inst_src),
30021 .@"struct" => {
3002230022 if (inst_ty.isTuple(zcu)) {
3002330023 return sema.coerceTupleToArray(block, dest_ty, dest_ty_src, inst, inst_src);
3002430024 }
3002530025 },
3002630026 else => {},
3002730027 },
30028 .Struct => blk: {
30028 .@"struct" => blk: {
3002930029 if (inst == .empty_struct) {
3003030030 return sema.structInitEmpty(block, dest_ty, dest_ty_src, inst_src);
3003130031 }
......@@ -30046,7 +30046,7 @@ fn coerceExtra(
3004630046
3004730047 if (!opts.report_err) return error.NotCoercible;
3004830048
30049 if (opts.is_ret and dest_ty.zigTypeTag(zcu) == .NoReturn) {
30049 if (opts.is_ret and dest_ty.zigTypeTag(zcu) == .noreturn) {
3005030050 const msg = msg: {
3005130051 const msg = try sema.errMsg(inst_src, "function declared 'noreturn' returns", .{});
3005230052 errdefer msg.destroy(sema.gpa);
......@@ -30066,7 +30066,7 @@ fn coerceExtra(
3006630066 errdefer msg.destroy(sema.gpa);
3006730067
3006830068 // E!T to T
30069 if (inst_ty.zigTypeTag(zcu) == .ErrorUnion and
30069 if (inst_ty.zigTypeTag(zcu) == .error_union and
3007030070 (try sema.coerceInMemoryAllowed(block, inst_ty.errorUnionPayload(zcu), dest_ty, false, target, dest_ty_src, inst_src, maybe_inst_val)) == .ok)
3007130071 {
3007230072 try sema.errNote(inst_src, msg, "cannot convert error union to payload type", .{});
......@@ -30074,7 +30074,7 @@ fn coerceExtra(
3007430074 }
3007530075
3007630076 // ?T to T
30077 if (inst_ty.zigTypeTag(zcu) == .Optional and
30077 if (inst_ty.zigTypeTag(zcu) == .optional and
3007830078 (try sema.coerceInMemoryAllowed(block, inst_ty.optionalChild(zcu), dest_ty, false, target, dest_ty_src, inst_src, maybe_inst_val)) == .ok)
3007930079 {
3008030080 try sema.errNote(inst_src, msg, "cannot convert optional to payload type", .{});
......@@ -30515,7 +30515,7 @@ pub fn coerceInMemoryAllowed(
3051530515 const src_tag = src_ty.zigTypeTag(zcu);
3051630516
3051730517 // Differently-named integers with the same number of bits.
30518 if (dest_tag == .Int and src_tag == .Int) {
30518 if (dest_tag == .int and src_tag == .int) {
3051930519 const dest_info = dest_ty.intInfo(zcu);
3052030520 const src_info = src_ty.intInfo(zcu);
3052130521
......@@ -30540,7 +30540,7 @@ pub fn coerceInMemoryAllowed(
3054030540 }
3054130541
3054230542 // Comptime int to regular int.
30543 if (dest_tag == .Int and src_tag == .ComptimeInt) {
30543 if (dest_tag == .int and src_tag == .comptime_int) {
3054430544 if (src_val) |val| {
3054530545 if (!(try sema.intFitsInType(val, dest_ty, null))) {
3054630546 return .{ .comptime_int_not_coercible = .{ .wanted = dest_ty, .actual = val } };
......@@ -30549,7 +30549,7 @@ pub fn coerceInMemoryAllowed(
3054930549 }
3055030550
3055130551 // Differently-named floats with the same number of bits.
30552 if (dest_tag == .Float and src_tag == .Float) {
30552 if (dest_tag == .float and src_tag == .float) {
3055330553 const dest_bits = dest_ty.floatBits(target);
3055430554 const src_bits = src_ty.floatBits(target);
3055530555 if (dest_bits == src_bits) {
......@@ -30572,12 +30572,12 @@ pub fn coerceInMemoryAllowed(
3057230572 }
3057330573
3057430574 // Functions
30575 if (dest_tag == .Fn and src_tag == .Fn) {
30575 if (dest_tag == .@"fn" and src_tag == .@"fn") {
3057630576 return try sema.coerceInMemoryAllowedFns(block, dest_ty, src_ty, target, dest_src, src_src);
3057730577 }
3057830578
3057930579 // Error Unions
30580 if (dest_tag == .ErrorUnion and src_tag == .ErrorUnion) {
30580 if (dest_tag == .error_union and src_tag == .error_union) {
3058130581 const dest_payload = dest_ty.errorUnionPayload(zcu);
3058230582 const src_payload = src_ty.errorUnionPayload(zcu);
3058330583 const child = try sema.coerceInMemoryAllowed(block, dest_payload, src_payload, dest_is_mut, target, dest_src, src_src, null);
......@@ -30592,12 +30592,12 @@ pub fn coerceInMemoryAllowed(
3059230592 }
3059330593
3059430594 // Error Sets
30595 if (dest_tag == .ErrorSet and src_tag == .ErrorSet) {
30595 if (dest_tag == .error_set and src_tag == .error_set) {
3059630596 return try sema.coerceInMemoryAllowedErrorSets(block, dest_ty, src_ty, dest_src, src_src);
3059730597 }
3059830598
3059930599 // Arrays
30600 if (dest_tag == .Array and src_tag == .Array) {
30600 if (dest_tag == .array and src_tag == .array) {
3060130601 const dest_info = dest_ty.arrayInfo(zcu);
3060230602 const src_info = src_ty.arrayInfo(zcu);
3060330603 if (dest_info.len != src_info.len) {
......@@ -30638,7 +30638,7 @@ pub fn coerceInMemoryAllowed(
3063830638 }
3063930639
3064030640 // Vectors
30641 if (dest_tag == .Vector and src_tag == .Vector) {
30641 if (dest_tag == .vector and src_tag == .vector) {
3064230642 const dest_len = dest_ty.vectorLen(zcu);
3064330643 const src_len = src_ty.vectorLen(zcu);
3064430644 if (dest_len != src_len) {
......@@ -30663,8 +30663,8 @@ pub fn coerceInMemoryAllowed(
3066330663 }
3066430664
3066530665 // Arrays <-> Vectors
30666 if ((dest_tag == .Vector and src_tag == .Array) or
30667 (dest_tag == .Array and src_tag == .Vector))
30666 if ((dest_tag == .vector and src_tag == .array) or
30667 (dest_tag == .array and src_tag == .vector))
3066830668 {
3066930669 const dest_len = dest_ty.arrayLen(zcu);
3067030670 const src_len = src_ty.arrayLen(zcu);
......@@ -30686,7 +30686,7 @@ pub fn coerceInMemoryAllowed(
3068630686 } };
3068730687 }
3068830688
30689 if (dest_tag == .Array) {
30689 if (dest_tag == .array) {
3069030690 const dest_info = dest_ty.arrayInfo(zcu);
3069130691 if (dest_info.sentinel != null) {
3069230692 return InMemoryCoercionResult{ .array_sentinel = .{
......@@ -30707,7 +30707,7 @@ pub fn coerceInMemoryAllowed(
3070730707 }
3070830708
3070930709 // Optionals
30710 if (dest_tag == .Optional and src_tag == .Optional) {
30710 if (dest_tag == .optional and src_tag == .optional) {
3071130711 if ((maybe_dest_ptr_ty != null) != (maybe_src_ptr_ty != null)) {
3071230712 return InMemoryCoercionResult{ .optional_shape = .{
3071330713 .actual = src_ty,
......@@ -31000,7 +31000,7 @@ fn coerceInMemoryAllowedPtrs(
3100031000 if (child != .ok) allow: {
3100131001 // As a special case, we also allow coercing `*[n:s]T` to `*[n]T`, akin to dropping the sentinel from a slice.
3100231002 // `*[n:s]T` cannot coerce in memory to `*[n]T` since they have different sizes.
31003 if (src_child.zigTypeTag(zcu) == .Array and dest_child.zigTypeTag(zcu) == .Array and
31003 if (src_child.zigTypeTag(zcu) == .array and dest_child.zigTypeTag(zcu) == .array and
3100431004 src_child.sentinel(zcu) != null and dest_child.sentinel(zcu) == null and
3100531005 .ok == try sema.coerceInMemoryAllowed(block, dest_child.childType(zcu), src_child.childType(zcu), !dest_info.flags.is_const, target, dest_src, src_src, null))
3100631006 {
......@@ -31095,19 +31095,19 @@ fn coerceVarArgParam(
3109531095 const uncasted_ty = sema.typeOf(inst);
3109631096 const coerced = switch (uncasted_ty.zigTypeTag(zcu)) {
3109731097 // TODO consider casting to c_int/f64 if they fit
31098 .ComptimeInt, .ComptimeFloat => return sema.fail(
31098 .comptime_int, .comptime_float => return sema.fail(
3109931099 block,
3110031100 inst_src,
3110131101 "integer and float literals passed to variadic function must be casted to a fixed-size number type",
3110231102 .{},
3110331103 ),
31104 .Fn => fn_ptr: {
31104 .@"fn" => fn_ptr: {
3110531105 const fn_val = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, inst, undefined);
3110631106 const fn_nav = zcu.funcInfo(fn_val.toIntern()).owner_nav;
3110731107 break :fn_ptr try sema.analyzeNavRef(inst_src, fn_nav);
3110831108 },
31109 .Array => return sema.fail(block, inst_src, "arrays must be passed by reference to variadic function", .{}),
31110 .Float => float: {
31109 .array => return sema.fail(block, inst_src, "arrays must be passed by reference to variadic function", .{}),
31110 .float => float: {
3111131111 const target = zcu.getTarget();
3111231112 const double_bits = target.cTypeBitSize(.double);
3111331113 const inst_bits = uncasted_ty.floatBits(target);
......@@ -31202,7 +31202,7 @@ fn storePtr2(
3120231202 // this code does not handle tuple-to-struct coercion which requires dealing with missing
3120331203 // fields.
3120431204 const operand_ty = sema.typeOf(uncasted_operand);
31205 if (operand_ty.isTuple(zcu) and elem_ty.zigTypeTag(zcu) == .Array) {
31205 if (operand_ty.isTuple(zcu) and elem_ty.zigTypeTag(zcu) == .array) {
3120631206 const field_count = operand_ty.structFieldCount(zcu);
3120731207 var i: u32 = 0;
3120831208 while (i < field_count) : (i += 1) {
......@@ -31397,16 +31397,16 @@ fn obtainBitCastedVectorPtr(sema: *Sema, ptr: Air.Inst.Ref) ?Air.Inst.Ref {
3139731397 const pt = sema.pt;
3139831398 const zcu = pt.zcu;
3139931399 const array_ty = sema.typeOf(ptr).childType(zcu);
31400 if (array_ty.zigTypeTag(zcu) != .Array) return null;
31400 if (array_ty.zigTypeTag(zcu) != .array) return null;
3140131401 var ptr_ref = ptr;
3140231402 var ptr_inst = ptr_ref.toIndex() orelse return null;
3140331403 const air_datas = sema.air_instructions.items(.data);
3140431404 const air_tags = sema.air_instructions.items(.tag);
3140531405 const vector_ty = while (air_tags[@intFromEnum(ptr_inst)] == .bitcast) {
3140631406 ptr_ref = air_datas[@intFromEnum(ptr_inst)].ty_op.operand;
31407 if (!sema.isKnownZigType(ptr_ref, .Pointer)) return null;
31407 if (!sema.isKnownZigType(ptr_ref, .pointer)) return null;
3140831408 const child_ty = sema.typeOf(ptr_ref).childType(zcu);
31409 if (child_ty.zigTypeTag(zcu) == .Vector) break child_ty;
31409 if (child_ty.zigTypeTag(zcu) == .vector) break child_ty;
3141031410 ptr_inst = ptr_ref.toIndex() orelse return null;
3141131411 } else return null;
3141231412
......@@ -31504,7 +31504,7 @@ fn bitCast(
3150431504 if (try sema.resolveValue(inst)) |val| {
3150531505 if (val.isUndef(zcu))
3150631506 return pt.undefRef(dest_ty);
31507 if (old_ty.zigTypeTag(zcu) == .ErrorSet and dest_ty.zigTypeTag(zcu) == .ErrorSet) {
31507 if (old_ty.zigTypeTag(zcu) == .error_set and dest_ty.zigTypeTag(zcu) == .error_set) {
3150831508 // Special case: we sometimes call `bitCast` on error set values, but they
3150931509 // don't have a well-defined layout, so we can't use `bitCastVal` on them.
3151031510 return Air.internedToRef((try pt.getCoerced(val, dest_ty)).toIntern());
......@@ -31548,7 +31548,7 @@ fn checkPtrAttributes(sema: *Sema, dest_ty: Type, inst_ty: Type, in_memory_resul
3154831548 const zcu = pt.zcu;
3154931549 const dest_info = dest_ty.ptrInfo(zcu);
3155031550 const inst_info = inst_ty.ptrInfo(zcu);
31551 const len0 = (Type.fromInterned(inst_info.child).zigTypeTag(zcu) == .Array and (Type.fromInterned(inst_info.child).arrayLenIncludingSentinel(zcu) == 0 or
31551 const len0 = (Type.fromInterned(inst_info.child).zigTypeTag(zcu) == .array and (Type.fromInterned(inst_info.child).arrayLenIncludingSentinel(zcu) == 0 or
3155231552 (Type.fromInterned(inst_info.child).arrayLen(zcu) == 0 and dest_info.sentinel == .none and dest_info.flags.size != .C and dest_info.flags.size != .Many))) or
3155331553 (Type.fromInterned(inst_info.child).isTuple(zcu) and Type.fromInterned(inst_info.child).structFieldCount(zcu) == 0);
3155431554
......@@ -31615,9 +31615,9 @@ fn coerceCompatiblePtrs(
3161531615 );
3161631616 }
3161731617 try sema.requireRuntimeBlock(block, inst_src, null);
31618 const inst_allows_zero = inst_ty.zigTypeTag(zcu) != .Pointer or inst_ty.ptrAllowsZero(zcu);
31618 const inst_allows_zero = inst_ty.zigTypeTag(zcu) != .pointer or inst_ty.ptrAllowsZero(zcu);
3161931619 if (block.wantSafety() and inst_allows_zero and !dest_ty.ptrAllowsZero(zcu) and
31620 (try dest_ty.elemType2(zcu).hasRuntimeBitsSema(pt) or dest_ty.elemType2(zcu).zigTypeTag(zcu) == .Fn))
31620 (try dest_ty.elemType2(zcu).hasRuntimeBitsSema(pt) or dest_ty.elemType2(zcu).zigTypeTag(zcu) == .@"fn"))
3162131621 {
3162231622 const actual_ptr = if (inst_ty.isSlice(zcu))
3162331623 try sema.analyzeSlicePtr(block, inst_src, inst, inst_ty)
......@@ -31674,7 +31674,7 @@ fn coerceEnumToUnion(
3167431674 const union_obj = zcu.typeToUnion(union_ty).?;
3167531675 const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[field_index]);
3167631676 try field_ty.resolveFields(pt);
31677 if (field_ty.zigTypeTag(zcu) == .NoReturn) {
31677 if (field_ty.zigTypeTag(zcu) == .noreturn) {
3167831678 const msg = msg: {
3167931679 const msg = try sema.errMsg(inst_src, "cannot initialize 'noreturn' field of union", .{});
3168031680 errdefer msg.destroy(sema.gpa);
......@@ -31729,7 +31729,7 @@ fn coerceEnumToUnion(
3172931729 errdefer if (msg) |some| some.destroy(sema.gpa);
3173031730
3173131731 for (union_obj.field_types.get(ip), 0..) |field_ty, field_index| {
31732 if (Type.fromInterned(field_ty).zigTypeTag(zcu) == .NoReturn) {
31732 if (Type.fromInterned(field_ty).zigTypeTag(zcu) == .noreturn) {
3173331733 const err_msg = msg orelse try sema.errMsg(
3173431734 inst_src,
3173531735 "runtime coercion from enum '{}' to union '{}' which has a 'noreturn' field",
......@@ -31911,7 +31911,7 @@ fn coerceArrayLike(
3191131911 if (dest_ty.isVector(zcu) and inst_ty.isVector(zcu) and (try sema.resolveValue(inst)) == null) {
3191231912 const inst_elem_ty = inst_ty.childType(zcu);
3191331913 switch (dest_elem_ty.zigTypeTag(zcu)) {
31914 .Int => if (inst_elem_ty.isInt(zcu)) {
31914 .int => if (inst_elem_ty.isInt(zcu)) {
3191531915 // integer widening
3191631916 const dst_info = dest_elem_ty.intInfo(zcu);
3191731917 const src_info = inst_elem_ty.intInfo(zcu);
......@@ -31923,7 +31923,7 @@ fn coerceArrayLike(
3192331923 return block.addTyOp(.intcast, dest_ty, inst);
3192431924 }
3192531925 },
31926 .Float => if (inst_elem_ty.isRuntimeFloat()) {
31926 .float => if (inst_elem_ty.isRuntimeFloat()) {
3192731927 // float widening
3192831928 const src_bits = inst_elem_ty.floatBits(target);
3192931929 const dst_bits = dest_elem_ty.floatBits(target);
......@@ -32504,10 +32504,10 @@ fn analyzeLoad(
3250432504 const zcu = pt.zcu;
3250532505 const ptr_ty = sema.typeOf(ptr);
3250632506 const elem_ty = switch (ptr_ty.zigTypeTag(zcu)) {
32507 .Pointer => ptr_ty.childType(zcu),
32507 .pointer => ptr_ty.childType(zcu),
3250832508 else => return sema.fail(block, ptr_src, "expected pointer, found '{}'", .{ptr_ty.fmt(pt)}),
3250932509 };
32510 if (elem_ty.zigTypeTag(zcu) == .Opaque) {
32510 if (elem_ty.zigTypeTag(zcu) == .@"opaque") {
3251132511 return sema.fail(block, ptr_src, "cannot load opaque type '{}'", .{elem_ty.fmt(pt)});
3251232512 }
3251332513
......@@ -32621,10 +32621,10 @@ fn analyzeIsNull(
3262132621
3262232622 const inverted_non_null_res: Air.Inst.Ref = if (invert_logic) .bool_true else .bool_false;
3262332623 const operand_ty = sema.typeOf(operand);
32624 if (operand_ty.zigTypeTag(zcu) == .Optional and operand_ty.optionalChild(zcu).zigTypeTag(zcu) == .NoReturn) {
32624 if (operand_ty.zigTypeTag(zcu) == .optional and operand_ty.optionalChild(zcu).zigTypeTag(zcu) == .noreturn) {
3262532625 return inverted_non_null_res;
3262632626 }
32627 if (operand_ty.zigTypeTag(zcu) != .Optional and !operand_ty.isPtrLikeOptional(zcu)) {
32627 if (operand_ty.zigTypeTag(zcu) != .optional and !operand_ty.isPtrLikeOptional(zcu)) {
3262832628 return inverted_non_null_res;
3262932629 }
3263032630 try sema.requireRuntimeBlock(block, src, null);
......@@ -32641,13 +32641,13 @@ fn analyzePtrIsNonErrComptimeOnly(
3264132641 const pt = sema.pt;
3264232642 const zcu = pt.zcu;
3264332643 const ptr_ty = sema.typeOf(operand);
32644 assert(ptr_ty.zigTypeTag(zcu) == .Pointer);
32644 assert(ptr_ty.zigTypeTag(zcu) == .pointer);
3264532645 const child_ty = ptr_ty.childType(zcu);
3264632646
3264732647 const child_tag = child_ty.zigTypeTag(zcu);
32648 if (child_tag != .ErrorSet and child_tag != .ErrorUnion) return .bool_true;
32649 if (child_tag == .ErrorSet) return .bool_false;
32650 assert(child_tag == .ErrorUnion);
32648 if (child_tag != .error_set and child_tag != .error_union) return .bool_true;
32649 if (child_tag == .error_set) return .bool_false;
32650 assert(child_tag == .error_union);
3265132651
3265232652 _ = block;
3265332653 _ = src;
......@@ -32666,12 +32666,12 @@ fn analyzeIsNonErrComptimeOnly(
3266632666 const ip = &zcu.intern_pool;
3266732667 const operand_ty = sema.typeOf(operand);
3266832668 const ot = operand_ty.zigTypeTag(zcu);
32669 if (ot != .ErrorSet and ot != .ErrorUnion) return .bool_true;
32670 if (ot == .ErrorSet) return .bool_false;
32671 assert(ot == .ErrorUnion);
32669 if (ot != .error_set and ot != .error_union) return .bool_true;
32670 if (ot == .error_set) return .bool_false;
32671 assert(ot == .error_union);
3267232672
3267332673 const payload_ty = operand_ty.errorUnionPayload(zcu);
32674 if (payload_ty.zigTypeTag(zcu) == .NoReturn) {
32674 if (payload_ty.zigTypeTag(zcu) == .noreturn) {
3267532675 return .bool_false;
3267632676 }
3267732677
......@@ -32828,7 +32828,7 @@ fn analyzeSlice(
3282832828 // the slice operand to be a pointer. In the case of a non-array, it will be a double pointer.
3282932829 const ptr_ptr_ty = sema.typeOf(ptr_ptr);
3283032830 const ptr_ptr_child_ty = switch (ptr_ptr_ty.zigTypeTag(zcu)) {
32831 .Pointer => ptr_ptr_ty.childType(zcu),
32831 .pointer => ptr_ptr_ty.childType(zcu),
3283232832 else => return sema.fail(block, ptr_src, "expected pointer, found '{}'", .{ptr_ptr_ty.fmt(pt)}),
3283332833 };
3283432834
......@@ -32838,15 +32838,15 @@ fn analyzeSlice(
3283832838 var elem_ty: Type = undefined;
3283932839 var ptr_sentinel: ?Value = null;
3284032840 switch (ptr_ptr_child_ty.zigTypeTag(zcu)) {
32841 .Array => {
32841 .array => {
3284232842 ptr_sentinel = ptr_ptr_child_ty.sentinel(zcu);
3284332843 elem_ty = ptr_ptr_child_ty.childType(zcu);
3284432844 },
32845 .Pointer => switch (ptr_ptr_child_ty.ptrSize(zcu)) {
32845 .pointer => switch (ptr_ptr_child_ty.ptrSize(zcu)) {
3284632846 .One => {
3284732847 const double_child_ty = ptr_ptr_child_ty.childType(zcu);
3284832848 ptr_or_slice = try sema.analyzeLoad(block, src, ptr_ptr, ptr_src);
32849 if (double_child_ty.zigTypeTag(zcu) == .Array) {
32849 if (double_child_ty.zigTypeTag(zcu) == .array) {
3285032850 ptr_sentinel = double_child_ty.sentinel(zcu);
3285132851 slice_ty = ptr_ptr_child_ty;
3285232852 array_ty = double_child_ty;
......@@ -32961,7 +32961,7 @@ fn analyzeSlice(
3296132961
3296232962 const ptr = if (slice_ty.isSlice(zcu))
3296332963 try sema.analyzeSlicePtr(block, ptr_src, ptr_or_slice, slice_ty)
32964 else if (array_ty.zigTypeTag(zcu) == .Array) ptr: {
32964 else if (array_ty.zigTypeTag(zcu) == .array) ptr: {
3296532965 var manyptr_ty_key = zcu.intern_pool.indexToKey(slice_ty.toIntern()).ptr_type;
3296632966 assert(manyptr_ty_key.child == array_ty.toIntern());
3296732967 assert(manyptr_ty_key.flags.size == .One);
......@@ -32980,7 +32980,7 @@ fn analyzeSlice(
3298032980 // we might learn of the length because it is a comptime-known slice value.
3298132981 var end_is_len = uncasted_end_opt == .none;
3298232982 const end = e: {
32983 if (array_ty.zigTypeTag(zcu) == .Array) {
32983 if (array_ty.zigTypeTag(zcu) == .array) {
3298432984 const len_val = try pt.intValue(Type.usize, array_ty.arrayLen(zcu));
3298532985
3298632986 if (!end_is_len) {
......@@ -33215,7 +33215,7 @@ fn analyzeSlice(
3321533215 }
3321633216
3321733217 bounds_check: {
33218 const actual_len = if (array_ty.zigTypeTag(zcu) == .Array)
33218 const actual_len = if (array_ty.zigTypeTag(zcu) == .array)
3321933219 try pt.intRef(Type.usize, array_ty.arrayLenIncludingSentinel(zcu))
3322033220 else if (slice_ty.isSlice(zcu)) l: {
3322133221 const slice_len_inst = try block.addTyOp(.slice_len, Type.usize, ptr_or_slice);
......@@ -33273,7 +33273,7 @@ fn analyzeSlice(
3327333273 }
3327433274
3327533275 // requirement: end <= len
33276 const opt_len_inst = if (array_ty.zigTypeTag(zcu) == .Array)
33276 const opt_len_inst = if (array_ty.zigTypeTag(zcu) == .array)
3327733277 try pt.intRef(Type.usize, array_ty.arrayLenIncludingSentinel(zcu))
3327833278 else if (slice_ty.isSlice(zcu)) blk: {
3327933279 if (try sema.resolveDefinedValue(block, src, ptr_or_slice)) |slice_val| {
......@@ -33342,12 +33342,12 @@ fn cmpNumeric(
3334233342 // One exception to heterogeneous comparison: comptime_float needs to
3334333343 // coerce to fixed-width float.
3334433344
33345 const lhs = if (lhs_ty_tag == .ComptimeFloat and rhs_ty_tag == .Float)
33345 const lhs = if (lhs_ty_tag == .comptime_float and rhs_ty_tag == .float)
3334633346 try sema.coerce(block, rhs_ty, uncasted_lhs, lhs_src)
3334733347 else
3334833348 uncasted_lhs;
3334933349
33350 const rhs = if (lhs_ty_tag == .Float and rhs_ty_tag == .ComptimeFloat)
33350 const rhs = if (lhs_ty_tag == .float and rhs_ty_tag == .comptime_float)
3335133351 try sema.coerce(block, lhs_ty, uncasted_rhs, rhs_src)
3335233352 else
3335333353 uncasted_rhs;
......@@ -33356,11 +33356,11 @@ fn cmpNumeric(
3335633356 if (try sema.resolveValue(lhs)) |lhs_val| {
3335733357 if (try sema.resolveValue(rhs)) |rhs_val| {
3335833358 // Compare ints: const vs. undefined (or vice versa)
33359 if (!lhs_val.isUndef(zcu) and (lhs_ty.isInt(zcu) or lhs_ty_tag == .ComptimeInt) and rhs_ty.isInt(zcu) and rhs_val.isUndef(zcu)) {
33359 if (!lhs_val.isUndef(zcu) and (lhs_ty.isInt(zcu) or lhs_ty_tag == .comptime_int) and rhs_ty.isInt(zcu) and rhs_val.isUndef(zcu)) {
3336033360 if (try sema.compareIntsOnlyPossibleResult(try sema.resolveLazyValue(lhs_val), op, rhs_ty)) |res| {
3336133361 return if (res) .bool_true else .bool_false;
3336233362 }
33363 } else if (!rhs_val.isUndef(zcu) and (rhs_ty.isInt(zcu) or rhs_ty_tag == .ComptimeInt) and lhs_ty.isInt(zcu) and lhs_val.isUndef(zcu)) {
33363 } else if (!rhs_val.isUndef(zcu) and (rhs_ty.isInt(zcu) or rhs_ty_tag == .comptime_int) and lhs_ty.isInt(zcu) and lhs_val.isUndef(zcu)) {
3336433364 if (try sema.compareIntsOnlyPossibleResult(try sema.resolveLazyValue(rhs_val), op.reverse(), lhs_ty)) |res| {
3336533365 return if (res) .bool_true else .bool_false;
3336633366 }
......@@ -33377,7 +33377,7 @@ fn cmpNumeric(
3337733377 else
3337833378 .bool_false;
3337933379 } else {
33380 if (!lhs_val.isUndef(zcu) and (lhs_ty.isInt(zcu) or lhs_ty_tag == .ComptimeInt) and rhs_ty.isInt(zcu)) {
33380 if (!lhs_val.isUndef(zcu) and (lhs_ty.isInt(zcu) or lhs_ty_tag == .comptime_int) and rhs_ty.isInt(zcu)) {
3338133381 // Compare ints: const vs. var
3338233382 if (try sema.compareIntsOnlyPossibleResult(try sema.resolveLazyValue(lhs_val), op, rhs_ty)) |res| {
3338333383 return if (res) .bool_true else .bool_false;
......@@ -33387,7 +33387,7 @@ fn cmpNumeric(
3338733387 }
3338833388 } else {
3338933389 if (try sema.resolveValueResolveLazy(rhs)) |rhs_val| {
33390 if (!rhs_val.isUndef(zcu) and (rhs_ty.isInt(zcu) or rhs_ty_tag == .ComptimeInt) and lhs_ty.isInt(zcu)) {
33390 if (!rhs_val.isUndef(zcu) and (rhs_ty.isInt(zcu) or rhs_ty_tag == .comptime_int) and lhs_ty.isInt(zcu)) {
3339133391 // Compare ints: var vs. const
3339233392 if (try sema.compareIntsOnlyPossibleResult(try sema.resolveLazyValue(rhs_val), op.reverse(), lhs_ty)) |res| {
3339333393 return if (res) .bool_true else .bool_false;
......@@ -33407,11 +33407,11 @@ fn cmpNumeric(
3340733407
3340833408 // For floats, emit a float comparison instruction.
3340933409 const lhs_is_float = switch (lhs_ty_tag) {
33410 .Float, .ComptimeFloat => true,
33410 .float, .comptime_float => true,
3341133411 else => false,
3341233412 };
3341333413 const rhs_is_float = switch (rhs_ty_tag) {
33414 .Float, .ComptimeFloat => true,
33414 .float, .comptime_float => true,
3341533415 else => false,
3341633416 };
3341733417
......@@ -33419,9 +33419,9 @@ fn cmpNumeric(
3341933419 // Smaller fixed-width floats coerce to larger fixed-width floats.
3342033420 // comptime_float coerces to fixed-width float.
3342133421 const dest_ty = x: {
33422 if (lhs_ty_tag == .ComptimeFloat) {
33422 if (lhs_ty_tag == .comptime_float) {
3342333423 break :x rhs_ty;
33424 } else if (rhs_ty_tag == .ComptimeFloat) {
33424 } else if (rhs_ty_tag == .comptime_float) {
3342533425 break :x lhs_ty;
3342633426 }
3342733427 if (lhs_ty.floatBits(target) >= rhs_ty.floatBits(target)) {
......@@ -33691,8 +33691,8 @@ fn cmpVector(
3369133691 const zcu = pt.zcu;
3369233692 const lhs_ty = sema.typeOf(lhs);
3369333693 const rhs_ty = sema.typeOf(rhs);
33694 assert(lhs_ty.zigTypeTag(zcu) == .Vector);
33695 assert(rhs_ty.zigTypeTag(zcu) == .Vector);
33694 assert(lhs_ty.zigTypeTag(zcu) == .vector);
33695 assert(rhs_ty.zigTypeTag(zcu) == .vector);
3369633696 try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src);
3369733697
3369833698 const resolved_ty = try sema.resolvePeerTypes(block, src, &.{ lhs, rhs }, .{ .override = &.{ lhs_src, rhs_src } });
......@@ -34005,22 +34005,22 @@ const PeerResolveStrategy = enum {
3400534005
3400634006 fn select(ty: Type, zcu: *Zcu) PeerResolveStrategy {
3400734007 return switch (ty.zigTypeTag(zcu)) {
34008 .Type, .Void, .Bool, .Opaque, .Frame, .AnyFrame => .exact,
34009 .NoReturn, .Undefined => .unknown,
34010 .Null => .nullable,
34011 .ComptimeInt => .comptime_int,
34012 .Int => .fixed_int,
34013 .ComptimeFloat => .comptime_float,
34014 .Float => .fixed_float,
34015 .Pointer => if (ty.ptrInfo(zcu).flags.size == .C) .c_ptr else .ptr,
34016 .Array => .array,
34017 .Vector => .vector,
34018 .Optional => .optional,
34019 .ErrorSet => .error_set,
34020 .ErrorUnion => .error_union,
34021 .EnumLiteral, .Enum, .Union => .enum_or_union,
34022 .Struct => if (ty.isTupleOrAnonStruct(zcu)) .coercible_struct else .exact,
34023 .Fn => .func,
34008 .type, .void, .bool, .@"opaque", .frame, .@"anyframe" => .exact,
34009 .noreturn, .undefined => .unknown,
34010 .null => .nullable,
34011 .comptime_int => .comptime_int,
34012 .int => .fixed_int,
34013 .comptime_float => .comptime_float,
34014 .float => .fixed_float,
34015 .pointer => if (ty.ptrInfo(zcu).flags.size == .C) .c_ptr else .ptr,
34016 .array => .array,
34017 .vector => .vector,
34018 .optional => .optional,
34019 .error_set => .error_set,
34020 .error_union => .error_union,
34021 .enum_literal, .@"enum", .@"union" => .enum_or_union,
34022 .@"struct" => if (ty.isTupleOrAnonStruct(zcu)) .coercible_struct else .exact,
34023 .@"fn" => .func,
3402434024 };
3402534025 }
3402634026};
......@@ -34213,7 +34213,7 @@ fn resolvePeerTypesInner(
3421334213 for (peer_tys) |*ty_ptr| {
3421434214 const ty = ty_ptr.* orelse continue;
3421534215 switch (ty.zigTypeTag(zcu)) {
34216 .NoReturn, .Undefined => ty_ptr.* = null,
34216 .noreturn, .undefined => ty_ptr.* = null,
3421734217 else => {},
3421834218 }
3421934219 }
......@@ -34228,7 +34228,7 @@ fn resolvePeerTypesInner(
3422834228 var final_set: ?Type = null;
3422934229 for (peer_tys, 0..) |opt_ty, i| {
3423034230 const ty = opt_ty orelse continue;
34231 if (ty.zigTypeTag(zcu) != .ErrorSet) return .{ .conflict = .{
34231 if (ty.zigTypeTag(zcu) != .error_set) return .{ .conflict = .{
3423234232 .peer_idx_a = strat_reason,
3423334233 .peer_idx_b = i,
3423434234 } };
......@@ -34246,12 +34246,12 @@ fn resolvePeerTypesInner(
3424634246 for (peer_tys, peer_vals) |*ty_ptr, *val_ptr| {
3424734247 const ty = ty_ptr.* orelse continue;
3424834248 const set_ty = switch (ty.zigTypeTag(zcu)) {
34249 .ErrorSet => blk: {
34249 .error_set => blk: {
3425034250 ty_ptr.* = null; // no payload to decide on
3425134251 val_ptr.* = null;
3425234252 break :blk ty;
3425334253 },
34254 .ErrorUnion => blk: {
34254 .error_union => blk: {
3425534255 const set_ty = ty.errorUnionSet(zcu);
3425634256 ty_ptr.* = ty.errorUnionPayload(zcu);
3425734257 if (val_ptr.*) |eu_val| switch (ip.indexToKey(eu_val.toIntern())) {
......@@ -34300,11 +34300,11 @@ fn resolvePeerTypesInner(
3430034300 for (peer_tys, peer_vals) |*ty_ptr, *val_ptr| {
3430134301 const ty = ty_ptr.* orelse continue;
3430234302 switch (ty.zigTypeTag(zcu)) {
34303 .Null => {
34303 .null => {
3430434304 ty_ptr.* = null;
3430534305 val_ptr.* = null;
3430634306 },
34307 .Optional => {
34307 .optional => {
3430834308 ty_ptr.* = ty.optionalChild(zcu);
3430934309 if (val_ptr.*) |opt_val| val_ptr.* = if (!opt_val.isUndef(zcu)) opt_val.optionalValue(zcu) else null;
3431034310 },
......@@ -34482,8 +34482,8 @@ fn resolvePeerTypesInner(
3448234482 for (peer_tys, peer_vals, 0..) |opt_ty, opt_val, i| {
3448334483 const ty = opt_ty orelse continue;
3448434484 switch (ty.zigTypeTag(zcu)) {
34485 .ComptimeInt => continue, // comptime-known integers can always coerce to C pointers
34486 .Int => {
34485 .comptime_int => continue, // comptime-known integers can always coerce to C pointers
34486 .int => {
3448734487 if (opt_val != null) {
3448834488 // Always allow the coercion for comptime-known ints
3448934489 continue;
......@@ -34494,7 +34494,7 @@ fn resolvePeerTypesInner(
3449434494 if (bits <= ptr_bits) continue;
3449534495 }
3449634496 },
34497 .Null => continue,
34497 .null => continue,
3449834498 else => {},
3449934499 }
3450034500
......@@ -34581,8 +34581,8 @@ fn resolvePeerTypesInner(
3458134581 for (peer_tys, 0..) |opt_ty, i| {
3458234582 const ty = opt_ty orelse continue;
3458334583 const peer_info: InternPool.Key.PtrType = switch (ty.zigTypeTag(zcu)) {
34584 .Pointer => ty.ptrInfo(zcu),
34585 .Fn => .{
34584 .pointer => ty.ptrInfo(zcu),
34585 .@"fn" => .{
3458634586 .child = ty.toIntern(),
3458734587 .flags = .{
3458834588 .address_space = target_util.defaultAddressSpace(target, .global_constant),
......@@ -34889,7 +34889,7 @@ fn resolvePeerTypesInner(
3488934889 first_idx = i;
3489034890 continue;
3489134891 };
34892 if (ty.zigTypeTag(zcu) != .Fn) return .{ .conflict = .{
34892 if (ty.zigTypeTag(zcu) != .@"fn") return .{ .conflict = .{
3489334893 .peer_idx_a = strat_reason,
3489434894 .peer_idx_b = i,
3489534895 } };
......@@ -34918,7 +34918,7 @@ fn resolvePeerTypesInner(
3491834918 for (peer_tys, 0..) |opt_ty, i| {
3491934919 const ty = opt_ty orelse continue;
3492034920 switch (ty.zigTypeTag(zcu)) {
34921 .EnumLiteral, .Enum, .Union => {},
34921 .enum_literal, .@"enum", .@"union" => {},
3492234922 else => return .{ .conflict = .{
3492334923 .peer_idx_a = strat_reason,
3492434924 .peer_idx_b = i,
......@@ -34937,16 +34937,16 @@ fn resolvePeerTypesInner(
3493734937 } };
3493834938
3493934939 switch (cur_ty.zigTypeTag(zcu)) {
34940 .EnumLiteral => {
34940 .enum_literal => {
3494134941 opt_cur_ty = ty;
3494234942 cur_ty_idx = i;
3494334943 },
34944 .Enum => switch (ty.zigTypeTag(zcu)) {
34945 .EnumLiteral => {},
34946 .Enum => {
34944 .@"enum" => switch (ty.zigTypeTag(zcu)) {
34945 .enum_literal => {},
34946 .@"enum" => {
3494734947 if (!ty.eql(cur_ty, zcu)) return generic_err;
3494834948 },
34949 .Union => {
34949 .@"union" => {
3495034950 const tag_ty = ty.unionTagTypeHypothetical(zcu);
3495134951 if (!tag_ty.eql(cur_ty, zcu)) return generic_err;
3495234952 opt_cur_ty = ty;
......@@ -34954,13 +34954,13 @@ fn resolvePeerTypesInner(
3495434954 },
3495534955 else => unreachable,
3495634956 },
34957 .Union => switch (ty.zigTypeTag(zcu)) {
34958 .EnumLiteral => {},
34959 .Enum => {
34957 .@"union" => switch (ty.zigTypeTag(zcu)) {
34958 .enum_literal => {},
34959 .@"enum" => {
3496034960 const cur_tag_ty = cur_ty.unionTagTypeHypothetical(zcu);
3496134961 if (!ty.eql(cur_tag_ty, zcu)) return generic_err;
3496234962 },
34963 .Union => {
34963 .@"union" => {
3496434964 if (!ty.eql(cur_ty, zcu)) return generic_err;
3496534965 },
3496634966 else => unreachable,
......@@ -34975,7 +34975,7 @@ fn resolvePeerTypesInner(
3497534975 for (peer_tys, 0..) |opt_ty, i| {
3497634976 const ty = opt_ty orelse continue;
3497734977 switch (ty.zigTypeTag(zcu)) {
34978 .ComptimeInt => {},
34978 .comptime_int => {},
3497934979 else => return .{ .conflict = .{
3498034980 .peer_idx_a = strat_reason,
3498134981 .peer_idx_b = i,
......@@ -34989,7 +34989,7 @@ fn resolvePeerTypesInner(
3498934989 for (peer_tys, 0..) |opt_ty, i| {
3499034990 const ty = opt_ty orelse continue;
3499134991 switch (ty.zigTypeTag(zcu)) {
34992 .ComptimeInt, .ComptimeFloat => {},
34992 .comptime_int, .comptime_float => {},
3499334993 else => return .{ .conflict = .{
3499434994 .peer_idx_a = strat_reason,
3499534995 .peer_idx_b = i,
......@@ -35012,7 +35012,7 @@ fn resolvePeerTypesInner(
3501235012
3501335013 const peer_tag = ty.zigTypeTag(zcu);
3501435014 switch (peer_tag) {
35015 .ComptimeInt => {
35015 .comptime_int => {
3501635016 // If the value is undefined, we can't refine to a fixed-width int
3501735017 if (opt_val == null or opt_val.?.isUndef(zcu)) return .{ .conflict = .{
3501835018 .peer_idx_a = strat_reason,
......@@ -35022,7 +35022,7 @@ fn resolvePeerTypesInner(
3502235022 ptr_opt_val.* = try sema.resolveLazyValue(opt_val.?);
3502335023 continue;
3502435024 },
35025 .Int => {},
35025 .int => {},
3502635026 else => return .{ .conflict = .{
3502735027 .peer_idx_a = strat_reason,
3502835028 .peer_idx_b = i,
......@@ -35091,14 +35091,14 @@ fn resolvePeerTypesInner(
3509135091 for (peer_tys, peer_vals, 0..) |opt_ty, opt_val, i| {
3509235092 const ty = opt_ty orelse continue;
3509335093 switch (ty.zigTypeTag(zcu)) {
35094 .ComptimeFloat, .ComptimeInt => {},
35095 .Int => {
35094 .comptime_float, .comptime_int => {},
35095 .int => {
3509635096 if (opt_val == null) return .{ .conflict = .{
3509735097 .peer_idx_a = strat_reason,
3509835098 .peer_idx_b = i,
3509935099 } };
3510035100 },
35101 .Float => {
35101 .float => {
3510235102 if (opt_cur_ty) |cur_ty| {
3510335103 if (cur_ty.eql(ty, zcu)) continue;
3510435104 // Recreate the type so we eliminate any c_longdouble
......@@ -35330,11 +35330,11 @@ fn typeIsArrayLike(sema: *Sema, ty: Type) ?ArrayLike {
3533035330 const pt = sema.pt;
3533135331 const zcu = pt.zcu;
3533235332 return switch (ty.zigTypeTag(zcu)) {
35333 .Array => .{
35333 .array => .{
3533435334 .len = ty.arrayLen(zcu),
3533535335 .elem_ty = ty.childType(zcu),
3533635336 },
35337 .Struct => {
35337 .@"struct" => {
3533835338 const field_count = ty.structFieldCount(zcu);
3533935339 if (field_count == 0) return .{
3534035340 .len = 0,
......@@ -35625,7 +35625,7 @@ fn backingIntType(
3562535625 const small: Zir.Inst.StructDecl.Small = @bitCast(extended.small);
3562635626
3562735627 if (small.has_backing_int) {
35628 var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).Struct.fields.len;
35628 var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).@"struct".fields.len;
3562935629 const captures_len = if (small.has_captures_len) blk: {
3563035630 const captures_len = zir.extra[extra_index];
3563135631 extra_index += 1;
......@@ -35700,12 +35700,12 @@ fn checkIndexable(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !void {
3570035700fn checkMemOperand(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !void {
3570135701 const pt = sema.pt;
3570235702 const zcu = pt.zcu;
35703 if (ty.zigTypeTag(zcu) == .Pointer) {
35703 if (ty.zigTypeTag(zcu) == .pointer) {
3570435704 switch (ty.ptrSize(zcu)) {
3570535705 .Slice, .Many, .C => return,
3570635706 .One => {
3570735707 const elem_ty = ty.childType(zcu);
35708 if (elem_ty.zigTypeTag(zcu) == .Array) return;
35708 if (elem_ty.zigTypeTag(zcu) == .array) return;
3570935709 // TODO https://github.com/ziglang/zig/issues/15479
3571035710 // if (elem_ty.isTuple()) return;
3571135711 },
......@@ -35797,7 +35797,7 @@ pub fn resolveUnionLayout(sema: *Sema, ty: Type) SemaError!void {
3579735797 for (0..union_type.field_types.len) |field_index| {
3579835798 const field_ty = Type.fromInterned(union_type.field_types.get(ip)[field_index]);
3579935799
35800 if (try field_ty.comptimeOnlySema(pt) or field_ty.zigTypeTag(pt.zcu) == .NoReturn) continue; // TODO: should this affect alignment?
35800 if (try field_ty.comptimeOnlySema(pt) or field_ty.zigTypeTag(pt.zcu) == .noreturn) continue; // TODO: should this affect alignment?
3580135801
3580235802 max_size = @max(max_size, field_ty.abiSizeSema(pt) catch |err| switch (err) {
3580335803 error.AnalysisFail => {
......@@ -36185,7 +36185,7 @@ fn structZirInfo(zir: Zir, zir_index: Zir.Inst.Index) struct {
3618536185 const extended = zir.instructions.items(.data)[@intFromEnum(zir_index)].extended;
3618636186 assert(extended.opcode == .struct_decl);
3618736187 const small: Zir.Inst.StructDecl.Small = @bitCast(extended.small);
36188 var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).Struct.fields.len;
36188 var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).@"struct".fields.len;
3618936189
3619036190 const captures_len = if (small.has_captures_len) blk: {
3619136191 const captures_len = zir.extra[extra_index];
......@@ -36357,7 +36357,7 @@ fn structFields(
3635736357
3635836358 struct_type.field_types.get(ip)[field_i] = field_ty.toIntern();
3635936359
36360 if (field_ty.zigTypeTag(zcu) == .Opaque) {
36360 if (field_ty.zigTypeTag(zcu) == .@"opaque") {
3636136361 const msg = msg: {
3636236362 const msg = try sema.errMsg(ty_src, "opaque types have unknown size and therefore cannot be directly embedded in structs", .{});
3636336363 errdefer msg.destroy(sema.gpa);
......@@ -36367,7 +36367,7 @@ fn structFields(
3636736367 };
3636836368 return sema.failWithOwnedErrorMsg(&block_scope, msg);
3636936369 }
36370 if (field_ty.zigTypeTag(zcu) == .NoReturn) {
36370 if (field_ty.zigTypeTag(zcu) == .noreturn) {
3637136371 const msg = msg: {
3637236372 const msg = try sema.errMsg(ty_src, "struct fields cannot be 'noreturn'", .{});
3637336373 errdefer msg.destroy(sema.gpa);
......@@ -36635,7 +36635,7 @@ fn unionFields(
3663536635 if (small.auto_enum_tag) {
3663636636 // The provided type is an integer type and we must construct the enum tag type here.
3663736637 int_tag_ty = provided_ty;
36638 if (int_tag_ty.zigTypeTag(zcu) != .Int and int_tag_ty.zigTypeTag(zcu) != .ComptimeInt) {
36638 if (int_tag_ty.zigTypeTag(zcu) != .int and int_tag_ty.zigTypeTag(zcu) != .comptime_int) {
3663936639 return sema.fail(&block_scope, tag_ty_src, "expected integer tag type, found '{}'", .{int_tag_ty.fmt(pt)});
3664036640 }
3664136641
......@@ -36834,7 +36834,7 @@ fn unionFields(
3683436834 }
3683536835 }
3683636836
36837 if (field_ty.zigTypeTag(zcu) == .Opaque) {
36837 if (field_ty.zigTypeTag(zcu) == .@"opaque") {
3683836838 const msg = msg: {
3683936839 const msg = try sema.errMsg(type_src, "opaque types have unknown size and therefore cannot be directly embedded in unions", .{});
3684036840 errdefer msg.destroy(sema.gpa);
......@@ -36932,7 +36932,7 @@ fn generateUnionTagTypeNumbered(
3693236932 const name = try ip.getOrPutStringFmt(
3693336933 gpa,
3693436934 pt.tid,
36935 "@typeInfo({}).Union.tag_type.?",
36935 "@typeInfo({}).@\"union\".tag_type.?",
3693636936 .{union_name.fmt(ip)},
3693736937 .no_embedded_nulls,
3693836938 );
......@@ -36968,7 +36968,7 @@ fn generateUnionTagTypeSimple(
3696836968 const name = try ip.getOrPutStringFmt(
3696936969 gpa,
3697036970 pt.tid,
36971 "@typeInfo({}).Union.tag_type.?",
36971 "@typeInfo({}).@\"union\".tag_type.?",
3697236972 .{union_name.fmt(ip)},
3697336973 .no_embedded_nulls,
3697436974 );
......@@ -37637,7 +37637,7 @@ fn intAdd(sema: *Sema, lhs: Value, rhs: Value, ty: Type, overflow_idx: *?usize)
3763737637fn intAddInner(sema: *Sema, lhs: Value, rhs: Value, ty: Type, overflow_idx: *usize) !Value {
3763837638 const pt = sema.pt;
3763937639 const zcu = pt.zcu;
37640 if (ty.zigTypeTag(zcu) == .Vector) {
37640 if (ty.zigTypeTag(zcu) == .vector) {
3764137641 const result_data = try sema.arena.alloc(InternPool.Index, ty.vectorLen(zcu));
3764237642 const scalar_ty = ty.scalarType(zcu);
3764337643 for (result_data, 0..) |*scalar, i| {
......@@ -37693,7 +37693,7 @@ fn numberAddWrapScalar(
3769337693 const zcu = pt.zcu;
3769437694 if (lhs.isUndef(zcu) or rhs.isUndef(zcu)) return pt.undefValue(ty);
3769537695
37696 if (ty.zigTypeTag(zcu) == .ComptimeInt) {
37696 if (ty.zigTypeTag(zcu) == .comptime_int) {
3769737697 return sema.intAdd(lhs, rhs, ty, undefined);
3769837698 }
3769937699
......@@ -37729,7 +37729,7 @@ fn intSub(sema: *Sema, lhs: Value, rhs: Value, ty: Type, overflow_idx: *?usize)
3772937729
3773037730fn intSubInner(sema: *Sema, lhs: Value, rhs: Value, ty: Type, overflow_idx: *usize) !Value {
3773137731 const pt = sema.pt;
37732 if (ty.zigTypeTag(pt.zcu) == .Vector) {
37732 if (ty.zigTypeTag(pt.zcu) == .vector) {
3773337733 const result_data = try sema.arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
3773437734 const scalar_ty = ty.scalarType(pt.zcu);
3773537735 for (result_data, 0..) |*scalar, i| {
......@@ -37786,7 +37786,7 @@ fn numberSubWrapScalar(
3778637786 const zcu = pt.zcu;
3778737787 if (lhs.isUndef(zcu) or rhs.isUndef(zcu)) return pt.undefValue(ty);
3778837788
37789 if (ty.zigTypeTag(zcu) == .ComptimeInt) {
37789 if (ty.zigTypeTag(zcu) == .comptime_int) {
3779037790 return sema.intSub(lhs, rhs, ty, undefined);
3779137791 }
3779237792
......@@ -37806,7 +37806,7 @@ fn intSubWithOverflow(
3780637806) !Value.OverflowArithmeticResult {
3780737807 const pt = sema.pt;
3780837808 const zcu = pt.zcu;
37809 if (ty.zigTypeTag(zcu) == .Vector) {
37809 if (ty.zigTypeTag(zcu) == .vector) {
3781037810 const vec_len = ty.vectorLen(zcu);
3781137811 const overflowed_data = try sema.arena.alloc(InternPool.Index, vec_len);
3781237812 const result_data = try sema.arena.alloc(InternPool.Index, vec_len);
......@@ -37879,7 +37879,7 @@ fn intFromFloat(
3787937879) CompileError!Value {
3788037880 const pt = sema.pt;
3788137881 const zcu = pt.zcu;
37882 if (float_ty.zigTypeTag(zcu) == .Vector) {
37882 if (float_ty.zigTypeTag(zcu) == .vector) {
3788337883 const result_data = try sema.arena.alloc(InternPool.Index, float_ty.vectorLen(zcu));
3788437884 for (result_data, 0..) |*scalar, i| {
3788537885 const elem_val = try val.elemValue(pt, i);
......@@ -38015,7 +38015,7 @@ fn intFitsInType(
3801538015 },
3801638016 },
3801738017 .aggregate => |aggregate| {
38018 assert(ty.zigTypeTag(zcu) == .Vector);
38018 assert(ty.zigTypeTag(zcu) == .vector);
3801938019 return switch (aggregate.storage) {
3802038020 .bytes => |bytes| for (bytes.toSlice(ty.vectorLen(zcu), &zcu.intern_pool), 0..) |byte, i| {
3802138021 if (byte == 0) continue;
......@@ -38070,7 +38070,7 @@ fn intAddWithOverflow(
3807038070) !Value.OverflowArithmeticResult {
3807138071 const pt = sema.pt;
3807238072 const zcu = pt.zcu;
38073 if (ty.zigTypeTag(zcu) == .Vector) {
38073 if (ty.zigTypeTag(zcu) == .vector) {
3807438074 const vec_len = ty.vectorLen(zcu);
3807538075 const overflowed_data = try sema.arena.alloc(InternPool.Index, vec_len);
3807638076 const result_data = try sema.arena.alloc(InternPool.Index, vec_len);
......@@ -38143,7 +38143,7 @@ fn compareAll(
3814338143) CompileError!bool {
3814438144 const pt = sema.pt;
3814538145 const zcu = pt.zcu;
38146 if (ty.zigTypeTag(zcu) == .Vector) {
38146 if (ty.zigTypeTag(zcu) == .vector) {
3814738147 var i: usize = 0;
3814838148 while (i < ty.vectorLen(zcu)) : (i += 1) {
3814938149 const lhs_elem = try lhs.elemValue(pt, i);
......@@ -38194,7 +38194,7 @@ fn compareVector(
3819438194) !Value {
3819538195 const pt = sema.pt;
3819638196 const zcu = pt.zcu;
38197 assert(ty.zigTypeTag(zcu) == .Vector);
38197 assert(ty.zigTypeTag(zcu) == .vector);
3819838198 const result_data = try sema.arena.alloc(InternPool.Index, ty.vectorLen(zcu));
3819938199 for (result_data, 0..) |*scalar, i| {
3820038200 const lhs_elem = try lhs.elemValue(pt, i);
......@@ -38555,7 +38555,7 @@ pub fn resolveDeclaredEnum(
3855538555
3855638556 if (tag_type_ref != .none) {
3855738557 const ty = try sema.resolveType(&block, tag_ty_src, tag_type_ref);
38558 if (ty.zigTypeTag(zcu) != .Int and ty.zigTypeTag(zcu) != .ComptimeInt) {
38558 if (ty.zigTypeTag(zcu) != .int and ty.zigTypeTag(zcu) != .comptime_int) {
3855938559 return sema.fail(&block, tag_ty_src, "expected integer tag type, found '{}'", .{ty.fmt(pt)});
3856038560 }
3856138561 break :ty ty;
src/Sema/bitcast.zig+7-7
......@@ -274,7 +274,7 @@ const UnpackValueBits = struct {
274274 => try unpack.primitive(val),
275275
276276 .aggregate => switch (ty.zigTypeTag(zcu)) {
277 .Vector => {
277 .vector => {
278278 const len: usize = @intCast(ty.arrayLen(zcu));
279279 for (0..len) |i| {
280280 // We reverse vector elements in packed memory on BE targets.
......@@ -286,7 +286,7 @@ const UnpackValueBits = struct {
286286 try unpack.add(elem_val);
287287 }
288288 },
289 .Array => {
289 .array => {
290290 // Each element is padded up to its ABI size. Padding bits are undefined.
291291 // The final element does not have trailing padding.
292292 // Elements are reversed in packed memory on BE targets.
......@@ -316,7 +316,7 @@ const UnpackValueBits = struct {
316316 try unpack.add(s);
317317 };
318318 },
319 .Struct => switch (ty.containerLayout(zcu)) {
319 .@"struct" => switch (ty.containerLayout(zcu)) {
320320 .auto => unreachable, // ill-defined layout
321321 .@"extern" => switch (endian) {
322322 .little => {
......@@ -473,7 +473,7 @@ const PackValueBits = struct {
473473 const ip = &zcu.intern_pool;
474474 const arena = pack.arena;
475475 switch (ty.zigTypeTag(zcu)) {
476 .Vector => {
476 .vector => {
477477 // Elements are bit-packed.
478478 const len = ty.arrayLen(zcu);
479479 const elem_ty = ty.childType(zcu);
......@@ -496,7 +496,7 @@ const PackValueBits = struct {
496496 .storage = .{ .elems = elems },
497497 } }));
498498 },
499 .Array => {
499 .array => {
500500 // Each element is padded up to its ABI size. The final element does not have trailing padding.
501501 const len = ty.arrayLen(zcu);
502502 const elem_ty = ty.childType(zcu);
......@@ -530,7 +530,7 @@ const PackValueBits = struct {
530530 .storage = .{ .elems = elems },
531531 } }));
532532 },
533 .Struct => switch (ty.containerLayout(zcu)) {
533 .@"struct" => switch (ty.containerLayout(zcu)) {
534534 .auto => unreachable, // ill-defined layout
535535 .@"extern" => {
536536 const elems = try arena.alloc(InternPool.Index, ty.structFieldCount(zcu));
......@@ -587,7 +587,7 @@ const PackValueBits = struct {
587587 } }));
588588 },
589589 },
590 .Union => {
590 .@"union" => {
591591 // We will attempt to read as the backing representation. If this emits
592592 // `error.ReinterpretDeclRef`, we will try each union field, preferring larger ones.
593593 // We will also attempt smaller fields when we get `undefined`, as if some bits are
src/Sema/comptime_ptr_access.zig+64-64
......@@ -226,7 +226,7 @@ fn loadComptimePtrInner(
226226 .variable => return .runtime_load,
227227 // We let `.@"extern"` through here if it's a function.
228228 // This allows you to alias `extern fn`s.
229 .@"extern" => |e| if (Type.fromInterned(e.ty).zigTypeTag(zcu) == .Fn)
229 .@"extern" => |e| if (Type.fromInterned(e.ty).zigTypeTag(zcu) == .@"fn")
230230 break :val .{ .interned = val }
231231 else
232232 return .runtime_load,
......@@ -296,8 +296,8 @@ fn loadComptimePtrInner(
296296
297297 const agg_ty = agg_val.typeOf(zcu);
298298 switch (agg_ty.zigTypeTag(zcu)) {
299 .Struct, .Pointer => break :val try agg_val.getElem(sema.pt, @intCast(base_index.index)),
300 .Union => {
299 .@"struct", .pointer => break :val try agg_val.getElem(sema.pt, @intCast(base_index.index)),
300 .@"union" => {
301301 const tag_val: Value, const payload_mv: MutableValue = switch (agg_val) {
302302 .un => |un| .{ Value.fromInterned(un.tag), un.payload.* },
303303 .interned => |ip_index| switch (ip.indexToKey(ip_index)) {
......@@ -321,7 +321,7 @@ fn loadComptimePtrInner(
321321 };
322322
323323 if (ptr.byte_offset == 0 and host_bits == 0) {
324 if (load_ty.zigTypeTag(zcu) != .Array or array_offset == 0) {
324 if (load_ty.zigTypeTag(zcu) != .array or array_offset == 0) {
325325 if (.ok == try sema.coerceInMemoryAllowed(
326326 block,
327327 load_ty,
......@@ -366,7 +366,7 @@ fn loadComptimePtrInner(
366366 null,
367367 )) {
368368 // Changing the length of an array.
369 const skip_base: u64 = extra_base_index + if (load_ty.zigTypeTag(zcu) == .Array) skip: {
369 const skip_base: u64 = extra_base_index + if (load_ty.zigTypeTag(zcu) == .array) skip: {
370370 break :skip load_ty.childType(zcu).arrayBase(zcu)[1] * array_offset;
371371 } else 0;
372372 if (skip_base + load_count > val_count) return .{ .out_of_bounds = base_val.typeOf(zcu) };
......@@ -394,7 +394,7 @@ fn loadComptimePtrInner(
394394 var cur_val = base_val;
395395 var cur_offset = ptr.byte_offset;
396396
397 if (load_ty.zigTypeTag(zcu) == .Array and array_offset > 0) {
397 if (load_ty.zigTypeTag(zcu) == .array and array_offset > 0) {
398398 cur_offset += try load_ty.childType(zcu).abiSizeSema(pt) * array_offset;
399399 }
400400
......@@ -410,30 +410,30 @@ fn loadComptimePtrInner(
410410 while (true) {
411411 const cur_ty = cur_val.typeOf(zcu);
412412 switch (cur_ty.zigTypeTag(zcu)) {
413 .NoReturn,
414 .Type,
415 .ComptimeInt,
416 .ComptimeFloat,
417 .Null,
418 .Undefined,
419 .EnumLiteral,
420 .Opaque,
421 .Fn,
422 .ErrorUnion,
413 .noreturn,
414 .type,
415 .comptime_int,
416 .comptime_float,
417 .null,
418 .undefined,
419 .enum_literal,
420 .@"opaque",
421 .@"fn",
422 .error_union,
423423 => unreachable, // ill-defined layout
424 .Int,
425 .Float,
426 .Bool,
427 .Void,
428 .Pointer,
429 .ErrorSet,
430 .AnyFrame,
431 .Frame,
432 .Enum,
433 .Vector,
424 .int,
425 .float,
426 .bool,
427 .void,
428 .pointer,
429 .error_set,
430 .@"anyframe",
431 .frame,
432 .@"enum",
433 .vector,
434434 => break, // terminal types (no sub-values)
435 .Optional => break, // this can only be a pointer-like optional so is terminal
436 .Array => {
435 .optional => break, // this can only be a pointer-like optional so is terminal
436 .array => {
437437 const elem_ty = cur_ty.childType(zcu);
438438 const elem_size = try elem_ty.abiSizeSema(pt);
439439 const elem_idx = cur_offset / elem_size;
......@@ -446,7 +446,7 @@ fn loadComptimePtrInner(
446446 break;
447447 }
448448 },
449 .Struct => switch (cur_ty.containerLayout(zcu)) {
449 .@"struct" => switch (cur_ty.containerLayout(zcu)) {
450450 .auto => unreachable, // ill-defined layout
451451 .@"packed" => break, // let the bitcast logic handle this
452452 .@"extern" => for (0..cur_ty.structFieldCount(zcu)) |field_idx| {
......@@ -459,7 +459,7 @@ fn loadComptimePtrInner(
459459 }
460460 } else break, // pointer spans multiple fields
461461 },
462 .Union => switch (cur_ty.containerLayout(zcu)) {
462 .@"union" => switch (cur_ty.containerLayout(zcu)) {
463463 .auto => unreachable, // ill-defined layout
464464 .@"packed" => break, // let the bitcast logic handle this
465465 .@"extern" => {
......@@ -692,11 +692,11 @@ fn prepareComptimePtrStore(
692692
693693 const agg_ty = agg_val.typeOf(zcu);
694694 switch (agg_ty.zigTypeTag(zcu)) {
695 .Struct, .Pointer => break :strat .{ .direct = .{
695 .@"struct", .pointer => break :strat .{ .direct = .{
696696 .val = try agg_val.elem(pt, sema.arena, @intCast(base_index.index)),
697697 .alloc = alloc,
698698 } },
699 .Union => {
699 .@"union" => {
700700 if (agg_val.* == .interned and Value.fromInterned(agg_val.interned).isUndef(zcu)) {
701701 return .undef;
702702 }
......@@ -717,7 +717,7 @@ fn prepareComptimePtrStore(
717717 };
718718
719719 if (ptr.byte_offset == 0) {
720 if (store_ty.zigTypeTag(zcu) != .Array or array_offset == 0) direct: {
720 if (store_ty.zigTypeTag(zcu) != .array or array_offset == 0) direct: {
721721 const base_val_ty = switch (base_strat) {
722722 .direct => |direct| direct.val.typeOf(zcu),
723723 .index => |index| index.val.typeOf(zcu).childType(zcu),
......@@ -770,7 +770,7 @@ fn prepareComptimePtrStore(
770770 }
771771 if (base_elem_offset + extra_base_index + store_count > val_count) return .{ .out_of_bounds = oob_ty };
772772
773 if (store_ty.zigTypeTag(zcu) == .Array) {
773 if (store_ty.zigTypeTag(zcu) == .array) {
774774 const skip = store_ty.childType(zcu).arrayBase(zcu)[1] * array_offset;
775775 return .{ .flat_index = .{
776776 .alloc = base_strat.alloc(),
......@@ -780,7 +780,7 @@ fn prepareComptimePtrStore(
780780 }
781781
782782 // `base_val` must be an array, since otherwise the "direct reinterpret" logic above noticed it.
783 assert(base_val.typeOf(zcu).zigTypeTag(zcu) == .Array);
783 assert(base_val.typeOf(zcu).zigTypeTag(zcu) == .array);
784784
785785 var index: u64 = base_elem_offset + extra_base_index;
786786 const arr_val, const arr_index = (try recursiveIndex(sema, base_val, &index)).?;
......@@ -816,7 +816,7 @@ fn prepareComptimePtrStore(
816816 return .{ .needed_well_defined = cur_val.typeOf(zcu) };
817817 }
818818
819 if (store_ty.zigTypeTag(zcu) == .Array and array_offset > 0) {
819 if (store_ty.zigTypeTag(zcu) == .array and array_offset > 0) {
820820 cur_offset += try store_ty.childType(zcu).abiSizeSema(pt) * array_offset;
821821 }
822822
......@@ -832,30 +832,30 @@ fn prepareComptimePtrStore(
832832 while (true) {
833833 const cur_ty = cur_val.typeOf(zcu);
834834 switch (cur_ty.zigTypeTag(zcu)) {
835 .NoReturn,
836 .Type,
837 .ComptimeInt,
838 .ComptimeFloat,
839 .Null,
840 .Undefined,
841 .EnumLiteral,
842 .Opaque,
843 .Fn,
844 .ErrorUnion,
835 .noreturn,
836 .type,
837 .comptime_int,
838 .comptime_float,
839 .null,
840 .undefined,
841 .enum_literal,
842 .@"opaque",
843 .@"fn",
844 .error_union,
845845 => unreachable, // ill-defined layout
846 .Int,
847 .Float,
848 .Bool,
849 .Void,
850 .Pointer,
851 .ErrorSet,
852 .AnyFrame,
853 .Frame,
854 .Enum,
855 .Vector,
846 .int,
847 .float,
848 .bool,
849 .void,
850 .pointer,
851 .error_set,
852 .@"anyframe",
853 .frame,
854 .@"enum",
855 .vector,
856856 => break, // terminal types (no sub-values)
857 .Optional => break, // this can only be a pointer-like optional so is terminal
858 .Array => {
857 .optional => break, // this can only be a pointer-like optional so is terminal
858 .array => {
859859 const elem_ty = cur_ty.childType(zcu);
860860 const elem_size = try elem_ty.abiSizeSema(pt);
861861 const elem_idx = cur_offset / elem_size;
......@@ -868,7 +868,7 @@ fn prepareComptimePtrStore(
868868 break;
869869 }
870870 },
871 .Struct => switch (cur_ty.containerLayout(zcu)) {
871 .@"struct" => switch (cur_ty.containerLayout(zcu)) {
872872 .auto => unreachable, // ill-defined layout
873873 .@"packed" => break, // let the bitcast logic handle this
874874 .@"extern" => for (0..cur_ty.structFieldCount(zcu)) |field_idx| {
......@@ -881,7 +881,7 @@ fn prepareComptimePtrStore(
881881 }
882882 } else break, // pointer spans multiple fields
883883 },
884 .Union => switch (cur_ty.containerLayout(zcu)) {
884 .@"union" => switch (cur_ty.containerLayout(zcu)) {
885885 .auto => unreachable, // ill-defined layout
886886 .@"packed" => break, // let the bitcast logic handle this
887887 .@"extern" => {
......@@ -942,7 +942,7 @@ fn flattenArray(
942942 return;
943943 }
944944
945 if (ty.zigTypeTag(zcu) != .Array) {
945 if (ty.zigTypeTag(zcu) != .array) {
946946 out[@intCast(next_idx.*)] = (try val.intern(sema.pt, sema.arena)).toIntern();
947947 next_idx.* += 1;
948948 return;
......@@ -975,7 +975,7 @@ fn unflattenArray(
975975 const zcu = sema.pt.zcu;
976976 const arena = sema.arena;
977977
978 if (ty.zigTypeTag(zcu) != .Array) {
978 if (ty.zigTypeTag(zcu) != .array) {
979979 const val = Value.fromInterned(elems[@intCast(next_idx.*)]);
980980 next_idx.* += 1;
981981 return sema.pt.getCoerced(val, ty);
......@@ -1008,7 +1008,7 @@ fn recursiveIndex(
10081008 const pt = sema.pt;
10091009
10101010 const ty = mv.typeOf(pt.zcu);
1011 assert(ty.zigTypeTag(pt.zcu) == .Array);
1011 assert(ty.zigTypeTag(pt.zcu) == .array);
10121012
10131013 const ty_base_elems = ty.arrayBase(pt.zcu)[1];
10141014 if (index.* >= ty_base_elems) {
......@@ -1017,7 +1017,7 @@ fn recursiveIndex(
10171017 }
10181018
10191019 const elem_ty = ty.childType(pt.zcu);
1020 if (elem_ty.zigTypeTag(pt.zcu) != .Array) {
1020 if (elem_ty.zigTypeTag(pt.zcu) != .array) {
10211021 assert(index.* < ty.arrayLenIncludingSentinel(pt.zcu)); // should be handled by initial check
10221022 return .{ mv, index.* };
10231023 }
src/Type.zig+93-93
......@@ -31,8 +31,8 @@ pub fn zigTypeTagOrPoison(ty: Type, zcu: *const Zcu) error{GenericPoison}!std.bu
3131
3232pub fn baseZigTypeTag(self: Type, mod: *Zcu) std.builtin.TypeId {
3333 return switch (self.zigTypeTag(mod)) {
34 .ErrorUnion => self.errorUnionPayload(mod).baseZigTypeTag(mod),
35 .Optional => {
34 .error_union => self.errorUnionPayload(mod).baseZigTypeTag(mod),
35 .optional => {
3636 return self.optionalChild(mod).baseZigTypeTag(mod);
3737 },
3838 else => |t| t,
......@@ -41,37 +41,37 @@ pub fn baseZigTypeTag(self: Type, mod: *Zcu) std.builtin.TypeId {
4141
4242pub fn isSelfComparable(ty: Type, zcu: *const Zcu, is_equality_cmp: bool) bool {
4343 return switch (ty.zigTypeTag(zcu)) {
44 .Int,
45 .Float,
46 .ComptimeFloat,
47 .ComptimeInt,
44 .int,
45 .float,
46 .comptime_float,
47 .comptime_int,
4848 => true,
4949
50 .Vector => ty.elemType2(zcu).isSelfComparable(zcu, is_equality_cmp),
51
52 .Bool,
53 .Type,
54 .Void,
55 .ErrorSet,
56 .Fn,
57 .Opaque,
58 .AnyFrame,
59 .Enum,
60 .EnumLiteral,
50 .vector => ty.elemType2(zcu).isSelfComparable(zcu, is_equality_cmp),
51
52 .bool,
53 .type,
54 .void,
55 .error_set,
56 .@"fn",
57 .@"opaque",
58 .@"anyframe",
59 .@"enum",
60 .enum_literal,
6161 => is_equality_cmp,
6262
63 .NoReturn,
64 .Array,
65 .Struct,
66 .Undefined,
67 .Null,
68 .ErrorUnion,
69 .Union,
70 .Frame,
63 .noreturn,
64 .array,
65 .@"struct",
66 .undefined,
67 .null,
68 .error_union,
69 .@"union",
70 .frame,
7171 => false,
7272
73 .Pointer => !ty.isSlice(zcu) and (is_equality_cmp or ty.isCPtr(zcu)),
74 .Optional => {
73 .pointer => !ty.isSlice(zcu) and (is_equality_cmp or ty.isCPtr(zcu)),
74 .optional => {
7575 if (!is_equality_cmp) return false;
7676 return ty.optionalChild(zcu).isSelfComparable(zcu, is_equality_cmp);
7777 },
......@@ -80,9 +80,9 @@ pub fn isSelfComparable(ty: Type, zcu: *const Zcu, is_equality_cmp: bool) bool {
8080
8181/// If it is a function pointer, returns the function type. Otherwise returns null.
8282pub fn castPtrToFn(ty: Type, zcu: *const Zcu) ?Type {
83 if (ty.zigTypeTag(zcu) != .Pointer) return null;
83 if (ty.zigTypeTag(zcu) != .pointer) return null;
8484 const elem_ty = ty.childType(zcu);
85 if (elem_ty.zigTypeTag(zcu) != .Fn) return null;
85 if (elem_ty.zigTypeTag(zcu) != .@"fn") return null;
8686 return elem_ty;
8787}
8888
......@@ -267,7 +267,7 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error
267267 },
268268 .inferred_error_set_type => |func_index| {
269269 const func_nav = ip.getNav(zcu.funcInfo(func_index).owner_nav);
270 try writer.print("@typeInfo(@typeInfo(@TypeOf({})).Fn.return_type.?).ErrorUnion.error_set", .{
270 try writer.print("@typeInfo(@typeInfo(@TypeOf({})).@\"fn\".return_type.?).error_union.error_set", .{
271271 func_nav.fqn.fmt(ip),
272272 });
273273 },
......@@ -796,7 +796,7 @@ pub fn fnHasRuntimeBitsInner(
796796
797797pub fn isFnOrHasRuntimeBits(ty: Type, zcu: *Zcu) bool {
798798 switch (ty.zigTypeTag(zcu)) {
799 .Fn => return ty.fnHasRuntimeBits(zcu),
799 .@"fn" => return ty.fnHasRuntimeBits(zcu),
800800 else => return ty.hasRuntimeBits(zcu),
801801 }
802802}
......@@ -804,7 +804,7 @@ pub fn isFnOrHasRuntimeBits(ty: Type, zcu: *Zcu) bool {
804804/// Same as `isFnOrHasRuntimeBits` but comptime-only types may return a false positive.
805805pub fn isFnOrHasRuntimeBitsIgnoreComptime(ty: Type, zcu: *Zcu) bool {
806806 return switch (ty.zigTypeTag(zcu)) {
807 .Fn => true,
807 .@"fn" => true,
808808 else => return ty.hasRuntimeBitsIgnoreComptime(zcu),
809809 };
810810}
......@@ -1216,9 +1216,9 @@ fn abiAlignmentInnerOptional(
12161216 const child_type = ty.optionalChild(zcu);
12171217
12181218 switch (child_type.zigTypeTag(zcu)) {
1219 .Pointer => return .{ .scalar = ptrAbiAlignment(target) },
1220 .ErrorSet => return Type.anyerror.abiAlignmentInner(strat, zcu, tid),
1221 .NoReturn => return .{ .scalar = .@"1" },
1219 .pointer => return .{ .scalar = ptrAbiAlignment(target) },
1220 .error_set => return Type.anyerror.abiAlignmentInner(strat, zcu, tid),
1221 .noreturn => return .{ .scalar = .@"1" },
12221222 else => {},
12231223 }
12241224
......@@ -2053,7 +2053,7 @@ pub fn elemType2(ty: Type, zcu: *const Zcu) Type {
20532053
20542054fn shallowElemType(child_ty: Type, zcu: *const Zcu) Type {
20552055 return switch (child_ty.zigTypeTag(zcu)) {
2056 .Array, .Vector => child_ty.childType(zcu),
2056 .array, .vector => child_ty.childType(zcu),
20572057 else => child_ty,
20582058 };
20592059}
......@@ -2061,7 +2061,7 @@ fn shallowElemType(child_ty: Type, zcu: *const Zcu) Type {
20612061/// For vectors, returns the element type. Otherwise returns self.
20622062pub fn scalarType(ty: Type, zcu: *const Zcu) Type {
20632063 return switch (ty.zigTypeTag(zcu)) {
2064 .Vector => ty.childType(zcu),
2064 .vector => ty.childType(zcu),
20652065 else => ty,
20662066 };
20672067}
......@@ -2217,7 +2217,7 @@ pub fn isAnyError(ty: Type, zcu: *const Zcu) bool {
22172217
22182218pub fn isError(ty: Type, zcu: *const Zcu) bool {
22192219 return switch (ty.zigTypeTag(zcu)) {
2220 .ErrorUnion, .ErrorSet => true,
2220 .error_union, .error_set => true,
22212221 else => false,
22222222 };
22232223}
......@@ -2341,8 +2341,8 @@ pub fn isUnsignedInt(ty: Type, zcu: *const Zcu) bool {
23412341/// If this function returns true, then intInfo() can be called on the type.
23422342pub fn isAbiInt(ty: Type, zcu: *const Zcu) bool {
23432343 return switch (ty.zigTypeTag(zcu)) {
2344 .Int, .Enum, .ErrorSet => true,
2345 .Struct => ty.containerLayout(zcu) == .@"packed",
2344 .int, .@"enum", .error_set => true,
2345 .@"struct" => ty.containerLayout(zcu) == .@"packed",
23462346 else => false,
23472347 };
23482348}
......@@ -2494,14 +2494,14 @@ pub fn fnCallingConvention(ty: Type, zcu: *const Zcu) std.builtin.CallingConvent
24942494
24952495pub fn isValidParamType(self: Type, zcu: *const Zcu) bool {
24962496 return switch (self.zigTypeTagOrPoison(zcu) catch return true) {
2497 .Opaque, .NoReturn => false,
2497 .@"opaque", .noreturn => false,
24982498 else => true,
24992499 };
25002500}
25012501
25022502pub fn isValidReturnType(self: Type, zcu: *const Zcu) bool {
25032503 return switch (self.zigTypeTagOrPoison(zcu) catch return true) {
2504 .Opaque => false,
2504 .@"opaque" => false,
25052505 else => true,
25062506 };
25072507}
......@@ -2782,8 +2782,8 @@ pub fn comptimeOnlyInner(
27822782 .ptr_type => |ptr_type| {
27832783 const child_ty = Type.fromInterned(ptr_type.child);
27842784 switch (child_ty.zigTypeTag(zcu)) {
2785 .Fn => return !try child_ty.fnHasRuntimeBitsInner(strat, zcu, tid),
2786 .Opaque => return false,
2785 .@"fn" => return !try child_ty.fnHasRuntimeBitsInner(strat, zcu, tid),
2786 .@"opaque" => return false,
27872787 else => return child_ty.comptimeOnlyInner(strat, zcu, tid),
27882788 }
27892789 },
......@@ -2954,7 +2954,7 @@ pub fn comptimeOnlyInner(
29542954}
29552955
29562956pub fn isVector(ty: Type, zcu: *const Zcu) bool {
2957 return ty.zigTypeTag(zcu) == .Vector;
2957 return ty.zigTypeTag(zcu) == .vector;
29582958}
29592959
29602960/// Returns 0 if not a vector, otherwise returns @bitSizeOf(Element) * vector_len.
......@@ -2966,40 +2966,40 @@ pub fn totalVectorBits(ty: Type, zcu: *Zcu) u64 {
29662966
29672967pub fn isArrayOrVector(ty: Type, zcu: *const Zcu) bool {
29682968 return switch (ty.zigTypeTag(zcu)) {
2969 .Array, .Vector => true,
2969 .array, .vector => true,
29702970 else => false,
29712971 };
29722972}
29732973
29742974pub fn isIndexable(ty: Type, zcu: *const Zcu) bool {
29752975 return switch (ty.zigTypeTag(zcu)) {
2976 .Array, .Vector => true,
2977 .Pointer => switch (ty.ptrSize(zcu)) {
2976 .array, .vector => true,
2977 .pointer => switch (ty.ptrSize(zcu)) {
29782978 .Slice, .Many, .C => true,
29792979 .One => switch (ty.childType(zcu).zigTypeTag(zcu)) {
2980 .Array, .Vector => true,
2981 .Struct => ty.childType(zcu).isTuple(zcu),
2980 .array, .vector => true,
2981 .@"struct" => ty.childType(zcu).isTuple(zcu),
29822982 else => false,
29832983 },
29842984 },
2985 .Struct => ty.isTuple(zcu),
2985 .@"struct" => ty.isTuple(zcu),
29862986 else => false,
29872987 };
29882988}
29892989
29902990pub fn indexableHasLen(ty: Type, zcu: *const Zcu) bool {
29912991 return switch (ty.zigTypeTag(zcu)) {
2992 .Array, .Vector => true,
2993 .Pointer => switch (ty.ptrSize(zcu)) {
2992 .array, .vector => true,
2993 .pointer => switch (ty.ptrSize(zcu)) {
29942994 .Many, .C => false,
29952995 .Slice => true,
29962996 .One => switch (ty.childType(zcu).zigTypeTag(zcu)) {
2997 .Array, .Vector => true,
2998 .Struct => ty.childType(zcu).isTuple(zcu),
2997 .array, .vector => true,
2998 .@"struct" => ty.childType(zcu).isTuple(zcu),
29992999 else => false,
30003000 },
30013001 },
3002 .Struct => ty.isTuple(zcu),
3002 .@"struct" => ty.isTuple(zcu),
30033003 else => false,
30043004 };
30053005}
......@@ -3030,7 +3030,7 @@ pub fn getParentNamespace(ty: Type, zcu: *Zcu) InternPool.OptionalNamespaceIndex
30303030pub fn minInt(ty: Type, pt: Zcu.PerThread, dest_ty: Type) !Value {
30313031 const zcu = pt.zcu;
30323032 const scalar = try minIntScalar(ty.scalarType(zcu), pt, dest_ty.scalarType(zcu));
3033 return if (ty.zigTypeTag(zcu) == .Vector) Value.fromInterned(try pt.intern(.{ .aggregate = .{
3033 return if (ty.zigTypeTag(zcu) == .vector) Value.fromInterned(try pt.intern(.{ .aggregate = .{
30343034 .ty = dest_ty.toIntern(),
30353035 .storage = .{ .repeated_elem = scalar.toIntern() },
30363036 } })) else scalar;
......@@ -3061,7 +3061,7 @@ pub fn minIntScalar(ty: Type, pt: Zcu.PerThread, dest_ty: Type) !Value {
30613061pub fn maxInt(ty: Type, pt: Zcu.PerThread, dest_ty: Type) !Value {
30623062 const zcu = pt.zcu;
30633063 const scalar = try maxIntScalar(ty.scalarType(zcu), pt, dest_ty.scalarType(zcu));
3064 return if (ty.zigTypeTag(zcu) == .Vector) Value.fromInterned(try pt.intern(.{ .aggregate = .{
3064 return if (ty.zigTypeTag(zcu) == .vector) Value.fromInterned(try pt.intern(.{ .aggregate = .{
30653065 .ty = dest_ty.toIntern(),
30663066 .storage = .{ .repeated_elem = scalar.toIntern() },
30673067 } })) else scalar;
......@@ -3539,8 +3539,8 @@ pub fn isSimpleTupleOrAnonStruct(ty: Type, zcu: *const Zcu) bool {
35393539pub fn optEuBaseType(ty: Type, zcu: *const Zcu) Type {
35403540 var cur = ty;
35413541 while (true) switch (cur.zigTypeTag(zcu)) {
3542 .Optional => cur = cur.optionalChild(zcu),
3543 .ErrorUnion => cur = cur.errorUnionPayload(zcu),
3542 .optional => cur = cur.optionalChild(zcu),
3543 .error_union => cur = cur.errorUnionPayload(zcu),
35443544 else => return cur,
35453545 };
35463546}
......@@ -3548,8 +3548,8 @@ pub fn optEuBaseType(ty: Type, zcu: *const Zcu) Type {
35483548pub fn toUnsigned(ty: Type, pt: Zcu.PerThread) !Type {
35493549 const zcu = pt.zcu;
35503550 return switch (ty.zigTypeTag(zcu)) {
3551 .Int => pt.intType(.unsigned, ty.intInfo(zcu).bits),
3552 .Vector => try pt.vectorType(.{
3551 .int => pt.intType(.unsigned, ty.intInfo(zcu).bits),
3552 .vector => try pt.vectorType(.{
35533553 .len = ty.vectorLen(zcu),
35543554 .child = (try ty.childType(zcu).toUnsigned(pt)).toIntern(),
35553555 }),
......@@ -3625,7 +3625,7 @@ pub fn getCaptures(ty: Type, zcu: *const Zcu) InternPool.CaptureValue.Slice {
36253625pub fn arrayBase(ty: Type, zcu: *const Zcu) struct { Type, u64 } {
36263626 var cur_ty: Type = ty;
36273627 var cur_len: u64 = 1;
3628 while (cur_ty.zigTypeTag(zcu) == .Array) {
3628 while (cur_ty.zigTypeTag(zcu) == .array) {
36293629 cur_len *= cur_ty.arrayLenIncludingSentinel(zcu);
36303630 cur_ty = cur_ty.childType(zcu);
36313631 }
......@@ -3692,7 +3692,7 @@ pub fn resolveLayout(ty: Type, pt: Zcu.PerThread) SemaError!void {
36923692 const zcu = pt.zcu;
36933693 const ip = &zcu.intern_pool;
36943694 switch (ty.zigTypeTag(zcu)) {
3695 .Struct => switch (ip.indexToKey(ty.toIntern())) {
3695 .@"struct" => switch (ip.indexToKey(ty.toIntern())) {
36963696 .anon_struct_type => |anon_struct_type| for (0..anon_struct_type.types.len) |i| {
36973697 const field_ty = Type.fromInterned(anon_struct_type.types.get(ip)[i]);
36983698 try field_ty.resolveLayout(pt);
......@@ -3700,21 +3700,21 @@ pub fn resolveLayout(ty: Type, pt: Zcu.PerThread) SemaError!void {
37003700 .struct_type => return ty.resolveStructInner(pt, .layout),
37013701 else => unreachable,
37023702 },
3703 .Union => return ty.resolveUnionInner(pt, .layout),
3704 .Array => {
3703 .@"union" => return ty.resolveUnionInner(pt, .layout),
3704 .array => {
37053705 if (ty.arrayLenIncludingSentinel(zcu) == 0) return;
37063706 const elem_ty = ty.childType(zcu);
37073707 return elem_ty.resolveLayout(pt);
37083708 },
3709 .Optional => {
3709 .optional => {
37103710 const payload_ty = ty.optionalChild(zcu);
37113711 return payload_ty.resolveLayout(pt);
37123712 },
3713 .ErrorUnion => {
3713 .error_union => {
37143714 const payload_ty = ty.errorUnionPayload(zcu);
37153715 return payload_ty.resolveLayout(pt);
37163716 },
3717 .Fn => {
3717 .@"fn" => {
37183718 const info = zcu.typeToFunc(ty).?;
37193719 if (info.is_generic) {
37203720 // Resolving of generic function types is deferred to when
......@@ -3830,30 +3830,30 @@ pub fn resolveFully(ty: Type, pt: Zcu.PerThread) SemaError!void {
38303830 const ip = &zcu.intern_pool;
38313831
38323832 switch (ty.zigTypeTag(zcu)) {
3833 .Type,
3834 .Void,
3835 .Bool,
3836 .NoReturn,
3837 .Int,
3838 .Float,
3839 .ComptimeFloat,
3840 .ComptimeInt,
3841 .Undefined,
3842 .Null,
3843 .ErrorSet,
3844 .Enum,
3845 .Opaque,
3846 .Frame,
3847 .AnyFrame,
3848 .Vector,
3849 .EnumLiteral,
3833 .type,
3834 .void,
3835 .bool,
3836 .noreturn,
3837 .int,
3838 .float,
3839 .comptime_float,
3840 .comptime_int,
3841 .undefined,
3842 .null,
3843 .error_set,
3844 .@"enum",
3845 .@"opaque",
3846 .frame,
3847 .@"anyframe",
3848 .vector,
3849 .enum_literal,
38503850 => {},
38513851
3852 .Pointer => return ty.childType(zcu).resolveFully(pt),
3853 .Array => return ty.childType(zcu).resolveFully(pt),
3854 .Optional => return ty.optionalChild(zcu).resolveFully(pt),
3855 .ErrorUnion => return ty.errorUnionPayload(zcu).resolveFully(pt),
3856 .Fn => {
3852 .pointer => return ty.childType(zcu).resolveFully(pt),
3853 .array => return ty.childType(zcu).resolveFully(pt),
3854 .optional => return ty.optionalChild(zcu).resolveFully(pt),
3855 .error_union => return ty.errorUnionPayload(zcu).resolveFully(pt),
3856 .@"fn" => {
38573857 const info = zcu.typeToFunc(ty).?;
38583858 if (info.is_generic) return;
38593859 for (0..info.param_types.len) |i| {
......@@ -3863,7 +3863,7 @@ pub fn resolveFully(ty: Type, pt: Zcu.PerThread) SemaError!void {
38633863 try Type.fromInterned(info.return_type).resolveFully(pt);
38643864 },
38653865
3866 .Struct => switch (ip.indexToKey(ty.toIntern())) {
3866 .@"struct" => switch (ip.indexToKey(ty.toIntern())) {
38673867 .anon_struct_type => |anon_struct_type| for (0..anon_struct_type.types.len) |i| {
38683868 const field_ty = Type.fromInterned(anon_struct_type.types.get(ip)[i]);
38693869 try field_ty.resolveFully(pt);
......@@ -3871,7 +3871,7 @@ pub fn resolveFully(ty: Type, pt: Zcu.PerThread) SemaError!void {
38713871 .struct_type => return ty.resolveStructInner(pt, .full),
38723872 else => unreachable,
38733873 },
3874 .Union => return ty.resolveUnionInner(pt, .full),
3874 .@"union" => return ty.resolveUnionInner(pt, .full),
38753875 }
38763876}
38773877
src/Value.zig+130-130
......@@ -64,7 +64,7 @@ pub fn fmtValueSemaFull(ctx: print_value.FormatContext) std.fmt.Formatter(print_
6464/// Asserts `val` is an array of `u8`
6565pub fn toIpString(val: Value, ty: Type, pt: Zcu.PerThread) !InternPool.NullTerminatedString {
6666 const zcu = pt.zcu;
67 assert(ty.zigTypeTag(zcu) == .Array);
67 assert(ty.zigTypeTag(zcu) == .array);
6868 assert(ty.childType(zcu).toIntern() == .u8_type);
6969 const ip = &zcu.intern_pool;
7070 switch (zcu.intern_pool.indexToKey(val.toIntern()).aggregate.storage) {
......@@ -349,12 +349,12 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
349349 return;
350350 }
351351 switch (ty.zigTypeTag(zcu)) {
352 .Void => {},
353 .Bool => {
352 .void => {},
353 .bool => {
354354 buffer[0] = @intFromBool(val.toBool());
355355 },
356 .Int, .Enum, .ErrorSet, .Pointer => |tag| {
357 const int_ty = if (tag == .Pointer) int_ty: {
356 .int, .@"enum", .error_set, .pointer => |tag| {
357 const int_ty = if (tag == .pointer) int_ty: {
358358 if (ty.isSlice(zcu)) return error.IllDefinedMemoryLayout;
359359 if (ip.getBackingAddrTag(val.toIntern()).? != .int) return error.ReinterpretDeclRef;
360360 break :int_ty Type.usize;
......@@ -367,7 +367,7 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
367367 const bigint = val.toBigInt(&bigint_buffer, zcu);
368368 bigint.writeTwosComplement(buffer[0..byte_count], endian);
369369 },
370 .Float => switch (ty.floatBits(target)) {
370 .float => switch (ty.floatBits(target)) {
371371 16 => std.mem.writeInt(u16, buffer[0..2], @bitCast(val.toFloat(f16, zcu)), endian),
372372 32 => std.mem.writeInt(u32, buffer[0..4], @bitCast(val.toFloat(f32, zcu)), endian),
373373 64 => std.mem.writeInt(u64, buffer[0..8], @bitCast(val.toFloat(f64, zcu)), endian),
......@@ -375,7 +375,7 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
375375 128 => std.mem.writeInt(u128, buffer[0..16], @bitCast(val.toFloat(f128, zcu)), endian),
376376 else => unreachable,
377377 },
378 .Array => {
378 .array => {
379379 const len = ty.arrayLen(zcu);
380380 const elem_ty = ty.childType(zcu);
381381 const elem_size: usize = @intCast(elem_ty.abiSize(zcu));
......@@ -387,13 +387,13 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
387387 buf_off += elem_size;
388388 }
389389 },
390 .Vector => {
390 .vector => {
391391 // We use byte_count instead of abi_size here, so that any padding bytes
392392 // follow the data bytes, on both big- and little-endian systems.
393393 const byte_count = (@as(usize, @intCast(ty.bitSize(zcu))) + 7) / 8;
394394 return writeToPackedMemory(val, ty, pt, buffer[0..byte_count], 0);
395395 },
396 .Struct => {
396 .@"struct" => {
397397 const struct_type = zcu.typeToStruct(ty) orelse return error.IllDefinedMemoryLayout;
398398 switch (struct_type.layout) {
399399 .auto => return error.IllDefinedMemoryLayout,
......@@ -415,7 +415,7 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
415415 },
416416 }
417417 },
418 .Union => switch (ty.containerLayout(zcu)) {
418 .@"union" => switch (ty.containerLayout(zcu)) {
419419 .auto => return error.IllDefinedMemoryLayout, // Sema is supposed to have emitted a compile error already
420420 .@"extern" => {
421421 if (val.unionTag(zcu)) |union_tag| {
......@@ -437,7 +437,7 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
437437 return writeToPackedMemory(val, ty, pt, buffer[0..byte_count], 0);
438438 },
439439 },
440 .Optional => {
440 .optional => {
441441 if (!ty.isPtrLikeOptional(zcu)) return error.IllDefinedMemoryLayout;
442442 const opt_val = val.optionalValue(zcu);
443443 if (opt_val) |some| {
......@@ -473,8 +473,8 @@ pub fn writeToPackedMemory(
473473 return;
474474 }
475475 switch (ty.zigTypeTag(zcu)) {
476 .Void => {},
477 .Bool => {
476 .void => {},
477 .bool => {
478478 const byte_index = switch (endian) {
479479 .little => bit_offset / 8,
480480 .big => buffer.len - bit_offset / 8 - 1,
......@@ -485,7 +485,7 @@ pub fn writeToPackedMemory(
485485 buffer[byte_index] &= ~(@as(u8, 1) << @as(u3, @intCast(bit_offset % 8)));
486486 }
487487 },
488 .Int, .Enum => {
488 .int, .@"enum" => {
489489 if (buffer.len == 0) return;
490490 const bits = ty.intInfo(zcu).bits;
491491 if (bits == 0) return;
......@@ -503,7 +503,7 @@ pub fn writeToPackedMemory(
503503 },
504504 }
505505 },
506 .Float => switch (ty.floatBits(target)) {
506 .float => switch (ty.floatBits(target)) {
507507 16 => std.mem.writePackedInt(u16, buffer, bit_offset, @bitCast(val.toFloat(f16, zcu)), endian),
508508 32 => std.mem.writePackedInt(u32, buffer, bit_offset, @bitCast(val.toFloat(f32, zcu)), endian),
509509 64 => std.mem.writePackedInt(u64, buffer, bit_offset, @bitCast(val.toFloat(f64, zcu)), endian),
......@@ -511,7 +511,7 @@ pub fn writeToPackedMemory(
511511 128 => std.mem.writePackedInt(u128, buffer, bit_offset, @bitCast(val.toFloat(f128, zcu)), endian),
512512 else => unreachable,
513513 },
514 .Vector => {
514 .vector => {
515515 const elem_ty = ty.childType(zcu);
516516 const elem_bit_size: u16 = @intCast(elem_ty.bitSize(zcu));
517517 const len: usize = @intCast(ty.arrayLen(zcu));
......@@ -526,7 +526,7 @@ pub fn writeToPackedMemory(
526526 bits += elem_bit_size;
527527 }
528528 },
529 .Struct => {
529 .@"struct" => {
530530 const struct_type = ip.loadStructType(ty.toIntern());
531531 // Sema is supposed to have emitted a compile error already in the case of Auto,
532532 // and Extern is handled in non-packed writeToMemory.
......@@ -544,7 +544,7 @@ pub fn writeToPackedMemory(
544544 bits += field_bits;
545545 }
546546 },
547 .Union => {
547 .@"union" => {
548548 const union_obj = zcu.typeToUnion(ty).?;
549549 switch (union_obj.flagsUnordered(ip).layout) {
550550 .auto, .@"extern" => unreachable, // Handled in non-packed writeToMemory
......@@ -561,12 +561,12 @@ pub fn writeToPackedMemory(
561561 },
562562 }
563563 },
564 .Pointer => {
564 .pointer => {
565565 assert(!ty.isSlice(zcu)); // No well defined layout.
566566 if (ip.getBackingAddrTag(val.toIntern()).? != .int) return error.ReinterpretDeclRef;
567567 return val.writeToPackedMemory(Type.usize, pt, buffer, bit_offset);
568568 },
569 .Optional => {
569 .optional => {
570570 assert(ty.isPtrLikeOptional(zcu));
571571 const child = ty.optionalChild(zcu);
572572 const opt_val = val.optionalValue(zcu);
......@@ -599,18 +599,18 @@ pub fn readFromMemory(
599599 const target = zcu.getTarget();
600600 const endian = target.cpu.arch.endian();
601601 switch (ty.zigTypeTag(zcu)) {
602 .Void => return Value.void,
603 .Bool => {
602 .void => return Value.void,
603 .bool => {
604604 if (buffer[0] == 0) {
605605 return Value.false;
606606 } else {
607607 return Value.true;
608608 }
609609 },
610 .Int, .Enum => |ty_tag| {
610 .int, .@"enum" => |ty_tag| {
611611 const int_ty = switch (ty_tag) {
612 .Int => ty,
613 .Enum => ty.intTagType(zcu),
612 .int => ty,
613 .@"enum" => ty.intTagType(zcu),
614614 else => unreachable,
615615 };
616616 const int_info = int_ty.intInfo(zcu);
......@@ -639,7 +639,7 @@ pub fn readFromMemory(
639639 return zcu.getCoerced(try zcu.intValue_big(int_ty, bigint.toConst()), ty);
640640 }
641641 },
642 .Float => return Value.fromInterned(try pt.intern(.{ .float = .{
642 .float => return Value.fromInterned(try pt.intern(.{ .float = .{
643643 .ty = ty.toIntern(),
644644 .storage = switch (ty.floatBits(target)) {
645645 16 => .{ .f16 = @bitCast(std.mem.readInt(u16, buffer[0..2], endian)) },
......@@ -650,7 +650,7 @@ pub fn readFromMemory(
650650 else => unreachable,
651651 },
652652 } })),
653 .Array => {
653 .array => {
654654 const elem_ty = ty.childType(zcu);
655655 const elem_size = elem_ty.abiSize(zcu);
656656 const elems = try arena.alloc(InternPool.Index, @intCast(ty.arrayLen(zcu)));
......@@ -664,13 +664,13 @@ pub fn readFromMemory(
664664 .storage = .{ .elems = elems },
665665 } }));
666666 },
667 .Vector => {
667 .vector => {
668668 // We use byte_count instead of abi_size here, so that any padding bytes
669669 // follow the data bytes, on both big- and little-endian systems.
670670 const byte_count = (@as(usize, @intCast(ty.bitSize(zcu))) + 7) / 8;
671671 return readFromPackedMemory(ty, zcu, buffer[0..byte_count], 0, arena);
672672 },
673 .Struct => {
673 .@"struct" => {
674674 const struct_type = zcu.typeToStruct(ty).?;
675675 switch (struct_type.layout) {
676676 .auto => unreachable, // Sema is supposed to have emitted a compile error already
......@@ -694,7 +694,7 @@ pub fn readFromMemory(
694694 },
695695 }
696696 },
697 .ErrorSet => {
697 .error_set => {
698698 const bits = zcu.errorSetBits();
699699 const byte_count: u16 = @intCast((@as(u17, bits) + 7) / 8);
700700 const int = std.mem.readVarInt(u64, buffer[0..byte_count], endian);
......@@ -706,7 +706,7 @@ pub fn readFromMemory(
706706 .name = name,
707707 } }));
708708 },
709 .Union => switch (ty.containerLayout(zcu)) {
709 .@"union" => switch (ty.containerLayout(zcu)) {
710710 .auto => return error.IllDefinedMemoryLayout,
711711 .@"extern" => {
712712 const union_size = ty.abiSize(zcu);
......@@ -723,7 +723,7 @@ pub fn readFromMemory(
723723 return readFromPackedMemory(ty, zcu, buffer[0..byte_count], 0, arena);
724724 },
725725 },
726 .Pointer => {
726 .pointer => {
727727 assert(!ty.isSlice(zcu)); // No well defined layout.
728728 const int_val = try readFromMemory(Type.usize, zcu, buffer, arena);
729729 return Value.fromInterned(try pt.intern(.{ .ptr = .{
......@@ -732,7 +732,7 @@ pub fn readFromMemory(
732732 .byte_offset = int_val.toUnsignedInt(zcu),
733733 } }));
734734 },
735 .Optional => {
735 .optional => {
736736 assert(ty.isPtrLikeOptional(zcu));
737737 const child_ty = ty.optionalChild(zcu);
738738 const child_val = try readFromMemory(child_ty, zcu, buffer, arena);
......@@ -768,8 +768,8 @@ pub fn readFromPackedMemory(
768768 const target = zcu.getTarget();
769769 const endian = target.cpu.arch.endian();
770770 switch (ty.zigTypeTag(zcu)) {
771 .Void => return Value.void,
772 .Bool => {
771 .void => return Value.void,
772 .bool => {
773773 const byte = switch (endian) {
774774 .big => buffer[buffer.len - bit_offset / 8 - 1],
775775 .little => buffer[bit_offset / 8],
......@@ -780,7 +780,7 @@ pub fn readFromPackedMemory(
780780 return Value.true;
781781 }
782782 },
783 .Int => {
783 .int => {
784784 if (buffer.len == 0) return pt.intValue(ty, 0);
785785 const int_info = ty.intInfo(zcu);
786786 const bits = int_info.bits;
......@@ -804,12 +804,12 @@ pub fn readFromPackedMemory(
804804 bigint.readPackedTwosComplement(buffer, bit_offset, bits, endian, int_info.signedness);
805805 return pt.intValue_big(ty, bigint.toConst());
806806 },
807 .Enum => {
807 .@"enum" => {
808808 const int_ty = ty.intTagType(zcu);
809809 const int_val = try Value.readFromPackedMemory(int_ty, pt, buffer, bit_offset, arena);
810810 return pt.getCoerced(int_val, ty);
811811 },
812 .Float => return Value.fromInterned(try pt.intern(.{ .float = .{
812 .float => return Value.fromInterned(try pt.intern(.{ .float = .{
813813 .ty = ty.toIntern(),
814814 .storage = switch (ty.floatBits(target)) {
815815 16 => .{ .f16 = @bitCast(std.mem.readPackedInt(u16, buffer, bit_offset, endian)) },
......@@ -820,7 +820,7 @@ pub fn readFromPackedMemory(
820820 else => unreachable,
821821 },
822822 } })),
823 .Vector => {
823 .vector => {
824824 const elem_ty = ty.childType(zcu);
825825 const elems = try arena.alloc(InternPool.Index, @intCast(ty.arrayLen(zcu)));
826826
......@@ -837,7 +837,7 @@ pub fn readFromPackedMemory(
837837 .storage = .{ .elems = elems },
838838 } }));
839839 },
840 .Struct => {
840 .@"struct" => {
841841 // Sema is supposed to have emitted a compile error already for Auto layout structs,
842842 // and Extern is handled by non-packed readFromMemory.
843843 const struct_type = zcu.typeToPackedStruct(ty).?;
......@@ -854,7 +854,7 @@ pub fn readFromPackedMemory(
854854 .storage = .{ .elems = field_vals },
855855 } }));
856856 },
857 .Union => switch (ty.containerLayout(zcu)) {
857 .@"union" => switch (ty.containerLayout(zcu)) {
858858 .auto, .@"extern" => unreachable, // Handled by non-packed readFromMemory
859859 .@"packed" => {
860860 const backing_ty = try ty.unionBackingType(pt);
......@@ -866,7 +866,7 @@ pub fn readFromPackedMemory(
866866 } }));
867867 },
868868 },
869 .Pointer => {
869 .pointer => {
870870 assert(!ty.isSlice(zcu)); // No well defined layout.
871871 const int_val = try readFromPackedMemory(Type.usize, pt, buffer, bit_offset, arena);
872872 return Value.fromInterned(try pt.intern(.{ .ptr = .{
......@@ -875,7 +875,7 @@ pub fn readFromPackedMemory(
875875 .byte_offset = int_val.toUnsignedInt(zcu),
876876 } }));
877877 },
878 .Optional => {
878 .optional => {
879879 assert(ty.isPtrLikeOptional(zcu));
880880 const child_ty = ty.optionalChild(zcu);
881881 const child_val = try readFromPackedMemory(child_ty, pt, buffer, bit_offset, arena);
......@@ -1155,7 +1155,7 @@ pub fn compareHeteroAdvanced(
11551155/// For vectors, returns true if comparison is true for ALL elements.
11561156pub fn compareAll(lhs: Value, op: std.math.CompareOperator, rhs: Value, ty: Type, pt: Zcu.PerThread) !bool {
11571157 const zcu = pt.zcu;
1158 if (ty.zigTypeTag(zcu) == .Vector) {
1158 if (ty.zigTypeTag(zcu) == .vector) {
11591159 const scalar_ty = ty.scalarType(zcu);
11601160 for (0..ty.vectorLen(zcu)) |i| {
11611161 const lhs_elem = try lhs.elemValue(pt, i);
......@@ -1519,7 +1519,7 @@ pub fn floatFromIntAdvanced(
15191519 comptime strat: ResolveStrat,
15201520) !Value {
15211521 const zcu = pt.zcu;
1522 if (int_ty.zigTypeTag(zcu) == .Vector) {
1522 if (int_ty.zigTypeTag(zcu) == .vector) {
15231523 const result_data = try arena.alloc(InternPool.Index, int_ty.vectorLen(zcu));
15241524 const scalar_ty = float_ty.scalarType(zcu);
15251525 for (result_data, 0..) |*scalar, i| {
......@@ -1573,7 +1573,7 @@ fn calcLimbLenFloat(scalar: anytype) usize {
15731573 }
15741574
15751575 const w_value = @abs(scalar);
1576 return @divFloor(@as(std.math.big.Limb, @intFromFloat(std.math.log2(w_value))), @typeInfo(std.math.big.Limb).Int.bits) + 1;
1576 return @divFloor(@as(std.math.big.Limb, @intFromFloat(std.math.log2(w_value))), @typeInfo(std.math.big.Limb).int.bits) + 1;
15771577}
15781578
15791579pub const OverflowArithmeticResult = struct {
......@@ -1589,7 +1589,7 @@ pub fn intAddSat(
15891589 arena: Allocator,
15901590 pt: Zcu.PerThread,
15911591) !Value {
1592 if (ty.zigTypeTag(pt.zcu) == .Vector) {
1592 if (ty.zigTypeTag(pt.zcu) == .vector) {
15931593 const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
15941594 const scalar_ty = ty.scalarType(pt.zcu);
15951595 for (result_data, 0..) |*scalar, i| {
......@@ -1640,7 +1640,7 @@ pub fn intSubSat(
16401640 arena: Allocator,
16411641 pt: Zcu.PerThread,
16421642) !Value {
1643 if (ty.zigTypeTag(pt.zcu) == .Vector) {
1643 if (ty.zigTypeTag(pt.zcu) == .vector) {
16441644 const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
16451645 const scalar_ty = ty.scalarType(pt.zcu);
16461646 for (result_data, 0..) |*scalar, i| {
......@@ -1692,7 +1692,7 @@ pub fn intMulWithOverflow(
16921692 pt: Zcu.PerThread,
16931693) !OverflowArithmeticResult {
16941694 const zcu = pt.zcu;
1695 if (ty.zigTypeTag(zcu) == .Vector) {
1695 if (ty.zigTypeTag(zcu) == .vector) {
16961696 const vec_len = ty.vectorLen(zcu);
16971697 const overflowed_data = try arena.alloc(InternPool.Index, vec_len);
16981698 const result_data = try arena.alloc(InternPool.Index, vec_len);
......@@ -1770,7 +1770,7 @@ pub fn numberMulWrap(
17701770 pt: Zcu.PerThread,
17711771) !Value {
17721772 const zcu = pt.zcu;
1773 if (ty.zigTypeTag(zcu) == .Vector) {
1773 if (ty.zigTypeTag(zcu) == .vector) {
17741774 const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(zcu));
17751775 const scalar_ty = ty.scalarType(zcu);
17761776 for (result_data, 0..) |*scalar, i| {
......@@ -1797,7 +1797,7 @@ pub fn numberMulWrapScalar(
17971797 const zcu = pt.zcu;
17981798 if (lhs.isUndef(zcu) or rhs.isUndef(zcu)) return Value.undef;
17991799
1800 if (ty.zigTypeTag(zcu) == .ComptimeInt) {
1800 if (ty.zigTypeTag(zcu) == .comptime_int) {
18011801 return intMul(lhs, rhs, ty, undefined, arena, pt);
18021802 }
18031803
......@@ -1817,7 +1817,7 @@ pub fn intMulSat(
18171817 arena: Allocator,
18181818 pt: Zcu.PerThread,
18191819) !Value {
1820 if (ty.zigTypeTag(pt.zcu) == .Vector) {
1820 if (ty.zigTypeTag(pt.zcu) == .vector) {
18211821 const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
18221822 const scalar_ty = ty.scalarType(pt.zcu);
18231823 for (result_data, 0..) |*scalar, i| {
......@@ -1897,7 +1897,7 @@ pub fn numberMin(lhs: Value, rhs: Value, zcu: *Zcu) Value {
18971897/// operands must be (vectors of) integers; handles undefined scalars.
18981898pub fn bitwiseNot(val: Value, ty: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
18991899 const zcu = pt.zcu;
1900 if (ty.zigTypeTag(zcu) == .Vector) {
1900 if (ty.zigTypeTag(zcu) == .vector) {
19011901 const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(zcu));
19021902 const scalar_ty = ty.scalarType(zcu);
19031903 for (result_data, 0..) |*scalar, i| {
......@@ -1941,7 +1941,7 @@ pub fn bitwiseNotScalar(val: Value, ty: Type, arena: Allocator, pt: Zcu.PerThrea
19411941/// operands must be (vectors of) integers; handles undefined scalars.
19421942pub fn bitwiseAnd(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
19431943 const zcu = pt.zcu;
1944 if (ty.zigTypeTag(zcu) == .Vector) {
1944 if (ty.zigTypeTag(zcu) == .vector) {
19451945 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
19461946 const scalar_ty = ty.scalarType(zcu);
19471947 for (result_data, 0..) |*scalar, i| {
......@@ -2014,7 +2014,7 @@ fn intValueAa(ty: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
20142014/// operands must be (vectors of) integers; handles undefined scalars.
20152015pub fn bitwiseNand(lhs: Value, rhs: Value, ty: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
20162016 const zcu = pt.zcu;
2017 if (ty.zigTypeTag(zcu) == .Vector) {
2017 if (ty.zigTypeTag(zcu) == .vector) {
20182018 const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(zcu));
20192019 const scalar_ty = ty.scalarType(zcu);
20202020 for (result_data, 0..) |*scalar, i| {
......@@ -2044,7 +2044,7 @@ pub fn bitwiseNandScalar(lhs: Value, rhs: Value, ty: Type, arena: Allocator, pt:
20442044/// operands must be (vectors of) integers; handles undefined scalars.
20452045pub fn bitwiseOr(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
20462046 const zcu = pt.zcu;
2047 if (ty.zigTypeTag(zcu) == .Vector) {
2047 if (ty.zigTypeTag(zcu) == .vector) {
20482048 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
20492049 const scalar_ty = ty.scalarType(zcu);
20502050 for (result_data, 0..) |*scalar, i| {
......@@ -2097,7 +2097,7 @@ pub fn bitwiseOrScalar(orig_lhs: Value, orig_rhs: Value, ty: Type, arena: Alloca
20972097/// operands must be (vectors of) integers; handles undefined scalars.
20982098pub fn bitwiseXor(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
20992099 const zcu = pt.zcu;
2100 if (ty.zigTypeTag(zcu) == .Vector) {
2100 if (ty.zigTypeTag(zcu) == .vector) {
21012101 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
21022102 const scalar_ty = ty.scalarType(zcu);
21032103 for (result_data, 0..) |*scalar, i| {
......@@ -2157,7 +2157,7 @@ pub fn intDiv(lhs: Value, rhs: Value, ty: Type, overflow_idx: *?usize, allocator
21572157}
21582158
21592159fn intDivInner(lhs: Value, rhs: Value, ty: Type, overflow_idx: *usize, allocator: Allocator, pt: Zcu.PerThread) !Value {
2160 if (ty.zigTypeTag(pt.zcu) == .Vector) {
2160 if (ty.zigTypeTag(pt.zcu) == .vector) {
21612161 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
21622162 const scalar_ty = ty.scalarType(pt.zcu);
21632163 for (result_data, 0..) |*scalar, i| {
......@@ -2213,7 +2213,7 @@ pub fn intDivScalar(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt:
22132213}
22142214
22152215pub fn intDivFloor(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
2216 if (ty.zigTypeTag(pt.zcu) == .Vector) {
2216 if (ty.zigTypeTag(pt.zcu) == .vector) {
22172217 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
22182218 const scalar_ty = ty.scalarType(pt.zcu);
22192219 for (result_data, 0..) |*scalar, i| {
......@@ -2256,7 +2256,7 @@ pub fn intDivFloorScalar(lhs: Value, rhs: Value, ty: Type, allocator: Allocator,
22562256}
22572257
22582258pub fn intMod(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
2259 if (ty.zigTypeTag(pt.zcu) == .Vector) {
2259 if (ty.zigTypeTag(pt.zcu) == .vector) {
22602260 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
22612261 const scalar_ty = ty.scalarType(pt.zcu);
22622262 for (result_data, 0..) |*scalar, i| {
......@@ -2328,7 +2328,7 @@ pub fn isNegativeInf(val: Value, zcu: *const Zcu) bool {
23282328}
23292329
23302330pub fn floatRem(lhs: Value, rhs: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
2331 if (float_type.zigTypeTag(pt.zcu) == .Vector) {
2331 if (float_type.zigTypeTag(pt.zcu) == .vector) {
23322332 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
23332333 const scalar_ty = float_type.scalarType(pt.zcu);
23342334 for (result_data, 0..) |*scalar, i| {
......@@ -2362,7 +2362,7 @@ pub fn floatRemScalar(lhs: Value, rhs: Value, float_type: Type, pt: Zcu.PerThrea
23622362}
23632363
23642364pub fn floatMod(lhs: Value, rhs: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
2365 if (float_type.zigTypeTag(pt.zcu) == .Vector) {
2365 if (float_type.zigTypeTag(pt.zcu) == .vector) {
23662366 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
23672367 const scalar_ty = float_type.scalarType(pt.zcu);
23682368 for (result_data, 0..) |*scalar, i| {
......@@ -2419,7 +2419,7 @@ pub fn intMul(lhs: Value, rhs: Value, ty: Type, overflow_idx: *?usize, allocator
24192419
24202420fn intMulInner(lhs: Value, rhs: Value, ty: Type, overflow_idx: *usize, allocator: Allocator, pt: Zcu.PerThread) !Value {
24212421 const zcu = pt.zcu;
2422 if (ty.zigTypeTag(zcu) == .Vector) {
2422 if (ty.zigTypeTag(zcu) == .vector) {
24232423 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
24242424 const scalar_ty = ty.scalarType(zcu);
24252425 for (result_data, 0..) |*scalar, i| {
......@@ -2471,7 +2471,7 @@ pub fn intMulScalar(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt:
24712471
24722472pub fn intTrunc(val: Value, ty: Type, allocator: Allocator, signedness: std.builtin.Signedness, bits: u16, pt: Zcu.PerThread) !Value {
24732473 const zcu = pt.zcu;
2474 if (ty.zigTypeTag(zcu) == .Vector) {
2474 if (ty.zigTypeTag(zcu) == .vector) {
24752475 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
24762476 const scalar_ty = ty.scalarType(zcu);
24772477 for (result_data, 0..) |*scalar, i| {
......@@ -2496,7 +2496,7 @@ pub fn intTruncBitsAsValue(
24962496 pt: Zcu.PerThread,
24972497) !Value {
24982498 const zcu = pt.zcu;
2499 if (ty.zigTypeTag(zcu) == .Vector) {
2499 if (ty.zigTypeTag(zcu) == .vector) {
25002500 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
25012501 const scalar_ty = ty.scalarType(zcu);
25022502 for (result_data, 0..) |*scalar, i| {
......@@ -2540,7 +2540,7 @@ pub fn intTruncScalar(
25402540
25412541pub fn shl(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
25422542 const zcu = pt.zcu;
2543 if (ty.zigTypeTag(zcu) == .Vector) {
2543 if (ty.zigTypeTag(zcu) == .vector) {
25442544 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
25452545 const scalar_ty = ty.scalarType(zcu);
25462546 for (result_data, 0..) |*scalar, i| {
......@@ -2588,7 +2588,7 @@ pub fn shlWithOverflow(
25882588 allocator: Allocator,
25892589 pt: Zcu.PerThread,
25902590) !OverflowArithmeticResult {
2591 if (ty.zigTypeTag(pt.zcu) == .Vector) {
2591 if (ty.zigTypeTag(pt.zcu) == .vector) {
25922592 const vec_len = ty.vectorLen(pt.zcu);
25932593 const overflowed_data = try allocator.alloc(InternPool.Index, vec_len);
25942594 const result_data = try allocator.alloc(InternPool.Index, vec_len);
......@@ -2653,7 +2653,7 @@ pub fn shlSat(
26532653 arena: Allocator,
26542654 pt: Zcu.PerThread,
26552655) !Value {
2656 if (ty.zigTypeTag(pt.zcu) == .Vector) {
2656 if (ty.zigTypeTag(pt.zcu) == .vector) {
26572657 const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
26582658 const scalar_ty = ty.scalarType(pt.zcu);
26592659 for (result_data, 0..) |*scalar, i| {
......@@ -2704,7 +2704,7 @@ pub fn shlTrunc(
27042704 arena: Allocator,
27052705 pt: Zcu.PerThread,
27062706) !Value {
2707 if (ty.zigTypeTag(pt.zcu) == .Vector) {
2707 if (ty.zigTypeTag(pt.zcu) == .vector) {
27082708 const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
27092709 const scalar_ty = ty.scalarType(pt.zcu);
27102710 for (result_data, 0..) |*scalar, i| {
......@@ -2734,7 +2734,7 @@ pub fn shlTruncScalar(
27342734}
27352735
27362736pub fn shr(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
2737 if (ty.zigTypeTag(pt.zcu) == .Vector) {
2737 if (ty.zigTypeTag(pt.zcu) == .vector) {
27382738 const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
27392739 const scalar_ty = ty.scalarType(pt.zcu);
27402740 for (result_data, 0..) |*scalar, i| {
......@@ -2789,7 +2789,7 @@ pub fn floatNeg(
27892789 pt: Zcu.PerThread,
27902790) !Value {
27912791 const zcu = pt.zcu;
2792 if (float_type.zigTypeTag(zcu) == .Vector) {
2792 if (float_type.zigTypeTag(zcu) == .vector) {
27932793 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
27942794 const scalar_ty = float_type.scalarType(zcu);
27952795 for (result_data, 0..) |*scalar, i| {
......@@ -2829,7 +2829,7 @@ pub fn floatAdd(
28292829 pt: Zcu.PerThread,
28302830) !Value {
28312831 const zcu = pt.zcu;
2832 if (float_type.zigTypeTag(zcu) == .Vector) {
2832 if (float_type.zigTypeTag(zcu) == .vector) {
28332833 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
28342834 const scalar_ty = float_type.scalarType(zcu);
28352835 for (result_data, 0..) |*scalar, i| {
......@@ -2875,7 +2875,7 @@ pub fn floatSub(
28752875 pt: Zcu.PerThread,
28762876) !Value {
28772877 const zcu = pt.zcu;
2878 if (float_type.zigTypeTag(zcu) == .Vector) {
2878 if (float_type.zigTypeTag(zcu) == .vector) {
28792879 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
28802880 const scalar_ty = float_type.scalarType(zcu);
28812881 for (result_data, 0..) |*scalar, i| {
......@@ -2920,7 +2920,7 @@ pub fn floatDiv(
29202920 arena: Allocator,
29212921 pt: Zcu.PerThread,
29222922) !Value {
2923 if (float_type.zigTypeTag(pt.zcu) == .Vector) {
2923 if (float_type.zigTypeTag(pt.zcu) == .vector) {
29242924 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
29252925 const scalar_ty = float_type.scalarType(pt.zcu);
29262926 for (result_data, 0..) |*scalar, i| {
......@@ -2965,7 +2965,7 @@ pub fn floatDivFloor(
29652965 arena: Allocator,
29662966 pt: Zcu.PerThread,
29672967) !Value {
2968 if (float_type.zigTypeTag(pt.zcu) == .Vector) {
2968 if (float_type.zigTypeTag(pt.zcu) == .vector) {
29692969 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
29702970 const scalar_ty = float_type.scalarType(pt.zcu);
29712971 for (result_data, 0..) |*scalar, i| {
......@@ -3010,7 +3010,7 @@ pub fn floatDivTrunc(
30103010 arena: Allocator,
30113011 pt: Zcu.PerThread,
30123012) !Value {
3013 if (float_type.zigTypeTag(pt.zcu) == .Vector) {
3013 if (float_type.zigTypeTag(pt.zcu) == .vector) {
30143014 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
30153015 const scalar_ty = float_type.scalarType(pt.zcu);
30163016 for (result_data, 0..) |*scalar, i| {
......@@ -3056,7 +3056,7 @@ pub fn floatMul(
30563056 pt: Zcu.PerThread,
30573057) !Value {
30583058 const zcu = pt.zcu;
3059 if (float_type.zigTypeTag(zcu) == .Vector) {
3059 if (float_type.zigTypeTag(zcu) == .vector) {
30603060 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
30613061 const scalar_ty = float_type.scalarType(zcu);
30623062 for (result_data, 0..) |*scalar, i| {
......@@ -3095,7 +3095,7 @@ pub fn floatMulScalar(
30953095}
30963096
30973097pub fn sqrt(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
3098 if (float_type.zigTypeTag(pt.zcu) == .Vector) {
3098 if (float_type.zigTypeTag(pt.zcu) == .vector) {
30993099 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
31003100 const scalar_ty = float_type.scalarType(pt.zcu);
31013101 for (result_data, 0..) |*scalar, i| {
......@@ -3129,7 +3129,7 @@ pub fn sqrtScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Err
31293129
31303130pub fn sin(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
31313131 const zcu = pt.zcu;
3132 if (float_type.zigTypeTag(zcu) == .Vector) {
3132 if (float_type.zigTypeTag(zcu) == .vector) {
31333133 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
31343134 const scalar_ty = float_type.scalarType(zcu);
31353135 for (result_data, 0..) |*scalar, i| {
......@@ -3163,7 +3163,7 @@ pub fn sinScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Erro
31633163
31643164pub fn cos(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
31653165 const zcu = pt.zcu;
3166 if (float_type.zigTypeTag(zcu) == .Vector) {
3166 if (float_type.zigTypeTag(zcu) == .vector) {
31673167 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
31683168 const scalar_ty = float_type.scalarType(zcu);
31693169 for (result_data, 0..) |*scalar, i| {
......@@ -3197,7 +3197,7 @@ pub fn cosScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Erro
31973197
31983198pub fn tan(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
31993199 const zcu = pt.zcu;
3200 if (float_type.zigTypeTag(zcu) == .Vector) {
3200 if (float_type.zigTypeTag(zcu) == .vector) {
32013201 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
32023202 const scalar_ty = float_type.scalarType(zcu);
32033203 for (result_data, 0..) |*scalar, i| {
......@@ -3231,7 +3231,7 @@ pub fn tanScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Erro
32313231
32323232pub fn exp(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
32333233 const zcu = pt.zcu;
3234 if (float_type.zigTypeTag(zcu) == .Vector) {
3234 if (float_type.zigTypeTag(zcu) == .vector) {
32353235 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
32363236 const scalar_ty = float_type.scalarType(zcu);
32373237 for (result_data, 0..) |*scalar, i| {
......@@ -3265,7 +3265,7 @@ pub fn expScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Erro
32653265
32663266pub fn exp2(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
32673267 const zcu = pt.zcu;
3268 if (float_type.zigTypeTag(zcu) == .Vector) {
3268 if (float_type.zigTypeTag(zcu) == .vector) {
32693269 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
32703270 const scalar_ty = float_type.scalarType(zcu);
32713271 for (result_data, 0..) |*scalar, i| {
......@@ -3299,7 +3299,7 @@ pub fn exp2Scalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Err
32993299
33003300pub fn log(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
33013301 const zcu = pt.zcu;
3302 if (float_type.zigTypeTag(zcu) == .Vector) {
3302 if (float_type.zigTypeTag(zcu) == .vector) {
33033303 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
33043304 const scalar_ty = float_type.scalarType(zcu);
33053305 for (result_data, 0..) |*scalar, i| {
......@@ -3333,7 +3333,7 @@ pub fn logScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Erro
33333333
33343334pub fn log2(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
33353335 const zcu = pt.zcu;
3336 if (float_type.zigTypeTag(zcu) == .Vector) {
3336 if (float_type.zigTypeTag(zcu) == .vector) {
33373337 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
33383338 const scalar_ty = float_type.scalarType(zcu);
33393339 for (result_data, 0..) |*scalar, i| {
......@@ -3367,7 +3367,7 @@ pub fn log2Scalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Err
33673367
33683368pub fn log10(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
33693369 const zcu = pt.zcu;
3370 if (float_type.zigTypeTag(zcu) == .Vector) {
3370 if (float_type.zigTypeTag(zcu) == .vector) {
33713371 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
33723372 const scalar_ty = float_type.scalarType(zcu);
33733373 for (result_data, 0..) |*scalar, i| {
......@@ -3401,7 +3401,7 @@ pub fn log10Scalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Er
34013401
34023402pub fn abs(val: Value, ty: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
34033403 const zcu = pt.zcu;
3404 if (ty.zigTypeTag(zcu) == .Vector) {
3404 if (ty.zigTypeTag(zcu) == .vector) {
34053405 const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(zcu));
34063406 const scalar_ty = ty.scalarType(zcu);
34073407 for (result_data, 0..) |*scalar, i| {
......@@ -3419,21 +3419,21 @@ pub fn abs(val: Value, ty: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
34193419pub fn absScalar(val: Value, ty: Type, pt: Zcu.PerThread, arena: Allocator) Allocator.Error!Value {
34203420 const zcu = pt.zcu;
34213421 switch (ty.zigTypeTag(zcu)) {
3422 .Int => {
3422 .int => {
34233423 var buffer: Value.BigIntSpace = undefined;
34243424 var operand_bigint = try val.toBigInt(&buffer, zcu).toManaged(arena);
34253425 operand_bigint.abs();
34263426
34273427 return pt.intValue_big(try ty.toUnsigned(pt), operand_bigint.toConst());
34283428 },
3429 .ComptimeInt => {
3429 .comptime_int => {
34303430 var buffer: Value.BigIntSpace = undefined;
34313431 var operand_bigint = try val.toBigInt(&buffer, zcu).toManaged(arena);
34323432 operand_bigint.abs();
34333433
34343434 return pt.intValue_big(ty, operand_bigint.toConst());
34353435 },
3436 .ComptimeFloat, .Float => {
3436 .comptime_float, .float => {
34373437 const target = zcu.getTarget();
34383438 const storage: InternPool.Key.Float.Storage = switch (ty.floatBits(target)) {
34393439 16 => .{ .f16 = @abs(val.toFloat(f16, zcu)) },
......@@ -3454,7 +3454,7 @@ pub fn absScalar(val: Value, ty: Type, pt: Zcu.PerThread, arena: Allocator) Allo
34543454
34553455pub fn floor(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
34563456 const zcu = pt.zcu;
3457 if (float_type.zigTypeTag(zcu) == .Vector) {
3457 if (float_type.zigTypeTag(zcu) == .vector) {
34583458 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
34593459 const scalar_ty = float_type.scalarType(zcu);
34603460 for (result_data, 0..) |*scalar, i| {
......@@ -3488,7 +3488,7 @@ pub fn floorScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Er
34883488
34893489pub fn ceil(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
34903490 const zcu = pt.zcu;
3491 if (float_type.zigTypeTag(zcu) == .Vector) {
3491 if (float_type.zigTypeTag(zcu) == .vector) {
34923492 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
34933493 const scalar_ty = float_type.scalarType(zcu);
34943494 for (result_data, 0..) |*scalar, i| {
......@@ -3522,7 +3522,7 @@ pub fn ceilScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Err
35223522
35233523pub fn round(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
35243524 const zcu = pt.zcu;
3525 if (float_type.zigTypeTag(zcu) == .Vector) {
3525 if (float_type.zigTypeTag(zcu) == .vector) {
35263526 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
35273527 const scalar_ty = float_type.scalarType(zcu);
35283528 for (result_data, 0..) |*scalar, i| {
......@@ -3556,7 +3556,7 @@ pub fn roundScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Er
35563556
35573557pub fn trunc(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
35583558 const zcu = pt.zcu;
3559 if (float_type.zigTypeTag(zcu) == .Vector) {
3559 if (float_type.zigTypeTag(zcu) == .vector) {
35603560 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
35613561 const scalar_ty = float_type.scalarType(zcu);
35623562 for (result_data, 0..) |*scalar, i| {
......@@ -3597,7 +3597,7 @@ pub fn mulAdd(
35973597 pt: Zcu.PerThread,
35983598) !Value {
35993599 const zcu = pt.zcu;
3600 if (float_type.zigTypeTag(zcu) == .Vector) {
3600 if (float_type.zigTypeTag(zcu) == .vector) {
36013601 const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
36023602 const scalar_ty = float_type.scalarType(zcu);
36033603 for (result_data, 0..) |*scalar, i| {
......@@ -3720,7 +3720,7 @@ pub fn ptrOptPayload(parent_ptr: Value, pt: Zcu.PerThread) !Value {
37203720 const opt_ty = parent_ptr_ty.childType(zcu);
37213721
37223722 assert(parent_ptr_ty.ptrSize(zcu) == .One);
3723 assert(opt_ty.zigTypeTag(zcu) == .Optional);
3723 assert(opt_ty.zigTypeTag(zcu) == .optional);
37243724
37253725 const result_ty = try pt.ptrTypeSema(info: {
37263726 var new = parent_ptr_ty.ptrInfo(zcu);
......@@ -3754,7 +3754,7 @@ pub fn ptrEuPayload(parent_ptr: Value, pt: Zcu.PerThread) !Value {
37543754 const eu_ty = parent_ptr_ty.childType(zcu);
37553755
37563756 assert(parent_ptr_ty.ptrSize(zcu) == .One);
3757 assert(eu_ty.zigTypeTag(zcu) == .ErrorUnion);
3757 assert(eu_ty.zigTypeTag(zcu) == .error_union);
37583758
37593759 const result_ty = try pt.ptrTypeSema(info: {
37603760 var new = parent_ptr_ty.ptrInfo(zcu);
......@@ -3789,7 +3789,7 @@ pub fn ptrField(parent_ptr: Value, field_idx: u32, pt: Zcu.PerThread) !Value {
37893789 // Exiting this `switch` indicates that the `field` pointer representation should be used.
37903790 // `field_align` may be `.none` to represent the natural alignment of `field_ty`, but is not necessarily.
37913791 const field_ty: Type, const field_align: InternPool.Alignment = switch (aggregate_ty.zigTypeTag(zcu)) {
3792 .Struct => field: {
3792 .@"struct" => field: {
37933793 const field_ty = aggregate_ty.fieldType(field_idx, zcu);
37943794 switch (aggregate_ty.containerLayout(zcu)) {
37953795 .auto => break :field .{ field_ty, try aggregate_ty.fieldAlignmentSema(field_idx, pt) },
......@@ -3839,7 +3839,7 @@ pub fn ptrField(parent_ptr: Value, field_idx: u32, pt: Zcu.PerThread) !Value {
38393839 },
38403840 }
38413841 },
3842 .Union => field: {
3842 .@"union" => field: {
38433843 const union_obj = zcu.typeToUnion(aggregate_ty).?;
38443844 const field_ty = Type.fromInterned(union_obj.field_types.get(&zcu.intern_pool)[field_idx]);
38453845 switch (aggregate_ty.containerLayout(zcu)) {
......@@ -3887,7 +3887,7 @@ pub fn ptrField(parent_ptr: Value, field_idx: u32, pt: Zcu.PerThread) !Value {
38873887 },
38883888 }
38893889 },
3890 .Pointer => field_ty: {
3890 .pointer => field_ty: {
38913891 assert(aggregate_ty.isSlice(zcu));
38923892 break :field_ty switch (field_idx) {
38933893 Value.slice_ptr_index => .{ aggregate_ty.slicePtrFieldType(zcu), Type.usize.abiAlignment(zcu) },
......@@ -3944,7 +3944,7 @@ pub fn ptrElem(orig_parent_ptr: Value, field_idx: u64, pt: Zcu.PerThread) !Value
39443944
39453945 if (result_ty.ptrInfo(zcu).packed_offset.host_size != 0) {
39463946 // Since we have a bit-pointer, the pointer address should be unchanged.
3947 assert(elem_ty.zigTypeTag(zcu) == .Vector);
3947 assert(elem_ty.zigTypeTag(zcu) == .vector);
39483948 return pt.getCoerced(parent_ptr, result_ty);
39493949 }
39503950
......@@ -3955,8 +3955,8 @@ pub fn ptrElem(orig_parent_ptr: Value, field_idx: u64, pt: Zcu.PerThread) !Value
39553955
39563956 const strat: PtrStrat = switch (parent_ptr_ty.ptrSize(zcu)) {
39573957 .One => switch (elem_ty.zigTypeTag(zcu)) {
3958 .Vector => .{ .offset = field_idx * @divExact(try elem_ty.childType(zcu).bitSizeSema(pt), 8) },
3959 .Array => strat: {
3958 .vector => .{ .offset = field_idx * @divExact(try elem_ty.childType(zcu).bitSizeSema(pt), 8) },
3959 .array => strat: {
39603960 const arr_elem_ty = elem_ty.childType(zcu);
39613961 if (try arr_elem_ty.comptimeOnlySema(pt)) {
39623962 break :strat .{ .elem_ptr = arr_elem_ty };
......@@ -4178,19 +4178,19 @@ pub fn pointerDerivationAdvanced(ptr_val: Value, arena: Allocator, pt: Zcu.PerTh
41784178 const base_ptr_ty = base_ptr.typeOf(zcu);
41794179 const agg_ty = base_ptr_ty.childType(zcu);
41804180 const field_ty, const field_align = switch (agg_ty.zigTypeTag(zcu)) {
4181 .Struct => .{ agg_ty.fieldType(@intCast(field.index), zcu), try agg_ty.fieldAlignmentInner(
4181 .@"struct" => .{ agg_ty.fieldType(@intCast(field.index), zcu), try agg_ty.fieldAlignmentInner(
41824182 @intCast(field.index),
41834183 if (have_sema) .sema else .normal,
41844184 pt.zcu,
41854185 if (have_sema) pt.tid else {},
41864186 ) },
4187 .Union => .{ agg_ty.unionFieldTypeByIndex(@intCast(field.index), zcu), try agg_ty.fieldAlignmentInner(
4187 .@"union" => .{ agg_ty.unionFieldTypeByIndex(@intCast(field.index), zcu), try agg_ty.fieldAlignmentInner(
41884188 @intCast(field.index),
41894189 if (have_sema) .sema else .normal,
41904190 pt.zcu,
41914191 if (have_sema) pt.tid else {},
41924192 ) },
4193 .Pointer => .{ switch (field.index) {
4193 .pointer => .{ switch (field.index) {
41944194 Value.slice_ptr_index => agg_ty.slicePtrFieldType(zcu),
41954195 Value.slice_len_index => Type.usize,
41964196 else => unreachable,
......@@ -4268,31 +4268,31 @@ pub fn pointerDerivationAdvanced(ptr_val: Value, arena: Allocator, pt: Zcu.PerTh
42684268 break;
42694269 }
42704270 switch (cur_ty.zigTypeTag(zcu)) {
4271 .NoReturn,
4272 .Type,
4273 .ComptimeInt,
4274 .ComptimeFloat,
4275 .Null,
4276 .Undefined,
4277 .EnumLiteral,
4278 .Opaque,
4279 .Fn,
4280 .ErrorUnion,
4281 .Int,
4282 .Float,
4283 .Bool,
4284 .Void,
4285 .Pointer,
4286 .ErrorSet,
4287 .AnyFrame,
4288 .Frame,
4289 .Enum,
4290 .Vector,
4291 .Optional,
4292 .Union,
4271 .noreturn,
4272 .type,
4273 .comptime_int,
4274 .comptime_float,
4275 .null,
4276 .undefined,
4277 .enum_literal,
4278 .@"opaque",
4279 .@"fn",
4280 .error_union,
4281 .int,
4282 .float,
4283 .bool,
4284 .void,
4285 .pointer,
4286 .error_set,
4287 .@"anyframe",
4288 .frame,
4289 .@"enum",
4290 .vector,
4291 .optional,
4292 .@"union",
42934293 => break,
42944294
4295 .Array => {
4295 .array => {
42964296 const elem_ty = cur_ty.childType(zcu);
42974297 const elem_size = elem_ty.abiSize(zcu);
42984298 const start_idx = cur_offset / elem_size;
......@@ -4321,7 +4321,7 @@ pub fn pointerDerivationAdvanced(ptr_val: Value, arena: Allocator, pt: Zcu.PerTh
43214321 break;
43224322 }
43234323 },
4324 .Struct => switch (cur_ty.containerLayout(zcu)) {
4324 .@"struct" => switch (cur_ty.containerLayout(zcu)) {
43254325 .auto, .@"packed" => break,
43264326 .@"extern" => for (0..cur_ty.structFieldCount(zcu)) |field_idx| {
43274327 const field_ty = cur_ty.fieldType(field_idx, zcu);
src/Zcu.zig+4-4
......@@ -43,9 +43,9 @@ const dev = @import("dev.zig");
4343comptime {
4444 @setEvalBranchQuota(4000);
4545 for (
46 @typeInfo(Zir.Inst.Ref).Enum.fields,
47 @typeInfo(Air.Inst.Ref).Enum.fields,
48 @typeInfo(InternPool.Index).Enum.fields,
46 @typeInfo(Zir.Inst.Ref).@"enum".fields,
47 @typeInfo(Air.Inst.Ref).@"enum".fields,
48 @typeInfo(InternPool.Index).@"enum".fields,
4949 ) |zir_field, air_field, ip_field| {
5050 assert(mem.eql(u8, zir_field.name, ip_field.name));
5151 assert(mem.eql(u8, air_field.name, ip_field.name));
......@@ -246,7 +246,7 @@ pub const PanicId = enum {
246246 memcpy_alias,
247247 noreturn_returned,
248248
249 pub const len = @typeInfo(PanicId).Enum.fields.len;
249 pub const len = @typeInfo(PanicId).@"enum".fields.len;
250250};
251251
252252pub const GlobalErrorSet = std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void);
src/Zcu/PerThread.zig+7-7
......@@ -921,7 +921,7 @@ fn createFileRootStruct(
921921 assert(!small.has_captures_len);
922922 assert(!small.has_backing_int);
923923 assert(small.layout == .auto);
924 var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).Struct.fields.len;
924 var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).@"struct".fields.len;
925925 const fields_len = if (small.has_fields_len) blk: {
926926 const fields_len = file.zir.extra[extra_index];
927927 extra_index += 1;
......@@ -1005,7 +1005,7 @@ fn updateFileNamespace(pt: Zcu.PerThread, file_index: Zcu.File.Index) Allocator.
10051005 const extended = file.zir.instructions.items(.data)[@intFromEnum(Zir.Inst.Index.main_struct_inst)].extended;
10061006 const small: Zir.Inst.StructDecl.Small = @bitCast(extended.small);
10071007
1008 var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).Struct.fields.len;
1008 var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).@"struct".fields.len;
10091009 extra_index += @intFromBool(small.has_fields_len);
10101010 const decls_len = if (small.has_decls_len) blk: {
10111011 const decls_len = file.zir.extra[extra_index];
......@@ -2080,7 +2080,7 @@ fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index) Zcu.SemaError!
20802080 func.setCallsOrAwaitsErrorableFn(ip, false);
20812081
20822082 // First few indexes of extra are reserved and set at the end.
2083 const reserved_count = @typeInfo(Air.ExtraIndex).Enum.fields.len;
2083 const reserved_count = @typeInfo(Air.ExtraIndex).@"enum".fields.len;
20842084 try sema.air_extra.ensureTotalCapacity(gpa, reserved_count);
20852085 sema.air_extra.items.len += reserved_count;
20862086
......@@ -2204,7 +2204,7 @@ fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index) Zcu.SemaError!
22042204 }
22052205
22062206 // Copy the block into place and mark that as the main block.
2207 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len +
2207 try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len +
22082208 inner_block.instructions.items.len);
22092209 const main_block_index = sema.addExtraAssumeCapacity(Air.Block{
22102210 .body_len = @intCast(inner_block.instructions.items.len),
......@@ -2405,7 +2405,7 @@ fn processExportsInner(
24052405 .resolved => |r| Value.fromInterned(r.val),
24062406 };
24072407 // If the value is a function, we also need to check if that function succeeded analysis.
2408 if (val.typeOf(zcu).zigTypeTag(zcu) == .Fn) {
2408 if (val.typeOf(zcu).zigTypeTag(zcu) == .@"fn") {
24092409 const func_unit = AnalUnit.wrap(.{ .func = val.toIntern() });
24102410 if (zcu.failed_analysis.contains(func_unit)) break :failed true;
24112411 if (zcu.transitive_failed_analysis.contains(func_unit)) break :failed true;
......@@ -2869,7 +2869,7 @@ pub fn errorSetFromUnsortedNames(
28692869/// Supports only pointers, not pointer-like optionals.
28702870pub fn ptrIntValue(pt: Zcu.PerThread, ty: Type, x: u64) Allocator.Error!Value {
28712871 const zcu = pt.zcu;
2872 assert(ty.zigTypeTag(zcu) == .Pointer and !ty.isSlice(zcu));
2872 assert(ty.zigTypeTag(zcu) == .pointer and !ty.isSlice(zcu));
28732873 assert(x != 0 or ty.isAllowzeroPtr(zcu));
28742874 return Value.fromInterned(try pt.intern(.{ .ptr = .{
28752875 .ty = ty.toIntern(),
......@@ -2882,7 +2882,7 @@ pub fn ptrIntValue(pt: Zcu.PerThread, ty: Type, x: u64) Allocator.Error!Value {
28822882pub fn enumValue(pt: Zcu.PerThread, ty: Type, tag_int: InternPool.Index) Allocator.Error!Value {
28832883 if (std.debug.runtime_safety) {
28842884 const tag = ty.zigTypeTag(pt.zcu);
2885 assert(tag == .Enum);
2885 assert(tag == .@"enum");
28862886 }
28872887 return Value.fromInterned(try pt.intern(.{ .enum_tag = .{
28882888 .ty = ty.toIntern(),
src/arch/aarch64/CodeGen.zig+56-56
......@@ -1324,7 +1324,7 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
13241324 .compare_flags => |cond| break :result MCValue{ .compare_flags = cond.negate() },
13251325 else => {
13261326 switch (operand_ty.zigTypeTag(zcu)) {
1327 .Bool => {
1327 .bool => {
13281328 // TODO convert this to mvn + and
13291329 const op_reg = switch (operand) {
13301330 .register => |r| r,
......@@ -1355,8 +1355,8 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
13551355
13561356 break :result MCValue{ .register = dest_reg };
13571357 },
1358 .Vector => return self.fail("TODO bitwise not for vectors", .{}),
1359 .Int => {
1358 .vector => return self.fail("TODO bitwise not for vectors", .{}),
1359 .int => {
13601360 const int_info = operand_ty.intInfo(zcu);
13611361 if (int_info.bits <= 64) {
13621362 const op_reg = switch (operand) {
......@@ -1412,9 +1412,9 @@ fn minMax(
14121412 const pt = self.pt;
14131413 const zcu = pt.zcu;
14141414 switch (lhs_ty.zigTypeTag(zcu)) {
1415 .Float => return self.fail("TODO ARM min/max on floats", .{}),
1416 .Vector => return self.fail("TODO ARM min/max on vectors", .{}),
1417 .Int => {
1415 .float => return self.fail("TODO ARM min/max on floats", .{}),
1416 .vector => return self.fail("TODO ARM min/max on vectors", .{}),
1417 .int => {
14181418 assert(lhs_ty.eql(rhs_ty, zcu));
14191419 const int_info = lhs_ty.intInfo(zcu);
14201420 if (int_info.bits <= 64) {
......@@ -1903,9 +1903,9 @@ fn addSub(
19031903 const pt = self.pt;
19041904 const zcu = pt.zcu;
19051905 switch (lhs_ty.zigTypeTag(zcu)) {
1906 .Float => return self.fail("TODO binary operations on floats", .{}),
1907 .Vector => return self.fail("TODO binary operations on vectors", .{}),
1908 .Int => {
1906 .float => return self.fail("TODO binary operations on floats", .{}),
1907 .vector => return self.fail("TODO binary operations on vectors", .{}),
1908 .int => {
19091909 assert(lhs_ty.eql(rhs_ty, zcu));
19101910 const int_info = lhs_ty.intInfo(zcu);
19111911 if (int_info.bits <= 64) {
......@@ -1965,8 +1965,8 @@ fn mul(
19651965 const pt = self.pt;
19661966 const zcu = pt.zcu;
19671967 switch (lhs_ty.zigTypeTag(zcu)) {
1968 .Vector => return self.fail("TODO binary operations on vectors", .{}),
1969 .Int => {
1968 .vector => return self.fail("TODO binary operations on vectors", .{}),
1969 .int => {
19701970 assert(lhs_ty.eql(rhs_ty, zcu));
19711971 const int_info = lhs_ty.intInfo(zcu);
19721972 if (int_info.bits <= 64) {
......@@ -1998,8 +1998,8 @@ fn divFloat(
19981998 const pt = self.pt;
19991999 const zcu = pt.zcu;
20002000 switch (lhs_ty.zigTypeTag(zcu)) {
2001 .Float => return self.fail("TODO div_float", .{}),
2002 .Vector => return self.fail("TODO div_float on vectors", .{}),
2001 .float => return self.fail("TODO div_float", .{}),
2002 .vector => return self.fail("TODO div_float on vectors", .{}),
20032003 else => unreachable,
20042004 }
20052005}
......@@ -2015,9 +2015,9 @@ fn divTrunc(
20152015 const pt = self.pt;
20162016 const zcu = pt.zcu;
20172017 switch (lhs_ty.zigTypeTag(zcu)) {
2018 .Float => return self.fail("TODO div on floats", .{}),
2019 .Vector => return self.fail("TODO div on vectors", .{}),
2020 .Int => {
2018 .float => return self.fail("TODO div on floats", .{}),
2019 .vector => return self.fail("TODO div on vectors", .{}),
2020 .int => {
20212021 assert(lhs_ty.eql(rhs_ty, zcu));
20222022 const int_info = lhs_ty.intInfo(zcu);
20232023 if (int_info.bits <= 64) {
......@@ -2050,9 +2050,9 @@ fn divFloor(
20502050 const pt = self.pt;
20512051 const zcu = pt.zcu;
20522052 switch (lhs_ty.zigTypeTag(zcu)) {
2053 .Float => return self.fail("TODO div on floats", .{}),
2054 .Vector => return self.fail("TODO div on vectors", .{}),
2055 .Int => {
2053 .float => return self.fail("TODO div on floats", .{}),
2054 .vector => return self.fail("TODO div on vectors", .{}),
2055 .int => {
20562056 assert(lhs_ty.eql(rhs_ty, zcu));
20572057 const int_info = lhs_ty.intInfo(zcu);
20582058 if (int_info.bits <= 64) {
......@@ -2084,9 +2084,9 @@ fn divExact(
20842084 const pt = self.pt;
20852085 const zcu = pt.zcu;
20862086 switch (lhs_ty.zigTypeTag(zcu)) {
2087 .Float => return self.fail("TODO div on floats", .{}),
2088 .Vector => return self.fail("TODO div on vectors", .{}),
2089 .Int => {
2087 .float => return self.fail("TODO div on floats", .{}),
2088 .vector => return self.fail("TODO div on vectors", .{}),
2089 .int => {
20902090 assert(lhs_ty.eql(rhs_ty, zcu));
20912091 const int_info = lhs_ty.intInfo(zcu);
20922092 if (int_info.bits <= 64) {
......@@ -2121,9 +2121,9 @@ fn rem(
21212121 const pt = self.pt;
21222122 const zcu = pt.zcu;
21232123 switch (lhs_ty.zigTypeTag(zcu)) {
2124 .Float => return self.fail("TODO rem/zcu on floats", .{}),
2125 .Vector => return self.fail("TODO rem/zcu on vectors", .{}),
2126 .Int => {
2124 .float => return self.fail("TODO rem/zcu on floats", .{}),
2125 .vector => return self.fail("TODO rem/zcu on vectors", .{}),
2126 .int => {
21272127 assert(lhs_ty.eql(rhs_ty, zcu));
21282128 const int_info = lhs_ty.intInfo(zcu);
21292129 if (int_info.bits <= 64) {
......@@ -2193,9 +2193,9 @@ fn modulo(
21932193 const pt = self.pt;
21942194 const zcu = pt.zcu;
21952195 switch (lhs_ty.zigTypeTag(zcu)) {
2196 .Float => return self.fail("TODO zcu on floats", .{}),
2197 .Vector => return self.fail("TODO zcu on vectors", .{}),
2198 .Int => return self.fail("TODO zcu on ints", .{}),
2196 .float => return self.fail("TODO zcu on floats", .{}),
2197 .vector => return self.fail("TODO zcu on vectors", .{}),
2198 .int => return self.fail("TODO zcu on ints", .{}),
21992199 else => unreachable,
22002200 }
22012201}
......@@ -2212,8 +2212,8 @@ fn wrappingArithmetic(
22122212 const pt = self.pt;
22132213 const zcu = pt.zcu;
22142214 switch (lhs_ty.zigTypeTag(zcu)) {
2215 .Vector => return self.fail("TODO binary operations on vectors", .{}),
2216 .Int => {
2215 .vector => return self.fail("TODO binary operations on vectors", .{}),
2216 .int => {
22172217 const int_info = lhs_ty.intInfo(zcu);
22182218 if (int_info.bits <= 64) {
22192219 // Generate an add/sub/mul
......@@ -2248,8 +2248,8 @@ fn bitwise(
22482248 const pt = self.pt;
22492249 const zcu = pt.zcu;
22502250 switch (lhs_ty.zigTypeTag(zcu)) {
2251 .Vector => return self.fail("TODO binary operations on vectors", .{}),
2252 .Int => {
2251 .vector => return self.fail("TODO binary operations on vectors", .{}),
2252 .int => {
22532253 assert(lhs_ty.eql(rhs_ty, zcu));
22542254 const int_info = lhs_ty.intInfo(zcu);
22552255 if (int_info.bits <= 64) {
......@@ -2284,8 +2284,8 @@ fn shiftExact(
22842284 const pt = self.pt;
22852285 const zcu = pt.zcu;
22862286 switch (lhs_ty.zigTypeTag(zcu)) {
2287 .Vector => return self.fail("TODO binary operations on vectors", .{}),
2288 .Int => {
2287 .vector => return self.fail("TODO binary operations on vectors", .{}),
2288 .int => {
22892289 const int_info = lhs_ty.intInfo(zcu);
22902290 if (int_info.bits <= 64) {
22912291 const rhs_immediate = try rhs_bind.resolveToImmediate(self);
......@@ -2335,8 +2335,8 @@ fn shiftNormal(
23352335 const pt = self.pt;
23362336 const zcu = pt.zcu;
23372337 switch (lhs_ty.zigTypeTag(zcu)) {
2338 .Vector => return self.fail("TODO binary operations on vectors", .{}),
2339 .Int => {
2338 .vector => return self.fail("TODO binary operations on vectors", .{}),
2339 .int => {
23402340 const int_info = lhs_ty.intInfo(zcu);
23412341 if (int_info.bits <= 64) {
23422342 // Generate a shl_exact/shr_exact
......@@ -2376,7 +2376,7 @@ fn booleanOp(
23762376 const pt = self.pt;
23772377 const zcu = pt.zcu;
23782378 switch (lhs_ty.zigTypeTag(zcu)) {
2379 .Bool => {
2379 .bool => {
23802380 assert((try lhs_bind.resolveToImmediate(self)) == null); // should have been handled by Sema
23812381 assert((try rhs_bind.resolveToImmediate(self)) == null); // should have been handled by Sema
23822382
......@@ -2404,7 +2404,7 @@ fn ptrArithmetic(
24042404 const pt = self.pt;
24052405 const zcu = pt.zcu;
24062406 switch (lhs_ty.zigTypeTag(zcu)) {
2407 .Pointer => {
2407 .pointer => {
24082408 assert(rhs_ty.eql(Type.usize, zcu));
24092409
24102410 const ptr_ty = lhs_ty;
......@@ -2539,8 +2539,8 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void {
25392539 const overflow_bit_offset = @as(u32, @intCast(tuple_ty.structFieldOffset(1, zcu)));
25402540
25412541 switch (lhs_ty.zigTypeTag(zcu)) {
2542 .Vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
2543 .Int => {
2542 .vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
2543 .int => {
25442544 assert(lhs_ty.eql(rhs_ty, zcu));
25452545 const int_info = lhs_ty.intInfo(zcu);
25462546 switch (int_info.bits) {
......@@ -2667,8 +2667,8 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
26672667 const overflow_bit_offset = @as(u32, @intCast(tuple_ty.structFieldOffset(1, zcu)));
26682668
26692669 switch (lhs_ty.zigTypeTag(zcu)) {
2670 .Vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
2671 .Int => {
2670 .vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
2671 .int => {
26722672 assert(lhs_ty.eql(rhs_ty, zcu));
26732673 const int_info = lhs_ty.intInfo(zcu);
26742674 if (int_info.bits <= 32) {
......@@ -2892,8 +2892,8 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
28922892 const overflow_bit_offset = @as(u32, @intCast(tuple_ty.structFieldOffset(1, zcu)));
28932893
28942894 switch (lhs_ty.zigTypeTag(zcu)) {
2895 .Vector => return self.fail("TODO implement shl_with_overflow for vectors", .{}),
2896 .Int => {
2895 .vector => return self.fail("TODO implement shl_with_overflow for vectors", .{}),
2896 .int => {
28972897 const int_info = lhs_ty.intInfo(zcu);
28982898 if (int_info.bits <= 64) {
28992899 const stack_offset = try self.allocMem(tuple_size, tuple_align, inst);
......@@ -4279,8 +4279,8 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
42794279 const ip = &zcu.intern_pool;
42804280
42814281 const fn_ty = switch (ty.zigTypeTag(zcu)) {
4282 .Fn => ty,
4283 .Pointer => ty.childType(zcu),
4282 .@"fn" => ty,
4283 .pointer => ty.childType(zcu),
42844284 else => unreachable,
42854285 };
42864286
......@@ -4388,7 +4388,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
43884388 },
43894389 else => return self.fail("TODO implement calling bitcasted functions", .{}),
43904390 } else {
4391 assert(ty.zigTypeTag(zcu) == .Pointer);
4391 assert(ty.zigTypeTag(zcu) == .pointer);
43924392 const mcv = try self.resolveInst(callee);
43934393 try self.genSetReg(ty, .x30, mcv);
43944394
......@@ -4523,7 +4523,7 @@ fn cmp(
45234523 const pt = self.pt;
45244524 const zcu = pt.zcu;
45254525 const int_ty = switch (lhs_ty.zigTypeTag(zcu)) {
4526 .Optional => blk: {
4526 .optional => blk: {
45274527 const payload_ty = lhs_ty.optionalChild(zcu);
45284528 if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
45294529 break :blk Type.u1;
......@@ -4533,12 +4533,12 @@ fn cmp(
45334533 return self.fail("TODO ARM cmp non-pointer optionals", .{});
45344534 }
45354535 },
4536 .Float => return self.fail("TODO ARM cmp floats", .{}),
4537 .Enum => lhs_ty.intTagType(zcu),
4538 .Int => lhs_ty,
4539 .Bool => Type.u1,
4540 .Pointer => Type.usize,
4541 .ErrorSet => Type.u16,
4536 .float => return self.fail("TODO ARM cmp floats", .{}),
4537 .@"enum" => lhs_ty.intTagType(zcu),
4538 .int => lhs_ty,
4539 .bool => Type.u1,
4540 .pointer => Type.usize,
4541 .error_set => Type.u16,
45424542 else => unreachable,
45434543 };
45444544
......@@ -6243,7 +6243,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
62436243 var ncrn: usize = 0; // Next Core Register Number
62446244 var nsaa: u32 = 0; // Next stacked argument address
62456245
6246 if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
6246 if (ret_ty.zigTypeTag(zcu) == .noreturn) {
62476247 result.return_value = .{ .unreach = {} };
62486248 } else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu) and !ret_ty.isError(zcu)) {
62496249 result.return_value = .{ .none = {} };
......@@ -6301,7 +6301,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
63016301 result.stack_align = 16;
63026302 },
63036303 .Unspecified => {
6304 if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
6304 if (ret_ty.zigTypeTag(zcu) == .noreturn) {
63056305 result.return_value = .{ .unreach = {} };
63066306 } else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu) and !ret_ty.isError(zcu)) {
63076307 result.return_value = .{ .none = {} };
src/arch/aarch64/abi.zig+27-27
......@@ -20,7 +20,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
2020
2121 var maybe_float_bits: ?u16 = null;
2222 switch (ty.zigTypeTag(zcu)) {
23 .Struct => {
23 .@"struct" => {
2424 if (ty.containerLayout(zcu) == .@"packed") return .byval;
2525 const float_count = countFloats(ty, zcu, &maybe_float_bits);
2626 if (float_count <= sret_float_count) return .{ .float_array = float_count };
......@@ -30,7 +30,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
3030 if (bit_size > 64) return .double_integer;
3131 return .integer;
3232 },
33 .Union => {
33 .@"union" => {
3434 if (ty.containerLayout(zcu) == .@"packed") return .byval;
3535 const float_count = countFloats(ty, zcu, &maybe_float_bits);
3636 if (float_count <= sret_float_count) return .{ .float_array = float_count };
......@@ -40,35 +40,35 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
4040 if (bit_size > 64) return .double_integer;
4141 return .integer;
4242 },
43 .Int, .Enum, .ErrorSet, .Float, .Bool => return .byval,
44 .Vector => {
43 .int, .@"enum", .error_set, .float, .bool => return .byval,
44 .vector => {
4545 const bit_size = ty.bitSize(zcu);
4646 // TODO is this controlled by a cpu feature?
4747 if (bit_size > 128) return .memory;
4848 return .byval;
4949 },
50 .Optional => {
50 .optional => {
5151 std.debug.assert(ty.isPtrLikeOptional(zcu));
5252 return .byval;
5353 },
54 .Pointer => {
54 .pointer => {
5555 std.debug.assert(!ty.isSlice(zcu));
5656 return .byval;
5757 },
58 .ErrorUnion,
59 .Frame,
60 .AnyFrame,
61 .NoReturn,
62 .Void,
63 .Type,
64 .ComptimeFloat,
65 .ComptimeInt,
66 .Undefined,
67 .Null,
68 .Fn,
69 .Opaque,
70 .EnumLiteral,
71 .Array,
58 .error_union,
59 .frame,
60 .@"anyframe",
61 .noreturn,
62 .void,
63 .type,
64 .comptime_float,
65 .comptime_int,
66 .undefined,
67 .null,
68 .@"fn",
69 .@"opaque",
70 .enum_literal,
71 .array,
7272 => unreachable,
7373 }
7474}
......@@ -79,7 +79,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u8 {
7979 const target = zcu.getTarget();
8080 const invalid = std.math.maxInt(u8);
8181 switch (ty.zigTypeTag(zcu)) {
82 .Union => {
82 .@"union" => {
8383 const union_obj = zcu.typeToUnion(ty).?;
8484 var max_count: u8 = 0;
8585 for (union_obj.field_types.get(ip)) |field_ty| {
......@@ -90,7 +90,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u8 {
9090 }
9191 return max_count;
9292 },
93 .Struct => {
93 .@"struct" => {
9494 const fields_len = ty.structFieldCount(zcu);
9595 var count: u8 = 0;
9696 var i: u32 = 0;
......@@ -103,7 +103,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u8 {
103103 }
104104 return count;
105105 },
106 .Float => {
106 .float => {
107107 const float_bits = maybe_float_bits.* orelse {
108108 maybe_float_bits.* = ty.floatBits(target);
109109 return 1;
......@@ -111,7 +111,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u8 {
111111 if (ty.floatBits(target) == float_bits) return 1;
112112 return invalid;
113113 },
114 .Void => return 0,
114 .void => return 0,
115115 else => return invalid,
116116 }
117117}
......@@ -119,14 +119,14 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u8 {
119119pub fn getFloatArrayType(ty: Type, zcu: *Zcu) ?Type {
120120 const ip = &zcu.intern_pool;
121121 switch (ty.zigTypeTag(zcu)) {
122 .Union => {
122 .@"union" => {
123123 const union_obj = zcu.typeToUnion(ty).?;
124124 for (union_obj.field_types.get(ip)) |field_ty| {
125125 if (getFloatArrayType(Type.fromInterned(field_ty), zcu)) |some| return some;
126126 }
127127 return null;
128128 },
129 .Struct => {
129 .@"struct" => {
130130 const fields_len = ty.structFieldCount(zcu);
131131 var i: u32 = 0;
132132 while (i < fields_len) : (i += 1) {
......@@ -135,7 +135,7 @@ pub fn getFloatArrayType(ty: Type, zcu: *Zcu) ?Type {
135135 }
136136 return null;
137137 },
138 .Float => return ty,
138 .float => return ty,
139139 else => return null,
140140 }
141141}
src/arch/arm/CodeGen.zig+58-58
......@@ -1286,7 +1286,7 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
12861286 .cpsr_flags => |cond| break :result MCValue{ .cpsr_flags = cond.negate() },
12871287 else => {
12881288 switch (operand_ty.zigTypeTag(zcu)) {
1289 .Bool => {
1289 .bool => {
12901290 var op_reg: Register = undefined;
12911291 var dest_reg: Register = undefined;
12921292
......@@ -1316,8 +1316,8 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
13161316
13171317 break :result MCValue{ .register = dest_reg };
13181318 },
1319 .Vector => return self.fail("TODO bitwise not for vectors", .{}),
1320 .Int => {
1319 .vector => return self.fail("TODO bitwise not for vectors", .{}),
1320 .int => {
13211321 const int_info = operand_ty.intInfo(zcu);
13221322 if (int_info.bits <= 32) {
13231323 var op_reg: Register = undefined;
......@@ -1375,9 +1375,9 @@ fn minMax(
13751375 const pt = self.pt;
13761376 const zcu = pt.zcu;
13771377 switch (lhs_ty.zigTypeTag(zcu)) {
1378 .Float => return self.fail("TODO ARM min/max on floats", .{}),
1379 .Vector => return self.fail("TODO ARM min/max on vectors", .{}),
1380 .Int => {
1378 .float => return self.fail("TODO ARM min/max on floats", .{}),
1379 .vector => return self.fail("TODO ARM min/max on vectors", .{}),
1380 .int => {
13811381 assert(lhs_ty.eql(rhs_ty, zcu));
13821382 const int_info = lhs_ty.intInfo(zcu);
13831383 if (int_info.bits <= 32) {
......@@ -1596,8 +1596,8 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void {
15961596 const overflow_bit_offset: u32 = @intCast(tuple_ty.structFieldOffset(1, zcu));
15971597
15981598 switch (lhs_ty.zigTypeTag(zcu)) {
1599 .Vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
1600 .Int => {
1599 .vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
1600 .int => {
16011601 assert(lhs_ty.eql(rhs_ty, zcu));
16021602 const int_info = lhs_ty.intInfo(zcu);
16031603 if (int_info.bits < 32) {
......@@ -1710,8 +1710,8 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
17101710 const overflow_bit_offset: u32 = @intCast(tuple_ty.structFieldOffset(1, zcu));
17111711
17121712 switch (lhs_ty.zigTypeTag(zcu)) {
1713 .Vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
1714 .Int => {
1713 .vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
1714 .int => {
17151715 assert(lhs_ty.eql(rhs_ty, zcu));
17161716 const int_info = lhs_ty.intInfo(zcu);
17171717 if (int_info.bits <= 16) {
......@@ -1873,8 +1873,8 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
18731873 const overflow_bit_offset: u32 = @intCast(tuple_ty.structFieldOffset(1, zcu));
18741874
18751875 switch (lhs_ty.zigTypeTag(zcu)) {
1876 .Vector => return self.fail("TODO implement shl_with_overflow for vectors", .{}),
1877 .Int => {
1876 .vector => return self.fail("TODO implement shl_with_overflow for vectors", .{}),
1877 .int => {
18781878 const int_info = lhs_ty.intInfo(zcu);
18791879 if (int_info.bits <= 32) {
18801880 const stack_offset = try self.allocMem(tuple_size, tuple_align, inst);
......@@ -3021,7 +3021,7 @@ fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {
30213021 const field_ptr = try self.resolveInst(extra.field_ptr);
30223022 const struct_ty = ty_pl.ty.toType().childType(zcu);
30233023
3024 if (struct_ty.zigTypeTag(zcu) == .Union) {
3024 if (struct_ty.zigTypeTag(zcu) == .@"union") {
30253025 return self.fail("TODO implement @fieldParentPtr codegen for unions", .{});
30263026 }
30273027
......@@ -3411,9 +3411,9 @@ fn addSub(
34113411 const pt = self.pt;
34123412 const zcu = pt.zcu;
34133413 switch (lhs_ty.zigTypeTag(zcu)) {
3414 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
3415 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3416 .Int => {
3414 .float => return self.fail("TODO ARM binary operations on floats", .{}),
3415 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3416 .int => {
34173417 assert(lhs_ty.eql(rhs_ty, zcu));
34183418 const int_info = lhs_ty.intInfo(zcu);
34193419 if (int_info.bits <= 32) {
......@@ -3468,9 +3468,9 @@ fn mul(
34683468 const pt = self.pt;
34693469 const zcu = pt.zcu;
34703470 switch (lhs_ty.zigTypeTag(zcu)) {
3471 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
3472 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3473 .Int => {
3471 .float => return self.fail("TODO ARM binary operations on floats", .{}),
3472 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3473 .int => {
34743474 assert(lhs_ty.eql(rhs_ty, zcu));
34753475 const int_info = lhs_ty.intInfo(zcu);
34763476 if (int_info.bits <= 32) {
......@@ -3502,8 +3502,8 @@ fn divFloat(
35023502 const pt = self.pt;
35033503 const zcu = pt.zcu;
35043504 switch (lhs_ty.zigTypeTag(zcu)) {
3505 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
3506 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3505 .float => return self.fail("TODO ARM binary operations on floats", .{}),
3506 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
35073507 else => unreachable,
35083508 }
35093509}
......@@ -3519,9 +3519,9 @@ fn divTrunc(
35193519 const pt = self.pt;
35203520 const zcu = pt.zcu;
35213521 switch (lhs_ty.zigTypeTag(zcu)) {
3522 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
3523 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3524 .Int => {
3522 .float => return self.fail("TODO ARM binary operations on floats", .{}),
3523 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3524 .int => {
35253525 assert(lhs_ty.eql(rhs_ty, zcu));
35263526 const int_info = lhs_ty.intInfo(zcu);
35273527 if (int_info.bits <= 32) {
......@@ -3563,9 +3563,9 @@ fn divFloor(
35633563 const pt = self.pt;
35643564 const zcu = pt.zcu;
35653565 switch (lhs_ty.zigTypeTag(zcu)) {
3566 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
3567 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3568 .Int => {
3566 .float => return self.fail("TODO ARM binary operations on floats", .{}),
3567 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3568 .int => {
35693569 assert(lhs_ty.eql(rhs_ty, zcu));
35703570 const int_info = lhs_ty.intInfo(zcu);
35713571 if (int_info.bits <= 32) {
......@@ -3612,9 +3612,9 @@ fn divExact(
36123612 const pt = self.pt;
36133613 const zcu = pt.zcu;
36143614 switch (lhs_ty.zigTypeTag(zcu)) {
3615 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
3616 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3617 .Int => return self.fail("TODO ARM div_exact", .{}),
3615 .float => return self.fail("TODO ARM binary operations on floats", .{}),
3616 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3617 .int => return self.fail("TODO ARM div_exact", .{}),
36183618 else => unreachable,
36193619 }
36203620}
......@@ -3630,9 +3630,9 @@ fn rem(
36303630 const pt = self.pt;
36313631 const zcu = pt.zcu;
36323632 switch (lhs_ty.zigTypeTag(zcu)) {
3633 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
3634 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3635 .Int => {
3633 .float => return self.fail("TODO ARM binary operations on floats", .{}),
3634 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3635 .int => {
36363636 assert(lhs_ty.eql(rhs_ty, zcu));
36373637 const int_info = lhs_ty.intInfo(zcu);
36383638 if (int_info.bits <= 32) {
......@@ -3700,9 +3700,9 @@ fn modulo(
37003700 const pt = self.pt;
37013701 const zcu = pt.zcu;
37023702 switch (lhs_ty.zigTypeTag(zcu)) {
3703 .Float => return self.fail("TODO ARM binary operations on floats", .{}),
3704 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3705 .Int => return self.fail("TODO ARM zcu", .{}),
3703 .float => return self.fail("TODO ARM binary operations on floats", .{}),
3704 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3705 .int => return self.fail("TODO ARM zcu", .{}),
37063706 else => unreachable,
37073707 }
37083708}
......@@ -3719,8 +3719,8 @@ fn wrappingArithmetic(
37193719 const pt = self.pt;
37203720 const zcu = pt.zcu;
37213721 switch (lhs_ty.zigTypeTag(zcu)) {
3722 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3723 .Int => {
3722 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3723 .int => {
37243724 const int_info = lhs_ty.intInfo(zcu);
37253725 if (int_info.bits <= 32) {
37263726 // Generate an add/sub/mul
......@@ -3758,8 +3758,8 @@ fn bitwise(
37583758 const pt = self.pt;
37593759 const zcu = pt.zcu;
37603760 switch (lhs_ty.zigTypeTag(zcu)) {
3761 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3762 .Int => {
3761 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3762 .int => {
37633763 assert(lhs_ty.eql(rhs_ty, zcu));
37643764 const int_info = lhs_ty.intInfo(zcu);
37653765 if (int_info.bits <= 32) {
......@@ -3804,8 +3804,8 @@ fn shiftExact(
38043804 const pt = self.pt;
38053805 const zcu = pt.zcu;
38063806 switch (lhs_ty.zigTypeTag(zcu)) {
3807 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3808 .Int => {
3807 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3808 .int => {
38093809 const int_info = lhs_ty.intInfo(zcu);
38103810 if (int_info.bits <= 32) {
38113811 const rhs_immediate = try rhs_bind.resolveToImmediate(self);
......@@ -3844,8 +3844,8 @@ fn shiftNormal(
38443844 const pt = self.pt;
38453845 const zcu = pt.zcu;
38463846 switch (lhs_ty.zigTypeTag(zcu)) {
3847 .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3848 .Int => {
3847 .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
3848 .int => {
38493849 const int_info = lhs_ty.intInfo(zcu);
38503850 if (int_info.bits <= 32) {
38513851 // Generate a shl_exact/shr_exact
......@@ -3888,7 +3888,7 @@ fn booleanOp(
38883888 const pt = self.pt;
38893889 const zcu = pt.zcu;
38903890 switch (lhs_ty.zigTypeTag(zcu)) {
3891 .Bool => {
3891 .bool => {
38923892 const lhs_immediate = try lhs_bind.resolveToImmediate(self);
38933893 const rhs_immediate = try rhs_bind.resolveToImmediate(self);
38943894
......@@ -3923,7 +3923,7 @@ fn ptrArithmetic(
39233923 const pt = self.pt;
39243924 const zcu = pt.zcu;
39253925 switch (lhs_ty.zigTypeTag(zcu)) {
3926 .Pointer => {
3926 .pointer => {
39273927 assert(rhs_ty.eql(Type.usize, zcu));
39283928
39293929 const ptr_ty = lhs_ty;
......@@ -4259,8 +4259,8 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
42594259 const ip = &zcu.intern_pool;
42604260
42614261 const fn_ty = switch (ty.zigTypeTag(zcu)) {
4262 .Fn => ty,
4263 .Pointer => ty.childType(zcu),
4262 .@"fn" => ty,
4263 .pointer => ty.childType(zcu),
42644264 else => unreachable,
42654265 };
42664266
......@@ -4337,7 +4337,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
43374337 return self.fail("TODO implement calling bitcasted functions", .{});
43384338 },
43394339 } else {
4340 assert(ty.zigTypeTag(zcu) == .Pointer);
4340 assert(ty.zigTypeTag(zcu) == .pointer);
43414341 const mcv = try self.resolveInst(callee);
43424342
43434343 try self.genSetReg(Type.usize, .lr, mcv);
......@@ -4494,7 +4494,7 @@ fn cmp(
44944494 const pt = self.pt;
44954495 const zcu = pt.zcu;
44964496 const int_ty = switch (lhs_ty.zigTypeTag(zcu)) {
4497 .Optional => blk: {
4497 .optional => blk: {
44984498 const payload_ty = lhs_ty.optionalChild(zcu);
44994499 if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
45004500 break :blk Type.u1;
......@@ -4504,12 +4504,12 @@ fn cmp(
45044504 return self.fail("TODO ARM cmp non-pointer optionals", .{});
45054505 }
45064506 },
4507 .Float => return self.fail("TODO ARM cmp floats", .{}),
4508 .Enum => lhs_ty.intTagType(zcu),
4509 .Int => lhs_ty,
4510 .Bool => Type.u1,
4511 .Pointer => Type.usize,
4512 .ErrorSet => Type.u16,
4507 .float => return self.fail("TODO ARM cmp floats", .{}),
4508 .@"enum" => lhs_ty.intTagType(zcu),
4509 .int => lhs_ty,
4510 .bool => Type.u1,
4511 .pointer => Type.usize,
4512 .error_set => Type.u16,
45134513 else => unreachable,
45144514 };
45154515
......@@ -6211,7 +6211,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
62116211 var ncrn: usize = 0; // Next Core Register Number
62126212 var nsaa: u32 = 0; // Next stacked argument address
62136213
6214 if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
6214 if (ret_ty.zigTypeTag(zcu) == .noreturn) {
62156215 result.return_value = .{ .unreach = {} };
62166216 } else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
62176217 result.return_value = .{ .none = {} };
......@@ -6258,7 +6258,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
62586258 result.stack_align = 8;
62596259 },
62606260 .Unspecified => {
6261 if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
6261 if (ret_ty.zigTypeTag(zcu) == .noreturn) {
62626262 result.return_value = .{ .unreach = {} };
62636263 } else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu) and !ret_ty.isError(zcu)) {
62646264 result.return_value = .{ .none = {} };
src/arch/arm/abi.zig+26-26
......@@ -31,7 +31,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu, ctx: Context) Class {
3131 const max_byval_size = 512;
3232 const ip = &zcu.intern_pool;
3333 switch (ty.zigTypeTag(zcu)) {
34 .Struct => {
34 .@"struct" => {
3535 const bit_size = ty.bitSize(zcu);
3636 if (ty.containerLayout(zcu) == .@"packed") {
3737 if (bit_size > 64) return .memory;
......@@ -53,7 +53,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu, ctx: Context) Class {
5353 }
5454 return Class.arrSize(bit_size, 32);
5555 },
56 .Union => {
56 .@"union" => {
5757 const bit_size = ty.bitSize(zcu);
5858 const union_obj = zcu.typeToUnion(ty).?;
5959 if (union_obj.flagsUnordered(ip).layout == .@"packed") {
......@@ -73,48 +73,48 @@ pub fn classifyType(ty: Type, zcu: *Zcu, ctx: Context) Class {
7373 }
7474 return Class.arrSize(bit_size, 32);
7575 },
76 .Bool, .Float => return .byval,
77 .Int => {
76 .bool, .float => return .byval,
77 .int => {
7878 // TODO this is incorrect for _BitInt(128) but implementing
7979 // this correctly makes implementing compiler-rt impossible.
8080 // const bit_size = ty.bitSize(zcu);
8181 // if (bit_size > 64) return .memory;
8282 return .byval;
8383 },
84 .Enum, .ErrorSet => {
84 .@"enum", .error_set => {
8585 const bit_size = ty.bitSize(zcu);
8686 if (bit_size > 64) return .memory;
8787 return .byval;
8888 },
89 .Vector => {
89 .vector => {
9090 const bit_size = ty.bitSize(zcu);
9191 // TODO is this controlled by a cpu feature?
9292 if (ctx == .ret and bit_size > 128) return .memory;
9393 if (bit_size > 512) return .memory;
9494 return .byval;
9595 },
96 .Optional => {
96 .optional => {
9797 assert(ty.isPtrLikeOptional(zcu));
9898 return .byval;
9999 },
100 .Pointer => {
100 .pointer => {
101101 assert(!ty.isSlice(zcu));
102102 return .byval;
103103 },
104 .ErrorUnion,
105 .Frame,
106 .AnyFrame,
107 .NoReturn,
108 .Void,
109 .Type,
110 .ComptimeFloat,
111 .ComptimeInt,
112 .Undefined,
113 .Null,
114 .Fn,
115 .Opaque,
116 .EnumLiteral,
117 .Array,
104 .error_union,
105 .frame,
106 .@"anyframe",
107 .noreturn,
108 .void,
109 .type,
110 .comptime_float,
111 .comptime_int,
112 .undefined,
113 .null,
114 .@"fn",
115 .@"opaque",
116 .enum_literal,
117 .array,
118118 => unreachable,
119119 }
120120}
......@@ -125,7 +125,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u32 {
125125 const target = zcu.getTarget();
126126 const invalid = std.math.maxInt(u32);
127127 switch (ty.zigTypeTag(zcu)) {
128 .Union => {
128 .@"union" => {
129129 const union_obj = zcu.typeToUnion(ty).?;
130130 var max_count: u32 = 0;
131131 for (union_obj.field_types.get(ip)) |field_ty| {
......@@ -136,7 +136,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u32 {
136136 }
137137 return max_count;
138138 },
139 .Struct => {
139 .@"struct" => {
140140 const fields_len = ty.structFieldCount(zcu);
141141 var count: u32 = 0;
142142 var i: u32 = 0;
......@@ -149,7 +149,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u32 {
149149 }
150150 return count;
151151 },
152 .Float => {
152 .float => {
153153 const float_bits = maybe_float_bits.* orelse {
154154 const float_bits = ty.floatBits(target);
155155 if (float_bits != 32 and float_bits != 64) return invalid;
......@@ -159,7 +159,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u32 {
159159 if (ty.floatBits(target) == float_bits) return 1;
160160 return invalid;
161161 },
162 .Void => return 0,
162 .void => return 0,
163163 else => return invalid,
164164 }
165165}
src/arch/arm/bits.zig+2-2
......@@ -1299,7 +1299,7 @@ pub const Instruction = union(enum) {
12991299 }
13001300
13011301 pub fn pop(cond: Condition, args: anytype) Instruction {
1302 if (@typeInfo(@TypeOf(args)) != .Struct) {
1302 if (@typeInfo(@TypeOf(args)) != .@"struct") {
13031303 @compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(args)));
13041304 }
13051305
......@@ -1323,7 +1323,7 @@ pub const Instruction = union(enum) {
13231323 }
13241324
13251325 pub fn push(cond: Condition, args: anytype) Instruction {
1326 if (@typeInfo(@TypeOf(args)) != .Struct) {
1326 if (@typeInfo(@TypeOf(args)) != .@"struct") {
13271327 @compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(args)));
13281328 }
13291329
src/arch/riscv64/CodeGen.zig+55-55
......@@ -675,14 +675,14 @@ fn restoreState(func: *Func, state: State, deaths: []const Air.Inst.Index, compt
675675 ) |inst, *tracking| tracking.resurrect(inst, state.scope_generation);
676676 for (deaths) |death| try func.processDeath(death);
677677
678 const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).Array.len]RegisterLock;
678 const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).array.len]RegisterLock;
679679 var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) =
680680 if (opts.update_tracking)
681681 {} else std.heap.stackFallback(@sizeOf(ExpectedContents), func.gpa);
682682
683683 var reg_locks = if (opts.update_tracking) {} else try std.ArrayList(RegisterLock).initCapacity(
684684 stack.get(),
685 @typeInfo(ExpectedContents).Array.len,
685 @typeInfo(ExpectedContents).array.len,
686686 );
687687 defer if (!opts.update_tracking) {
688688 for (reg_locks.items) |lock| func.register_manager.unlockReg(lock);
......@@ -1382,7 +1382,7 @@ fn genLazy(func: *Func, lazy_sym: link.File.LazySymbol) InnerError!void {
13821382 const zcu = pt.zcu;
13831383 const ip = &zcu.intern_pool;
13841384 switch (Type.fromInterned(lazy_sym.ty).zigTypeTag(zcu)) {
1385 .Enum => {
1385 .@"enum" => {
13861386 const enum_ty = Type.fromInterned(lazy_sym.ty);
13871387 wip_mir_log.debug("{}.@tagName:", .{enum_ty.fmt(pt)});
13881388
......@@ -1945,7 +1945,7 @@ fn memSize(func: *Func, ty: Type) Memory.Size {
19451945 const pt = func.pt;
19461946 const zcu = pt.zcu;
19471947 return switch (ty.zigTypeTag(zcu)) {
1948 .Float => Memory.Size.fromBitSize(ty.floatBits(func.target.*)),
1948 .float => Memory.Size.fromBitSize(ty.floatBits(func.target.*)),
19491949 else => Memory.Size.fromByteSize(ty.abiSize(zcu)),
19501950 };
19511951}
......@@ -2094,24 +2094,24 @@ fn typeRegClass(func: *Func, ty: Type) abi.RegisterClass {
20942094 const pt = func.pt;
20952095 const zcu = pt.zcu;
20962096 return switch (ty.zigTypeTag(zcu)) {
2097 .Float => .float,
2098 .Vector => .vector,
2097 .float => .float,
2098 .vector => .vector,
20992099 else => .int,
21002100 };
21012101}
21022102
21032103fn regGeneralClassForType(func: *Func, ty: Type) RegisterManager.RegisterBitSet {
21042104 return switch (ty.zigTypeTag(func.pt.zcu)) {
2105 .Float => abi.Registers.Float.general_purpose,
2106 .Vector => abi.Registers.Vector.general_purpose,
2105 .float => abi.Registers.Float.general_purpose,
2106 .vector => abi.Registers.Vector.general_purpose,
21072107 else => abi.Registers.Integer.general_purpose,
21082108 };
21092109}
21102110
21112111fn regTempClassForType(func: *Func, ty: Type) RegisterManager.RegisterBitSet {
21122112 return switch (ty.zigTypeTag(func.pt.zcu)) {
2113 .Float => abi.Registers.Float.temporary,
2114 .Vector => abi.Registers.Vector.general_purpose, // there are no temporary vector registers
2113 .float => abi.Registers.Float.temporary,
2114 .vector => abi.Registers.Vector.general_purpose, // there are no temporary vector registers
21152115 else => abi.Registers.Integer.temporary,
21162116 };
21172117}
......@@ -2122,8 +2122,8 @@ fn allocRegOrMem(func: *Func, elem_ty: Type, inst: ?Air.Inst.Index, reg_ok: bool
21222122
21232123 const bit_size = elem_ty.bitSize(zcu);
21242124 const min_size: u64 = switch (elem_ty.zigTypeTag(zcu)) {
2125 .Float => if (func.hasFeature(.d)) 64 else 32,
2126 .Vector => 256, // TODO: calculate it from avl * vsew
2125 .float => if (func.hasFeature(.d)) 64 else 32,
2126 .vector => 256, // TODO: calculate it from avl * vsew
21272127 else => 64,
21282128 };
21292129
......@@ -2131,7 +2131,7 @@ fn allocRegOrMem(func: *Func, elem_ty: Type, inst: ?Air.Inst.Index, reg_ok: bool
21312131 if (func.register_manager.tryAllocReg(inst, func.regGeneralClassForType(elem_ty))) |reg| {
21322132 return .{ .register = reg };
21332133 }
2134 } else if (reg_ok and elem_ty.zigTypeTag(zcu) == .Vector) {
2134 } else if (reg_ok and elem_ty.zigTypeTag(zcu) == .vector) {
21352135 return func.fail("did you forget to extend vector registers before allocating", .{});
21362136 }
21372137
......@@ -2358,7 +2358,7 @@ fn airNot(func: *Func, inst: Air.Inst.Index) !void {
23582358 (try func.allocRegOrMem(func.typeOfIndex(inst), inst, true)).register;
23592359
23602360 switch (ty.zigTypeTag(zcu)) {
2361 .Bool => {
2361 .bool => {
23622362 _ = try func.addInst(.{
23632363 .tag = .pseudo_not,
23642364 .data = .{
......@@ -2369,7 +2369,7 @@ fn airNot(func: *Func, inst: Air.Inst.Index) !void {
23692369 },
23702370 });
23712371 },
2372 .Int => {
2372 .int => {
23732373 const size = ty.bitSize(zcu);
23742374 if (!math.isPowerOfTwo(size))
23752375 return func.fail("TODO: airNot non-pow 2 int size", .{});
......@@ -2485,7 +2485,7 @@ fn binOp(
24852485
24862486 // don't have support for certain sizes of addition
24872487 switch (lhs_ty.zigTypeTag(zcu)) {
2488 .Vector => {}, // works differently and fails in a different place
2488 .vector => {}, // works differently and fails in a different place
24892489 else => if (lhs_ty.bitSize(zcu) > 64) return func.fail("TODO: binOp >= 64 bits", .{}),
24902490 }
24912491
......@@ -2578,7 +2578,7 @@ fn genBinOp(
25782578 }
25792579
25802580 switch (lhs_ty.zigTypeTag(zcu)) {
2581 .Int => {
2581 .int => {
25822582 const mnem: Mnemonic = switch (tag) {
25832583 .add, .add_wrap => switch (bit_size) {
25842584 8, 16, 64 => .add,
......@@ -2617,7 +2617,7 @@ fn genBinOp(
26172617 },
26182618 });
26192619 },
2620 .Float => {
2620 .float => {
26212621 const mir_tag: Mnemonic = switch (tag) {
26222622 .add => switch (bit_size) {
26232623 32 => .fadds,
......@@ -2648,7 +2648,7 @@ fn genBinOp(
26482648 },
26492649 });
26502650 },
2651 .Vector => {
2651 .vector => {
26522652 const num_elem = lhs_ty.vectorLen(zcu);
26532653 const elem_size = lhs_ty.childType(zcu).bitSize(zcu);
26542654
......@@ -2656,18 +2656,18 @@ fn genBinOp(
26562656
26572657 const mir_tag: Mnemonic = switch (tag) {
26582658 .add => switch (child_ty.zigTypeTag(zcu)) {
2659 .Int => .vaddvv,
2660 .Float => .vfaddvv,
2659 .int => .vaddvv,
2660 .float => .vfaddvv,
26612661 else => unreachable,
26622662 },
26632663 .sub => switch (child_ty.zigTypeTag(zcu)) {
2664 .Int => .vsubvv,
2665 .Float => .vfsubvv,
2664 .int => .vsubvv,
2665 .float => .vfsubvv,
26662666 else => unreachable,
26672667 },
26682668 .mul => switch (child_ty.zigTypeTag(zcu)) {
2669 .Int => .vmulvv,
2670 .Float => .vfmulvv,
2669 .int => .vmulvv,
2670 .float => .vfmulvv,
26712671 else => unreachable,
26722672 },
26732673 else => return func.fail("TODO: genBinOp {s} Vector", .{@tagName(tag)}),
......@@ -2905,7 +2905,7 @@ fn genBinOp(
29052905 // s0 was 0, leaving a2 unchanged as a0.
29062906 .min, .max => {
29072907 switch (lhs_ty.zigTypeTag(zcu)) {
2908 .Int => {
2908 .int => {
29092909 const int_info = lhs_ty.intInfo(zcu);
29102910
29112911 const mask_reg, const mask_lock = try func.allocReg(.int);
......@@ -2981,8 +2981,8 @@ fn airAddWithOverflow(func: *Func, inst: Air.Inst.Index) !void {
29812981
29822982 const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: {
29832983 switch (lhs_ty.zigTypeTag(zcu)) {
2984 .Vector => return func.fail("TODO implement add with overflow for Vector type", .{}),
2985 .Int => {
2984 .vector => return func.fail("TODO implement add with overflow for Vector type", .{}),
2985 .int => {
29862986 const int_info = lhs_ty.intInfo(zcu);
29872987
29882988 const tuple_ty = func.typeOfIndex(inst);
......@@ -3263,7 +3263,7 @@ fn airMulWithOverflow(func: *Func, inst: Air.Inst.Index) !void {
32633263
32643264 switch (lhs_ty.zigTypeTag(zcu)) {
32653265 else => |x| return func.fail("TODO: airMulWithOverflow {s}", .{@tagName(x)}),
3266 .Int => {
3266 .int => {
32673267 if (std.debug.runtime_safety) assert(lhs_ty.eql(rhs_ty, zcu));
32683268
32693269 const trunc_reg = try func.copyToTmpRegister(lhs_ty, .{ .register = dest_reg });
......@@ -4129,7 +4129,7 @@ fn airAbs(func: *Func, inst: Air.Inst.Index) !void {
41294129 const operand = try func.resolveInst(ty_op.operand);
41304130
41314131 switch (scalar_ty.zigTypeTag(zcu)) {
4132 .Int => if (ty.zigTypeTag(zcu) == .Vector) {
4132 .int => if (ty.zigTypeTag(zcu) == .vector) {
41334133 return func.fail("TODO implement airAbs for {}", .{ty.fmt(pt)});
41344134 } else {
41354135 const int_info = scalar_ty.intInfo(zcu);
......@@ -4182,7 +4182,7 @@ fn airAbs(func: *Func, inst: Air.Inst.Index) !void {
41824182
41834183 break :result return_mcv;
41844184 },
4185 .Float => {
4185 .float => {
41864186 const float_bits = scalar_ty.floatBits(zcu.getTarget());
41874187 const mnem: Mnemonic = switch (float_bits) {
41884188 16 => return func.fail("TODO: airAbs 16-bit float", .{}),
......@@ -4228,7 +4228,7 @@ fn airByteSwap(func: *Func, inst: Air.Inst.Index) !void {
42284228 const operand = try func.resolveInst(ty_op.operand);
42294229
42304230 switch (ty.zigTypeTag(zcu)) {
4231 .Int => {
4231 .int => {
42324232 const int_bits = ty.intInfo(zcu).bits;
42334233
42344234 // bytes are no-op
......@@ -4308,7 +4308,7 @@ fn airUnaryMath(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
43084308 defer func.register_manager.unlockReg(dst_lock);
43094309
43104310 switch (ty.zigTypeTag(zcu)) {
4311 .Float => {
4311 .float => {
43124312 assert(dst_class == .float);
43134313
43144314 switch (operand_bit_size) {
......@@ -4334,7 +4334,7 @@ fn airUnaryMath(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
43344334 else => return func.fail("TODO: airUnaryMath Float {s}", .{@tagName(tag)}),
43354335 }
43364336 },
4337 .Int => {
4337 .int => {
43384338 assert(dst_class == .int);
43394339
43404340 switch (tag) {
......@@ -4824,8 +4824,8 @@ fn genCall(
48244824 .air => |callee| fn_info: {
48254825 const callee_ty = func.typeOf(callee);
48264826 break :fn_info switch (callee_ty.zigTypeTag(zcu)) {
4827 .Fn => callee_ty,
4828 .Pointer => callee_ty.childType(zcu),
4827 .@"fn" => callee_ty,
4828 .pointer => callee_ty.childType(zcu),
48294829 else => unreachable,
48304830 };
48314831 },
......@@ -4977,7 +4977,7 @@ fn genCall(
49774977 else => return func.fail("TODO implement calling bitcasted functions", .{}),
49784978 }
49794979 } else {
4980 assert(func.typeOf(callee).zigTypeTag(zcu) == .Pointer);
4980 assert(func.typeOf(callee).zigTypeTag(zcu) == .pointer);
49814981 const addr_reg, const addr_lock = try func.allocReg(.int);
49824982 defer func.register_manager.unlockReg(addr_lock);
49834983 try func.genSetReg(Type.u64, addr_reg, .{ .air_ref = callee });
......@@ -5105,20 +5105,20 @@ fn airCmp(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
51055105 const lhs_ty = func.typeOf(bin_op.lhs);
51065106
51075107 switch (lhs_ty.zigTypeTag(zcu)) {
5108 .Int,
5109 .Enum,
5110 .Bool,
5111 .Pointer,
5112 .ErrorSet,
5113 .Optional,
5108 .int,
5109 .@"enum",
5110 .bool,
5111 .pointer,
5112 .error_set,
5113 .optional,
51145114 => {
51155115 const int_ty = switch (lhs_ty.zigTypeTag(zcu)) {
5116 .Enum => lhs_ty.intTagType(zcu),
5117 .Int => lhs_ty,
5118 .Bool => Type.u1,
5119 .Pointer => Type.u64,
5120 .ErrorSet => Type.anyerror,
5121 .Optional => blk: {
5116 .@"enum" => lhs_ty.intTagType(zcu),
5117 .int => lhs_ty,
5118 .bool => Type.u1,
5119 .pointer => Type.u64,
5120 .error_set => Type.anyerror,
5121 .optional => blk: {
51225122 const payload_ty = lhs_ty.optionalChild(zcu);
51235123 if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
51245124 break :blk Type.u1;
......@@ -5138,7 +5138,7 @@ fn airCmp(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
51385138 return func.fail("TODO riscv cmp for ints > 64 bits", .{});
51395139 }
51405140 },
5141 .Float => {
5141 .float => {
51425142 const float_bits = lhs_ty.floatBits(func.target.*);
51435143 const float_reg_size: u32 = if (func.hasFeature(.d)) 64 else 32;
51445144 if (float_bits > float_reg_size) {
......@@ -7456,8 +7456,8 @@ fn airAtomicRmw(func: *Func, inst: Air.Inst.Index) !void {
74567456 return func.fail("TODO: airAtomicRmw non-pow 2", .{});
74577457
74587458 switch (val_ty.zigTypeTag(pt.zcu)) {
7459 .Enum, .Int => {},
7460 inline .Bool, .Float, .Pointer => |ty| return func.fail("TODO: airAtomicRmw {s}", .{@tagName(ty)}),
7459 .@"enum", .int => {},
7460 inline .bool, .float, .pointer => |ty| return func.fail("TODO: airAtomicRmw {s}", .{@tagName(ty)}),
74617461 else => unreachable,
74627462 }
74637463
......@@ -7861,7 +7861,7 @@ fn airAggregateInit(func: *Func, inst: Air.Inst.Index) !void {
78617861
78627862 const result: MCValue = result: {
78637863 switch (result_ty.zigTypeTag(zcu)) {
7864 .Struct => {
7864 .@"struct" => {
78657865 const frame_index = try func.allocFrameIndex(FrameAlloc.initSpill(result_ty, zcu));
78667866 if (result_ty.containerLayout(zcu) == .@"packed") {
78677867 const struct_obj = zcu.typeToStruct(result_ty).?;
......@@ -7916,7 +7916,7 @@ fn airAggregateInit(func: *Func, inst: Air.Inst.Index) !void {
79167916 }
79177917 break :result .{ .load_frame = .{ .index = frame_index } };
79187918 },
7919 .Array => {
7919 .array => {
79207920 const elem_ty = result_ty.childType(zcu);
79217921 const frame_index = try func.allocFrameIndex(FrameAlloc.initSpill(result_ty, zcu));
79227922 const elem_size: u32 = @intCast(elem_ty.abiSize(zcu));
......@@ -8099,7 +8099,7 @@ fn resolveCallingConventionValues(
80998099 result.stack_align = .@"16";
81008100
81018101 // Return values
8102 if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
8102 if (ret_ty.zigTypeTag(zcu) == .noreturn) {
81038103 result.return_value = InstTracking.init(.unreach);
81048104 } else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
81058105 result.return_value = InstTracking.init(.none);
src/arch/riscv64/abi.zig+31-31
......@@ -15,7 +15,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
1515
1616 const max_byval_size = target.ptrBitWidth() * 2;
1717 switch (ty.zigTypeTag(zcu)) {
18 .Struct => {
18 .@"struct" => {
1919 const bit_size = ty.bitSize(zcu);
2020 if (ty.containerLayout(zcu) == .@"packed") {
2121 if (bit_size > max_byval_size) return .memory;
......@@ -44,7 +44,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
4444 if (bit_size > max_byval_size / 2) return .double_integer;
4545 return .integer;
4646 },
47 .Union => {
47 .@"union" => {
4848 const bit_size = ty.bitSize(zcu);
4949 if (ty.containerLayout(zcu) == .@"packed") {
5050 if (bit_size > max_byval_size) return .memory;
......@@ -55,40 +55,40 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
5555 if (bit_size > max_byval_size / 2) return .double_integer;
5656 return .integer;
5757 },
58 .Bool => return .integer,
59 .Float => return .byval,
60 .Int, .Enum, .ErrorSet => {
58 .bool => return .integer,
59 .float => return .byval,
60 .int, .@"enum", .error_set => {
6161 const bit_size = ty.bitSize(zcu);
6262 if (bit_size > max_byval_size) return .memory;
6363 return .byval;
6464 },
65 .Vector => {
65 .vector => {
6666 const bit_size = ty.bitSize(zcu);
6767 if (bit_size > max_byval_size) return .memory;
6868 return .integer;
6969 },
70 .Optional => {
70 .optional => {
7171 std.debug.assert(ty.isPtrLikeOptional(zcu));
7272 return .byval;
7373 },
74 .Pointer => {
74 .pointer => {
7575 std.debug.assert(!ty.isSlice(zcu));
7676 return .byval;
7777 },
78 .ErrorUnion,
79 .Frame,
80 .AnyFrame,
81 .NoReturn,
82 .Void,
83 .Type,
84 .ComptimeFloat,
85 .ComptimeInt,
86 .Undefined,
87 .Null,
88 .Fn,
89 .Opaque,
90 .EnumLiteral,
91 .Array,
78 .error_union,
79 .frame,
80 .@"anyframe",
81 .noreturn,
82 .void,
83 .type,
84 .comptime_float,
85 .comptime_int,
86 .undefined,
87 .null,
88 .@"fn",
89 .@"opaque",
90 .enum_literal,
91 .array,
9292 => unreachable,
9393 }
9494}
......@@ -104,11 +104,11 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
104104 .none, .none, .none, .none,
105105 };
106106 switch (ty.zigTypeTag(zcu)) {
107 .Bool, .Void, .NoReturn => {
107 .bool, .void, .noreturn => {
108108 result[0] = .integer;
109109 return result;
110110 },
111 .Pointer => switch (ty.ptrSize(zcu)) {
111 .pointer => switch (ty.ptrSize(zcu)) {
112112 .Slice => {
113113 result[0] = .integer;
114114 result[1] = .integer;
......@@ -119,14 +119,14 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
119119 return result;
120120 },
121121 },
122 .Optional => {
122 .optional => {
123123 if (ty.isPtrLikeOptional(zcu)) {
124124 result[0] = .integer;
125125 return result;
126126 }
127127 return memory_class;
128128 },
129 .Int, .Enum, .ErrorSet => {
129 .int, .@"enum", .error_set => {
130130 const int_bits = ty.intInfo(zcu).bits;
131131 if (int_bits <= 64) {
132132 result[0] = .integer;
......@@ -139,7 +139,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
139139 }
140140 unreachable; // support > 128 bit int arguments
141141 },
142 .Float => {
142 .float => {
143143 const target = zcu.getTarget();
144144 const features = target.cpu.features;
145145
......@@ -151,7 +151,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
151151 }
152152 unreachable; // support split float args
153153 },
154 .ErrorUnion => {
154 .error_union => {
155155 const payload_ty = ty.errorUnionPayload(zcu);
156156 const payload_bits = payload_ty.bitSize(zcu);
157157
......@@ -163,7 +163,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
163163
164164 return memory_class;
165165 },
166 .Struct, .Union => {
166 .@"struct", .@"union" => {
167167 const layout = ty.containerLayout(zcu);
168168 const ty_size = ty.abiSize(zcu);
169169
......@@ -176,7 +176,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
176176
177177 return memory_class;
178178 },
179 .Array => {
179 .array => {
180180 const ty_size = ty.abiSize(zcu);
181181 if (ty_size <= 8) {
182182 result[0] = .integer;
......@@ -189,7 +189,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
189189 }
190190 return memory_class;
191191 },
192 .Vector => {
192 .vector => {
193193 // we pass vectors through integer registers if they are small enough to fit.
194194 const vec_bits = ty.totalVectorBits(zcu);
195195 if (vec_bits <= 64) {
src/arch/riscv64/bits.zig+3-3
......@@ -115,7 +115,7 @@ pub const Immediate = union(enum) {
115115 }
116116
117117 pub fn asBits(imm: Immediate, comptime T: type) T {
118 const int_info = @typeInfo(T).Int;
118 const int_info = @typeInfo(T).int;
119119 if (int_info.signedness != .unsigned) @compileError("Immediate.asBits needs unsigned T");
120120 return switch (imm) {
121121 .signed => |x| @bitCast(@as(std.meta.Int(.signed, int_info.bits), @intCast(x))),
......@@ -189,7 +189,7 @@ pub const Register = enum(u8) {
189189 /// The goal of this function is to return the same ID for `zero` and `x0` but two
190190 /// seperate IDs for `x0` and `f0`. We will assume that each register set has 32 registers
191191 /// and is repeated twice, once for the named version, once for the number version.
192 pub fn id(reg: Register) std.math.IntFittingRange(0, @typeInfo(Register).Enum.fields.len) {
192 pub fn id(reg: Register) std.math.IntFittingRange(0, @typeInfo(Register).@"enum".fields.len) {
193193 const base = switch (@intFromEnum(reg)) {
194194 // zig fmt: off
195195 @intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => @intFromEnum(Register.zero),
......@@ -252,7 +252,7 @@ pub const FrameIndex = enum(u32) {
252252 /// Other indices are used for local variable stack slots
253253 _,
254254
255 pub const named_count = @typeInfo(FrameIndex).Enum.fields.len;
255 pub const named_count = @typeInfo(FrameIndex).@"enum".fields.len;
256256
257257 pub fn isNamed(fi: FrameIndex) bool {
258258 return @intFromEnum(fi) < named_count;
src/arch/sparc64/CodeGen.zig+39-39
......@@ -770,8 +770,8 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
770770 const rhs_ty = self.typeOf(extra.rhs);
771771
772772 switch (lhs_ty.zigTypeTag(zcu)) {
773 .Vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
774 .Int => {
773 .vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
774 .int => {
775775 assert(lhs_ty.eql(rhs_ty, zcu));
776776 const int_info = lhs_ty.intInfo(zcu);
777777 switch (int_info.bits) {
......@@ -1231,8 +1231,8 @@ fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void {
12311231 const operand = try self.resolveInst(ty_op.operand);
12321232 const operand_ty = self.typeOf(ty_op.operand);
12331233 switch (operand_ty.zigTypeTag(zcu)) {
1234 .Vector => return self.fail("TODO byteswap for vectors", .{}),
1235 .Int => {
1234 .vector => return self.fail("TODO byteswap for vectors", .{}),
1235 .int => {
12361236 const int_info = operand_ty.intInfo(zcu);
12371237 if (int_info.bits == 8) break :result operand;
12381238
......@@ -1310,8 +1310,8 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
13101310 const zcu = pt.zcu;
13111311 const ip = &zcu.intern_pool;
13121312 const fn_ty = switch (ty.zigTypeTag(zcu)) {
1313 .Fn => ty,
1314 .Pointer => ty.childType(zcu),
1313 .@"fn" => ty,
1314 .pointer => ty.childType(zcu),
13151315 else => unreachable,
13161316 };
13171317
......@@ -1363,7 +1363,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
13631363 return self.fail("TODO implement calling bitcasted functions", .{});
13641364 },
13651365 } else {
1366 assert(ty.zigTypeTag(zcu) == .Pointer);
1366 assert(ty.zigTypeTag(zcu) == .pointer);
13671367 const mcv = try self.resolveInst(callee);
13681368 try self.genSetReg(ty, .o7, mcv);
13691369
......@@ -1419,13 +1419,13 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
14191419 const lhs_ty = self.typeOf(bin_op.lhs);
14201420
14211421 const int_ty = switch (lhs_ty.zigTypeTag(zcu)) {
1422 .Vector => unreachable, // Handled by cmp_vector.
1423 .Enum => lhs_ty.intTagType(zcu),
1424 .Int => lhs_ty,
1425 .Bool => Type.u1,
1426 .Pointer => Type.usize,
1427 .ErrorSet => Type.u16,
1428 .Optional => blk: {
1422 .vector => unreachable, // Handled by cmp_vector.
1423 .@"enum" => lhs_ty.intTagType(zcu),
1424 .int => lhs_ty,
1425 .bool => Type.u1,
1426 .pointer => Type.usize,
1427 .error_set => Type.u16,
1428 .optional => blk: {
14291429 const payload_ty = lhs_ty.optionalChild(zcu);
14301430 if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
14311431 break :blk Type.u1;
......@@ -1435,7 +1435,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
14351435 return self.fail("TODO SPARCv9 cmp non-pointer optionals", .{});
14361436 }
14371437 },
1438 .Float => return self.fail("TODO SPARCv9 cmp floats", .{}),
1438 .float => return self.fail("TODO SPARCv9 cmp floats", .{}),
14391439 else => unreachable,
14401440 };
14411441
......@@ -2031,8 +2031,8 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
20312031 const rhs_ty = self.typeOf(extra.rhs);
20322032
20332033 switch (lhs_ty.zigTypeTag(zcu)) {
2034 .Vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
2035 .Int => {
2034 .vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
2035 .int => {
20362036 assert(lhs_ty.eql(rhs_ty, zcu));
20372037 const int_info = lhs_ty.intInfo(zcu);
20382038 switch (int_info.bits) {
......@@ -2105,7 +2105,7 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
21052105 },
21062106 else => {
21072107 switch (operand_ty.zigTypeTag(zcu)) {
2108 .Bool => {
2108 .bool => {
21092109 const op_reg = switch (operand) {
21102110 .register => |r| r,
21112111 else => try self.copyToTmpRegister(operand_ty, operand),
......@@ -2136,8 +2136,8 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
21362136
21372137 break :result MCValue{ .register = dest_reg };
21382138 },
2139 .Vector => return self.fail("TODO bitwise not for vectors", .{}),
2140 .Int => {
2139 .vector => return self.fail("TODO bitwise not for vectors", .{}),
2140 .int => {
21412141 const int_info = operand_ty.intInfo(zcu);
21422142 if (int_info.bits <= 64) {
21432143 const op_reg = switch (operand) {
......@@ -2329,8 +2329,8 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
23292329 const rhs_ty = self.typeOf(extra.rhs);
23302330
23312331 switch (lhs_ty.zigTypeTag(zcu)) {
2332 .Vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
2333 .Int => {
2332 .vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
2333 .int => {
23342334 const int_info = lhs_ty.intInfo(zcu);
23352335 if (int_info.bits <= 64) {
23362336 try self.spillConditionFlagsIfOccupied();
......@@ -2858,9 +2858,9 @@ fn binOp(
28582858 .cmp_eq,
28592859 => {
28602860 switch (lhs_ty.zigTypeTag(zcu)) {
2861 .Float => return self.fail("TODO binary operations on floats", .{}),
2862 .Vector => return self.fail("TODO binary operations on vectors", .{}),
2863 .Int => {
2861 .float => return self.fail("TODO binary operations on floats", .{}),
2862 .vector => return self.fail("TODO binary operations on vectors", .{}),
2863 .int => {
28642864 assert(lhs_ty.eql(rhs_ty, zcu));
28652865 const int_info = lhs_ty.intInfo(zcu);
28662866 if (int_info.bits <= 64) {
......@@ -2932,8 +2932,8 @@ fn binOp(
29322932
29332933 // Truncate if necessary
29342934 switch (lhs_ty.zigTypeTag(zcu)) {
2935 .Vector => return self.fail("TODO binary operations on vectors", .{}),
2936 .Int => {
2935 .vector => return self.fail("TODO binary operations on vectors", .{}),
2936 .int => {
29372937 const int_info = lhs_ty.intInfo(zcu);
29382938 if (int_info.bits <= 64) {
29392939 const result_reg = result.register;
......@@ -2949,8 +2949,8 @@ fn binOp(
29492949
29502950 .div_trunc => {
29512951 switch (lhs_ty.zigTypeTag(zcu)) {
2952 .Vector => return self.fail("TODO binary operations on vectors", .{}),
2953 .Int => {
2952 .vector => return self.fail("TODO binary operations on vectors", .{}),
2953 .int => {
29542954 assert(lhs_ty.eql(rhs_ty, zcu));
29552955 const int_info = lhs_ty.intInfo(zcu);
29562956 if (int_info.bits <= 64) {
......@@ -2982,7 +2982,7 @@ fn binOp(
29822982
29832983 .ptr_add => {
29842984 switch (lhs_ty.zigTypeTag(zcu)) {
2985 .Pointer => {
2985 .pointer => {
29862986 const ptr_ty = lhs_ty;
29872987 const elem_ty = switch (ptr_ty.ptrSize(zcu)) {
29882988 .One => ptr_ty.childType(zcu).childType(zcu), // ptr to array, so get array element type
......@@ -3014,7 +3014,7 @@ fn binOp(
30143014 .bool_or,
30153015 => {
30163016 switch (lhs_ty.zigTypeTag(zcu)) {
3017 .Bool => {
3017 .bool => {
30183018 assert(lhs != .immediate); // should have been handled by Sema
30193019 assert(rhs != .immediate); // should have been handled by Sema
30203020
......@@ -3044,8 +3044,8 @@ fn binOp(
30443044
30453045 // Truncate if necessary
30463046 switch (lhs_ty.zigTypeTag(zcu)) {
3047 .Vector => return self.fail("TODO binary operations on vectors", .{}),
3048 .Int => {
3047 .vector => return self.fail("TODO binary operations on vectors", .{}),
3048 .int => {
30493049 const int_info = lhs_ty.intInfo(zcu);
30503050 if (int_info.bits <= 64) {
30513051 // 32 and 64 bit operands doesn't need truncating
......@@ -3066,8 +3066,8 @@ fn binOp(
30663066 .shr_exact,
30673067 => {
30683068 switch (lhs_ty.zigTypeTag(zcu)) {
3069 .Vector => return self.fail("TODO binary operations on vectors", .{}),
3070 .Int => {
3069 .vector => return self.fail("TODO binary operations on vectors", .{}),
3070 .int => {
30713071 const int_info = lhs_ty.intInfo(zcu);
30723072 if (int_info.bits <= 64) {
30733073 const rhs_immediate_ok = rhs == .immediate;
......@@ -4329,9 +4329,9 @@ fn minMax(
43294329 const zcu = pt.zcu;
43304330 assert(lhs_ty.eql(rhs_ty, zcu));
43314331 switch (lhs_ty.zigTypeTag(zcu)) {
4332 .Float => return self.fail("TODO min/max on floats", .{}),
4333 .Vector => return self.fail("TODO min/max on vectors", .{}),
4334 .Int => {
4332 .float => return self.fail("TODO min/max on floats", .{}),
4333 .vector => return self.fail("TODO min/max on vectors", .{}),
4334 .int => {
43354335 const int_info = lhs_ty.intInfo(zcu);
43364336 if (int_info.bits <= 64) {
43374337 // TODO skip register setting when one of the operands
......@@ -4515,7 +4515,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type, role: RegisterView)
45154515 result.stack_byte_count = next_stack_offset;
45164516 result.stack_align = .@"16";
45174517
4518 if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
4518 if (ret_ty.zigTypeTag(zcu) == .noreturn) {
45194519 result.return_value = .{ .unreach = {} };
45204520 } else if (!ret_ty.hasRuntimeBits(zcu)) {
45214521 result.return_value = .{ .none = {} };
src/arch/wasm/CodeGen.zig+92-92
......@@ -1004,19 +1004,19 @@ fn typeToValtype(ty: Type, pt: Zcu.PerThread, target: std.Target) wasm.Valtype {
10041004 const zcu = pt.zcu;
10051005 const ip = &zcu.intern_pool;
10061006 return switch (ty.zigTypeTag(zcu)) {
1007 .Float => switch (ty.floatBits(target)) {
1007 .float => switch (ty.floatBits(target)) {
10081008 16 => .i32, // stored/loaded as u16
10091009 32 => .f32,
10101010 64 => .f64,
10111011 80, 128 => .i32,
10121012 else => unreachable,
10131013 },
1014 .Int, .Enum => switch (ty.intInfo(zcu).bits) {
1014 .int, .@"enum" => switch (ty.intInfo(zcu).bits) {
10151015 0...32 => .i32,
10161016 33...64 => .i64,
10171017 else => .i32,
10181018 },
1019 .Struct => blk: {
1019 .@"struct" => blk: {
10201020 if (zcu.typeToPackedStruct(ty)) |packed_struct| {
10211021 const backing_int_ty = Type.fromInterned(packed_struct.backingIntTypeUnordered(ip));
10221022 break :blk typeToValtype(backing_int_ty, pt, target);
......@@ -1024,11 +1024,11 @@ fn typeToValtype(ty: Type, pt: Zcu.PerThread, target: std.Target) wasm.Valtype {
10241024 break :blk .i32;
10251025 }
10261026 },
1027 .Vector => switch (determineSimdStoreStrategy(ty, zcu, target)) {
1027 .vector => switch (determineSimdStoreStrategy(ty, zcu, target)) {
10281028 .direct => .v128,
10291029 .unrolled => .i32,
10301030 },
1031 .Union => switch (ty.containerLayout(zcu)) {
1031 .@"union" => switch (ty.containerLayout(zcu)) {
10321032 .@"packed" => blk: {
10331033 const int_ty = pt.intType(.unsigned, @as(u16, @intCast(ty.bitSize(zcu)))) catch @panic("out of memory");
10341034 break :blk typeToValtype(int_ty, pt, target);
......@@ -1430,7 +1430,7 @@ fn lowerArg(func: *CodeGen, cc: std.builtin.CallingConvention, ty: Type, value:
14301430 const ty_classes = abi.classifyType(ty, zcu);
14311431 assert(ty_classes[0] != .none);
14321432 switch (ty.zigTypeTag(zcu)) {
1433 .Struct, .Union => {
1433 .@"struct", .@"union" => {
14341434 if (ty_classes[0] == .indirect) {
14351435 return func.lowerToStack(value);
14361436 }
......@@ -1445,7 +1445,7 @@ fn lowerArg(func: *CodeGen, cc: std.builtin.CallingConvention, ty: Type, value:
14451445 else => try func.emitWValue(value),
14461446 }
14471447 },
1448 .Int, .Float => {
1448 .int, .float => {
14491449 if (ty_classes[1] == .none) {
14501450 return func.lowerToStack(value);
14511451 }
......@@ -1719,27 +1719,27 @@ fn isByRef(ty: Type, pt: Zcu.PerThread, target: std.Target) bool {
17191719 const zcu = pt.zcu;
17201720 const ip = &zcu.intern_pool;
17211721 switch (ty.zigTypeTag(zcu)) {
1722 .Type,
1723 .ComptimeInt,
1724 .ComptimeFloat,
1725 .EnumLiteral,
1726 .Undefined,
1727 .Null,
1728 .Opaque,
1722 .type,
1723 .comptime_int,
1724 .comptime_float,
1725 .enum_literal,
1726 .undefined,
1727 .null,
1728 .@"opaque",
17291729 => unreachable,
17301730
1731 .NoReturn,
1732 .Void,
1733 .Bool,
1734 .ErrorSet,
1735 .Fn,
1736 .AnyFrame,
1731 .noreturn,
1732 .void,
1733 .bool,
1734 .error_set,
1735 .@"fn",
1736 .@"anyframe",
17371737 => return false,
17381738
1739 .Array,
1740 .Frame,
1739 .array,
1740 .frame,
17411741 => return ty.hasRuntimeBitsIgnoreComptime(zcu),
1742 .Union => {
1742 .@"union" => {
17431743 if (zcu.typeToUnion(ty)) |union_obj| {
17441744 if (union_obj.flagsUnordered(ip).layout == .@"packed") {
17451745 return ty.abiSize(zcu) > 8;
......@@ -1747,30 +1747,30 @@ fn isByRef(ty: Type, pt: Zcu.PerThread, target: std.Target) bool {
17471747 }
17481748 return ty.hasRuntimeBitsIgnoreComptime(zcu);
17491749 },
1750 .Struct => {
1750 .@"struct" => {
17511751 if (zcu.typeToPackedStruct(ty)) |packed_struct| {
17521752 return isByRef(Type.fromInterned(packed_struct.backingIntTypeUnordered(ip)), pt, target);
17531753 }
17541754 return ty.hasRuntimeBitsIgnoreComptime(zcu);
17551755 },
1756 .Vector => return determineSimdStoreStrategy(ty, zcu, target) == .unrolled,
1757 .Int => return ty.intInfo(zcu).bits > 64,
1758 .Enum => return ty.intInfo(zcu).bits > 64,
1759 .Float => return ty.floatBits(target) > 64,
1760 .ErrorUnion => {
1756 .vector => return determineSimdStoreStrategy(ty, zcu, target) == .unrolled,
1757 .int => return ty.intInfo(zcu).bits > 64,
1758 .@"enum" => return ty.intInfo(zcu).bits > 64,
1759 .float => return ty.floatBits(target) > 64,
1760 .error_union => {
17611761 const pl_ty = ty.errorUnionPayload(zcu);
17621762 if (!pl_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
17631763 return false;
17641764 }
17651765 return true;
17661766 },
1767 .Optional => {
1767 .optional => {
17681768 if (ty.isPtrLikeOptional(zcu)) return false;
17691769 const pl_type = ty.optionalChild(zcu);
1770 if (pl_type.zigTypeTag(zcu) == .ErrorSet) return false;
1770 if (pl_type.zigTypeTag(zcu) == .error_set) return false;
17711771 return pl_type.hasRuntimeBitsIgnoreComptime(zcu);
17721772 },
1773 .Pointer => {
1773 .pointer => {
17741774 // Slices act like struct and will be passed by reference
17751775 if (ty.isSlice(zcu)) return true;
17761776 return false;
......@@ -1788,7 +1788,7 @@ const SimdStoreStrategy = enum {
17881788/// features are enabled, the function will return `.direct`. This would allow to store
17891789/// it using a instruction, rather than an unrolled version.
17901790fn determineSimdStoreStrategy(ty: Type, zcu: *Zcu, target: std.Target) SimdStoreStrategy {
1791 std.debug.assert(ty.zigTypeTag(zcu) == .Vector);
1791 std.debug.assert(ty.zigTypeTag(zcu) == .vector);
17921792 if (ty.bitSize(zcu) != 128) return .unrolled;
17931793 const hasFeature = std.Target.wasm.featureSetHas;
17941794 const features = target.cpu.features;
......@@ -2106,7 +2106,7 @@ fn airRet(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
21062106 } else if (fn_info.cc == .C and ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
21072107 switch (ret_ty.zigTypeTag(zcu)) {
21082108 // Aggregate types can be lowered as a singular value
2109 .Struct, .Union => {
2109 .@"struct", .@"union" => {
21102110 const scalar_type = abi.scalarType(ret_ty, zcu);
21112111 try func.emitWValue(operand);
21122112 const opcode = buildOpcode(.{
......@@ -2189,8 +2189,8 @@ fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif
21892189 const zcu = pt.zcu;
21902190 const ip = &zcu.intern_pool;
21912191 const fn_ty = switch (ty.zigTypeTag(zcu)) {
2192 .Fn => ty,
2193 .Pointer => ty.childType(zcu),
2192 .@"fn" => ty,
2193 .pointer => ty.childType(zcu),
21942194 else => unreachable,
21952195 };
21962196 const ret_ty = fn_ty.fnReturnType(zcu);
......@@ -2261,7 +2261,7 @@ fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif
22612261 } else {
22622262 // in this case we call a function pointer
22632263 // so load its value onto the stack
2264 std.debug.assert(ty.zigTypeTag(zcu) == .Pointer);
2264 std.debug.assert(ty.zigTypeTag(zcu) == .pointer);
22652265 const operand = try func.resolveInst(pl_op.operand);
22662266 try func.emitWValue(operand);
22672267
......@@ -2281,7 +2281,7 @@ fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif
22812281 } else if (first_param_sret) {
22822282 break :result_value sret;
22832283 // TODO: Make this less fragile and optimize
2284 } else if (zcu.typeToFunc(fn_ty).?.cc == .C and ret_ty.zigTypeTag(zcu) == .Struct or ret_ty.zigTypeTag(zcu) == .Union) {
2284 } else if (zcu.typeToFunc(fn_ty).?.cc == .C and ret_ty.zigTypeTag(zcu) == .@"struct" or ret_ty.zigTypeTag(zcu) == .@"union") {
22852285 const result_local = try func.allocLocal(ret_ty);
22862286 try func.addLabel(.local_set, result_local.local.value);
22872287 const scalar_type = abi.scalarType(ret_ty, zcu);
......@@ -2371,7 +2371,7 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE
23712371 const zcu = pt.zcu;
23722372 const abi_size = ty.abiSize(zcu);
23732373 switch (ty.zigTypeTag(zcu)) {
2374 .ErrorUnion => {
2374 .error_union => {
23752375 const pl_ty = ty.errorUnionPayload(zcu);
23762376 if (!pl_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
23772377 return func.store(lhs, rhs, Type.anyerror, 0);
......@@ -2380,7 +2380,7 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE
23802380 const len = @as(u32, @intCast(abi_size));
23812381 return func.memcpy(lhs, rhs, .{ .imm32 = len });
23822382 },
2383 .Optional => {
2383 .optional => {
23842384 if (ty.isPtrLikeOptional(zcu)) {
23852385 return func.store(lhs, rhs, Type.usize, 0);
23862386 }
......@@ -2388,18 +2388,18 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE
23882388 if (!pl_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
23892389 return func.store(lhs, rhs, Type.u8, 0);
23902390 }
2391 if (pl_ty.zigTypeTag(zcu) == .ErrorSet) {
2391 if (pl_ty.zigTypeTag(zcu) == .error_set) {
23922392 return func.store(lhs, rhs, Type.anyerror, 0);
23932393 }
23942394
23952395 const len = @as(u32, @intCast(abi_size));
23962396 return func.memcpy(lhs, rhs, .{ .imm32 = len });
23972397 },
2398 .Struct, .Array, .Union => if (isByRef(ty, pt, func.target.*)) {
2398 .@"struct", .array, .@"union" => if (isByRef(ty, pt, func.target.*)) {
23992399 const len = @as(u32, @intCast(abi_size));
24002400 return func.memcpy(lhs, rhs, .{ .imm32 = len });
24012401 },
2402 .Vector => switch (determineSimdStoreStrategy(ty, zcu, func.target.*)) {
2402 .vector => switch (determineSimdStoreStrategy(ty, zcu, func.target.*)) {
24032403 .unrolled => {
24042404 const len: u32 = @intCast(abi_size);
24052405 return func.memcpy(lhs, rhs, .{ .imm32 = len });
......@@ -2418,7 +2418,7 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE
24182418 return func.addInst(.{ .tag = .simd_prefix, .data = .{ .payload = extra_index } });
24192419 },
24202420 },
2421 .Pointer => {
2421 .pointer => {
24222422 if (ty.isSlice(zcu)) {
24232423 // store pointer first
24242424 // lower it to the stack so we do not have to store rhs into a local first
......@@ -2433,7 +2433,7 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE
24332433 return;
24342434 }
24352435 },
2436 .Int, .Enum, .Float => if (abi_size > 8 and abi_size <= 16) {
2436 .int, .@"enum", .float => if (abi_size > 8 and abi_size <= 16) {
24372437 try func.emitWValue(lhs);
24382438 const lsb = try func.load(rhs, Type.u64, 0);
24392439 try func.store(.stack, lsb, Type.u64, 0 + lhs.offset());
......@@ -2521,7 +2521,7 @@ fn load(func: *CodeGen, operand: WValue, ty: Type, offset: u32) InnerError!WValu
25212521 // load local's value from memory by its stack position
25222522 try func.emitWValue(operand);
25232523
2524 if (ty.zigTypeTag(zcu) == .Vector) {
2524 if (ty.zigTypeTag(zcu) == .vector) {
25252525 // TODO: Add helper functions for simd opcodes
25262526 const extra_index = @as(u32, @intCast(func.mir_extra.items.len));
25272527 // stores as := opcode, offset, alignment (opcode::memarg)
......@@ -2571,7 +2571,7 @@ fn airArg(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
25712571 // When we have an argument that's passed using more than a single parameter,
25722572 // we combine them into a single stack value
25732573 if (arg_classes[0] == .direct and arg_classes[1] == .direct) {
2574 if (arg_ty.zigTypeTag(zcu) != .Int and arg_ty.zigTypeTag(zcu) != .Float) {
2574 if (arg_ty.zigTypeTag(zcu) != .int and arg_ty.zigTypeTag(zcu) != .float) {
25752575 return func.fail(
25762576 "TODO: Implement C-ABI argument for type '{}'",
25772577 .{arg_ty.fmt(pt)},
......@@ -2647,7 +2647,7 @@ fn binOp(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) InnerError!
26472647 }
26482648
26492649 if (isByRef(ty, pt, func.target.*)) {
2650 if (ty.zigTypeTag(zcu) == .Int) {
2650 if (ty.zigTypeTag(zcu) == .int) {
26512651 return func.binOpBigInt(lhs, rhs, ty, op);
26522652 } else {
26532653 return func.fail(
......@@ -2822,7 +2822,7 @@ fn airAbs(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
28222822 const scalar_ty = ty.scalarType(zcu);
28232823
28242824 switch (scalar_ty.zigTypeTag(zcu)) {
2825 .Int => if (ty.zigTypeTag(zcu) == .Vector) {
2825 .int => if (ty.zigTypeTag(zcu) == .vector) {
28262826 return func.fail("TODO implement airAbs for {}", .{ty.fmt(pt)});
28272827 } else {
28282828 const int_bits = ty.intInfo(zcu).bits;
......@@ -2887,7 +2887,7 @@ fn airAbs(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
28872887 else => unreachable,
28882888 }
28892889 },
2890 .Float => {
2890 .float => {
28912891 const result = try func.floatOp(.fabs, ty, &.{operand});
28922892 return func.finishAir(inst, result, &.{ty_op.operand});
28932893 },
......@@ -2907,7 +2907,7 @@ fn airUnaryFloatOp(func: *CodeGen, inst: Air.Inst.Index, op: FloatOp) InnerError
29072907fn floatOp(func: *CodeGen, float_op: FloatOp, ty: Type, args: []const WValue) InnerError!WValue {
29082908 const pt = func.pt;
29092909 const zcu = pt.zcu;
2910 if (ty.zigTypeTag(zcu) == .Vector) {
2910 if (ty.zigTypeTag(zcu) == .vector) {
29112911 return func.fail("TODO: Implement floatOps for vectors", .{});
29122912 }
29132913
......@@ -3021,7 +3021,7 @@ fn airWrapBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
30213021 const lhs_ty = func.typeOf(bin_op.lhs);
30223022 const rhs_ty = func.typeOf(bin_op.rhs);
30233023
3024 if (lhs_ty.zigTypeTag(zcu) == .Vector or rhs_ty.zigTypeTag(zcu) == .Vector) {
3024 if (lhs_ty.zigTypeTag(zcu) == .vector or rhs_ty.zigTypeTag(zcu) == .vector) {
30253025 return func.fail("TODO: Implement wrapping arithmetic for vectors", .{});
30263026 }
30273027
......@@ -3139,7 +3139,7 @@ fn lowerPtr(func: *CodeGen, ptr_val: InternPool.Index, prev_offset: u64) InnerEr
31393139 const base_ptr = Value.fromInterned(field.base);
31403140 const base_ty = base_ptr.typeOf(zcu).childType(zcu);
31413141 const field_off: u64 = switch (base_ty.zigTypeTag(zcu)) {
3142 .Pointer => off: {
3142 .pointer => off: {
31433143 assert(base_ty.isSlice(zcu));
31443144 break :off switch (field.index) {
31453145 Value.slice_ptr_index => 0,
......@@ -3147,11 +3147,11 @@ fn lowerPtr(func: *CodeGen, ptr_val: InternPool.Index, prev_offset: u64) InnerEr
31473147 else => unreachable,
31483148 };
31493149 },
3150 .Struct => switch (base_ty.containerLayout(zcu)) {
3150 .@"struct" => switch (base_ty.containerLayout(zcu)) {
31513151 .auto => base_ty.structFieldOffset(@intCast(field.index), zcu),
31523152 .@"extern", .@"packed" => unreachable,
31533153 },
3154 .Union => switch (base_ty.containerLayout(zcu)) {
3154 .@"union" => switch (base_ty.containerLayout(zcu)) {
31553155 .auto => off: {
31563156 // Keep in sync with the `un` case of `generateSymbol`.
31573157 const layout = base_ty.unionGetLayout(zcu);
......@@ -3184,7 +3184,7 @@ fn lowerUavRef(
31843184 const zcu = pt.zcu;
31853185 const ty = Type.fromInterned(zcu.intern_pool.typeOf(uav.val));
31863186
3187 const is_fn_body = ty.zigTypeTag(zcu) == .Fn;
3187 const is_fn_body = ty.zigTypeTag(zcu) == .@"fn";
31883188 if (!is_fn_body and !ty.hasRuntimeBitsIgnoreComptime(zcu)) {
31893189 return .{ .imm32 = 0xaaaaaaaa };
31903190 }
......@@ -3404,34 +3404,34 @@ fn emitUndefined(func: *CodeGen, ty: Type) InnerError!WValue {
34043404 const zcu = pt.zcu;
34053405 const ip = &zcu.intern_pool;
34063406 switch (ty.zigTypeTag(zcu)) {
3407 .Bool, .ErrorSet => return .{ .imm32 = 0xaaaaaaaa },
3408 .Int, .Enum => switch (ty.intInfo(zcu).bits) {
3407 .bool, .error_set => return .{ .imm32 = 0xaaaaaaaa },
3408 .int, .@"enum" => switch (ty.intInfo(zcu).bits) {
34093409 0...32 => return .{ .imm32 = 0xaaaaaaaa },
34103410 33...64 => return .{ .imm64 = 0xaaaaaaaaaaaaaaaa },
34113411 else => unreachable,
34123412 },
3413 .Float => switch (ty.floatBits(func.target.*)) {
3413 .float => switch (ty.floatBits(func.target.*)) {
34143414 16 => return .{ .imm32 = 0xaaaaaaaa },
34153415 32 => return .{ .float32 = @as(f32, @bitCast(@as(u32, 0xaaaaaaaa))) },
34163416 64 => return .{ .float64 = @as(f64, @bitCast(@as(u64, 0xaaaaaaaaaaaaaaaa))) },
34173417 else => unreachable,
34183418 },
3419 .Pointer => switch (func.arch()) {
3419 .pointer => switch (func.arch()) {
34203420 .wasm32 => return .{ .imm32 = 0xaaaaaaaa },
34213421 .wasm64 => return .{ .imm64 = 0xaaaaaaaaaaaaaaaa },
34223422 else => unreachable,
34233423 },
3424 .Optional => {
3424 .optional => {
34253425 const pl_ty = ty.optionalChild(zcu);
34263426 if (ty.optionalReprIsPayload(zcu)) {
34273427 return func.emitUndefined(pl_ty);
34283428 }
34293429 return .{ .imm32 = 0xaaaaaaaa };
34303430 },
3431 .ErrorUnion => {
3431 .error_union => {
34323432 return .{ .imm32 = 0xaaaaaaaa };
34333433 },
3434 .Struct => {
3434 .@"struct" => {
34353435 const packed_struct = zcu.typeToPackedStruct(ty).?;
34363436 return func.emitUndefined(Type.fromInterned(packed_struct.backingIntTypeUnordered(ip)));
34373437 },
......@@ -3604,7 +3604,7 @@ fn cmp(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: std.math.CompareO
36043604 assert(!(lhs != .stack and rhs == .stack));
36053605 const pt = func.pt;
36063606 const zcu = pt.zcu;
3607 if (ty.zigTypeTag(zcu) == .Optional and !ty.optionalReprIsPayload(zcu)) {
3607 if (ty.zigTypeTag(zcu) == .optional and !ty.optionalReprIsPayload(zcu)) {
36083608 const payload_ty = ty.optionalChild(zcu);
36093609 if (payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
36103610 // When we hit this case, we must check the value of optionals
......@@ -3620,7 +3620,7 @@ fn cmp(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: std.math.CompareO
36203620
36213621 const signedness: std.builtin.Signedness = blk: {
36223622 // by default we tell the operand type is unsigned (i.e. bools and enum values)
3623 if (ty.zigTypeTag(zcu) != .Int) break :blk .unsigned;
3623 if (ty.zigTypeTag(zcu) != .int) break :blk .unsigned;
36243624
36253625 // incase of an actual integer, we emit the correct signedness
36263626 break :blk ty.intInfo(zcu).signedness;
......@@ -3743,7 +3743,7 @@ fn airNot(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
37433743 const zcu = pt.zcu;
37443744
37453745 const result = result: {
3746 if (operand_ty.zigTypeTag(zcu) == .Bool) {
3746 if (operand_ty.zigTypeTag(zcu) == .bool) {
37473747 try func.emitWValue(operand);
37483748 try func.addTag(.i32_eqz);
37493749 const not_tmp = try func.allocLocal(operand_ty);
......@@ -3922,14 +3922,14 @@ fn structFieldPtr(
39223922
39233923 const offset = switch (struct_ty.containerLayout(zcu)) {
39243924 .@"packed" => switch (struct_ty.zigTypeTag(zcu)) {
3925 .Struct => offset: {
3925 .@"struct" => offset: {
39263926 if (result_ty.ptrInfo(zcu).packed_offset.host_size != 0) {
39273927 break :offset @as(u32, 0);
39283928 }
39293929 const struct_type = zcu.typeToStruct(struct_ty).?;
39303930 break :offset @divExact(pt.structPackedFieldBitOffset(struct_type, index) + struct_ptr_ty_info.packed_offset.bit_offset, 8);
39313931 },
3932 .Union => 0,
3932 .@"union" => 0,
39333933 else => unreachable,
39343934 },
39353935 else => struct_ty.structFieldOffset(index, zcu),
......@@ -3961,7 +3961,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
39613961
39623962 const result: WValue = switch (struct_ty.containerLayout(zcu)) {
39633963 .@"packed" => switch (struct_ty.zigTypeTag(zcu)) {
3964 .Struct => result: {
3964 .@"struct" => result: {
39653965 const packed_struct = zcu.typeToPackedStruct(struct_ty).?;
39663966 const offset = pt.structPackedFieldBitOffset(packed_struct, field_index);
39673967 const backing_ty = Type.fromInterned(packed_struct.backingIntTypeUnordered(ip));
......@@ -3981,7 +3981,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
39813981 else
39823982 try func.binOp(operand, const_wvalue, backing_ty, .shr);
39833983
3984 if (field_ty.zigTypeTag(zcu) == .Float) {
3984 if (field_ty.zigTypeTag(zcu) == .float) {
39853985 const int_type = try pt.intType(.unsigned, @as(u16, @intCast(field_ty.bitSize(zcu))));
39863986 const truncated = try func.trunc(shifted_value, int_type, backing_ty);
39873987 break :result try func.bitcast(field_ty, int_type, truncated);
......@@ -3995,7 +3995,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
39953995 }
39963996 break :result try func.trunc(shifted_value, field_ty, backing_ty);
39973997 },
3998 .Union => result: {
3998 .@"union" => result: {
39993999 if (isByRef(struct_ty, pt, func.target.*)) {
40004000 if (!isByRef(field_ty, pt, func.target.*)) {
40014001 break :result try func.load(operand, field_ty, 0);
......@@ -4007,7 +4007,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
40074007 }
40084008
40094009 const union_int_type = try pt.intType(.unsigned, @as(u16, @intCast(struct_ty.bitSize(zcu))));
4010 if (field_ty.zigTypeTag(zcu) == .Float) {
4010 if (field_ty.zigTypeTag(zcu) == .float) {
40114011 const int_type = try pt.intType(.unsigned, @as(u16, @intCast(field_ty.bitSize(zcu))));
40124012 const truncated = try func.trunc(operand, int_type, union_int_type);
40134013 break :result try func.bitcast(field_ty, int_type, truncated);
......@@ -4136,7 +4136,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
41364136 // for errors that are not present in any branch. This is fine as this default
41374137 // case will never be hit for those cases but we do save runtime cost and size
41384138 // by using a jump table for this instead of if-else chains.
4139 break :blk if (has_else_body or target_ty.zigTypeTag(zcu) == .ErrorSet) switch_br.cases_len else unreachable;
4139 break :blk if (has_else_body or target_ty.zigTypeTag(zcu) == .error_set) switch_br.cases_len else unreachable;
41404140 };
41414141 func.mir_extra.appendAssumeCapacity(idx);
41424142 } else if (has_else_body) {
......@@ -4147,7 +4147,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
41474147
41484148 const signedness: std.builtin.Signedness = blk: {
41494149 // by default we tell the operand type is unsigned (i.e. bools and enum values)
4150 if (target_ty.zigTypeTag(zcu) != .Int) break :blk .unsigned;
4150 if (target_ty.zigTypeTag(zcu) != .int) break :blk .unsigned;
41514151
41524152 // incase of an actual integer, we emit the correct signedness
41534153 break :blk target_ty.intInfo(zcu).signedness;
......@@ -4364,7 +4364,7 @@ fn airIntcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
43644364 const operand_ty = func.typeOf(ty_op.operand);
43654365 const pt = func.pt;
43664366 const zcu = pt.zcu;
4367 if (ty.zigTypeTag(zcu) == .Vector or operand_ty.zigTypeTag(zcu) == .Vector) {
4367 if (ty.zigTypeTag(zcu) == .vector or operand_ty.zigTypeTag(zcu) == .vector) {
43684368 return func.fail("todo Wasm intcast for vectors", .{});
43694369 }
43704370 if (ty.abiSize(zcu) > 16 or operand_ty.abiSize(zcu) > 16) {
......@@ -4682,7 +4682,7 @@ fn airTrunc(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
46824682 const pt = func.pt;
46834683 const zcu = pt.zcu;
46844684
4685 if (wanted_ty.zigTypeTag(zcu) == .Vector or op_ty.zigTypeTag(zcu) == .Vector) {
4685 if (wanted_ty.zigTypeTag(zcu) == .vector or op_ty.zigTypeTag(zcu) == .vector) {
46864686 return func.fail("TODO: trunc for vectors", .{});
46874687 }
46884688
......@@ -4990,7 +4990,7 @@ fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
49904990 try func.addTag(.i32_mul);
49914991 try func.addTag(.i32_add);
49924992 } else {
4993 std.debug.assert(array_ty.zigTypeTag(zcu) == .Vector);
4993 std.debug.assert(array_ty.zigTypeTag(zcu) == .vector);
49944994
49954995 switch (index) {
49964996 inline .imm32, .imm64 => |lane| {
......@@ -5281,7 +5281,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
52815281
52825282 const result: WValue = result_value: {
52835283 switch (result_ty.zigTypeTag(zcu)) {
5284 .Array => {
5284 .array => {
52855285 const result = try func.allocStack(result_ty);
52865286 const elem_ty = result_ty.childType(zcu);
52875287 const elem_size = @as(u32, @intCast(elem_ty.abiSize(zcu)));
......@@ -5320,7 +5320,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
53205320 }
53215321 break :result_value result;
53225322 },
5323 .Struct => switch (result_ty.containerLayout(zcu)) {
5323 .@"struct" => switch (result_ty.containerLayout(zcu)) {
53245324 .@"packed" => {
53255325 if (isByRef(result_ty, pt, func.target.*)) {
53265326 return func.fail("TODO: airAggregateInit for packed structs larger than 64 bits", .{});
......@@ -5386,7 +5386,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
53865386 break :result_value result;
53875387 },
53885388 },
5389 .Vector => return func.fail("TODO: Wasm backend: implement airAggregateInit for vectors", .{}),
5389 .vector => return func.fail("TODO: Wasm backend: implement airAggregateInit for vectors", .{}),
53905390 else => unreachable,
53915391 }
53925392 };
......@@ -5458,7 +5458,7 @@ fn airUnionInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
54585458 } else {
54595459 const operand = try func.resolveInst(extra.init);
54605460 const union_int_type = try pt.intType(.unsigned, @as(u16, @intCast(union_ty.bitSize(zcu))));
5461 if (field_ty.zigTypeTag(zcu) == .Float) {
5461 if (field_ty.zigTypeTag(zcu) == .float) {
54625462 const int_type = try pt.intType(.unsigned, @intCast(field_ty.bitSize(zcu)));
54635463 const bitcasted = try func.bitcast(field_ty, int_type, operand);
54645464 break :result try func.trunc(bitcasted, int_type, union_int_type);
......@@ -5810,7 +5810,7 @@ fn airPopcount(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
58105810 const operand = try func.resolveInst(ty_op.operand);
58115811 const op_ty = func.typeOf(ty_op.operand);
58125812
5813 if (op_ty.zigTypeTag(zcu) == .Vector) {
5813 if (op_ty.zigTypeTag(zcu) == .vector) {
58145814 return func.fail("TODO: Implement @popCount for vectors", .{});
58155815 }
58165816
......@@ -5862,7 +5862,7 @@ fn airBitReverse(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
58625862 const operand = try func.resolveInst(ty_op.operand);
58635863 const ty = func.typeOf(ty_op.operand);
58645864
5865 if (ty.zigTypeTag(zcu) == .Vector) {
5865 if (ty.zigTypeTag(zcu) == .vector) {
58665866 return func.fail("TODO: Implement @bitReverse for vectors", .{});
58675867 }
58685868
......@@ -6028,7 +6028,7 @@ fn airAddSubWithOverflow(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerErro
60286028 const pt = func.pt;
60296029 const zcu = pt.zcu;
60306030
6031 if (ty.zigTypeTag(zcu) == .Vector) {
6031 if (ty.zigTypeTag(zcu) == .vector) {
60326032 return func.fail("TODO: Implement overflow arithmetic for vectors", .{});
60336033 }
60346034
......@@ -6075,7 +6075,7 @@ fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
60756075 const ty = func.typeOf(extra.lhs);
60766076 const rhs_ty = func.typeOf(extra.rhs);
60776077
6078 if (ty.zigTypeTag(zcu) == .Vector) {
6078 if (ty.zigTypeTag(zcu) == .vector) {
60796079 return func.fail("TODO: Implement overflow arithmetic for vectors", .{});
60806080 }
60816081
......@@ -6121,7 +6121,7 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
61216121 const pt = func.pt;
61226122 const zcu = pt.zcu;
61236123
6124 if (ty.zigTypeTag(zcu) == .Vector) {
6124 if (ty.zigTypeTag(zcu) == .vector) {
61256125 return func.fail("TODO: Implement overflow arithmetic for vectors", .{});
61266126 }
61276127
......@@ -6251,7 +6251,7 @@ fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
62516251 const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
62526252
62536253 const ty = func.typeOfIndex(inst);
6254 if (ty.zigTypeTag(zcu) == .Vector) {
6254 if (ty.zigTypeTag(zcu) == .vector) {
62556255 return func.fail("TODO: `@maximum` and `@minimum` for vectors", .{});
62566256 }
62576257
......@@ -6262,7 +6262,7 @@ fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
62626262 const lhs = try func.resolveInst(bin_op.lhs);
62636263 const rhs = try func.resolveInst(bin_op.rhs);
62646264
6265 if (ty.zigTypeTag(zcu) == .Float) {
6265 if (ty.zigTypeTag(zcu) == .float) {
62666266 var fn_name_buf: [64]u8 = undefined;
62676267 const float_bits = ty.floatBits(func.target.*);
62686268 const fn_name = std.fmt.bufPrint(&fn_name_buf, "{s}f{s}{s}", .{
......@@ -6292,7 +6292,7 @@ fn airMulAdd(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
62926292 const bin_op = func.air.extraData(Air.Bin, pl_op.payload).data;
62936293
62946294 const ty = func.typeOfIndex(inst);
6295 if (ty.zigTypeTag(zcu) == .Vector) {
6295 if (ty.zigTypeTag(zcu) == .vector) {
62966296 return func.fail("TODO: `@mulAdd` for vectors", .{});
62976297 }
62986298
......@@ -6326,7 +6326,7 @@ fn airClz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
63266326 const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
63276327
63286328 const ty = func.typeOf(ty_op.operand);
6329 if (ty.zigTypeTag(zcu) == .Vector) {
6329 if (ty.zigTypeTag(zcu) == .vector) {
63306330 return func.fail("TODO: `@clz` for vectors", .{});
63316331 }
63326332
......@@ -6378,7 +6378,7 @@ fn airCtz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
63786378
63796379 const ty = func.typeOf(ty_op.operand);
63806380
6381 if (ty.zigTypeTag(zcu) == .Vector) {
6381 if (ty.zigTypeTag(zcu) == .vector) {
63826382 return func.fail("TODO: `@ctz` for vectors", .{});
63836383 }
63846384
......@@ -6571,7 +6571,7 @@ fn airByteSwap(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
65716571 const ty = func.typeOfIndex(inst);
65726572 const operand = try func.resolveInst(ty_op.operand);
65736573
6574 if (ty.zigTypeTag(zcu) == .Vector) {
6574 if (ty.zigTypeTag(zcu) == .vector) {
65756575 return func.fail("TODO: @byteSwap for vectors", .{});
65766576 }
65776577 const int_info = ty.intInfo(zcu);
src/arch/wasm/abi.zig+24-24
......@@ -27,7 +27,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) [2]Class {
2727 const target = zcu.getTarget();
2828 if (!ty.hasRuntimeBitsIgnoreComptime(zcu)) return none;
2929 switch (ty.zigTypeTag(zcu)) {
30 .Struct => {
30 .@"struct" => {
3131 const struct_type = zcu.typeToStruct(ty).?;
3232 if (struct_type.layout == .@"packed") {
3333 if (ty.bitSize(zcu) <= 64) return direct;
......@@ -45,30 +45,30 @@ pub fn classifyType(ty: Type, zcu: *Zcu) [2]Class {
4545 }
4646 return classifyType(field_ty, zcu);
4747 },
48 .Int, .Enum, .ErrorSet => {
48 .int, .@"enum", .error_set => {
4949 const int_bits = ty.intInfo(zcu).bits;
5050 if (int_bits <= 64) return direct;
5151 if (int_bits <= 128) return .{ .direct, .direct };
5252 return memory;
5353 },
54 .Float => {
54 .float => {
5555 const float_bits = ty.floatBits(target);
5656 if (float_bits <= 64) return direct;
5757 if (float_bits <= 128) return .{ .direct, .direct };
5858 return memory;
5959 },
60 .Bool => return direct,
61 .Vector => return direct,
62 .Array => return memory,
63 .Optional => {
60 .bool => return direct,
61 .vector => return direct,
62 .array => return memory,
63 .optional => {
6464 assert(ty.isPtrLikeOptional(zcu));
6565 return direct;
6666 },
67 .Pointer => {
67 .pointer => {
6868 assert(!ty.isSlice(zcu));
6969 return direct;
7070 },
71 .Union => {
71 .@"union" => {
7272 const union_obj = zcu.typeToUnion(ty).?;
7373 if (union_obj.flagsUnordered(ip).layout == .@"packed") {
7474 if (ty.bitSize(zcu) <= 64) return direct;
......@@ -80,19 +80,19 @@ pub fn classifyType(ty: Type, zcu: *Zcu) [2]Class {
8080 const first_field_ty = Type.fromInterned(union_obj.field_types.get(ip)[0]);
8181 return classifyType(first_field_ty, zcu);
8282 },
83 .ErrorUnion,
84 .Frame,
85 .AnyFrame,
86 .NoReturn,
87 .Void,
88 .Type,
89 .ComptimeFloat,
90 .ComptimeInt,
91 .Undefined,
92 .Null,
93 .Fn,
94 .Opaque,
95 .EnumLiteral,
83 .error_union,
84 .frame,
85 .@"anyframe",
86 .noreturn,
87 .void,
88 .type,
89 .comptime_float,
90 .comptime_int,
91 .undefined,
92 .null,
93 .@"fn",
94 .@"opaque",
95 .enum_literal,
9696 => unreachable,
9797 }
9898}
......@@ -103,7 +103,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) [2]Class {
103103pub fn scalarType(ty: Type, zcu: *Zcu) Type {
104104 const ip = &zcu.intern_pool;
105105 switch (ty.zigTypeTag(zcu)) {
106 .Struct => {
106 .@"struct" => {
107107 if (zcu.typeToPackedStruct(ty)) |packed_struct| {
108108 return scalarType(Type.fromInterned(packed_struct.backingIntTypeUnordered(ip)), zcu);
109109 } else {
......@@ -111,7 +111,7 @@ pub fn scalarType(ty: Type, zcu: *Zcu) Type {
111111 return scalarType(ty.fieldType(0, zcu), zcu);
112112 }
113113 },
114 .Union => {
114 .@"union" => {
115115 const union_obj = zcu.typeToUnion(ty).?;
116116 if (union_obj.flagsUnordered(ip).layout != .@"packed") {
117117 const layout = Type.getUnionLayout(union_obj, zcu);
src/arch/x86_64/CodeGen.zig+118-118
......@@ -2419,7 +2419,7 @@ fn genLazy(self: *Self, lazy_sym: link.File.LazySymbol) InnerError!void {
24192419 const zcu = pt.zcu;
24202420 const ip = &zcu.intern_pool;
24212421 switch (Type.fromInterned(lazy_sym.ty).zigTypeTag(zcu)) {
2422 .Enum => {
2422 .@"enum" => {
24232423 const enum_ty = Type.fromInterned(lazy_sym.ty);
24242424 wip_mir_log.debug("{}.@tagName:", .{enum_ty.fmt(pt)});
24252425
......@@ -2704,13 +2704,13 @@ fn allocRegOrMemAdvanced(self: *Self, ty: Type, inst: ?Air.Inst.Index, reg_ok: b
27042704
27052705 if (reg_ok) need_mem: {
27062706 if (abi_size <= @as(u32, switch (ty.zigTypeTag(zcu)) {
2707 .Float => switch (ty.floatBits(self.target.*)) {
2707 .float => switch (ty.floatBits(self.target.*)) {
27082708 16, 32, 64, 128 => 16,
27092709 80 => break :need_mem,
27102710 else => unreachable,
27112711 },
2712 .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
2713 .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
2712 .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
2713 .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
27142714 16, 32, 64, 128 => if (self.hasFeature(.avx)) 32 else 16,
27152715 80 => break :need_mem,
27162716 else => unreachable,
......@@ -2733,11 +2733,11 @@ fn regClassForType(self: *Self, ty: Type) RegisterManager.RegisterBitSet {
27332733 const pt = self.pt;
27342734 const zcu = pt.zcu;
27352735 return switch (ty.zigTypeTag(zcu)) {
2736 .Float => switch (ty.floatBits(self.target.*)) {
2736 .float => switch (ty.floatBits(self.target.*)) {
27372737 80 => abi.RegisterClass.x87,
27382738 else => abi.RegisterClass.sse,
27392739 },
2740 .Vector => switch (ty.childType(zcu).toIntern()) {
2740 .vector => switch (ty.childType(zcu).toIntern()) {
27412741 .bool_type, .u1_type => abi.RegisterClass.gp,
27422742 else => if (ty.isAbiInt(zcu) and ty.intInfo(zcu).bits == 1)
27432743 abi.RegisterClass.gp
......@@ -2801,14 +2801,14 @@ fn restoreState(self: *Self, state: State, deaths: []const Air.Inst.Index, compt
28012801 ) |inst, *tracking| tracking.resurrect(inst, state.scope_generation);
28022802 for (deaths) |death| try self.processDeath(death);
28032803
2804 const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).Array.len]RegisterLock;
2804 const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).array.len]RegisterLock;
28052805 var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) =
28062806 if (opts.update_tracking)
28072807 {} else std.heap.stackFallback(@sizeOf(ExpectedContents), self.gpa);
28082808
28092809 var reg_locks = if (opts.update_tracking) {} else try std.ArrayList(RegisterLock).initCapacity(
28102810 stack.get(),
2811 @typeInfo(ExpectedContents).Array.len,
2811 @typeInfo(ExpectedContents).array.len,
28122812 );
28132813 defer if (!opts.update_tracking) {
28142814 for (reg_locks.items) |lock| self.register_manager.unlockReg(lock);
......@@ -3475,8 +3475,8 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
34753475 break :dst dst_mcv;
34763476 };
34773477
3478 if (dst_ty.zigTypeTag(zcu) == .Vector) {
3479 assert(src_ty.zigTypeTag(zcu) == .Vector and dst_ty.vectorLen(zcu) == src_ty.vectorLen(zcu));
3478 if (dst_ty.zigTypeTag(zcu) == .vector) {
3479 assert(src_ty.zigTypeTag(zcu) == .vector and dst_ty.vectorLen(zcu) == src_ty.vectorLen(zcu));
34803480 const dst_elem_ty = dst_ty.childType(zcu);
34813481 const dst_elem_abi_size: u32 = @intCast(dst_elem_ty.abiSize(zcu));
34823482 const src_elem_ty = src_ty.childType(zcu);
......@@ -3714,7 +3714,7 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {
37143714 const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
37153715 const dst_ty = self.typeOfIndex(inst);
37163716 switch (dst_ty.zigTypeTag(zcu)) {
3717 .Float, .Vector => break :result try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs),
3717 .float, .vector => break :result try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs),
37183718 else => {},
37193719 }
37203720 const dst_abi_size: u32 = @intCast(dst_ty.abiSize(zcu));
......@@ -3941,7 +3941,7 @@ fn airAddSat(self: *Self, inst: Air.Inst.Index) !void {
39413941 const zcu = pt.zcu;
39423942 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
39433943 const ty = self.typeOf(bin_op.lhs);
3944 if (ty.zigTypeTag(zcu) == .Vector or ty.abiSize(zcu) > 8) return self.fail(
3944 if (ty.zigTypeTag(zcu) == .vector or ty.abiSize(zcu) > 8) return self.fail(
39453945 "TODO implement airAddSat for {}",
39463946 .{ty.fmt(pt)},
39473947 );
......@@ -4042,7 +4042,7 @@ fn airSubSat(self: *Self, inst: Air.Inst.Index) !void {
40424042 const zcu = pt.zcu;
40434043 const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
40444044 const ty = self.typeOf(bin_op.lhs);
4045 if (ty.zigTypeTag(zcu) == .Vector or ty.abiSize(zcu) > 8) return self.fail(
4045 if (ty.zigTypeTag(zcu) == .vector or ty.abiSize(zcu) > 8) return self.fail(
40464046 "TODO implement airSubSat for {}",
40474047 .{ty.fmt(pt)},
40484048 );
......@@ -4216,7 +4216,7 @@ fn airMulSat(self: *Self, inst: Air.Inst.Index) !void {
42164216 break :result dst_mcv;
42174217 }
42184218
4219 if (ty.zigTypeTag(zcu) == .Vector or ty.abiSize(zcu) > 8) return self.fail(
4219 if (ty.zigTypeTag(zcu) == .vector or ty.abiSize(zcu) > 8) return self.fail(
42204220 "TODO implement airMulSat for {}",
42214221 .{ty.fmt(pt)},
42224222 );
......@@ -4287,8 +4287,8 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
42874287 const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
42884288 const ty = self.typeOf(bin_op.lhs);
42894289 switch (ty.zigTypeTag(zcu)) {
4290 .Vector => return self.fail("TODO implement add/sub with overflow for Vector type", .{}),
4291 .Int => {
4290 .vector => return self.fail("TODO implement add/sub with overflow for Vector type", .{}),
4291 .int => {
42924292 try self.spillEflagsIfOccupied();
42934293 try self.spillRegisters(&.{ .rcx, .rdi, .rsi });
42944294 const reg_locks = self.register_manager.lockRegsAssumeUnused(3, .{ .rcx, .rdi, .rsi });
......@@ -4354,8 +4354,8 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
43544354 const lhs_ty = self.typeOf(bin_op.lhs);
43554355 const rhs_ty = self.typeOf(bin_op.rhs);
43564356 switch (lhs_ty.zigTypeTag(zcu)) {
4357 .Vector => return self.fail("TODO implement shl with overflow for Vector type", .{}),
4358 .Int => {
4357 .vector => return self.fail("TODO implement shl with overflow for Vector type", .{}),
4358 .int => {
43594359 try self.spillEflagsIfOccupied();
43604360 try self.spillRegisters(&.{ .rcx, .rdi, .rsi });
43614361 const reg_locks = self.register_manager.lockRegsAssumeUnused(3, .{ .rcx, .rdi, .rsi });
......@@ -4510,8 +4510,8 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
45104510 const tuple_ty = self.typeOfIndex(inst);
45114511 const dst_ty = self.typeOf(bin_op.lhs);
45124512 const result: MCValue = switch (dst_ty.zigTypeTag(zcu)) {
4513 .Vector => return self.fail("TODO implement airMulWithOverflow for {}", .{dst_ty.fmt(pt)}),
4514 .Int => result: {
4513 .vector => return self.fail("TODO implement airMulWithOverflow for {}", .{dst_ty.fmt(pt)}),
4514 .int => result: {
45154515 const dst_info = dst_ty.intInfo(zcu);
45164516 if (dst_info.bits > 128 and dst_info.signedness == .unsigned) {
45174517 const slow_inc = self.hasFeature(.slow_incdec);
......@@ -5005,7 +5005,7 @@ fn airShlShrBinOp(self: *Self, inst: Air.Inst.Index) !void {
50055005 const rhs_ty = self.typeOf(bin_op.rhs);
50065006 const result: MCValue = result: {
50075007 switch (lhs_ty.zigTypeTag(zcu)) {
5008 .Int => {
5008 .int => {
50095009 try self.spillRegisters(&.{.rcx});
50105010 try self.register_manager.getKnownReg(.rcx, null);
50115011 const lhs_mcv = try self.resolveInst(bin_op.lhs);
......@@ -5047,8 +5047,8 @@ fn airShlShrBinOp(self: *Self, inst: Air.Inst.Index) !void {
50475047 }
50485048 break :result dst_mcv;
50495049 },
5050 .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
5051 .Int => if (@as(?Mir.Inst.FixedTag, switch (lhs_ty.childType(zcu).intInfo(zcu).bits) {
5050 .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
5051 .int => if (@as(?Mir.Inst.FixedTag, switch (lhs_ty.childType(zcu).intInfo(zcu).bits) {
50525052 else => null,
50535053 16 => switch (lhs_ty.vectorLen(zcu)) {
50545054 else => null,
......@@ -6212,7 +6212,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void {
62126212
62136213 const dst_ty = self.typeOfIndex(inst);
62146214 const src_ty = self.typeOf(ty_op.operand);
6215 if (src_ty.zigTypeTag(zcu) == .Vector) return self.fail("TODO implement airClz for {}", .{
6215 if (src_ty.zigTypeTag(zcu) == .vector) return self.fail("TODO implement airClz for {}", .{
62166216 src_ty.fmt(pt),
62176217 });
62186218
......@@ -6409,7 +6409,7 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {
64096409
64106410 const dst_ty = self.typeOfIndex(inst);
64116411 const src_ty = self.typeOf(ty_op.operand);
6412 if (src_ty.zigTypeTag(zcu) == .Vector) return self.fail("TODO implement airCtz for {}", .{
6412 if (src_ty.zigTypeTag(zcu) == .vector) return self.fail("TODO implement airCtz for {}", .{
64136413 src_ty.fmt(pt),
64146414 });
64156415
......@@ -6571,7 +6571,7 @@ fn airPopCount(self: *Self, inst: Air.Inst.Index) !void {
65716571
65726572 const src_ty = self.typeOf(ty_op.operand);
65736573 const src_abi_size: u32 = @intCast(src_ty.abiSize(zcu));
6574 if (src_ty.zigTypeTag(zcu) == .Vector or src_abi_size > 16)
6574 if (src_ty.zigTypeTag(zcu) == .vector or src_abi_size > 16)
65756575 return self.fail("TODO implement airPopCount for {}", .{src_ty.fmt(pt)});
65766576 const src_mcv = try self.resolveInst(ty_op.operand);
65776577
......@@ -6724,7 +6724,7 @@ fn genByteSwap(
67246724 const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
67256725 const has_movbe = self.hasFeature(.movbe);
67266726
6727 if (src_ty.zigTypeTag(zcu) == .Vector) return self.fail(
6727 if (src_ty.zigTypeTag(zcu) == .vector) return self.fail(
67286728 "TODO implement genByteSwap for {}",
67296729 .{src_ty.fmt(pt)},
67306730 );
......@@ -7036,7 +7036,7 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)
70367036 const result = result: {
70377037 const scalar_bits = ty.scalarType(zcu).floatBits(self.target.*);
70387038 if (scalar_bits == 80) {
7039 if (ty.zigTypeTag(zcu) != .Float) return self.fail("TODO implement floatSign for {}", .{
7039 if (ty.zigTypeTag(zcu) != .float) return self.fail("TODO implement floatSign for {}", .{
70407040 ty.fmt(pt),
70417041 });
70427042
......@@ -7209,14 +7209,14 @@ fn getRoundTag(self: *Self, ty: Type) ?Mir.Inst.FixedTag {
72097209 const pt = self.pt;
72107210 const zcu = pt.zcu;
72117211 return if (self.hasFeature(.sse4_1)) switch (ty.zigTypeTag(zcu)) {
7212 .Float => switch (ty.floatBits(self.target.*)) {
7212 .float => switch (ty.floatBits(self.target.*)) {
72137213 32 => if (self.hasFeature(.avx)) .{ .v_ss, .round } else .{ ._ss, .round },
72147214 64 => if (self.hasFeature(.avx)) .{ .v_sd, .round } else .{ ._sd, .round },
72157215 16, 80, 128 => null,
72167216 else => unreachable,
72177217 },
7218 .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
7219 .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
7218 .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
7219 .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
72207220 32 => switch (ty.vectorLen(zcu)) {
72217221 1 => if (self.hasFeature(.avx)) .{ .v_ss, .round } else .{ ._ss, .round },
72227222 2...4 => if (self.hasFeature(.avx)) .{ .v_ps, .round } else .{ ._ps, .round },
......@@ -7243,7 +7243,7 @@ fn genRoundLibcall(self: *Self, ty: Type, src_mcv: MCValue, mode: RoundMode) !MC
72437243 const zcu = pt.zcu;
72447244 if (self.getRoundTag(ty)) |_| return .none;
72457245
7246 if (ty.zigTypeTag(zcu) != .Float)
7246 if (ty.zigTypeTag(zcu) != .float)
72477247 return self.fail("TODO implement genRound for {}", .{ty.fmt(pt)});
72487248
72497249 var callee_buf: ["__trunc?".len]u8 = undefined;
......@@ -7314,7 +7314,7 @@ fn airAbs(self: *Self, inst: Air.Inst.Index) !void {
73147314 const result: MCValue = result: {
73157315 const mir_tag = @as(?Mir.Inst.FixedTag, switch (ty.zigTypeTag(zcu)) {
73167316 else => null,
7317 .Int => switch (ty.abiSize(zcu)) {
7317 .int => switch (ty.abiSize(zcu)) {
73187318 0 => unreachable,
73197319 1...8 => {
73207320 try self.spillEflagsIfOccupied();
......@@ -7442,10 +7442,10 @@ fn airAbs(self: *Self, inst: Air.Inst.Index) !void {
74427442 break :result dst_mcv;
74437443 },
74447444 },
7445 .Float => return self.floatSign(inst, ty_op.operand, ty),
7446 .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
7445 .float => return self.floatSign(inst, ty_op.operand, ty),
7446 .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
74477447 else => null,
7448 .Int => switch (ty.childType(zcu).intInfo(zcu).bits) {
7448 .int => switch (ty.childType(zcu).intInfo(zcu).bits) {
74497449 else => null,
74507450 8 => switch (ty.vectorLen(zcu)) {
74517451 else => null,
......@@ -7478,7 +7478,7 @@ fn airAbs(self: *Self, inst: Air.Inst.Index) !void {
74787478 5...8 => if (self.hasFeature(.avx2)) .{ .vp_d, .abs } else null,
74797479 },
74807480 },
7481 .Float => return self.floatSign(inst, ty_op.operand, ty),
7481 .float => return self.floatSign(inst, ty_op.operand, ty),
74827482 },
74837483 }) orelse return self.fail("TODO implement airAbs for {}", .{ty.fmt(pt)});
74847484
......@@ -7515,7 +7515,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
75157515
75167516 const result: MCValue = result: {
75177517 switch (ty.zigTypeTag(zcu)) {
7518 .Float => {
7518 .float => {
75197519 const float_bits = ty.floatBits(self.target.*);
75207520 if (switch (float_bits) {
75217521 16 => !self.hasFeature(.f16c),
......@@ -7547,7 +7547,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
75477547 defer if (dst_lock) |lock| self.register_manager.unlockReg(lock);
75487548
75497549 const mir_tag = @as(?Mir.Inst.FixedTag, switch (ty.zigTypeTag(zcu)) {
7550 .Float => switch (ty.floatBits(self.target.*)) {
7550 .float => switch (ty.floatBits(self.target.*)) {
75517551 16 => {
75527552 assert(self.hasFeature(.f16c));
75537553 const mat_src_reg = if (src_mcv.isRegister())
......@@ -7568,8 +7568,8 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
75687568 64 => if (self.hasFeature(.avx)) .{ .v_sd, .sqrt } else .{ ._sd, .sqrt },
75697569 else => unreachable,
75707570 },
7571 .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
7572 .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
7571 .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
7572 .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
75737573 16 => if (self.hasFeature(.f16c)) switch (ty.vectorLen(zcu)) {
75747574 1 => {
75757575 try self.asmRegisterRegister(
......@@ -8496,7 +8496,7 @@ fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air:
84968496 const pt = self.pt;
84978497 const zcu = pt.zcu;
84988498 const src_ty = self.typeOf(src_air);
8499 if (src_ty.zigTypeTag(zcu) == .Vector)
8499 if (src_ty.zigTypeTag(zcu) == .vector)
85008500 return self.fail("TODO implement genUnOp for {}", .{src_ty.fmt(pt)});
85018501
85028502 var src_mcv = try self.resolveInst(src_air);
......@@ -9291,7 +9291,7 @@ fn genShiftBinOp(
92919291) !MCValue {
92929292 const pt = self.pt;
92939293 const zcu = pt.zcu;
9294 if (lhs_ty.zigTypeTag(zcu) == .Vector) return self.fail("TODO implement genShiftBinOp for {}", .{
9294 if (lhs_ty.zigTypeTag(zcu) == .vector) return self.fail("TODO implement genShiftBinOp for {}", .{
92959295 lhs_ty.fmt(pt),
92969296 });
92979297
......@@ -9350,7 +9350,7 @@ fn genMulDivBinOp(
93509350) !MCValue {
93519351 const pt = self.pt;
93529352 const zcu = pt.zcu;
9353 if (dst_ty.zigTypeTag(zcu) == .Vector or dst_ty.zigTypeTag(zcu) == .Float) return self.fail(
9353 if (dst_ty.zigTypeTag(zcu) == .vector or dst_ty.zigTypeTag(zcu) == .float) return self.fail(
93549354 "TODO implement genMulDivBinOp for {s} from {} to {}",
93559355 .{ @tagName(tag), src_ty.fmt(pt), dst_ty.fmt(pt) },
93569356 );
......@@ -9938,8 +9938,8 @@ fn genBinOp(
99389938
99399939 const sse_op = switch (lhs_ty.zigTypeTag(zcu)) {
99409940 else => false,
9941 .Float => true,
9942 .Vector => switch (lhs_ty.childType(zcu).toIntern()) {
9941 .float => true,
9942 .vector => switch (lhs_ty.childType(zcu).toIntern()) {
99439943 .bool_type, .u1_type => false,
99449944 else => true,
99459945 },
......@@ -9966,12 +9966,12 @@ fn genBinOp(
99669966
99679967 const ordered_air: [2]Air.Inst.Ref = if (lhs_ty.isVector(zcu) and
99689968 switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
9969 .Bool => false,
9970 .Int => switch (air_tag) {
9969 .bool => false,
9970 .int => switch (air_tag) {
99719971 .cmp_lt, .cmp_gte => true,
99729972 else => false,
99739973 },
9974 .Float => switch (air_tag) {
9974 .float => switch (air_tag) {
99759975 .cmp_gte, .cmp_gt => true,
99769976 else => false,
99779977 },
......@@ -10337,7 +10337,7 @@ fn genBinOp(
1033710337 const dst_reg = registerAlias(dst_mcv.getReg().?, abi_size);
1033810338 const mir_tag = @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) {
1033910339 else => unreachable,
10340 .Float => switch (lhs_ty.floatBits(self.target.*)) {
10340 .float => switch (lhs_ty.floatBits(self.target.*)) {
1034110341 16 => {
1034210342 assert(self.hasFeature(.f16c));
1034310343 const tmp_reg =
......@@ -10430,9 +10430,9 @@ fn genBinOp(
1043010430 80, 128 => null,
1043110431 else => unreachable,
1043210432 },
10433 .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
10433 .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
1043410434 else => null,
10435 .Int => switch (lhs_ty.childType(zcu).intInfo(zcu).bits) {
10435 .int => switch (lhs_ty.childType(zcu).intInfo(zcu).bits) {
1043610436 8 => switch (lhs_ty.vectorLen(zcu)) {
1043710437 1...16 => switch (air_tag) {
1043810438 .add,
......@@ -10779,7 +10779,7 @@ fn genBinOp(
1077910779 },
1078010780 else => null,
1078110781 },
10782 .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
10782 .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
1078310783 16 => tag: {
1078410784 assert(self.hasFeature(.f16c));
1078510785 switch (lhs_ty.vectorLen(zcu)) {
......@@ -11101,7 +11101,7 @@ fn genBinOp(
1110111101 lhs_reg,
1110211102 try src_mcv.mem(self, switch (lhs_ty.zigTypeTag(zcu)) {
1110311103 else => Memory.Size.fromSize(abi_size),
11104 .Vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
11104 .vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
1110511105 }),
1110611106 ) else try self.asmRegisterRegisterRegister(
1110711107 mir_tag,
......@@ -11119,7 +11119,7 @@ fn genBinOp(
1111911119 dst_reg,
1112011120 try src_mcv.mem(self, switch (lhs_ty.zigTypeTag(zcu)) {
1112111121 else => Memory.Size.fromSize(abi_size),
11122 .Vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
11122 .vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
1112311123 }),
1112411124 ) else try self.asmRegisterRegister(
1112511125 mir_tag,
......@@ -11147,7 +11147,7 @@ fn genBinOp(
1114711147 lhs_reg,
1114811148 try src_mcv.mem(self, switch (lhs_ty.zigTypeTag(zcu)) {
1114911149 else => Memory.Size.fromSize(abi_size),
11150 .Vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
11150 .vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
1115111151 }),
1115211152 imm,
1115311153 ) else try self.asmRegisterRegisterRegisterImmediate(
......@@ -11167,7 +11167,7 @@ fn genBinOp(
1116711167 dst_reg,
1116811168 try src_mcv.mem(self, switch (lhs_ty.zigTypeTag(zcu)) {
1116911169 else => Memory.Size.fromSize(abi_size),
11170 .Vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
11170 .vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
1117111171 }),
1117211172 imm,
1117311173 ) else try self.asmRegisterRegisterImmediate(
......@@ -11199,14 +11199,14 @@ fn genBinOp(
1119911199
1120011200 try self.asmRegisterRegisterRegisterImmediate(
1120111201 @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) {
11202 .Float => switch (lhs_ty.floatBits(self.target.*)) {
11202 .float => switch (lhs_ty.floatBits(self.target.*)) {
1120311203 32 => .{ .v_ss, .cmp },
1120411204 64 => .{ .v_sd, .cmp },
1120511205 16, 80, 128 => null,
1120611206 else => unreachable,
1120711207 },
11208 .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11209 .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
11208 .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11209 .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
1121011210 32 => switch (lhs_ty.vectorLen(zcu)) {
1121111211 1 => .{ .v_ss, .cmp },
1121211212 2...8 => .{ .v_ps, .cmp },
......@@ -11233,14 +11233,14 @@ fn genBinOp(
1123311233 );
1123411234 try self.asmRegisterRegisterRegisterRegister(
1123511235 @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) {
11236 .Float => switch (lhs_ty.floatBits(self.target.*)) {
11236 .float => switch (lhs_ty.floatBits(self.target.*)) {
1123711237 32 => .{ .v_ps, .blendv },
1123811238 64 => .{ .v_pd, .blendv },
1123911239 16, 80, 128 => null,
1124011240 else => unreachable,
1124111241 },
11242 .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11243 .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
11242 .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11243 .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
1124411244 32 => switch (lhs_ty.vectorLen(zcu)) {
1124511245 1...8 => .{ .v_ps, .blendv },
1124611246 else => null,
......@@ -11267,14 +11267,14 @@ fn genBinOp(
1126711267 const has_blend = self.hasFeature(.sse4_1);
1126811268 try self.asmRegisterRegisterImmediate(
1126911269 @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) {
11270 .Float => switch (lhs_ty.floatBits(self.target.*)) {
11270 .float => switch (lhs_ty.floatBits(self.target.*)) {
1127111271 32 => .{ ._ss, .cmp },
1127211272 64 => .{ ._sd, .cmp },
1127311273 16, 80, 128 => null,
1127411274 else => unreachable,
1127511275 },
11276 .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11277 .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
11276 .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11277 .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
1127811278 32 => switch (lhs_ty.vectorLen(zcu)) {
1127911279 1 => .{ ._ss, .cmp },
1128011280 2...4 => .{ ._ps, .cmp },
......@@ -11300,14 +11300,14 @@ fn genBinOp(
1130011300 );
1130111301 if (has_blend) try self.asmRegisterRegisterRegister(
1130211302 @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) {
11303 .Float => switch (lhs_ty.floatBits(self.target.*)) {
11303 .float => switch (lhs_ty.floatBits(self.target.*)) {
1130411304 32 => .{ ._ps, .blendv },
1130511305 64 => .{ ._pd, .blendv },
1130611306 16, 80, 128 => null,
1130711307 else => unreachable,
1130811308 },
11309 .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11310 .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
11309 .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11310 .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
1131111311 32 => switch (lhs_ty.vectorLen(zcu)) {
1131211312 1...4 => .{ ._ps, .blendv },
1131311313 else => null,
......@@ -11330,14 +11330,14 @@ fn genBinOp(
1133011330 mask_reg,
1133111331 ) else {
1133211332 const mir_fixes = @as(?Mir.Inst.Fixes, switch (lhs_ty.zigTypeTag(zcu)) {
11333 .Float => switch (lhs_ty.floatBits(self.target.*)) {
11333 .float => switch (lhs_ty.floatBits(self.target.*)) {
1133411334 32 => ._ps,
1133511335 64 => ._pd,
1133611336 16, 80, 128 => null,
1133711337 else => unreachable,
1133811338 },
11339 .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11340 .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
11339 .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11340 .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
1134111341 32 => switch (lhs_ty.vectorLen(zcu)) {
1134211342 1...4 => ._ps,
1134311343 else => null,
......@@ -11362,7 +11362,7 @@ fn genBinOp(
1136211362 },
1136311363 .cmp_lt, .cmp_lte, .cmp_eq, .cmp_gte, .cmp_gt, .cmp_neq => {
1136411364 switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
11365 .Int => switch (air_tag) {
11365 .int => switch (air_tag) {
1136611366 .cmp_lt,
1136711367 .cmp_eq,
1136811368 .cmp_gt,
......@@ -11396,7 +11396,7 @@ fn genBinOp(
1139611396 },
1139711397 else => unreachable,
1139811398 },
11399 .Float => {},
11399 .float => {},
1140011400 else => unreachable,
1140111401 }
1140211402
......@@ -12268,8 +12268,8 @@ fn genCall(self: *Self, info: union(enum) {
1226812268 .air => |callee| fn_info: {
1226912269 const callee_ty = self.typeOf(callee);
1227012270 break :fn_info switch (callee_ty.zigTypeTag(zcu)) {
12271 .Fn => callee_ty,
12272 .Pointer => callee_ty.childType(zcu),
12271 .@"fn" => callee_ty,
12272 .pointer => callee_ty.childType(zcu),
1227312273 else => unreachable,
1227412274 };
1227512275 },
......@@ -12544,7 +12544,7 @@ fn genCall(self: *Self, info: union(enum) {
1254412544 else => return self.fail("TODO implement calling bitcasted functions", .{}),
1254512545 }
1254612546 } else {
12547 assert(self.typeOf(callee).zigTypeTag(zcu) == .Pointer);
12547 assert(self.typeOf(callee).zigTypeTag(zcu) == .pointer);
1254812548 try self.genSetReg(.rax, Type.usize, .{ .air_ref = callee }, .{});
1254912549 try self.asmRegister(.{ ._, .call }, .rax);
1255012550 },
......@@ -12650,7 +12650,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
1265012650 defer for (rhs_locks) |rhs_lock| if (rhs_lock) |lock| self.register_manager.unlockReg(lock);
1265112651
1265212652 switch (ty.zigTypeTag(zcu)) {
12653 .Float => {
12653 .float => {
1265412654 const float_bits = ty.floatBits(self.target.*);
1265512655 if (switch (float_bits) {
1265612656 16 => !self.hasFeature(.f16c),
......@@ -12685,7 +12685,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
1268512685 };
1268612686 }
1268712687 },
12688 .Optional => if (!ty.optionalReprIsPayload(zcu)) {
12688 .optional => if (!ty.optionalReprIsPayload(zcu)) {
1268912689 const opt_ty = ty;
1269012690 const opt_abi_size: u31 = @intCast(opt_ty.abiSize(zcu));
1269112691 ty = opt_ty.optionalChild(zcu);
......@@ -12982,7 +12982,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
1298212982 },
1298312983 );
1298412984 },
12985 .Float => {
12985 .float => {
1298612986 const flipped = switch (op) {
1298712987 .lt, .lte => true,
1298812988 .eq, .gte, .gt, .neq => false,
......@@ -14659,7 +14659,7 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo
1465914659 else => {},
1466014660 }
1466114661 },
14662 .Float => switch (ty.floatBits(self.target.*)) {
14662 .float => switch (ty.floatBits(self.target.*)) {
1466314663 16 => return if (self.hasFeature(.avx)) .{ .vex_insert_extract = .{
1466414664 .insert = .{ .vp_w, .insr },
1466514665 .extract = .{ .vp_w, .extr },
......@@ -14680,15 +14680,15 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo
1468014680 else if (aligned) .{ ._, .movdqa } else .{ ._, .movdqu } },
1468114681 else => {},
1468214682 },
14683 .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
14684 .Bool => switch (ty.vectorLen(zcu)) {
14683 .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
14684 .bool => switch (ty.vectorLen(zcu)) {
1468514685 33...64 => return .{ .move = if (self.hasFeature(.avx))
1468614686 .{ .v_q, .mov }
1468714687 else
1468814688 .{ ._q, .mov } },
1468914689 else => {},
1469014690 },
14691 .Int => switch (ty.childType(zcu).intInfo(zcu).bits) {
14691 .int => switch (ty.childType(zcu).intInfo(zcu).bits) {
1469214692 1...8 => switch (ty.vectorLen(zcu)) {
1469314693 1...16 => return .{ .move = if (self.hasFeature(.avx))
1469414694 if (aligned) .{ .v_, .movdqa } else .{ .v_, .movdqu }
......@@ -14754,7 +14754,7 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo
1475414754 },
1475514755 else => {},
1475614756 },
14757 .Pointer, .Optional => if (ty.childType(zcu).isPtrAtRuntime(zcu))
14757 .pointer, .optional => if (ty.childType(zcu).isPtrAtRuntime(zcu))
1475814758 switch (ty.vectorLen(zcu)) {
1475914759 1...2 => return .{ .move = if (self.hasFeature(.avx))
1476014760 if (aligned) .{ .v_, .movdqa } else .{ .v_, .movdqu }
......@@ -14768,7 +14768,7 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo
1476814768 }
1476914769 else
1477014770 unreachable,
14771 .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
14771 .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
1477214772 16 => switch (ty.vectorLen(zcu)) {
1477314773 1...8 => return .{ .move = if (self.hasFeature(.avx))
1477414774 if (aligned) .{ .v_, .movdqa } else .{ .v_, .movdqu }
......@@ -15072,7 +15072,7 @@ fn genSetReg(
1507215072 17...32 => if (self.hasFeature(.avx)) .{ .v_, .movdqa } else null,
1507315073 else => null,
1507415074 },
15075 .Float => switch (ty.scalarType(zcu).floatBits(self.target.*)) {
15075 .float => switch (ty.scalarType(zcu).floatBits(self.target.*)) {
1507615076 16, 128 => switch (abi_size) {
1507715077 2...16 => if (self.hasFeature(.avx))
1507815078 .{ .v_, .movdqa }
......@@ -15368,7 +15368,7 @@ fn genSetMem(
1536815368 }
1536915369 },
1537015370 .register_overflow => |ro| switch (ty.zigTypeTag(zcu)) {
15371 .Struct => {
15371 .@"struct" => {
1537215372 try self.genSetMem(
1537315373 base,
1537415374 disp + @as(i32, @intCast(ty.structFieldOffset(0, zcu))),
......@@ -15384,7 +15384,7 @@ fn genSetMem(
1538415384 opts,
1538515385 );
1538615386 },
15387 .Optional => {
15387 .optional => {
1538815388 assert(!ty.optionalReprIsPayload(zcu));
1538915389 const child_ty = ty.optionalChild(zcu);
1539015390 try self.genSetMem(base, disp, child_ty, .{ .register = ro.reg }, opts);
......@@ -15768,7 +15768,7 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
1576815768 defer self.register_manager.unlockReg(dst_lock);
1576915769
1577015770 const mir_tag = @as(?Mir.Inst.FixedTag, switch (dst_ty.zigTypeTag(zcu)) {
15771 .Float => switch (dst_ty.floatBits(self.target.*)) {
15771 .float => switch (dst_ty.floatBits(self.target.*)) {
1577215772 32 => if (self.hasFeature(.avx)) .{ .v_ss, .cvtsi2 } else .{ ._ss, .cvtsi2 },
1577315773 64 => if (self.hasFeature(.avx)) .{ .v_sd, .cvtsi2 } else .{ ._sd, .cvtsi2 },
1577415774 16, 80, 128 => null,
......@@ -16702,7 +16702,7 @@ fn airSplat(self: *Self, inst: Air.Inst.Index) !void {
1670216702 const result: MCValue = result: {
1670316703 switch (scalar_ty.zigTypeTag(zcu)) {
1670416704 else => {},
16705 .Bool => {
16705 .bool => {
1670616706 const regs =
1670716707 try self.register_manager.allocRegs(2, .{ inst, null }, abi.RegisterClass.gp);
1670816708 const reg_locks = self.register_manager.lockRegsAssumeUnused(2, regs);
......@@ -16742,7 +16742,7 @@ fn airSplat(self: *Self, inst: Air.Inst.Index) !void {
1674216742 );
1674316743 break :result .{ .register = regs[0] };
1674416744 },
16745 .Int => if (self.hasFeature(.avx2)) avx2: {
16745 .int => if (self.hasFeature(.avx2)) avx2: {
1674616746 const mir_tag = @as(?Mir.Inst.FixedTag, switch (scalar_ty.intInfo(zcu).bits) {
1674716747 else => null,
1674816748 1...8 => switch (vector_len) {
......@@ -16835,7 +16835,7 @@ fn airSplat(self: *Self, inst: Air.Inst.Index) !void {
1683516835 );
1683616836 break :result .{ .register = dst_reg };
1683716837 },
16838 .Float => switch (scalar_ty.floatBits(self.target.*)) {
16838 .float => switch (scalar_ty.floatBits(self.target.*)) {
1683916839 32 => switch (vector_len) {
1684016840 1 => {
1684116841 const src_mcv = try self.resolveInst(ty_op.operand);
......@@ -17264,7 +17264,7 @@ fn airSelect(self: *Self, inst: Air.Inst.Index) !void {
1726417264
1726517265 const mir_tag = @as(?Mir.Inst.FixedTag, switch (ty.childType(zcu).zigTypeTag(zcu)) {
1726617266 else => null,
17267 .Int => switch (abi_size) {
17267 .int => switch (abi_size) {
1726817268 0 => unreachable,
1726917269 1...16 => if (has_avx)
1727017270 .{ .vp_b, .blendv }
......@@ -17278,7 +17278,7 @@ fn airSelect(self: *Self, inst: Air.Inst.Index) !void {
1727817278 null,
1727917279 else => null,
1728017280 },
17281 .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
17281 .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
1728217282 else => unreachable,
1728317283 16, 80, 128 => null,
1728417284 32 => switch (vec_len) {
......@@ -17334,8 +17334,8 @@ fn airSelect(self: *Self, inst: Air.Inst.Index) !void {
1733417334 ) else {
1733517335 const mir_fixes = @as(?Mir.Inst.Fixes, switch (elem_ty.zigTypeTag(zcu)) {
1733617336 else => null,
17337 .Int => .p_,
17338 .Float => switch (elem_ty.floatBits(self.target.*)) {
17337 .int => .p_,
17338 .float => switch (elem_ty.floatBits(self.target.*)) {
1733917339 32 => ._ps,
1734017340 64 => ._pd,
1734117341 16, 80, 128 => null,
......@@ -18132,8 +18132,8 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void {
1813218132 if (has_avx) try self.asmRegisterRegisterRegister(
1813318133 .{ switch (elem_ty.zigTypeTag(zcu)) {
1813418134 else => break :result null,
18135 .Int => .vp_,
18136 .Float => switch (elem_ty.floatBits(self.target.*)) {
18135 .int => .vp_,
18136 .float => switch (elem_ty.floatBits(self.target.*)) {
1813718137 32 => .v_ps,
1813818138 64 => .v_pd,
1813918139 16, 80, 128 => break :result null,
......@@ -18146,8 +18146,8 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void {
1814618146 ) else try self.asmRegisterRegister(
1814718147 .{ switch (elem_ty.zigTypeTag(zcu)) {
1814818148 else => break :result null,
18149 .Int => .p_,
18150 .Float => switch (elem_ty.floatBits(self.target.*)) {
18149 .int => .p_,
18150 .float => switch (elem_ty.floatBits(self.target.*)) {
1815118151 32 => ._ps,
1815218152 64 => ._pd,
1815318153 16, 80, 128 => break :result null,
......@@ -18235,7 +18235,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
1823518235 const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra[ty_pl.payload..][0..len]);
1823618236 const result: MCValue = result: {
1823718237 switch (result_ty.zigTypeTag(zcu)) {
18238 .Struct => {
18238 .@"struct" => {
1823918239 const frame_index = try self.allocFrameIndex(FrameAlloc.initSpill(result_ty, zcu));
1824018240 if (result_ty.containerLayout(zcu) == .@"packed") {
1824118241 const struct_obj = zcu.typeToStruct(result_ty).?;
......@@ -18342,7 +18342,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
1834218342 }
1834318343 break :result .{ .load_frame = .{ .index = frame_index } };
1834418344 },
18345 .Array, .Vector => {
18345 .array, .vector => {
1834618346 const elem_ty = result_ty.childType(zcu);
1834718347 if (result_ty.isVector(zcu) and elem_ty.toIntern() == .bool_type) {
1834818348 const result_size: u32 = @intCast(result_ty.abiSize(zcu));
......@@ -18483,7 +18483,7 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
1848318483 32, 64 => !self.hasFeature(.fma),
1848418484 else => unreachable,
1848518485 }) {
18486 if (ty.zigTypeTag(zcu) != .Float) return self.fail("TODO implement airMulAdd for {}", .{
18486 if (ty.zigTypeTag(zcu) != .float) return self.fail("TODO implement airMulAdd for {}", .{
1848718487 ty.fmt(pt),
1848818488 });
1848918489
......@@ -18533,14 +18533,14 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
1853318533 const mir_tag = @as(?Mir.Inst.FixedTag, if (mem.eql(u2, &order, &.{ 1, 3, 2 }) or
1853418534 mem.eql(u2, &order, &.{ 3, 1, 2 }))
1853518535 switch (ty.zigTypeTag(zcu)) {
18536 .Float => switch (ty.floatBits(self.target.*)) {
18536 .float => switch (ty.floatBits(self.target.*)) {
1853718537 32 => .{ .v_ss, .fmadd132 },
1853818538 64 => .{ .v_sd, .fmadd132 },
1853918539 16, 80, 128 => null,
1854018540 else => unreachable,
1854118541 },
18542 .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
18543 .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
18542 .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
18543 .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
1854418544 32 => switch (ty.vectorLen(zcu)) {
1854518545 1 => .{ .v_ss, .fmadd132 },
1854618546 2...8 => .{ .v_ps, .fmadd132 },
......@@ -18560,14 +18560,14 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
1856018560 }
1856118561 else if (mem.eql(u2, &order, &.{ 2, 1, 3 }) or mem.eql(u2, &order, &.{ 1, 2, 3 }))
1856218562 switch (ty.zigTypeTag(zcu)) {
18563 .Float => switch (ty.floatBits(self.target.*)) {
18563 .float => switch (ty.floatBits(self.target.*)) {
1856418564 32 => .{ .v_ss, .fmadd213 },
1856518565 64 => .{ .v_sd, .fmadd213 },
1856618566 16, 80, 128 => null,
1856718567 else => unreachable,
1856818568 },
18569 .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
18570 .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
18569 .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
18570 .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
1857118571 32 => switch (ty.vectorLen(zcu)) {
1857218572 1 => .{ .v_ss, .fmadd213 },
1857318573 2...8 => .{ .v_ps, .fmadd213 },
......@@ -18587,14 +18587,14 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
1858718587 }
1858818588 else if (mem.eql(u2, &order, &.{ 2, 3, 1 }) or mem.eql(u2, &order, &.{ 3, 2, 1 }))
1858918589 switch (ty.zigTypeTag(zcu)) {
18590 .Float => switch (ty.floatBits(self.target.*)) {
18590 .float => switch (ty.floatBits(self.target.*)) {
1859118591 32 => .{ .v_ss, .fmadd231 },
1859218592 64 => .{ .v_sd, .fmadd231 },
1859318593 16, 80, 128 => null,
1859418594 else => unreachable,
1859518595 },
18596 .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
18597 .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
18596 .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
18597 .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
1859818598 32 => switch (ty.vectorLen(zcu)) {
1859918599 1 => .{ .v_ss, .fmadd231 },
1860018600 2...8 => .{ .v_ps, .fmadd231 },
......@@ -18971,7 +18971,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) *InstTracking {
1897118971/// and as a register.
1897218972fn limitImmediateType(self: *Self, operand: Air.Inst.Ref, comptime T: type) !MCValue {
1897318973 const mcv = try self.resolveInst(operand);
18974 const ti = @typeInfo(T).Int;
18974 const ti = @typeInfo(T).int;
1897518975 switch (mcv) {
1897618976 .immediate => |imm| {
1897718977 // This immediate is unsigned.
......@@ -19078,7 +19078,7 @@ fn resolveCallingConventionValues(
1907819078 }
1907919079
1908019080 // Return values
19081 if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
19081 if (ret_ty.zigTypeTag(zcu) == .noreturn) {
1908219082 result.return_value = InstTracking.init(.unreach);
1908319083 } else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
1908419084 // TODO: is this even possible for C calling convention?
......@@ -19266,7 +19266,7 @@ fn resolveCallingConventionValues(
1926619266 result.stack_align = .@"16";
1926719267
1926819268 // Return values
19269 if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
19269 if (ret_ty.zigTypeTag(zcu) == .noreturn) {
1927019270 result.return_value = InstTracking.init(.unreach);
1927119271 } else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
1927219272 result.return_value = InstTracking.init(.none);
......@@ -19372,7 +19372,7 @@ fn memSize(self: *Self, ty: Type) Memory.Size {
1937219372 const pt = self.pt;
1937319373 const zcu = pt.zcu;
1937419374 return switch (ty.zigTypeTag(zcu)) {
19375 .Float => Memory.Size.fromBitSize(ty.floatBits(self.target.*)),
19375 .float => Memory.Size.fromBitSize(ty.floatBits(self.target.*)),
1937619376 else => Memory.Size.fromSize(@intCast(ty.abiSize(zcu))),
1937719377 };
1937819378}
......@@ -19467,7 +19467,7 @@ fn regBitSize(self: *Self, ty: Type) u64 {
1946719467 5...8 => 64,
1946819468 else => unreachable,
1946919469 },
19470 .Float => switch (abi_size) {
19470 .float => switch (abi_size) {
1947119471 1...16 => 128,
1947219472 17...32 => 256,
1947319473 else => unreachable,
src/arch/x86_64/Encoding.zig+3-3
......@@ -845,7 +845,7 @@ fn estimateInstructionLength(prefix: Prefix, encoding: Encoding, ops: []const Op
845845
846846const mnemonic_to_encodings_map = init: {
847847 @setEvalBranchQuota(5_000);
848 const mnemonic_count = @typeInfo(Mnemonic).Enum.fields.len;
848 const mnemonic_count = @typeInfo(Mnemonic).@"enum".fields.len;
849849 var mnemonic_map: [mnemonic_count][]Data = .{&.{}} ** mnemonic_count;
850850 const encodings = @import("encodings.zig");
851851 for (encodings.table) |entry| mnemonic_map[@intFromEnum(entry[0])].len += 1;
......@@ -856,8 +856,8 @@ const mnemonic_to_encodings_map = init: {
856856 storage_i += value.len;
857857 }
858858 var mnemonic_i: [mnemonic_count]usize = .{0} ** mnemonic_count;
859 const ops_len = @typeInfo(std.meta.FieldType(Data, .ops)).Array.len;
860 const opc_len = @typeInfo(std.meta.FieldType(Data, .opc)).Array.len;
859 const ops_len = @typeInfo(std.meta.FieldType(Data, .ops)).array.len;
860 const opc_len = @typeInfo(std.meta.FieldType(Data, .opc)).array.len;
861861 for (encodings.table) |entry| {
862862 const i = &mnemonic_i[@intFromEnum(entry[0])];
863863 mnemonic_map[@intFromEnum(entry[0])][i.*] = .{
src/arch/x86_64/Lower.zig+1-1
......@@ -571,7 +571,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
571571 @setEvalBranchQuota(2_000);
572572
573573 comptime var max_len = 0;
574 inline for (@typeInfo(Mnemonic).Enum.fields) |field| max_len = @max(field.name.len, max_len);
574 inline for (@typeInfo(Mnemonic).@"enum".fields) |field| max_len = @max(field.name.len, max_len);
575575 var buf: [max_len]u8 = undefined;
576576
577577 const fixes_name = @tagName(fixes);
src/arch/x86_64/Mir.zig+2-2
......@@ -1185,8 +1185,8 @@ pub const Memory = struct {
11851185 extra: u32,
11861186
11871187 pub const Info = packed struct(u32) {
1188 base: @typeInfo(bits.Memory.Base).Union.tag_type.?,
1189 mod: @typeInfo(bits.Memory.Mod).Union.tag_type.?,
1188 base: @typeInfo(bits.Memory.Base).@"union".tag_type.?,
1189 mod: @typeInfo(bits.Memory.Mod).@"union".tag_type.?,
11901190 size: bits.Memory.Size,
11911191 index: Register,
11921192 scale: bits.Memory.Scale,
src/arch/x86_64/abi.zig+33-33
......@@ -54,26 +54,26 @@ pub fn classifyWindows(ty: Type, zcu: *Zcu) Class {
5454 // "Structs and unions of size 8, 16, 32, or 64 bits, and __m64 types, are passed
5555 // as if they were integers of the same size."
5656 switch (ty.zigTypeTag(zcu)) {
57 .Pointer,
58 .Int,
59 .Bool,
60 .Enum,
61 .Void,
62 .NoReturn,
63 .ErrorSet,
64 .Struct,
65 .Union,
66 .Optional,
67 .Array,
68 .ErrorUnion,
69 .AnyFrame,
70 .Frame,
57 .pointer,
58 .int,
59 .bool,
60 .@"enum",
61 .void,
62 .noreturn,
63 .error_set,
64 .@"struct",
65 .@"union",
66 .optional,
67 .array,
68 .error_union,
69 .@"anyframe",
70 .frame,
7171 => switch (ty.abiSize(zcu)) {
7272 0 => unreachable,
7373 1, 2, 4, 8 => return .integer,
7474 else => switch (ty.zigTypeTag(zcu)) {
75 .Int => return .win_i128,
76 .Struct, .Union => if (ty.containerLayout(zcu) == .@"packed") {
75 .int => return .win_i128,
76 .@"struct", .@"union" => if (ty.containerLayout(zcu) == .@"packed") {
7777 return .win_i128;
7878 } else {
7979 return .memory;
......@@ -82,16 +82,16 @@ pub fn classifyWindows(ty: Type, zcu: *Zcu) Class {
8282 },
8383 },
8484
85 .Float, .Vector => return .sse,
85 .float, .vector => return .sse,
8686
87 .Type,
88 .ComptimeFloat,
89 .ComptimeInt,
90 .Undefined,
91 .Null,
92 .Fn,
93 .Opaque,
94 .EnumLiteral,
87 .type,
88 .comptime_float,
89 .comptime_int,
90 .undefined,
91 .null,
92 .@"fn",
93 .@"opaque",
94 .enum_literal,
9595 => unreachable,
9696 }
9797}
......@@ -107,7 +107,7 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
107107 };
108108 var result = [1]Class{.none} ** 8;
109109 switch (ty.zigTypeTag(zcu)) {
110 .Pointer => switch (ty.ptrSize(zcu)) {
110 .pointer => switch (ty.ptrSize(zcu)) {
111111 .Slice => {
112112 result[0] = .integer;
113113 result[1] = .integer;
......@@ -118,7 +118,7 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
118118 return result;
119119 },
120120 },
121 .Int, .Enum, .ErrorSet => {
121 .int, .@"enum", .error_set => {
122122 const bits = ty.intInfo(zcu).bits;
123123 if (bits <= 64) {
124124 result[0] = .integer;
......@@ -144,11 +144,11 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
144144 }
145145 return memory_class;
146146 },
147 .Bool, .Void, .NoReturn => {
147 .bool, .void, .noreturn => {
148148 result[0] = .integer;
149149 return result;
150150 },
151 .Float => switch (ty.floatBits(target)) {
151 .float => switch (ty.floatBits(target)) {
152152 16 => {
153153 if (ctx == .field) {
154154 result[0] = .memory;
......@@ -184,7 +184,7 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
184184 },
185185 else => unreachable,
186186 },
187 .Vector => {
187 .vector => {
188188 const elem_ty = ty.childType(zcu);
189189 const bits = elem_ty.bitSize(zcu) * ty.arrayLen(zcu);
190190 if (elem_ty.toIntern() == .bool_type) {
......@@ -249,14 +249,14 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
249249 };
250250 return memory_class;
251251 },
252 .Optional => {
252 .optional => {
253253 if (ty.isPtrLikeOptional(zcu)) {
254254 result[0] = .integer;
255255 return result;
256256 }
257257 return memory_class;
258258 },
259 .Struct, .Union => {
259 .@"struct", .@"union" => {
260260 // "If the size of an object is larger than eight eightbytes, or
261261 // it contains unaligned fields, it has class MEMORY"
262262 // "If the size of the aggregate exceeds a single eightbyte, each is classified
......@@ -305,7 +305,7 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
305305 }
306306 return result;
307307 },
308 .Array => {
308 .array => {
309309 const ty_size = ty.abiSize(zcu);
310310 if (ty_size <= 8) {
311311 result[0] = .integer;
src/arch/x86_64/bits.zig+2-2
......@@ -423,7 +423,7 @@ pub const FrameIndex = enum(u32) {
423423 // Other indices are used for local variable stack slots
424424 _,
425425
426 pub const named_count = @typeInfo(FrameIndex).Enum.fields.len;
426 pub const named_count = @typeInfo(FrameIndex).@"enum".fields.len;
427427
428428 pub fn isNamed(fi: FrameIndex) bool {
429429 return @intFromEnum(fi) < named_count;
......@@ -463,7 +463,7 @@ pub const Memory = struct {
463463 frame: FrameIndex,
464464 reloc: u32,
465465
466 pub const Tag = @typeInfo(Base).Union.tag_type.?;
466 pub const Tag = @typeInfo(Base).@"union".tag_type.?;
467467
468468 pub fn isExtended(self: Base) bool {
469469 return switch (self) {
src/arch/x86_64/encoder.zig+4-4
......@@ -2262,7 +2262,7 @@ const Assembler = struct {
22622262 }
22632263
22642264 fn mnemonicFromString(bytes: []const u8) ?Instruction.Mnemonic {
2265 const ti = @typeInfo(Instruction.Mnemonic).Enum;
2265 const ti = @typeInfo(Instruction.Mnemonic).@"enum";
22662266 inline for (ti.fields) |field| {
22672267 if (std.mem.eql(u8, bytes, field.name)) {
22682268 return @field(Instruction.Mnemonic, field.name);
......@@ -2278,7 +2278,7 @@ const Assembler = struct {
22782278 _ = try as.expect(.comma);
22792279 try as.skip(1, .{.space});
22802280 }
2281 if (@typeInfo(@TypeOf(cond)) != .EnumLiteral) {
2281 if (@typeInfo(@TypeOf(cond)) != .enum_literal) {
22822282 @compileError("invalid condition in the rule: " ++ @typeName(@TypeOf(cond)));
22832283 }
22842284 switch (cond) {
......@@ -2315,7 +2315,7 @@ const Assembler = struct {
23152315 }
23162316
23172317 fn registerFromString(bytes: []const u8) ?Register {
2318 const ti = @typeInfo(Register).Enum;
2318 const ti = @typeInfo(Register).@"enum";
23192319 inline for (ti.fields) |field| {
23202320 if (std.mem.eql(u8, bytes, field.name)) {
23212321 return @field(Register, field.name);
......@@ -2405,7 +2405,7 @@ const Assembler = struct {
24052405 fn parseMemoryRule(as: *Assembler, rule: anytype) ParseError!MemoryParseResult {
24062406 var res: MemoryParseResult = .{};
24072407 inline for (rule, 0..) |cond, i| {
2408 if (@typeInfo(@TypeOf(cond)) != .EnumLiteral) {
2408 if (@typeInfo(@TypeOf(cond)) != .enum_literal) {
24092409 @compileError("unsupported condition type in the rule: " ++ @typeName(@TypeOf(cond)));
24102410 }
24112411 switch (cond) {
src/codegen.zig+25-25
......@@ -113,8 +113,8 @@ pub fn generateLazyFunction(
113113
114114fn writeFloat(comptime F: type, f: F, target: std.Target, endian: std.builtin.Endian, code: []u8) void {
115115 _ = target;
116 const bits = @typeInfo(F).Float.bits;
117 const Int = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = bits } });
116 const bits = @typeInfo(F).float.bits;
117 const Int = @Type(.{ .int = .{ .signedness = .unsigned, .bits = bits } });
118118 const int: Int = @bitCast(f);
119119 mem.writeInt(Int, code[0..@divExact(bits, 8)], int, endian);
120120}
......@@ -167,7 +167,7 @@ pub fn generateLazySymbol(
167167 }
168168 mem.writeInt(u32, code.items[offset..][0..4], @intCast(code.items.len), endian);
169169 return Result.ok;
170 } else if (Type.fromInterned(lazy_sym.ty).zigTypeTag(pt.zcu) == .Enum) {
170 } else if (Type.fromInterned(lazy_sym.ty).zigTypeTag(pt.zcu) == .@"enum") {
171171 alignment.* = .@"1";
172172 const enum_ty = Type.fromInterned(lazy_sym.ty);
173173 const tag_names = enum_ty.enumFields(pt.zcu);
......@@ -519,7 +519,7 @@ pub fn generateSymbol(
519519
520520 // pointer may point to a decl which must be marked used
521521 // but can also result in a relocation. Therefore we handle those separately.
522 if (Type.fromInterned(field_ty).zigTypeTag(zcu) == .Pointer) {
522 if (Type.fromInterned(field_ty).zigTypeTag(zcu) == .pointer) {
523523 const field_size = math.cast(usize, Type.fromInterned(field_ty).abiSize(zcu)) orelse
524524 return error.Overflow;
525525 var tmp_list = try std.ArrayList(u8).initCapacity(code.allocator, field_size);
......@@ -678,7 +678,7 @@ fn lowerPtr(
678678 const base_ptr = Value.fromInterned(field.base);
679679 const base_ty = base_ptr.typeOf(zcu).childType(zcu);
680680 const field_off: u64 = switch (base_ty.zigTypeTag(zcu)) {
681 .Pointer => off: {
681 .pointer => off: {
682682 assert(base_ty.isSlice(zcu));
683683 break :off switch (field.index) {
684684 Value.slice_ptr_index => 0,
......@@ -686,7 +686,7 @@ fn lowerPtr(
686686 else => unreachable,
687687 };
688688 },
689 .Struct, .Union => switch (base_ty.containerLayout(zcu)) {
689 .@"struct", .@"union" => switch (base_ty.containerLayout(zcu)) {
690690 .auto => base_ty.structFieldOffset(@intCast(field.index), zcu),
691691 .@"extern", .@"packed" => unreachable,
692692 },
......@@ -721,7 +721,7 @@ fn lowerUavRef(
721721 const uav_val = uav.val;
722722 const uav_ty = Type.fromInterned(ip.typeOf(uav_val));
723723 log.debug("lowerUavRef: ty = {}", .{uav_ty.fmt(pt)});
724 const is_fn_body = uav_ty.zigTypeTag(zcu) == .Fn;
724 const is_fn_body = uav_ty.zigTypeTag(zcu) == .@"fn";
725725 if (!is_fn_body and !uav_ty.hasRuntimeBits(zcu)) {
726726 try code.appendNTimes(0xaa, ptr_width_bytes);
727727 return Result.ok;
......@@ -768,7 +768,7 @@ fn lowerNavRef(
768768
769769 const ptr_width = target.ptrBitWidth();
770770 const nav_ty = Type.fromInterned(ip.getNav(nav_index).typeOf(ip));
771 const is_fn_body = nav_ty.zigTypeTag(zcu) == .Fn;
771 const is_fn_body = nav_ty.zigTypeTag(zcu) == .@"fn";
772772 if (!is_fn_body and !nav_ty.hasRuntimeBits(zcu)) {
773773 try code.appendNTimes(0xaa, @divExact(ptr_width, 8));
774774 return Result.ok;
......@@ -880,7 +880,7 @@ fn genNavRef(
880880 if (zcu.typeToFunc(fn_ty).?.is_generic) {
881881 return .{ .mcv = .{ .immediate = fn_ty.abiAlignment(zcu).toByteUnits().? } };
882882 }
883 } else if (ty.zigTypeTag(zcu) == .Pointer) {
883 } else if (ty.zigTypeTag(zcu) == .pointer) {
884884 const elem_ty = ty.elemType2(zcu);
885885 if (!elem_ty.hasRuntimeBits(zcu)) {
886886 return .{ .mcv = .{ .immediate = elem_ty.abiAlignment(zcu).toByteUnits().? } };
......@@ -955,8 +955,8 @@ pub fn genTypedValue(
955955 if (val.isUndef(zcu)) return .{ .mcv = .undef };
956956
957957 switch (ty.zigTypeTag(zcu)) {
958 .Void => return .{ .mcv = .none },
959 .Pointer => switch (ty.ptrSize(zcu)) {
958 .void => return .{ .mcv = .none },
959 .pointer => switch (ty.ptrSize(zcu)) {
960960 .Slice => {},
961961 else => switch (val.toIntern()) {
962962 .null_value => {
......@@ -991,7 +991,7 @@ pub fn genTypedValue(
991991 },
992992 },
993993 },
994 .Int => {
994 .int => {
995995 const info = ty.intInfo(zcu);
996996 if (info.bits <= target.ptrBitWidth()) {
997997 const unsigned: u64 = switch (info.signedness) {
......@@ -1001,10 +1001,10 @@ pub fn genTypedValue(
10011001 return .{ .mcv = .{ .immediate = unsigned } };
10021002 }
10031003 },
1004 .Bool => {
1004 .bool => {
10051005 return .{ .mcv = .{ .immediate = @intFromBool(val.toBool()) } };
10061006 },
1007 .Optional => {
1007 .optional => {
10081008 if (ty.isPtrLikeOptional(zcu)) {
10091009 return genTypedValue(
10101010 lf,
......@@ -1017,7 +1017,7 @@ pub fn genTypedValue(
10171017 return .{ .mcv = .{ .immediate = @intFromBool(!val.isNull(zcu)) } };
10181018 }
10191019 },
1020 .Enum => {
1020 .@"enum" => {
10211021 const enum_tag = ip.indexToKey(val.toIntern()).enum_tag;
10221022 return genTypedValue(
10231023 lf,
......@@ -1027,12 +1027,12 @@ pub fn genTypedValue(
10271027 target,
10281028 );
10291029 },
1030 .ErrorSet => {
1030 .error_set => {
10311031 const err_name = ip.indexToKey(val.toIntern()).err.name;
10321032 const error_index = try pt.getErrorValue(err_name);
10331033 return .{ .mcv = .{ .immediate = error_index } };
10341034 },
1035 .ErrorUnion => {
1035 .error_union => {
10361036 const err_type = ty.errorUnionSet(zcu);
10371037 const payload_type = ty.errorUnionPayload(zcu);
10381038 if (!payload_type.hasRuntimeBitsIgnoreComptime(zcu)) {
......@@ -1060,14 +1060,14 @@ pub fn genTypedValue(
10601060 }
10611061 },
10621062
1063 .ComptimeInt => unreachable,
1064 .ComptimeFloat => unreachable,
1065 .Type => unreachable,
1066 .EnumLiteral => unreachable,
1067 .NoReturn => unreachable,
1068 .Undefined => unreachable,
1069 .Null => unreachable,
1070 .Opaque => unreachable,
1063 .comptime_int => unreachable,
1064 .comptime_float => unreachable,
1065 .type => unreachable,
1066 .enum_literal => unreachable,
1067 .noreturn => unreachable,
1068 .undefined => unreachable,
1069 .null => unreachable,
1070 .@"opaque" => unreachable,
10711071
10721072 else => {},
10731073 }
src/codegen/c.zig+29-29
......@@ -1401,7 +1401,7 @@ pub const DeclGen = struct {
14011401 try writer.writeByte('(');
14021402 try dg.renderCType(writer, ctype);
14031403 try writer.writeByte(')');
1404 } else if (field_ty.zigTypeTag(zcu) == .Float) {
1404 } else if (field_ty.zigTypeTag(zcu) == .float) {
14051405 try writer.writeByte('(');
14061406 try dg.renderCType(writer, ctype);
14071407 try writer.writeByte(')');
......@@ -4473,8 +4473,8 @@ fn airCall(
44734473
44744474 const callee_ty = f.typeOf(pl_op.operand);
44754475 const fn_info = zcu.typeToFunc(switch (callee_ty.zigTypeTag(zcu)) {
4476 .Fn => callee_ty,
4477 .Pointer => callee_ty.childType(zcu),
4476 .@"fn" => callee_ty,
4477 .pointer => callee_ty.childType(zcu),
44784478 else => unreachable,
44794479 }).?;
44804480 const ret_ty = Type.fromInterned(fn_info.return_type);
......@@ -5848,7 +5848,7 @@ fn airUnwrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue {
58485848 const operand_ty = f.typeOf(ty_op.operand);
58495849 try reap(f, inst, &.{ty_op.operand});
58505850
5851 const operand_is_ptr = operand_ty.zigTypeTag(zcu) == .Pointer;
5851 const operand_is_ptr = operand_ty.zigTypeTag(zcu) == .pointer;
58525852 const error_union_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty;
58535853 const error_ty = error_union_ty.errorUnionSet(zcu);
58545854 const payload_ty = error_union_ty.errorUnionPayload(zcu);
......@@ -7011,23 +7011,23 @@ fn airReduce(f: *Function, inst: Air.Inst.Index) !CValue {
70117011 .Or => if (use_operator) .{ .infix = " |= " } else .{ .builtin = .{ .operation = "or" } },
70127012 .Xor => if (use_operator) .{ .infix = " ^= " } else .{ .builtin = .{ .operation = "xor" } },
70137013 .Min => switch (scalar_ty.zigTypeTag(zcu)) {
7014 .Int => if (use_operator) .{ .ternary = " < " } else .{ .builtin = .{ .operation = "min" } },
7015 .Float => .{ .builtin = .{ .operation = "min" } },
7014 .int => if (use_operator) .{ .ternary = " < " } else .{ .builtin = .{ .operation = "min" } },
7015 .float => .{ .builtin = .{ .operation = "min" } },
70167016 else => unreachable,
70177017 },
70187018 .Max => switch (scalar_ty.zigTypeTag(zcu)) {
7019 .Int => if (use_operator) .{ .ternary = " > " } else .{ .builtin = .{ .operation = "max" } },
7020 .Float => .{ .builtin = .{ .operation = "max" } },
7019 .int => if (use_operator) .{ .ternary = " > " } else .{ .builtin = .{ .operation = "max" } },
7020 .float => .{ .builtin = .{ .operation = "max" } },
70217021 else => unreachable,
70227022 },
70237023 .Add => switch (scalar_ty.zigTypeTag(zcu)) {
7024 .Int => if (use_operator) .{ .infix = " += " } else .{ .builtin = .{ .operation = "addw", .info = .bits } },
7025 .Float => .{ .builtin = .{ .operation = "add" } },
7024 .int => if (use_operator) .{ .infix = " += " } else .{ .builtin = .{ .operation = "addw", .info = .bits } },
7025 .float => .{ .builtin = .{ .operation = "add" } },
70267026 else => unreachable,
70277027 },
70287028 .Mul => switch (scalar_ty.zigTypeTag(zcu)) {
7029 .Int => if (use_operator) .{ .infix = " *= " } else .{ .builtin = .{ .operation = "mulw", .info = .bits } },
7030 .Float => .{ .builtin = .{ .operation = "mul" } },
7029 .int => if (use_operator) .{ .infix = " *= " } else .{ .builtin = .{ .operation = "mulw", .info = .bits } },
7030 .float => .{ .builtin = .{ .operation = "mul" } },
70317031 else => unreachable,
70327032 },
70337033 };
......@@ -7050,38 +7050,38 @@ fn airReduce(f: *Function, inst: Air.Inst.Index) !CValue {
70507050
70517051 try f.object.dg.renderValue(writer, switch (reduce.operation) {
70527052 .Or, .Xor => switch (scalar_ty.zigTypeTag(zcu)) {
7053 .Bool => Value.false,
7054 .Int => try pt.intValue(scalar_ty, 0),
7053 .bool => Value.false,
7054 .int => try pt.intValue(scalar_ty, 0),
70557055 else => unreachable,
70567056 },
70577057 .And => switch (scalar_ty.zigTypeTag(zcu)) {
7058 .Bool => Value.true,
7059 .Int => switch (scalar_ty.intInfo(zcu).signedness) {
7058 .bool => Value.true,
7059 .int => switch (scalar_ty.intInfo(zcu).signedness) {
70607060 .unsigned => try scalar_ty.maxIntScalar(pt, scalar_ty),
70617061 .signed => try pt.intValue(scalar_ty, -1),
70627062 },
70637063 else => unreachable,
70647064 },
70657065 .Add => switch (scalar_ty.zigTypeTag(zcu)) {
7066 .Int => try pt.intValue(scalar_ty, 0),
7067 .Float => try pt.floatValue(scalar_ty, 0.0),
7066 .int => try pt.intValue(scalar_ty, 0),
7067 .float => try pt.floatValue(scalar_ty, 0.0),
70687068 else => unreachable,
70697069 },
70707070 .Mul => switch (scalar_ty.zigTypeTag(zcu)) {
7071 .Int => try pt.intValue(scalar_ty, 1),
7072 .Float => try pt.floatValue(scalar_ty, 1.0),
7071 .int => try pt.intValue(scalar_ty, 1),
7072 .float => try pt.floatValue(scalar_ty, 1.0),
70737073 else => unreachable,
70747074 },
70757075 .Min => switch (scalar_ty.zigTypeTag(zcu)) {
7076 .Bool => Value.true,
7077 .Int => try scalar_ty.maxIntScalar(pt, scalar_ty),
7078 .Float => try pt.floatValue(scalar_ty, std.math.nan(f128)),
7076 .bool => Value.true,
7077 .int => try scalar_ty.maxIntScalar(pt, scalar_ty),
7078 .float => try pt.floatValue(scalar_ty, std.math.nan(f128)),
70797079 else => unreachable,
70807080 },
70817081 .Max => switch (scalar_ty.zigTypeTag(zcu)) {
7082 .Bool => Value.false,
7083 .Int => try scalar_ty.minIntScalar(pt, scalar_ty),
7084 .Float => try pt.floatValue(scalar_ty, std.math.nan(f128)),
7082 .bool => Value.false,
7083 .int => try scalar_ty.minIntScalar(pt, scalar_ty),
7084 .float => try pt.floatValue(scalar_ty, std.math.nan(f128)),
70857085 else => unreachable,
70867086 },
70877087 }, .Initializer);
......@@ -7765,7 +7765,7 @@ fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Formatter(formatStri
77657765}
77667766
77677767fn undefPattern(comptime IntType: type) IntType {
7768 const int_info = @typeInfo(IntType).Int;
7768 const int_info = @typeInfo(IntType).int;
77697769 const UnsignedType = std.meta.Int(.unsigned, int_info.bits);
77707770 return @as(IntType, @bitCast(@as(UnsignedType, (1 << (int_info.bits | 1)) / 3)));
77717771}
......@@ -8027,7 +8027,7 @@ const Vectorize = struct {
80278027 pub fn start(f: *Function, inst: Air.Inst.Index, writer: anytype, ty: Type) !Vectorize {
80288028 const pt = f.object.dg.pt;
80298029 const zcu = pt.zcu;
8030 return if (ty.zigTypeTag(zcu) == .Vector) index: {
8030 return if (ty.zigTypeTag(zcu) == .vector) index: {
80318031 const local = try f.allocLocal(inst, Type.usize);
80328032
80338033 try writer.writeAll("for (");
......@@ -8063,7 +8063,7 @@ const Vectorize = struct {
80638063fn lowersToArray(ty: Type, pt: Zcu.PerThread) bool {
80648064 const zcu = pt.zcu;
80658065 return switch (ty.zigTypeTag(zcu)) {
8066 .Array, .Vector => return true,
8066 .array, .vector => return true,
80678067 else => return ty.isAbiInt(zcu) and toCIntBits(@as(u32, @intCast(ty.bitSize(zcu)))) == null,
80688068 };
80698069}
src/codegen/c/Type.zig+25-25
......@@ -669,7 +669,7 @@ const Index = enum(u32) {
669669
670670 _,
671671
672 const first_pool_index: u32 = @typeInfo(CType.Index).Enum.fields.len;
672 const first_pool_index: u32 = @typeInfo(CType.Index).@"enum".fields.len;
673673 const basic_hashes = init: {
674674 @setEvalBranchQuota(1_600);
675675 var basic_hashes_init: [first_pool_index]Pool.Map.Hash = undefined;
......@@ -740,7 +740,7 @@ pub const Info = union(enum) {
740740 aggregate: Aggregate,
741741 function: Function,
742742
743 const Tag = @typeInfo(Info).Union.tag_type.?;
743 const Tag = @typeInfo(Info).@"union".tag_type.?;
744744
745745 pub const Pointer = struct {
746746 elem_ctype: CType,
......@@ -783,7 +783,7 @@ pub const Info = union(enum) {
783783 pub fn at(slice: Field.Slice, index: usize, pool: *const Pool) Field {
784784 assert(index < slice.len);
785785 const extra = pool.getExtra(Pool.Field, @intCast(slice.extra_index +
786 index * @typeInfo(Pool.Field).Struct.fields.len));
786 index * @typeInfo(Pool.Field).@"struct".fields.len));
787787 return .{
788788 .name = .{ .index = extra.name },
789789 .ctype = .{ .index = extra.ctype },
......@@ -991,7 +991,7 @@ pub const Pool = struct {
991991 _,
992992
993993 const first_named_index: u32 = 1 << 31;
994 const first_pool_index: u32 = first_named_index + @typeInfo(String.Index).Enum.fields.len;
994 const first_pool_index: u32 = first_named_index + @typeInfo(String.Index).@"enum".fields.len;
995995 };
996996
997997 const Adapter = struct {
......@@ -1127,7 +1127,7 @@ pub const Pool = struct {
11271127 allocator,
11281128 FwdDeclAnon,
11291129 extra,
1130 fields.len * @typeInfo(Field).Struct.fields.len,
1130 fields.len * @typeInfo(Field).@"struct".fields.len,
11311131 );
11321132 for (fields, field_ctypes) |field, field_ctype| pool.addHashedExtraAssumeCapacity(
11331133 &hasher,
......@@ -1184,7 +1184,7 @@ pub const Pool = struct {
11841184 allocator,
11851185 AggregateAnon,
11861186 extra,
1187 aggregate_info.fields.len * @typeInfo(Field).Struct.fields.len,
1187 aggregate_info.fields.len * @typeInfo(Field).@"struct".fields.len,
11881188 );
11891189 for (aggregate_info.fields) |field| pool.addHashedExtraAssumeCapacity(&hasher, Field, .{
11901190 .name = field.name.index,
......@@ -1213,7 +1213,7 @@ pub const Pool = struct {
12131213 allocator,
12141214 Aggregate,
12151215 extra,
1216 aggregate_info.fields.len * @typeInfo(Field).Struct.fields.len,
1216 aggregate_info.fields.len * @typeInfo(Field).@"struct".fields.len,
12171217 );
12181218 for (aggregate_info.fields) |field| pool.addHashedExtraAssumeCapacity(&hasher, Field, .{
12191219 .name = field.name.index,
......@@ -1672,7 +1672,7 @@ pub const Pool = struct {
16721672 defer scratch.shrinkRetainingCapacity(scratch_top);
16731673 try scratch.ensureUnusedCapacity(
16741674 allocator,
1675 loaded_struct.field_types.len * @typeInfo(Field).Struct.fields.len,
1675 loaded_struct.field_types.len * @typeInfo(Field).@"struct".fields.len,
16761676 );
16771677 var hasher = Hasher.init;
16781678 var tag: Pool.Tag = .aggregate_struct;
......@@ -1709,14 +1709,14 @@ pub const Pool = struct {
17091709 }
17101710 const fields_len: u32 = @intCast(@divExact(
17111711 scratch.items.len - scratch_top,
1712 @typeInfo(Field).Struct.fields.len,
1712 @typeInfo(Field).@"struct".fields.len,
17131713 ));
17141714 if (fields_len == 0) return CType.void;
17151715 try pool.ensureUnusedCapacity(allocator, 1);
17161716 const extra_index = try pool.addHashedExtra(allocator, &hasher, Aggregate, .{
17171717 .fwd_decl = fwd_decl.index,
17181718 .fields_len = fields_len,
1719 }, fields_len * @typeInfo(Field).Struct.fields.len);
1719 }, fields_len * @typeInfo(Field).@"struct".fields.len);
17201720 pool.extra.appendSliceAssumeCapacity(scratch.items[scratch_top..]);
17211721 return pool.tagTrailingExtraAssumeCapacity(hasher, tag, extra_index);
17221722 },
......@@ -1734,7 +1734,7 @@ pub const Pool = struct {
17341734 const scratch_top = scratch.items.len;
17351735 defer scratch.shrinkRetainingCapacity(scratch_top);
17361736 try scratch.ensureUnusedCapacity(allocator, anon_struct_info.types.len *
1737 @typeInfo(Field).Struct.fields.len);
1737 @typeInfo(Field).@"struct".fields.len);
17381738 var hasher = Hasher.init;
17391739 for (0..anon_struct_info.types.len) |field_index| {
17401740 if (anon_struct_info.values.get(ip)[field_index] != .none) continue;
......@@ -1765,7 +1765,7 @@ pub const Pool = struct {
17651765 }
17661766 const fields_len: u32 = @intCast(@divExact(
17671767 scratch.items.len - scratch_top,
1768 @typeInfo(Field).Struct.fields.len,
1768 @typeInfo(Field).@"struct".fields.len,
17691769 ));
17701770 if (fields_len == 0) return CType.void;
17711771 if (kind.isForward()) {
......@@ -1775,7 +1775,7 @@ pub const Pool = struct {
17751775 &hasher,
17761776 FwdDeclAnon,
17771777 .{ .fields_len = fields_len },
1778 fields_len * @typeInfo(Field).Struct.fields.len,
1778 fields_len * @typeInfo(Field).@"struct".fields.len,
17791779 );
17801780 pool.extra.appendSliceAssumeCapacity(scratch.items[scratch_top..]);
17811781 return pool.tagTrailingExtra(
......@@ -1790,7 +1790,7 @@ pub const Pool = struct {
17901790 const extra_index = try pool.addHashedExtra(allocator, &hasher, Aggregate, .{
17911791 .fwd_decl = fwd_decl.index,
17921792 .fields_len = fields_len,
1793 }, fields_len * @typeInfo(Field).Struct.fields.len);
1793 }, fields_len * @typeInfo(Field).@"struct".fields.len);
17941794 pool.extra.appendSliceAssumeCapacity(scratch.items[scratch_top..]);
17951795 return pool.tagTrailingExtraAssumeCapacity(hasher, .aggregate_struct, extra_index);
17961796 },
......@@ -1812,7 +1812,7 @@ pub const Pool = struct {
18121812 defer scratch.shrinkRetainingCapacity(scratch_top);
18131813 try scratch.ensureUnusedCapacity(
18141814 allocator,
1815 loaded_union.field_types.len * @typeInfo(Field).Struct.fields.len,
1815 loaded_union.field_types.len * @typeInfo(Field).@"struct".fields.len,
18161816 );
18171817 var hasher = Hasher.init;
18181818 var tag: Pool.Tag = .aggregate_union;
......@@ -1850,7 +1850,7 @@ pub const Pool = struct {
18501850 }
18511851 const fields_len: u32 = @intCast(@divExact(
18521852 scratch.items.len - scratch_top,
1853 @typeInfo(Field).Struct.fields.len,
1853 @typeInfo(Field).@"struct".fields.len,
18541854 ));
18551855 if (!has_tag) {
18561856 if (fields_len == 0) return CType.void;
......@@ -1860,7 +1860,7 @@ pub const Pool = struct {
18601860 &hasher,
18611861 Aggregate,
18621862 .{ .fwd_decl = fwd_decl.index, .fields_len = fields_len },
1863 fields_len * @typeInfo(Field).Struct.fields.len,
1863 fields_len * @typeInfo(Field).@"struct".fields.len,
18641864 );
18651865 pool.extra.appendSliceAssumeCapacity(scratch.items[scratch_top..]);
18661866 return pool.tagTrailingExtraAssumeCapacity(hasher, tag, extra_index);
......@@ -1898,7 +1898,7 @@ pub const Pool = struct {
18981898 .id = 0,
18991899 .fields_len = fields_len,
19001900 },
1901 fields_len * @typeInfo(Field).Struct.fields.len,
1901 fields_len * @typeInfo(Field).@"struct".fields.len,
19021902 );
19031903 pool.extra.appendSliceAssumeCapacity(scratch.items[scratch_top..]);
19041904 break :payload_ctype pool.tagTrailingExtraAssumeCapacity(
......@@ -2087,7 +2087,7 @@ pub const Pool = struct {
20872087 .tag = tag,
20882088 .data = try pool.addExtra(allocator, FwdDeclAnon, .{
20892089 .fields_len = fields.len,
2090 }, fields.len * @typeInfo(Field).Struct.fields.len),
2090 }, fields.len * @typeInfo(Field).@"struct".fields.len),
20912091 });
20922092 for (0..fields.len) |field_index| {
20932093 const field = fields.at(field_index, source_pool);
......@@ -2115,11 +2115,11 @@ pub const Pool = struct {
21152115 .index = anon.index,
21162116 .id = anon.id,
21172117 .fields_len = aggregate_info.fields.len,
2118 }, aggregate_info.fields.len * @typeInfo(Field).Struct.fields.len),
2118 }, aggregate_info.fields.len * @typeInfo(Field).@"struct".fields.len),
21192119 .fwd_decl => |fwd_decl| try pool.addExtra(allocator, Aggregate, .{
21202120 .fwd_decl = pool_adapter.copy(fwd_decl).index,
21212121 .fields_len = aggregate_info.fields.len,
2122 }, aggregate_info.fields.len * @typeInfo(Field).Struct.fields.len),
2122 }, aggregate_info.fields.len * @typeInfo(Field).@"struct".fields.len),
21232123 },
21242124 });
21252125 for (0..aggregate_info.fields.len) |field_index| {
......@@ -2182,7 +2182,7 @@ pub const Pool = struct {
21822182 const init: Hasher = .{ .impl = Impl.init(0) };
21832183
21842184 fn updateExtra(hasher: *Hasher, comptime Extra: type, extra: Extra, pool: *const Pool) void {
2185 inline for (@typeInfo(Extra).Struct.fields) |field| {
2185 inline for (@typeInfo(Extra).@"struct".fields) |field| {
21862186 const value = @field(extra, field.name);
21872187 switch (field.type) {
21882188 Pool.Tag, String, CType => unreachable,
......@@ -2429,7 +2429,7 @@ pub const Pool = struct {
24292429 ) !ExtraIndex {
24302430 try pool.extra.ensureUnusedCapacity(
24312431 allocator,
2432 @typeInfo(Extra).Struct.fields.len + trailing_len,
2432 @typeInfo(Extra).@"struct".fields.len + trailing_len,
24332433 );
24342434 defer pool.addExtraAssumeCapacity(Extra, extra);
24352435 return @intCast(pool.extra.items.len);
......@@ -2442,7 +2442,7 @@ pub const Pool = struct {
24422442 comptime Extra: type,
24432443 extra: Extra,
24442444 ) void {
2445 inline for (@typeInfo(Extra).Struct.fields) |field| {
2445 inline for (@typeInfo(Extra).@"struct".fields) |field| {
24462446 const value = @field(extra, field.name);
24472447 array.appendAssumeCapacity(switch (field.type) {
24482448 u32 => value,
......@@ -2505,7 +2505,7 @@ pub const Pool = struct {
25052505 extra_index: ExtraIndex,
25062506 ) struct { extra: Extra, trail: ExtraTrail } {
25072507 var extra: Extra = undefined;
2508 const fields = @typeInfo(Extra).Struct.fields;
2508 const fields = @typeInfo(Extra).@"struct".fields;
25092509 inline for (fields, pool.extra.items[extra_index..][0..fields.len]) |field, value|
25102510 @field(extra, field.name) = switch (field.type) {
25112511 u32 => value,
src/codegen/llvm.zig+113-113
......@@ -1538,7 +1538,7 @@ pub const Object = struct {
15381538 try attributes.addParamAttr(llvm_arg_i, .@"noalias", &o.builder);
15391539 }
15401540 }
1541 if (param_ty.zigTypeTag(zcu) != .Optional) {
1541 if (param_ty.zigTypeTag(zcu) != .optional) {
15421542 try attributes.addParamAttr(llvm_arg_i, .nonnull, &o.builder);
15431543 }
15441544 if (ptr_info.flags.is_const) {
......@@ -1907,8 +1907,8 @@ pub const Object = struct {
19071907 if (o.debug_type_map.get(ty)) |debug_type| return debug_type;
19081908
19091909 switch (ty.zigTypeTag(zcu)) {
1910 .Void,
1911 .NoReturn,
1910 .void,
1911 .noreturn,
19121912 => {
19131913 const debug_void_type = try o.builder.debugSignedType(
19141914 try o.builder.metadataString("void"),
......@@ -1917,7 +1917,7 @@ pub const Object = struct {
19171917 try o.debug_type_map.put(gpa, ty, debug_void_type);
19181918 return debug_void_type;
19191919 },
1920 .Int => {
1920 .int => {
19211921 const info = ty.intInfo(zcu);
19221922 assert(info.bits != 0);
19231923 const name = try o.allocTypeName(ty);
......@@ -1931,7 +1931,7 @@ pub const Object = struct {
19311931 try o.debug_type_map.put(gpa, ty, debug_int_type);
19321932 return debug_int_type;
19331933 },
1934 .Enum => {
1934 .@"enum" => {
19351935 if (!ty.hasRuntimeBitsIgnoreComptime(zcu)) {
19361936 const debug_enum_type = try o.makeEmptyNamespaceDebugType(ty);
19371937 try o.debug_type_map.put(gpa, ty, debug_enum_type);
......@@ -1985,7 +1985,7 @@ pub const Object = struct {
19851985 try o.debug_enums.append(gpa, debug_enum_type);
19861986 return debug_enum_type;
19871987 },
1988 .Float => {
1988 .float => {
19891989 const bits = ty.floatBits(target);
19901990 const name = try o.allocTypeName(ty);
19911991 defer gpa.free(name);
......@@ -1996,7 +1996,7 @@ pub const Object = struct {
19961996 try o.debug_type_map.put(gpa, ty, debug_float_type);
19971997 return debug_float_type;
19981998 },
1999 .Bool => {
1999 .bool => {
20002000 const debug_bool_type = try o.builder.debugBoolType(
20012001 try o.builder.metadataString("bool"),
20022002 8, // lldb cannot handle non-byte sized types
......@@ -2004,7 +2004,7 @@ pub const Object = struct {
20042004 try o.debug_type_map.put(gpa, ty, debug_bool_type);
20052005 return debug_bool_type;
20062006 },
2007 .Pointer => {
2007 .pointer => {
20082008 // Normalize everything that the debug info does not represent.
20092009 const ptr_info = ty.ptrInfo(zcu);
20102010
......@@ -2126,7 +2126,7 @@ pub const Object = struct {
21262126
21272127 return debug_ptr_type;
21282128 },
2129 .Opaque => {
2129 .@"opaque" => {
21302130 if (ty.toIntern() == .anyopaque_type) {
21312131 const debug_opaque_type = try o.builder.debugSignedType(
21322132 try o.builder.metadataString("anyopaque"),
......@@ -2158,7 +2158,7 @@ pub const Object = struct {
21582158 try o.debug_type_map.put(gpa, ty, debug_opaque_type);
21592159 return debug_opaque_type;
21602160 },
2161 .Array => {
2161 .array => {
21622162 const debug_array_type = try o.builder.debugArrayType(
21632163 .none, // Name
21642164 .none, // File
......@@ -2177,14 +2177,14 @@ pub const Object = struct {
21772177 try o.debug_type_map.put(gpa, ty, debug_array_type);
21782178 return debug_array_type;
21792179 },
2180 .Vector => {
2180 .vector => {
21812181 const elem_ty = ty.elemType2(zcu);
21822182 // Vector elements cannot be padded since that would make
21832183 // @bitSizOf(elem) * len > @bitSizOf(vec).
21842184 // Neither gdb nor lldb seem to be able to display non-byte sized
21852185 // vectors properly.
21862186 const debug_elem_type = switch (elem_ty.zigTypeTag(zcu)) {
2187 .Int => blk: {
2187 .int => blk: {
21882188 const info = elem_ty.intInfo(zcu);
21892189 assert(info.bits != 0);
21902190 const name = try o.allocTypeName(ty);
......@@ -2195,7 +2195,7 @@ pub const Object = struct {
21952195 .unsigned => try o.builder.debugUnsignedType(builder_name, info.bits),
21962196 };
21972197 },
2198 .Bool => try o.builder.debugBoolType(
2198 .bool => try o.builder.debugBoolType(
21992199 try o.builder.metadataString("bool"),
22002200 1,
22012201 ),
......@@ -2221,7 +2221,7 @@ pub const Object = struct {
22212221 try o.debug_type_map.put(gpa, ty, debug_vector_type);
22222222 return debug_vector_type;
22232223 },
2224 .Optional => {
2224 .optional => {
22252225 const name = try o.allocTypeName(ty);
22262226 defer gpa.free(name);
22272227 const child_ty = ty.optionalChild(zcu);
......@@ -2302,7 +2302,7 @@ pub const Object = struct {
23022302
23032303 return debug_optional_type;
23042304 },
2305 .ErrorUnion => {
2305 .error_union => {
23062306 const payload_ty = ty.errorUnionPayload(zcu);
23072307 if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
23082308 // TODO: Maybe remove?
......@@ -2375,7 +2375,7 @@ pub const Object = struct {
23752375 try o.debug_type_map.put(gpa, ty, debug_error_union_type);
23762376 return debug_error_union_type;
23772377 },
2378 .ErrorSet => {
2378 .error_set => {
23792379 const debug_error_set = try o.builder.debugUnsignedType(
23802380 try o.builder.metadataString("anyerror"),
23812381 16,
......@@ -2383,7 +2383,7 @@ pub const Object = struct {
23832383 try o.debug_type_map.put(gpa, ty, debug_error_set);
23842384 return debug_error_set;
23852385 },
2386 .Struct => {
2386 .@"struct" => {
23872387 const name = try o.allocTypeName(ty);
23882388 defer gpa.free(name);
23892389
......@@ -2531,7 +2531,7 @@ pub const Object = struct {
25312531
25322532 return debug_struct_type;
25332533 },
2534 .Union => {
2534 .@"union" => {
25352535 const name = try o.allocTypeName(ty);
25362536 defer gpa.free(name);
25372537
......@@ -2693,7 +2693,7 @@ pub const Object = struct {
26932693
26942694 return debug_tagged_union_type;
26952695 },
2696 .Fn => {
2696 .@"fn" => {
26972697 const fn_info = zcu.typeToFunc(ty).?;
26982698
26992699 var debug_param_types = std.ArrayList(Builder.Metadata).init(gpa);
......@@ -2741,15 +2741,15 @@ pub const Object = struct {
27412741 try o.debug_type_map.put(gpa, ty, debug_function_type);
27422742 return debug_function_type;
27432743 },
2744 .ComptimeInt => unreachable,
2745 .ComptimeFloat => unreachable,
2746 .Type => unreachable,
2747 .Undefined => unreachable,
2748 .Null => unreachable,
2749 .EnumLiteral => unreachable,
2744 .comptime_int => unreachable,
2745 .comptime_float => unreachable,
2746 .type => unreachable,
2747 .undefined => unreachable,
2748 .null => unreachable,
2749 .enum_literal => unreachable,
27502750
2751 .Frame => @panic("TODO implement lowerDebugType for Frame types"),
2752 .AnyFrame => @panic("TODO implement lowerDebugType for AnyFrame types"),
2751 .frame => @panic("TODO implement lowerDebugType for Frame types"),
2752 .@"anyframe" => @panic("TODO implement lowerDebugType for AnyFrame types"),
27532753 }
27542754 }
27552755
......@@ -3539,9 +3539,9 @@ pub const Object = struct {
35393539 const pt = o.pt;
35403540 const zcu = pt.zcu;
35413541 const lower_elem_ty = switch (elem_ty.zigTypeTag(zcu)) {
3542 .Opaque => true,
3543 .Fn => !zcu.typeToFunc(elem_ty).?.is_generic,
3544 .Array => elem_ty.childType(zcu).hasRuntimeBitsIgnoreComptime(zcu),
3542 .@"opaque" => true,
3543 .@"fn" => !zcu.typeToFunc(elem_ty).?.is_generic,
3544 .array => elem_ty.childType(zcu).hasRuntimeBitsIgnoreComptime(zcu),
35453545 else => elem_ty.hasRuntimeBitsIgnoreComptime(zcu),
35463546 };
35473547 return if (lower_elem_ty) try o.lowerType(elem_ty) else .i8;
......@@ -3883,7 +3883,7 @@ pub const Object = struct {
38833883 },
38843884 else => |payload| try o.lowerValue(payload),
38853885 };
3886 assert(payload_ty.zigTypeTag(zcu) != .Fn);
3886 assert(payload_ty.zigTypeTag(zcu) != .@"fn");
38873887
38883888 var fields: [3]Builder.Type = undefined;
38893889 var vals: [3]Builder.Constant = undefined;
......@@ -4303,7 +4303,7 @@ pub const Object = struct {
43034303 .field => |field| {
43044304 const agg_ty = Value.fromInterned(field.base).typeOf(zcu).childType(zcu);
43054305 const field_off: u64 = switch (agg_ty.zigTypeTag(zcu)) {
4306 .Pointer => off: {
4306 .pointer => off: {
43074307 assert(agg_ty.isSlice(zcu));
43084308 break :off switch (field.index) {
43094309 Value.slice_ptr_index => 0,
......@@ -4311,7 +4311,7 @@ pub const Object = struct {
43114311 else => unreachable,
43124312 };
43134313 },
4314 .Struct, .Union => switch (agg_ty.containerLayout(zcu)) {
4314 .@"struct", .@"union" => switch (agg_ty.containerLayout(zcu)) {
43154315 .auto => agg_ty.structFieldOffset(@intCast(field.index), zcu),
43164316 .@"extern", .@"packed" => unreachable,
43174317 },
......@@ -4344,7 +4344,7 @@ pub const Object = struct {
43444344
43454345 const ptr_ty = Type.fromInterned(uav.orig_ty);
43464346
4347 const is_fn_body = uav_ty.zigTypeTag(zcu) == .Fn;
4347 const is_fn_body = uav_ty.zigTypeTag(zcu) == .@"fn";
43484348 if ((!is_fn_body and !uav_ty.hasRuntimeBits(zcu)) or
43494349 (is_fn_body and zcu.typeToFunc(uav_ty).?.is_generic)) return o.lowerPtrToVoid(ptr_ty);
43504350
......@@ -4383,7 +4383,7 @@ pub const Object = struct {
43834383 const nav_ty = Type.fromInterned(owner_nav.typeOf(ip));
43844384 const ptr_ty = try pt.navPtrType(owner_nav_index);
43854385
4386 const is_fn_body = nav_ty.zigTypeTag(zcu) == .Fn;
4386 const is_fn_body = nav_ty.zigTypeTag(zcu) == .@"fn";
43874387 if ((!is_fn_body and !nav_ty.hasRuntimeBits(zcu)) or
43884388 (is_fn_body and zcu.typeToFunc(nav_ty).?.is_generic))
43894389 {
......@@ -4435,13 +4435,13 @@ pub const Object = struct {
44354435 const pt = o.pt;
44364436 const zcu = pt.zcu;
44374437 const int_ty = switch (ty.zigTypeTag(zcu)) {
4438 .Int => ty,
4439 .Enum => ty.intTagType(zcu),
4440 .Float => {
4438 .int => ty,
4439 .@"enum" => ty.intTagType(zcu),
4440 .float => {
44414441 if (!is_rmw_xchg) return .none;
44424442 return o.builder.intType(@intCast(ty.abiSize(zcu) * 8));
44434443 },
4444 .Bool => return .i8,
4444 .bool => return .i8,
44454445 else => return .none,
44464446 };
44474447 const bit_count = int_ty.intInfo(zcu).bits;
......@@ -4693,7 +4693,7 @@ pub const NavGen = struct {
46934693 const global_index = o.nav_map.get(nav_index).?;
46944694
46954695 const decl_name = decl_name: {
4696 if (zcu.getTarget().isWasm() and ty.zigTypeTag(zcu) == .Fn) {
4696 if (zcu.getTarget().isWasm() and ty.zigTypeTag(zcu) == .@"fn") {
46974697 if (lib_name.toSlice(ip)) |lib_name_slice| {
46984698 if (!std.mem.eql(u8, lib_name_slice, "c")) {
46994699 break :decl_name try o.builder.strtabStringFmt("{}|{s}", .{ nav.name.fmt(ip), lib_name_slice });
......@@ -5192,8 +5192,8 @@ pub const FuncGen = struct {
51925192 const ip = &zcu.intern_pool;
51935193 const callee_ty = self.typeOf(pl_op.operand);
51945194 const zig_fn_ty = switch (callee_ty.zigTypeTag(zcu)) {
5195 .Fn => callee_ty,
5196 .Pointer => callee_ty.childType(zcu),
5195 .@"fn" => callee_ty,
5196 .pointer => callee_ty.childType(zcu),
51975197 else => unreachable,
51985198 };
51995199 const fn_info = zcu.typeToFunc(zig_fn_ty).?;
......@@ -5410,7 +5410,7 @@ pub const FuncGen = struct {
54105410 try attributes.addParamAttr(llvm_arg_i, .@"noalias", &o.builder);
54115411 }
54125412 }
5413 if (param_ty.zigTypeTag(zcu) != .Optional) {
5413 if (param_ty.zigTypeTag(zcu) != .optional) {
54145414 try attributes.addParamAttr(llvm_arg_i, .nonnull, &o.builder);
54155415 }
54165416 if (ptr_info.flags.is_const) {
......@@ -5773,9 +5773,9 @@ pub const FuncGen = struct {
57735773 const zcu = pt.zcu;
57745774 const scalar_ty = operand_ty.scalarType(zcu);
57755775 const int_ty = switch (scalar_ty.zigTypeTag(zcu)) {
5776 .Enum => scalar_ty.intTagType(zcu),
5777 .Int, .Bool, .Pointer, .ErrorSet => scalar_ty,
5778 .Optional => blk: {
5776 .@"enum" => scalar_ty.intTagType(zcu),
5777 .int, .bool, .pointer, .error_set => scalar_ty,
5778 .optional => blk: {
57795779 const payload_ty = operand_ty.optionalChild(zcu);
57805780 if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu) or
57815781 operand_ty.optionalReprIsPayload(zcu))
......@@ -5848,7 +5848,7 @@ pub const FuncGen = struct {
58485848 );
58495849 return phi.toValue();
58505850 },
5851 .Float => return self.buildFloatCmp(fast, op, operand_ty, .{ lhs, rhs }),
5851 .float => return self.buildFloatCmp(fast, op, operand_ty, .{ lhs, rhs }),
58525852 else => unreachable,
58535853 };
58545854 const is_signed = int_ty.isSignedInt(zcu);
......@@ -5909,7 +5909,7 @@ pub const FuncGen = struct {
59095909 // a pointer to it. LLVM IR allows the call instruction to use function bodies instead
59105910 // of function pointers, however the phi makes it a runtime value and therefore
59115911 // the LLVM type has to be wrapped in a pointer.
5912 if (inst_ty.zigTypeTag(zcu) == .Fn or isByRef(inst_ty, zcu)) {
5912 if (inst_ty.zigTypeTag(zcu) == .@"fn" or isByRef(inst_ty, zcu)) {
59135913 break :ty .ptr;
59145914 }
59155915 break :ty raw_llvm_ty;
......@@ -6605,7 +6605,7 @@ pub const FuncGen = struct {
66056605 if (!isByRef(struct_ty, zcu)) {
66066606 assert(!isByRef(field_ty, zcu));
66076607 switch (struct_ty.zigTypeTag(zcu)) {
6608 .Struct => switch (struct_ty.containerLayout(zcu)) {
6608 .@"struct" => switch (struct_ty.containerLayout(zcu)) {
66096609 .@"packed" => {
66106610 const struct_type = zcu.typeToStruct(struct_ty).?;
66116611 const bit_offset = pt.structPackedFieldBitOffset(struct_type, field_index);
......@@ -6614,7 +6614,7 @@ pub const FuncGen = struct {
66146614 try o.builder.intValue(containing_int.typeOfWip(&self.wip), bit_offset);
66156615 const shifted_value = try self.wip.bin(.lshr, containing_int, shift_amt, "");
66166616 const elem_llvm_ty = try o.lowerType(field_ty);
6617 if (field_ty.zigTypeTag(zcu) == .Float or field_ty.zigTypeTag(zcu) == .Vector) {
6617 if (field_ty.zigTypeTag(zcu) == .float or field_ty.zigTypeTag(zcu) == .vector) {
66186618 const same_size_int = try o.builder.intType(@intCast(field_ty.bitSize(zcu)));
66196619 const truncated_int =
66206620 try self.wip.cast(.trunc, shifted_value, same_size_int, "");
......@@ -6632,11 +6632,11 @@ pub const FuncGen = struct {
66326632 return self.wip.extractValue(struct_llvm_val, &.{llvm_field_index}, "");
66336633 },
66346634 },
6635 .Union => {
6635 .@"union" => {
66366636 assert(struct_ty.containerLayout(zcu) == .@"packed");
66376637 const containing_int = struct_llvm_val;
66386638 const elem_llvm_ty = try o.lowerType(field_ty);
6639 if (field_ty.zigTypeTag(zcu) == .Float or field_ty.zigTypeTag(zcu) == .Vector) {
6639 if (field_ty.zigTypeTag(zcu) == .float or field_ty.zigTypeTag(zcu) == .vector) {
66406640 const same_size_int = try o.builder.intType(@intCast(field_ty.bitSize(zcu)));
66416641 const truncated_int =
66426642 try self.wip.cast(.trunc, containing_int, same_size_int, "");
......@@ -6654,7 +6654,7 @@ pub const FuncGen = struct {
66546654 }
66556655
66566656 switch (struct_ty.zigTypeTag(zcu)) {
6657 .Struct => {
6657 .@"struct" => {
66586658 const layout = struct_ty.containerLayout(zcu);
66596659 assert(layout != .@"packed");
66606660 const struct_llvm_ty = try o.lowerType(struct_ty);
......@@ -6677,7 +6677,7 @@ pub const FuncGen = struct {
66776677 return self.load(field_ptr, field_ptr_ty);
66786678 }
66796679 },
6680 .Union => {
6680 .@"union" => {
66816681 const union_llvm_ty = try o.lowerType(struct_ty);
66826682 const layout = struct_ty.unionGetLayout(zcu);
66836683 const payload_index = @intFromBool(layout.tag_align.compare(.gte, layout.payload_align));
......@@ -6934,7 +6934,7 @@ pub const FuncGen = struct {
69346934 if (output != .none) {
69356935 const output_inst = try self.resolveInst(output);
69366936 const output_ty = self.typeOf(output);
6937 assert(output_ty.zigTypeTag(zcu) == .Pointer);
6937 assert(output_ty.zigTypeTag(zcu) == .pointer);
69386938 const elem_llvm_ty = try o.lowerPtrElemTy(output_ty.childType(zcu));
69396939
69406940 switch (constraint[0]) {
......@@ -8280,7 +8280,7 @@ pub const FuncGen = struct {
82808280 .gte => .sge,
82818281 };
82828282
8283 if (ty.zigTypeTag(zcu) == .Vector) {
8283 if (ty.zigTypeTag(zcu) == .vector) {
82848284 const vec_len = ty.vectorLen(zcu);
82858285 const vector_result_ty = try o.builder.vectorType(.normal, vec_len, .i32);
82868286
......@@ -8457,7 +8457,7 @@ pub const FuncGen = struct {
84578457 ([1]Builder.Type{scalar_llvm_ty} ** 3)[0..params.len],
84588458 scalar_llvm_ty,
84598459 );
8460 if (ty.zigTypeTag(zcu) == .Vector) {
8460 if (ty.zigTypeTag(zcu) == .vector) {
84618461 const result = try o.builder.poisonValue(llvm_ty);
84628462 return self.buildElementwiseCall(libc_fn, &params, result, ty.vectorLen(zcu));
84638463 }
......@@ -8658,7 +8658,7 @@ pub const FuncGen = struct {
86588658 const scalar_ty = operand_ty.scalarType(zcu);
86598659
86608660 switch (scalar_ty.zigTypeTag(zcu)) {
8661 .Int => return self.wip.callIntrinsic(
8661 .int => return self.wip.callIntrinsic(
86628662 .normal,
86638663 .none,
86648664 .abs,
......@@ -8666,7 +8666,7 @@ pub const FuncGen = struct {
86668666 &.{ operand, try o.builder.intValue(.i1, 0) },
86678667 "",
86688668 ),
8669 .Float => return self.buildFloatOp(.fabs, .normal, operand_ty, 1, .{operand}),
8669 .float => return self.buildFloatOp(.fabs, .normal, operand_ty, 1, .{operand}),
86708670 else => unreachable,
86718671 }
86728672 }
......@@ -8806,11 +8806,11 @@ pub const FuncGen = struct {
88068806 return self.wip.conv(.unsigned, operand, llvm_dest_ty, "");
88078807 }
88088808
8809 if (operand_ty.zigTypeTag(zcu) == .Int and inst_ty.isPtrAtRuntime(zcu)) {
8809 if (operand_ty.zigTypeTag(zcu) == .int and inst_ty.isPtrAtRuntime(zcu)) {
88108810 return self.wip.cast(.inttoptr, operand, llvm_dest_ty, "");
88118811 }
88128812
8813 if (operand_ty.zigTypeTag(zcu) == .Vector and inst_ty.zigTypeTag(zcu) == .Array) {
8813 if (operand_ty.zigTypeTag(zcu) == .vector and inst_ty.zigTypeTag(zcu) == .array) {
88148814 const elem_ty = operand_ty.childType(zcu);
88158815 if (!result_is_ref) {
88168816 return self.ng.todo("implement bitcast vector to non-ref array", .{});
......@@ -8837,7 +8837,7 @@ pub const FuncGen = struct {
88378837 }
88388838 }
88398839 return array_ptr;
8840 } else if (operand_ty.zigTypeTag(zcu) == .Array and inst_ty.zigTypeTag(zcu) == .Vector) {
8840 } else if (operand_ty.zigTypeTag(zcu) == .array and inst_ty.zigTypeTag(zcu) == .vector) {
88418841 const elem_ty = operand_ty.childType(zcu);
88428842 const llvm_vector_ty = try o.lowerType(inst_ty);
88438843 if (!operand_is_ref) return self.ng.todo("implement bitcast non-ref array to vector", .{});
......@@ -8883,7 +8883,7 @@ pub const FuncGen = struct {
88838883 }
88848884
88858885 if (llvm_dest_ty.isStruct(&o.builder) or
8886 ((operand_ty.zigTypeTag(zcu) == .Vector or inst_ty.zigTypeTag(zcu) == .Vector) and
8886 ((operand_ty.zigTypeTag(zcu) == .vector or inst_ty.zigTypeTag(zcu) == .vector) and
88878887 operand_ty.bitSize(zcu) != inst_ty.bitSize(zcu)))
88888888 {
88898889 // Both our operand and our result are values, not pointers,
......@@ -9687,7 +9687,7 @@ pub const FuncGen = struct {
96879687 // If not an even byte-multiple, we need zero-extend + shift-left 1 byte
96889688 // The truncated result at the end will be the correct bswap
96899689 const scalar_ty = try o.builder.intType(@intCast(bits + 8));
9690 if (operand_ty.zigTypeTag(zcu) == .Vector) {
9690 if (operand_ty.zigTypeTag(zcu) == .vector) {
96919691 const vec_len = operand_ty.vectorLen(zcu);
96929692 llvm_operand_ty = try o.builder.vectorType(.normal, vec_len, scalar_ty);
96939693 } else llvm_operand_ty = scalar_ty;
......@@ -9993,7 +9993,7 @@ pub const FuncGen = struct {
99939993 else => unreachable,
99949994 }, &.{llvm_operand_ty}, &.{operand}, ""),
99959995 .Min, .Max => switch (scalar_ty.zigTypeTag(zcu)) {
9996 .Int => return self.wip.callIntrinsic(.normal, .none, switch (reduce.operation) {
9996 .int => return self.wip.callIntrinsic(.normal, .none, switch (reduce.operation) {
99979997 .Min => if (scalar_ty.isSignedInt(zcu))
99989998 .@"vector.reduce.smin"
99999999 else
......@@ -10004,7 +10004,7 @@ pub const FuncGen = struct {
1000410004 .@"vector.reduce.umax",
1000510005 else => unreachable,
1000610006 }, &.{llvm_operand_ty}, &.{operand}, ""),
10007 .Float => if (intrinsicsAllowed(scalar_ty, target))
10007 .float => if (intrinsicsAllowed(scalar_ty, target))
1000810008 return self.wip.callIntrinsic(fast, .none, switch (reduce.operation) {
1000910009 .Min => .@"vector.reduce.fmin",
1001010010 .Max => .@"vector.reduce.fmax",
......@@ -10013,12 +10013,12 @@ pub const FuncGen = struct {
1001310013 else => unreachable,
1001410014 },
1001510015 .Add, .Mul => switch (scalar_ty.zigTypeTag(zcu)) {
10016 .Int => return self.wip.callIntrinsic(.normal, .none, switch (reduce.operation) {
10016 .int => return self.wip.callIntrinsic(.normal, .none, switch (reduce.operation) {
1001710017 .Add => .@"vector.reduce.add",
1001810018 .Mul => .@"vector.reduce.mul",
1001910019 else => unreachable,
1002010020 }, &.{llvm_operand_ty}, &.{operand}, ""),
10021 .Float => if (intrinsicsAllowed(scalar_ty, target))
10021 .float => if (intrinsicsAllowed(scalar_ty, target))
1002210022 return self.wip.callIntrinsic(fast, .none, switch (reduce.operation) {
1002310023 .Add => .@"vector.reduce.fadd",
1002410024 .Mul => .@"vector.reduce.fmul",
......@@ -10095,7 +10095,7 @@ pub const FuncGen = struct {
1009510095 const llvm_result_ty = try o.lowerType(result_ty);
1009610096
1009710097 switch (result_ty.zigTypeTag(zcu)) {
10098 .Vector => {
10098 .vector => {
1009910099 var vector = try o.builder.poisonValue(llvm_result_ty);
1010010100 for (elements, 0..) |elem, i| {
1010110101 const index_u32 = try o.builder.intValue(.i32, i);
......@@ -10104,7 +10104,7 @@ pub const FuncGen = struct {
1010410104 }
1010510105 return vector;
1010610106 },
10107 .Struct => {
10107 .@"struct" => {
1010810108 if (zcu.typeToPackedStruct(result_ty)) |struct_type| {
1010910109 const backing_int_ty = struct_type.backingIntTypeUnordered(ip);
1011010110 assert(backing_int_ty != .none);
......@@ -10170,7 +10170,7 @@ pub const FuncGen = struct {
1017010170 return result;
1017110171 }
1017210172 },
10173 .Array => {
10173 .array => {
1017410174 assert(isByRef(result_ty, zcu));
1017510175
1017610176 const llvm_usize = try o.lowerType(Type.usize);
......@@ -10577,7 +10577,7 @@ pub const FuncGen = struct {
1057710577 const zcu = pt.zcu;
1057810578 const struct_ty = struct_ptr_ty.childType(zcu);
1057910579 switch (struct_ty.zigTypeTag(zcu)) {
10580 .Struct => switch (struct_ty.containerLayout(zcu)) {
10580 .@"struct" => switch (struct_ty.containerLayout(zcu)) {
1058110581 .@"packed" => {
1058210582 const result_ty = self.typeOfIndex(inst);
1058310583 const result_ty_info = result_ty.ptrInfo(zcu);
......@@ -10618,7 +10618,7 @@ pub const FuncGen = struct {
1061810618 }
1061910619 },
1062010620 },
10621 .Union => {
10621 .@"union" => {
1062210622 const layout = struct_ty.unionGetLayout(zcu);
1062310623 if (layout.payload_size == 0 or struct_ty.containerLayout(zcu) == .@"packed") return struct_ptr;
1062410624 const payload_index = @intFromBool(layout.tag_align.compare(.gte, layout.payload_align));
......@@ -10761,7 +10761,7 @@ pub const FuncGen = struct {
1076110761 return result_ptr;
1076210762 }
1076310763
10764 if (elem_ty.zigTypeTag(zcu) == .Float or elem_ty.zigTypeTag(zcu) == .Vector) {
10764 if (elem_ty.zigTypeTag(zcu) == .float or elem_ty.zigTypeTag(zcu) == .vector) {
1076510765 const same_size_int = try o.builder.intType(@intCast(elem_bits));
1076610766 const truncated_int = try self.wip.cast(.trunc, shifted_value, same_size_int, "");
1076710767 return self.wip.cast(.bitcast, truncated_int, elem_llvm_ty, "");
......@@ -11432,7 +11432,7 @@ const ParamTypeIterator = struct {
1143211432 it.zig_index += 1;
1143311433 it.llvm_index += 1;
1143411434 if (ty.isSlice(zcu) or
11435 (ty.zigTypeTag(zcu) == .Optional and ty.optionalChild(zcu).isSlice(zcu) and !ty.ptrAllowsZero(zcu)))
11435 (ty.zigTypeTag(zcu) == .optional and ty.optionalChild(zcu).isSlice(zcu) and !ty.ptrAllowsZero(zcu)))
1143611436 {
1143711437 it.llvm_index += 1;
1143811438 return .slice;
......@@ -11707,8 +11707,8 @@ fn ccAbiPromoteInt(
1170711707 else => {},
1170811708 }
1170911709 const int_info = switch (ty.zigTypeTag(zcu)) {
11710 .Bool => Type.u1.intInfo(zcu),
11711 .Int, .Enum, .ErrorSet => ty.intInfo(zcu),
11710 .bool => Type.u1.intInfo(zcu),
11711 .int, .@"enum", .error_set => ty.intInfo(zcu),
1171211712 else => return null,
1171311713 };
1171411714 return switch (target.os.tag) {
......@@ -11753,30 +11753,30 @@ fn isByRef(ty: Type, zcu: *Zcu) bool {
1175311753 const ip = &zcu.intern_pool;
1175411754
1175511755 switch (ty.zigTypeTag(zcu)) {
11756 .Type,
11757 .ComptimeInt,
11758 .ComptimeFloat,
11759 .EnumLiteral,
11760 .Undefined,
11761 .Null,
11762 .Opaque,
11756 .type,
11757 .comptime_int,
11758 .comptime_float,
11759 .enum_literal,
11760 .undefined,
11761 .null,
11762 .@"opaque",
1176311763 => unreachable,
1176411764
11765 .NoReturn,
11766 .Void,
11767 .Bool,
11768 .Int,
11769 .Float,
11770 .Pointer,
11771 .ErrorSet,
11772 .Fn,
11773 .Enum,
11774 .Vector,
11775 .AnyFrame,
11765 .noreturn,
11766 .void,
11767 .bool,
11768 .int,
11769 .float,
11770 .pointer,
11771 .error_set,
11772 .@"fn",
11773 .@"enum",
11774 .vector,
11775 .@"anyframe",
1177611776 => return false,
1177711777
11778 .Array, .Frame => return ty.hasRuntimeBits(zcu),
11779 .Struct => {
11778 .array, .frame => return ty.hasRuntimeBits(zcu),
11779 .@"struct" => {
1178011780 const struct_type = switch (ip.indexToKey(ty.toIntern())) {
1178111781 .anon_struct_type => |tuple| {
1178211782 var count: usize = 0;
......@@ -11807,18 +11807,18 @@ fn isByRef(ty: Type, zcu: *Zcu) bool {
1180711807 }
1180811808 return false;
1180911809 },
11810 .Union => switch (ty.containerLayout(zcu)) {
11810 .@"union" => switch (ty.containerLayout(zcu)) {
1181111811 .@"packed" => return false,
1181211812 else => return ty.hasRuntimeBits(zcu),
1181311813 },
11814 .ErrorUnion => {
11814 .error_union => {
1181511815 const payload_ty = ty.errorUnionPayload(zcu);
1181611816 if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
1181711817 return false;
1181811818 }
1181911819 return true;
1182011820 },
11821 .Optional => {
11821 .optional => {
1182211822 const payload_ty = ty.optionalChild(zcu);
1182311823 if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
1182411824 return false;
......@@ -11833,21 +11833,21 @@ fn isByRef(ty: Type, zcu: *Zcu) bool {
1183311833
1183411834fn isScalar(zcu: *Zcu, ty: Type) bool {
1183511835 return switch (ty.zigTypeTag(zcu)) {
11836 .Void,
11837 .Bool,
11838 .NoReturn,
11839 .Int,
11840 .Float,
11841 .Pointer,
11842 .Optional,
11843 .ErrorSet,
11844 .Enum,
11845 .AnyFrame,
11846 .Vector,
11836 .void,
11837 .bool,
11838 .noreturn,
11839 .int,
11840 .float,
11841 .pointer,
11842 .optional,
11843 .error_set,
11844 .@"enum",
11845 .@"anyframe",
11846 .vector,
1184711847 => true,
1184811848
11849 .Struct => ty.containerLayout(zcu) == .@"packed",
11850 .Union => ty.containerLayout(zcu) == .@"packed",
11849 .@"struct" => ty.containerLayout(zcu) == .@"packed",
11850 .@"union" => ty.containerLayout(zcu) == .@"packed",
1185111851 else => false,
1185211852 };
1185311853}
src/codegen/llvm/BitcodeReader.zig+3-3
......@@ -273,7 +273,7 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void {
273273 };
274274 try state.abbrevs.abbrevs.ensureTotalCapacity(
275275 bc.allocator,
276 @typeInfo(Abbrev.Builtin).Enum.fields.len + abbrevs.len,
276 @typeInfo(Abbrev.Builtin).@"enum".fields.len + abbrevs.len,
277277 );
278278
279279 assert(state.abbrevs.abbrevs.items.len == @intFromEnum(Abbrev.Builtin.end_block));
......@@ -309,7 +309,7 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void {
309309 .{ .encoding = .{ .vbr = 6 } }, // ops
310310 },
311311 });
312 assert(state.abbrevs.abbrevs.items.len == @typeInfo(Abbrev.Builtin).Enum.fields.len);
312 assert(state.abbrevs.abbrevs.items.len == @typeInfo(Abbrev.Builtin).@"enum".fields.len);
313313 for (abbrevs) |abbrev| try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, abbrev);
314314}
315315
......@@ -448,7 +448,7 @@ const Abbrev = struct {
448448 define_abbrev,
449449 unabbrev_record,
450450
451 const first_record_id: u32 = std.math.maxInt(u32) - @typeInfo(Builtin).Enum.fields.len + 1;
451 const first_record_id: u32 = std.math.maxInt(u32) - @typeInfo(Builtin).@"enum".fields.len + 1;
452452 fn toRecordId(builtin: Builtin) u32 {
453453 return first_record_id + @intFromEnum(builtin);
454454 }
src/codegen/llvm/Builder.zig+47-47
......@@ -1115,7 +1115,7 @@ pub const Attribute = union(Kind) {
11151115 => |kind| {
11161116 const field = comptime blk: {
11171117 @setEvalBranchQuota(10_000);
1118 for (@typeInfo(Attribute).Union.fields) |field| {
1118 for (@typeInfo(Attribute).@"union".fields) |field| {
11191119 if (std.mem.eql(u8, field.name, @tagName(kind))) break :blk field;
11201120 }
11211121 unreachable;
......@@ -1232,11 +1232,11 @@ pub const Attribute = union(Kind) {
12321232 .dereferenceable_or_null,
12331233 => |size| try writer.print(" {s}({d})", .{ @tagName(attribute), size }),
12341234 .nofpclass => |fpclass| {
1235 const Int = @typeInfo(FpClass).Struct.backing_integer.?;
1235 const Int = @typeInfo(FpClass).@"struct".backing_integer.?;
12361236 try writer.print(" {s}(", .{@tagName(attribute)});
12371237 var any = false;
12381238 var remaining: Int = @bitCast(fpclass);
1239 inline for (@typeInfo(FpClass).Struct.decls) |decl| {
1239 inline for (@typeInfo(FpClass).@"struct".decls) |decl| {
12401240 const pattern: Int = @bitCast(@field(FpClass, decl.name));
12411241 if (remaining & pattern == pattern) {
12421242 if (!any) {
......@@ -1259,7 +1259,7 @@ pub const Attribute = union(Kind) {
12591259 .allockind => |allockind| {
12601260 try writer.print(" {s}(\"", .{@tagName(attribute)});
12611261 var any = false;
1262 inline for (@typeInfo(AllocKind).Struct.fields) |field| {
1262 inline for (@typeInfo(AllocKind).@"struct".fields) |field| {
12631263 if (comptime std.mem.eql(u8, field.name, "_")) continue;
12641264 if (@field(allockind, field.name)) {
12651265 if (!any) {
......@@ -1418,7 +1418,7 @@ pub const Attribute = union(Kind) {
14181418 none = std.math.maxInt(u32),
14191419 _,
14201420
1421 pub const len = @typeInfo(Kind).Enum.fields.len - 2;
1421 pub const len = @typeInfo(Kind).@"enum".fields.len - 2;
14221422
14231423 pub fn fromString(str: String) Kind {
14241424 assert(!str.isAnon());
......@@ -5037,7 +5037,7 @@ pub const Function = struct {
50375037 index: Instruction.ExtraIndex,
50385038 ) struct { data: T, trail: ExtraDataTrail } {
50395039 var result: T = undefined;
5040 const fields = @typeInfo(T).Struct.fields;
5040 const fields = @typeInfo(T).@"struct".fields;
50415041 inline for (fields, self.extra[index..][0..fields.len]) |field, value|
50425042 @field(result, field.name) = switch (field.type) {
50435043 u32 => value,
......@@ -6151,7 +6151,7 @@ pub const WipFunction = struct {
61516151
61526152 fn addExtra(wip_extra: *@This(), extra: anytype) Instruction.ExtraIndex {
61536153 const result = wip_extra.index;
6154 inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
6154 inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
61556155 const value = @field(extra, field.name);
61566156 wip_extra.items[wip_extra.index] = switch (field.type) {
61576157 u32 => value,
......@@ -6175,7 +6175,7 @@ pub const WipFunction = struct {
61756175 }
61766176
61776177 fn appendSlice(wip_extra: *@This(), slice: anytype) void {
6178 if (@typeInfo(@TypeOf(slice)).Pointer.child == Value)
6178 if (@typeInfo(@TypeOf(slice)).pointer.child == Value)
61796179 @compileError("use appendMappedValues");
61806180 const data: []const u32 = @ptrCast(slice);
61816181 @memcpy(wip_extra.items[wip_extra.index..][0..data.len], data);
......@@ -6760,7 +6760,7 @@ pub const WipFunction = struct {
67606760 ) Allocator.Error!void {
67616761 try self.extra.ensureUnusedCapacity(
67626762 self.builder.gpa,
6763 count * (@typeInfo(Extra).Struct.fields.len + trail_len),
6763 count * (@typeInfo(Extra).@"struct".fields.len + trail_len),
67646764 );
67656765 }
67666766
......@@ -6799,7 +6799,7 @@ pub const WipFunction = struct {
67996799
68006800 fn addExtraAssumeCapacity(self: *WipFunction, extra: anytype) Instruction.ExtraIndex {
68016801 const result: Instruction.ExtraIndex = @intCast(self.extra.items.len);
6802 inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
6802 inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
68036803 const value = @field(extra, field.name);
68046804 self.extra.appendAssumeCapacity(switch (field.type) {
68056805 u32 => value,
......@@ -6848,7 +6848,7 @@ pub const WipFunction = struct {
68486848 index: Instruction.ExtraIndex,
68496849 ) struct { data: T, trail: ExtraDataTrail } {
68506850 var result: T = undefined;
6851 const fields = @typeInfo(T).Struct.fields;
6851 const fields = @typeInfo(T).@"struct".fields;
68526852 inline for (fields, self.extra.items[index..][0..fields.len]) |field, value|
68536853 @field(result, field.name) = switch (field.type) {
68546854 u32 => value,
......@@ -7926,17 +7926,17 @@ pub const Metadata = enum(u32) {
79267926 writer: anytype,
79277927 ) @TypeOf(writer).Error!void {
79287928 var need_pipe = false;
7929 inline for (@typeInfo(DIFlags).Struct.fields) |field| {
7929 inline for (@typeInfo(DIFlags).@"struct".fields) |field| {
79307930 switch (@typeInfo(field.type)) {
7931 .Bool => if (@field(self, field.name)) {
7931 .bool => if (@field(self, field.name)) {
79327932 if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
79337933 try writer.print("DIFlag{s}", .{field.name});
79347934 },
7935 .Enum => if (@field(self, field.name) != .Zero) {
7935 .@"enum" => if (@field(self, field.name) != .Zero) {
79367936 if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
79377937 try writer.print("DIFlag{s}", .{@tagName(@field(self, field.name))});
79387938 },
7939 .Int => assert(@field(self, field.name) == 0),
7939 .int => assert(@field(self, field.name) == 0),
79407940 else => @compileError("bad field type: " ++ field.name ++ ": " ++
79417941 @typeName(field.type)),
79427942 }
......@@ -7988,17 +7988,17 @@ pub const Metadata = enum(u32) {
79887988 writer: anytype,
79897989 ) @TypeOf(writer).Error!void {
79907990 var need_pipe = false;
7991 inline for (@typeInfo(DISPFlags).Struct.fields) |field| {
7991 inline for (@typeInfo(DISPFlags).@"struct".fields) |field| {
79927992 switch (@typeInfo(field.type)) {
7993 .Bool => if (@field(self, field.name)) {
7993 .bool => if (@field(self, field.name)) {
79947994 if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
79957995 try writer.print("DISPFlag{s}", .{field.name});
79967996 },
7997 .Enum => if (@field(self, field.name) != .Zero) {
7997 .@"enum" => if (@field(self, field.name) != .Zero) {
79987998 if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
79997999 try writer.print("DISPFlag{s}", .{@tagName(@field(self, field.name))});
80008000 },
8001 .Int => assert(@field(self, field.name) == 0),
8001 .int => assert(@field(self, field.name) == 0),
80028002 else => @compileError("bad field type: " ++ field.name ++ ": " ++
80038003 @typeName(field.type)),
80048004 }
......@@ -8281,16 +8281,16 @@ pub const Metadata = enum(u32) {
82818281 }!std.fmt.Formatter(format) {
82828282 const Node = @TypeOf(node);
82838283 const MaybeNode = switch (@typeInfo(Node)) {
8284 .Optional => Node,
8285 .Null => ?noreturn,
8284 .optional => Node,
8285 .null => ?noreturn,
82868286 else => ?Node,
82878287 };
8288 const Some = @typeInfo(MaybeNode).Optional.child;
8288 const Some = @typeInfo(MaybeNode).optional.child;
82898289 return .{ .data = .{
82908290 .formatter = formatter,
82918291 .prefix = prefix,
82928292 .node = if (@as(MaybeNode, node)) |some| switch (@typeInfo(Some)) {
8293 .Enum => |enum_info| switch (Some) {
8293 .@"enum" => |enum_info| switch (Some) {
82948294 Metadata => switch (some) {
82958295 .none => .none,
82968296 else => try formatter.refUnwrapped(some.unwrap(formatter.builder)),
......@@ -8301,18 +8301,18 @@ pub const Metadata = enum(u32) {
83018301 else
83028302 @compileError("unknown type to format: " ++ @typeName(Node)),
83038303 },
8304 .EnumLiteral => .{ .raw = @tagName(some) },
8305 .Bool => .{ .bool = some },
8306 .Struct => switch (Some) {
8304 .enum_literal => .{ .raw = @tagName(some) },
8305 .bool => .{ .bool = some },
8306 .@"struct" => switch (Some) {
83078307 DIFlags => .{ .di_flags = some },
83088308 Subprogram.DISPFlags => .{ .sp_flags = some },
83098309 else => @compileError("unknown type to format: " ++ @typeName(Node)),
83108310 },
8311 .Int, .ComptimeInt => .{ .u64 = some },
8312 .Pointer => .{ .raw = some },
8311 .int, .comptime_int => .{ .u64 = some },
8312 .pointer => .{ .raw = some },
83138313 else => @compileError("unknown type to format: " ++ @typeName(Node)),
83148314 } else switch (@typeInfo(Node)) {
8315 .Optional, .Null => .none,
8315 .optional, .null => .none,
83168316 else => unreachable,
83178317 },
83188318 } };
......@@ -8414,7 +8414,7 @@ pub const Metadata = enum(u32) {
84148414 }
84158415 fmt_str = fmt_str ++ ")\n";
84168416
8417 var fmt_args: @Type(.{ .Struct = .{
8417 var fmt_args: @Type(.{ .@"struct" = .{
84188418 .layout = .auto,
84198419 .fields = &fields,
84208420 .decls = &.{},
......@@ -8501,10 +8501,10 @@ pub fn init(options: Options) Allocator.Error!Builder {
85018501 }
85028502
85038503 {
8504 const static_len = @typeInfo(Type).Enum.fields.len - 1;
8504 const static_len = @typeInfo(Type).@"enum".fields.len - 1;
85058505 try self.type_map.ensureTotalCapacity(self.gpa, static_len);
85068506 try self.type_items.ensureTotalCapacity(self.gpa, static_len);
8507 inline for (@typeInfo(Type.Simple).Enum.fields) |simple_field| {
8507 inline for (@typeInfo(Type.Simple).@"enum".fields) |simple_field| {
85088508 const result = self.getOrPutTypeNoExtraAssumeCapacity(
85098509 .{ .tag = .simple, .data = simple_field.value },
85108510 );
......@@ -9031,14 +9031,14 @@ pub fn getIntrinsic(
90319031
90329032pub fn intConst(self: *Builder, ty: Type, value: anytype) Allocator.Error!Constant {
90339033 const int_value = switch (@typeInfo(@TypeOf(value))) {
9034 .Int, .ComptimeInt => value,
9035 .Enum => @intFromEnum(value),
9034 .int, .comptime_int => value,
9035 .@"enum" => @intFromEnum(value),
90369036 else => @compileError("intConst expected an integral value, got " ++ @typeName(@TypeOf(value))),
90379037 };
90389038 var limbs: [
90399039 switch (@typeInfo(@TypeOf(int_value))) {
9040 .Int => |info| std.math.big.int.calcTwosCompLimbCount(info.bits),
9041 .ComptimeInt => std.math.big.int.calcLimbLen(int_value),
9040 .int => |info| std.math.big.int.calcTwosCompLimbCount(info.bits),
9041 .comptime_int => std.math.big.int.calcLimbLen(int_value),
90429042 else => unreachable,
90439043 }
90449044 ]std.math.big.Limb = undefined;
......@@ -10759,7 +10759,7 @@ fn ensureUnusedTypeCapacity(
1075910759 try self.type_items.ensureUnusedCapacity(self.gpa, count);
1076010760 try self.type_extra.ensureUnusedCapacity(
1076110761 self.gpa,
10762 count * (@typeInfo(Extra).Struct.fields.len + trail_len),
10762 count * (@typeInfo(Extra).@"struct".fields.len + trail_len),
1076310763 );
1076410764}
1076510765
......@@ -10789,7 +10789,7 @@ fn getOrPutTypeNoExtraAssumeCapacity(self: *Builder, item: Type.Item) struct { n
1078910789
1079010790fn addTypeExtraAssumeCapacity(self: *Builder, extra: anytype) Type.Item.ExtraIndex {
1079110791 const result: Type.Item.ExtraIndex = @intCast(self.type_extra.items.len);
10792 inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
10792 inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
1079310793 const value = @field(extra, field.name);
1079410794 self.type_extra.appendAssumeCapacity(switch (field.type) {
1079510795 u32 => value,
......@@ -10827,7 +10827,7 @@ fn typeExtraDataTrail(
1082710827 index: Type.Item.ExtraIndex,
1082810828) struct { data: T, trail: TypeExtraDataTrail } {
1082910829 var result: T = undefined;
10830 const fields = @typeInfo(T).Struct.fields;
10830 const fields = @typeInfo(T).@"struct".fields;
1083110831 inline for (fields, self.type_extra.items[index..][0..fields.len]) |field, value|
1083210832 @field(result, field.name) = switch (field.type) {
1083310833 u32 => value,
......@@ -11642,7 +11642,7 @@ fn ensureUnusedConstantCapacity(
1164211642 try self.constant_items.ensureUnusedCapacity(self.gpa, count);
1164311643 try self.constant_extra.ensureUnusedCapacity(
1164411644 self.gpa,
11645 count * (@typeInfo(Extra).Struct.fields.len + trail_len),
11645 count * (@typeInfo(Extra).@"struct".fields.len + trail_len),
1164611646 );
1164711647}
1164811648
......@@ -11717,7 +11717,7 @@ fn getOrPutConstantAggregateAssumeCapacity(
1171711717
1171811718fn addConstantExtraAssumeCapacity(self: *Builder, extra: anytype) Constant.Item.ExtraIndex {
1171911719 const result: Constant.Item.ExtraIndex = @intCast(self.constant_extra.items.len);
11720 inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
11720 inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
1172111721 const value = @field(extra, field.name);
1172211722 self.constant_extra.appendAssumeCapacity(switch (field.type) {
1172311723 u32 => value,
......@@ -11756,7 +11756,7 @@ fn constantExtraDataTrail(
1175611756 index: Constant.Item.ExtraIndex,
1175711757) struct { data: T, trail: ConstantExtraDataTrail } {
1175811758 var result: T = undefined;
11759 const fields = @typeInfo(T).Struct.fields;
11759 const fields = @typeInfo(T).@"struct".fields;
1176011760 inline for (fields, self.constant_extra.items[index..][0..fields.len]) |field, value|
1176111761 @field(result, field.name) = switch (field.type) {
1176211762 u32 => value,
......@@ -11784,13 +11784,13 @@ fn ensureUnusedMetadataCapacity(
1178411784 try self.metadata_items.ensureUnusedCapacity(self.gpa, count);
1178511785 try self.metadata_extra.ensureUnusedCapacity(
1178611786 self.gpa,
11787 count * (@typeInfo(Extra).Struct.fields.len + trail_len),
11787 count * (@typeInfo(Extra).@"struct".fields.len + trail_len),
1178811788 );
1178911789}
1179011790
1179111791fn addMetadataExtraAssumeCapacity(self: *Builder, extra: anytype) Metadata.Item.ExtraIndex {
1179211792 const result: Metadata.Item.ExtraIndex = @intCast(self.metadata_extra.items.len);
11793 inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
11793 inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
1179411794 const value = @field(extra, field.name);
1179511795 self.metadata_extra.appendAssumeCapacity(switch (field.type) {
1179611796 u32 => value,
......@@ -11829,7 +11829,7 @@ fn metadataExtraDataTrail(
1182911829 index: Metadata.Item.ExtraIndex,
1183011830) struct { data: T, trail: MetadataExtraDataTrail } {
1183111831 var result: T = undefined;
11832 const fields = @typeInfo(T).Struct.fields;
11832 const fields = @typeInfo(T).@"struct".fields;
1183311833 inline for (fields, self.metadata_extra.items[index..][0..fields.len]) |field, value|
1183411834 @field(result, field.name) = switch (field.type) {
1183511835 u32 => value,
......@@ -13921,7 +13921,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
1392113921 const MetadataKindBlock = ir.MetadataKindBlock;
1392213922 var metadata_kind_block = try module_block.enterSubBlock(MetadataKindBlock, true);
1392313923
13924 inline for (@typeInfo(ir.FixedMetadataKind).Enum.fields) |field| {
13924 inline for (@typeInfo(ir.FixedMetadataKind).@"enum".fields) |field| {
1392513925 // don't include `dbg` in stripped functions
1392613926 if (!(self.strip and std.mem.eql(u8, field.name, "dbg"))) {
1392713927 try metadata_kind_block.writeAbbrev(MetadataKindBlock.Kind{
......@@ -14197,7 +14197,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
1419714197 const limbs_len = std.math.divCeil(u32, extra.bit_width, 64) catch unreachable;
1419814198 try record.ensureTotalCapacity(self.gpa, 3 + limbs_len);
1419914199 record.appendAssumeCapacity(@as(
14200 @typeInfo(MetadataBlock.Enumerator.Flags).Struct.backing_integer.?,
14200 @typeInfo(MetadataBlock.Enumerator.Flags).@"struct".backing_integer.?,
1420114201 @bitCast(flags),
1420214202 ));
1420314203 record.appendAssumeCapacity(extra.bit_width);
src/codegen/llvm/bitcode_writer.zig+9-9
......@@ -407,14 +407,14 @@ fn charTo6Bit(c: u8) u8 {
407407
408408fn BufType(comptime T: type, comptime min_len: usize) type {
409409 return std.meta.Int(.unsigned, @max(min_len, @bitSizeOf(switch (@typeInfo(T)) {
410 .ComptimeInt => u32,
411 .Int => |info| if (info.signedness == .unsigned)
410 .comptime_int => u32,
411 .int => |info| if (info.signedness == .unsigned)
412412 T
413413 else
414414 @compileError("Unsupported type: " ++ @typeName(T)),
415 .Enum => |info| info.tag_type,
416 .Bool => u1,
417 .Struct => |info| switch (info.layout) {
415 .@"enum" => |info| info.tag_type,
416 .bool => u1,
417 .@"struct" => |info| switch (info.layout) {
418418 .auto, .@"extern" => @compileError("Unsupported type: " ++ @typeName(T)),
419419 .@"packed" => std.meta.Int(.unsigned, @bitSizeOf(T)),
420420 },
......@@ -424,10 +424,10 @@ fn BufType(comptime T: type, comptime min_len: usize) type {
424424
425425fn bufValue(value: anytype, comptime min_len: usize) BufType(@TypeOf(value), min_len) {
426426 return switch (@typeInfo(@TypeOf(value))) {
427 .ComptimeInt, .Int => @intCast(value),
428 .Enum => @intFromEnum(value),
429 .Bool => @intFromBool(value),
430 .Struct => @intCast(@as(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))),
427 .comptime_int, .int => @intCast(value),
428 .@"enum" => @intFromEnum(value),
429 .bool => @intFromBool(value),
430 .@"struct" => @intCast(@as(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))),
431431 else => unreachable,
432432 };
433433}
src/codegen/spirv.zig+65-65
......@@ -439,7 +439,7 @@ const NavGen = struct {
439439 const zcu = pt.zcu;
440440 if (try self.air.value(inst, pt)) |val| {
441441 const ty = self.typeOf(inst);
442 if (ty.zigTypeTag(zcu) == .Fn) {
442 if (ty.zigTypeTag(zcu) == .@"fn") {
443443 const fn_nav = switch (zcu.intern_pool.indexToKey(val.ip_index)) {
444444 .@"extern" => |@"extern"| @"extern".owner_nav,
445445 .func => |func| func.owner_nav,
......@@ -641,16 +641,16 @@ const NavGen = struct {
641641 fn isSpvVector(self: *NavGen, ty: Type) bool {
642642 const zcu = self.pt.zcu;
643643 const target = self.getTarget();
644 if (ty.zigTypeTag(zcu) != .Vector) return false;
644 if (ty.zigTypeTag(zcu) != .vector) return false;
645645
646646 // TODO: This check must be expanded for types that can be represented
647647 // as integers (enums / packed structs?) and types that are represented
648648 // by multiple SPIR-V values.
649649 const scalar_ty = ty.scalarType(zcu);
650650 switch (scalar_ty.zigTypeTag(zcu)) {
651 .Bool,
652 .Int,
653 .Float,
651 .bool,
652 .int,
653 .float,
654654 => {},
655655 else => return false,
656656 }
......@@ -668,26 +668,26 @@ const NavGen = struct {
668668 const zcu = self.pt.zcu;
669669 const target = self.getTarget();
670670 var scalar_ty = ty.scalarType(zcu);
671 if (scalar_ty.zigTypeTag(zcu) == .Enum) {
671 if (scalar_ty.zigTypeTag(zcu) == .@"enum") {
672672 scalar_ty = scalar_ty.intTagType(zcu);
673673 }
674674 const vector_len = if (ty.isVector(zcu)) ty.vectorLen(zcu) else null;
675675 return switch (scalar_ty.zigTypeTag(zcu)) {
676 .Bool => ArithmeticTypeInfo{
676 .bool => ArithmeticTypeInfo{
677677 .bits = 1, // Doesn't matter for this class.
678678 .backing_bits = self.backingIntBits(1).?,
679679 .vector_len = vector_len,
680680 .signedness = .unsigned, // Technically, but doesn't matter for this class.
681681 .class = .bool,
682682 },
683 .Float => ArithmeticTypeInfo{
683 .float => ArithmeticTypeInfo{
684684 .bits = scalar_ty.floatBits(target),
685685 .backing_bits = scalar_ty.floatBits(target), // TODO: F80?
686686 .vector_len = vector_len,
687687 .signedness = .signed, // Technically, but doesn't matter for this class.
688688 .class = .float,
689689 },
690 .Int => blk: {
690 .int => blk: {
691691 const int_info = scalar_ty.intInfo(zcu);
692692 // TODO: Maybe it's useful to also return this value.
693693 const maybe_backing_bits = self.backingIntBits(int_info.bits);
......@@ -705,8 +705,8 @@ const NavGen = struct {
705705 .composite_integer,
706706 };
707707 },
708 .Enum => unreachable,
709 .Vector => unreachable,
708 .@"enum" => unreachable,
709 .vector => unreachable,
710710 else => unreachable, // Unhandled arithmetic type
711711 };
712712 }
......@@ -748,8 +748,8 @@ const NavGen = struct {
748748 const backing_bits = self.backingIntBits(int_info.bits).?; // Assertion failure means big int
749749
750750 const signedness: Signedness = switch (@typeInfo(@TypeOf(value))) {
751 .Int => |int| int.signedness,
752 .ComptimeInt => if (value < 0) .signed else .unsigned,
751 .int => |int| int.signedness,
752 .comptime_int => if (value < 0) .signed else .unsigned,
753753 else => unreachable,
754754 };
755755
......@@ -1243,7 +1243,7 @@ const NavGen = struct {
12431243 else => {},
12441244 }
12451245
1246 // const is_fn_body = decl_ty.zigTypeTag(zcu) == .Fn;
1246 // const is_fn_body = decl_ty.zigTypeTag(zcu) == .@"fn";
12471247 if (!uav_ty.isFnOrHasRuntimeBitsIgnoreComptime(zcu)) {
12481248 // Pointer to nothing - return undefined
12491249 return self.spv.constUndef(ty_id);
......@@ -1539,11 +1539,11 @@ const NavGen = struct {
15391539 const section = &self.spv.sections.types_globals_constants;
15401540
15411541 switch (ty.zigTypeTag(zcu)) {
1542 .NoReturn => {
1542 .noreturn => {
15431543 assert(repr == .direct);
15441544 return try self.spv.voidType();
15451545 },
1546 .Void => switch (repr) {
1546 .void => switch (repr) {
15471547 .direct => {
15481548 return try self.spv.voidType();
15491549 },
......@@ -1557,11 +1557,11 @@ const NavGen = struct {
15571557 return result_id;
15581558 },
15591559 },
1560 .Bool => switch (repr) {
1560 .bool => switch (repr) {
15611561 .direct => return try self.spv.boolType(),
15621562 .indirect => return try self.resolveType(Type.u1, .indirect),
15631563 },
1564 .Int => {
1564 .int => {
15651565 const int_info = ty.intInfo(zcu);
15661566 if (int_info.bits == 0) {
15671567 // Some times, the backend will be asked to generate a pointer to i0. OpTypeInt
......@@ -1576,11 +1576,11 @@ const NavGen = struct {
15761576 }
15771577 return try self.intType(int_info.signedness, int_info.bits);
15781578 },
1579 .Enum => {
1579 .@"enum" => {
15801580 const tag_ty = ty.intTagType(zcu);
15811581 return try self.resolveType(tag_ty, repr);
15821582 },
1583 .Float => {
1583 .float => {
15841584 // We can (and want) not really emulate floating points with other floating point types like with the integer types,
15851585 // so if the float is not supported, just return an error.
15861586 const bits = ty.floatBits(target);
......@@ -1598,7 +1598,7 @@ const NavGen = struct {
15981598
15991599 return try self.spv.floatType(bits);
16001600 },
1601 .Array => {
1601 .array => {
16021602 const elem_ty = ty.childType(zcu);
16031603 const elem_ty_id = try self.resolveType(elem_ty, .indirect);
16041604 const total_len = std.math.cast(u32, ty.arrayLenIncludingSentinel(zcu)) orelse {
......@@ -1633,7 +1633,7 @@ const NavGen = struct {
16331633 return try self.arrayType(total_len, elem_ty_id);
16341634 }
16351635 },
1636 .Fn => switch (repr) {
1636 .@"fn" => switch (repr) {
16371637 .direct => {
16381638 const fn_info = zcu.typeToFunc(ty).?;
16391639
......@@ -1676,7 +1676,7 @@ const NavGen = struct {
16761676 return try self.resolveType(Type.usize, .indirect);
16771677 },
16781678 },
1679 .Pointer => {
1679 .pointer => {
16801680 const ptr_info = ty.ptrInfo(zcu);
16811681
16821682 const storage_class = self.spvStorageClass(ptr_info.flags.address_space);
......@@ -1692,7 +1692,7 @@ const NavGen = struct {
16921692 &.{ "ptr", "len" },
16931693 );
16941694 },
1695 .Vector => {
1695 .vector => {
16961696 const elem_ty = ty.childType(zcu);
16971697 const elem_ty_id = try self.resolveType(elem_ty, repr);
16981698 const len = ty.vectorLen(zcu);
......@@ -1703,7 +1703,7 @@ const NavGen = struct {
17031703 return try self.arrayType(len, elem_ty_id);
17041704 }
17051705 },
1706 .Struct => {
1706 .@"struct" => {
17071707 const struct_type = switch (ip.indexToKey(ty.toIntern())) {
17081708 .anon_struct_type => |tuple| {
17091709 const member_types = try self.gpa.alloc(IdRef, tuple.values.len);
......@@ -1757,7 +1757,7 @@ const NavGen = struct {
17571757 try self.spv.debugName(result_id, type_name);
17581758 return result_id;
17591759 },
1760 .Optional => {
1760 .optional => {
17611761 const payload_ty = ty.optionalChild(zcu);
17621762 if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
17631763 // Just use a bool.
......@@ -1779,9 +1779,9 @@ const NavGen = struct {
17791779 &.{ "payload", "valid" },
17801780 );
17811781 },
1782 .Union => return try self.resolveUnionType(ty),
1783 .ErrorSet => return try self.resolveType(Type.u16, repr),
1784 .ErrorUnion => {
1782 .@"union" => return try self.resolveUnionType(ty),
1783 .error_set => return try self.resolveType(Type.u16, repr),
1784 .error_union => {
17851785 const payload_ty = ty.errorUnionPayload(zcu);
17861786 const error_ty_id = try self.resolveType(Type.anyerror, .indirect);
17871787
......@@ -1808,7 +1808,7 @@ const NavGen = struct {
18081808
18091809 return try self.spv.structType(&member_types, &member_names);
18101810 },
1811 .Opaque => {
1811 .@"opaque" => {
18121812 const type_name = try self.resolveTypeName(ty);
18131813 defer self.gpa.free(type_name);
18141814
......@@ -1820,15 +1820,15 @@ const NavGen = struct {
18201820 return result_id;
18211821 },
18221822
1823 .Null,
1824 .Undefined,
1825 .EnumLiteral,
1826 .ComptimeFloat,
1827 .ComptimeInt,
1828 .Type,
1823 .null,
1824 .undefined,
1825 .enum_literal,
1826 .comptime_float,
1827 .comptime_int,
1828 .type,
18291829 => unreachable, // Must be comptime.
18301830
1831 .Frame, .AnyFrame => unreachable, // TODO
1831 .frame, .@"anyframe" => unreachable, // TODO
18321832 }
18331833 }
18341834
......@@ -2429,7 +2429,7 @@ const NavGen = struct {
24292429 const op_result_ty_id = try self.resolveType(op_result_ty, .direct);
24302430 const result_ty = try v.resultType(self, lhs.ty);
24312431
2432 assert(condition.ty.scalarType(zcu).zigTypeTag(zcu) == .Bool);
2432 assert(condition.ty.scalarType(zcu).zigTypeTag(zcu) == .bool);
24332433
24342434 const cond = try v.prepare(self, condition);
24352435 const object_1 = try v.prepare(self, lhs);
......@@ -3119,7 +3119,7 @@ const NavGen = struct {
31193119 fn convertToDirect(self: *NavGen, ty: Type, operand_id: IdRef) !IdRef {
31203120 const zcu = self.pt.zcu;
31213121 switch (ty.scalarType(zcu).zigTypeTag(zcu)) {
3122 .Bool => {
3122 .bool => {
31233123 const false_id = try self.constBool(false, .indirect);
31243124 // The operation below requires inputs in direct representation, but the operand
31253125 // is actually in indirect representation.
......@@ -3145,7 +3145,7 @@ const NavGen = struct {
31453145 fn convertToIndirect(self: *NavGen, ty: Type, operand_id: IdRef) !IdRef {
31463146 const zcu = self.pt.zcu;
31473147 switch (ty.scalarType(zcu).zigTypeTag(zcu)) {
3148 .Bool => {
3148 .bool => {
31493149 const result = try self.intFromBool(Temporary.init(ty, operand_id));
31503150 return try result.materialize(self);
31513151 },
......@@ -4281,17 +4281,17 @@ const NavGen = struct {
42814281 const is_vector = lhs.ty.isVector(zcu);
42824282
42834283 switch (scalar_ty.zigTypeTag(zcu)) {
4284 .Int, .Bool, .Float => {},
4285 .Enum => {
4284 .int, .bool, .float => {},
4285 .@"enum" => {
42864286 assert(!is_vector);
42874287 const ty = lhs.ty.intTagType(zcu);
42884288 return try self.cmp(op, lhs.pun(ty), rhs.pun(ty));
42894289 },
4290 .ErrorSet => {
4290 .error_set => {
42914291 assert(!is_vector);
42924292 return try self.cmp(op, lhs.pun(Type.u16), rhs.pun(Type.u16));
42934293 },
4294 .Pointer => {
4294 .pointer => {
42954295 assert(!is_vector);
42964296 // Note that while SPIR-V offers OpPtrEqual and OpPtrNotEqual, they are
42974297 // currently not implemented in the SPIR-V LLVM translator. Thus, we emit these using
......@@ -4317,7 +4317,7 @@ const NavGen = struct {
43174317 const rhs_int = Temporary.init(Type.usize, rhs_int_id);
43184318 return try self.cmp(op, lhs_int, rhs_int);
43194319 },
4320 .Optional => {
4320 .optional => {
43214321 assert(!is_vector);
43224322
43234323 const ty = lhs.ty;
......@@ -4478,7 +4478,7 @@ const NavGen = struct {
44784478 // TODO: Some more cases are missing here
44794479 // See fn bitCast in llvm.zig
44804480
4481 if (src_ty.zigTypeTag(zcu) == .Int and dst_ty.isPtrAtRuntime(zcu)) {
4481 if (src_ty.zigTypeTag(zcu) == .int and dst_ty.isPtrAtRuntime(zcu)) {
44824482 const result_id = self.spv.allocId();
44834483 try self.func.body.emit(self.spv.gpa, .OpConvertUToPtr, .{
44844484 .id_result_type = dst_ty_id,
......@@ -4520,7 +4520,7 @@ const NavGen = struct {
45204520 // the result here.
45214521 // TODO: This detail could cause stuff like @as(*const i1, @ptrCast(&@as(u1, 1))) to break
45224522 // should we change the representation of strange integers?
4523 if (dst_ty.zigTypeTag(zcu) == .Int) {
4523 if (dst_ty.zigTypeTag(zcu) == .int) {
45244524 const info = self.arithmeticTypeInfo(dst_ty);
45254525 const result = try self.normalize(Temporary.init(dst_ty, result_id), info);
45264526 return try result.materialize(self);
......@@ -4729,7 +4729,7 @@ const NavGen = struct {
47294729 const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra[ty_pl.payload..][0..len]);
47304730
47314731 switch (result_ty.zigTypeTag(zcu)) {
4732 .Struct => {
4732 .@"struct" => {
47334733 if (zcu.typeToPackedStruct(result_ty)) |struct_type| {
47344734 _ = struct_type;
47354735 unreachable; // TODO
......@@ -4777,7 +4777,7 @@ const NavGen = struct {
47774777 constituents[0..index],
47784778 );
47794779 },
4780 .Vector => {
4780 .vector => {
47814781 const n_elems = result_ty.vectorLen(zcu);
47824782 const elem_ids = try self.gpa.alloc(IdRef, n_elems);
47834783 defer self.gpa.free(elem_ids);
......@@ -4788,7 +4788,7 @@ const NavGen = struct {
47884788
47894789 return try self.constructVector(result_ty, elem_ids);
47904790 },
4791 .Array => {
4791 .array => {
47924792 const array_info = result_ty.arrayInfo(zcu);
47934793 const n_elems: usize = @intCast(result_ty.arrayLenIncludingSentinel(zcu));
47944794 const elem_ids = try self.gpa.alloc(IdRef, n_elems);
......@@ -5153,11 +5153,11 @@ const NavGen = struct {
51535153 if (!field_ty.hasRuntimeBitsIgnoreComptime(zcu)) return null;
51545154
51555155 switch (object_ty.zigTypeTag(zcu)) {
5156 .Struct => switch (object_ty.containerLayout(zcu)) {
5156 .@"struct" => switch (object_ty.containerLayout(zcu)) {
51575157 .@"packed" => unreachable, // TODO
51585158 else => return try self.extractField(field_ty, object_id, field_index),
51595159 },
5160 .Union => switch (object_ty.containerLayout(zcu)) {
5160 .@"union" => switch (object_ty.containerLayout(zcu)) {
51615161 .@"packed" => unreachable, // TODO
51625162 else => {
51635163 // Store, ptr-elem-ptr, pointer-cast, load
......@@ -5229,17 +5229,17 @@ const NavGen = struct {
52295229 const zcu = self.pt.zcu;
52305230 const object_ty = object_ptr_ty.childType(zcu);
52315231 switch (object_ty.zigTypeTag(zcu)) {
5232 .Pointer => {
5232 .pointer => {
52335233 assert(object_ty.isSlice(zcu));
52345234 return self.accessChain(result_ty_id, object_ptr, &.{field_index});
52355235 },
5236 .Struct => switch (object_ty.containerLayout(zcu)) {
5236 .@"struct" => switch (object_ty.containerLayout(zcu)) {
52375237 .@"packed" => unreachable, // TODO
52385238 else => {
52395239 return try self.accessChain(result_ty_id, object_ptr, &.{field_index});
52405240 },
52415241 },
5242 .Union => switch (object_ty.containerLayout(zcu)) {
5242 .@"union" => switch (object_ty.containerLayout(zcu)) {
52435243 .@"packed" => unreachable, // TODO
52445244 else => {
52455245 const layout = self.unionLayout(object_ty);
......@@ -6179,15 +6179,15 @@ const NavGen = struct {
61796179 var cond_indirect = try self.convertToIndirect(cond_ty, cond);
61806180
61816181 const cond_words: u32 = switch (cond_ty.zigTypeTag(zcu)) {
6182 .Bool, .ErrorSet => 1,
6183 .Int => blk: {
6182 .bool, .error_set => 1,
6183 .int => blk: {
61846184 const bits = cond_ty.intInfo(zcu).bits;
61856185 const backing_bits = self.backingIntBits(bits) orelse {
61866186 return self.todo("implement composite int switch", .{});
61876187 };
61886188 break :blk if (backing_bits <= 32) 1 else 2;
61896189 },
6190 .Enum => blk: {
6190 .@"enum" => blk: {
61916191 const int_ty = cond_ty.intTagType(zcu);
61926192 const int_info = int_ty.intInfo(zcu);
61936193 const backing_bits = self.backingIntBits(int_info.bits) orelse {
......@@ -6195,7 +6195,7 @@ const NavGen = struct {
61956195 };
61966196 break :blk if (backing_bits <= 32) 1 else 2;
61976197 },
6198 .Pointer => blk: {
6198 .pointer => blk: {
61996199 cond_indirect = try self.intFromPtr(cond_indirect);
62006200 break :blk target.ptrBitWidth() / 32;
62016201 },
......@@ -6248,13 +6248,13 @@ const NavGen = struct {
62486248 for (case.items) |item| {
62496249 const value = (try self.air.value(item, pt)) orelse unreachable;
62506250 const int_val: u64 = switch (cond_ty.zigTypeTag(zcu)) {
6251 .Bool, .Int => if (cond_ty.isSignedInt(zcu)) @bitCast(value.toSignedInt(zcu)) else value.toUnsignedInt(zcu),
6252 .Enum => blk: {
6251 .bool, .int => if (cond_ty.isSignedInt(zcu)) @bitCast(value.toSignedInt(zcu)) else value.toUnsignedInt(zcu),
6252 .@"enum" => blk: {
62536253 // TODO: figure out of cond_ty is correct (something with enum literals)
62546254 break :blk (try value.intFromEnum(cond_ty, pt)).toUnsignedInt(zcu); // TODO: composite integer constants
62556255 },
6256 .ErrorSet => value.getErrorInt(zcu),
6257 .Pointer => value.toUnsignedInt(zcu),
6256 .error_set => value.getErrorInt(zcu),
6257 .pointer => value.toUnsignedInt(zcu),
62586258 else => unreachable,
62596259 };
62606260 const int_lit: spec.LiteralContextDependentNumber = switch (cond_words) {
......@@ -6496,8 +6496,8 @@ const NavGen = struct {
64966496 const args: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra.end..][0..extra.data.args_len]);
64976497 const callee_ty = self.typeOf(pl_op.operand);
64986498 const zig_fn_ty = switch (callee_ty.zigTypeTag(zcu)) {
6499 .Fn => callee_ty,
6500 .Pointer => return self.fail("cannot call function pointers", .{}),
6499 .@"fn" => callee_ty,
6500 .pointer => return self.fail("cannot call function pointers", .{}),
65016501 else => unreachable,
65026502 };
65036503 const fn_info = zcu.typeToFunc(zig_fn_ty).?;
src/codegen/spirv/Section.zig+26-26
......@@ -98,7 +98,7 @@ pub fn emitSpecConstantOp(
9898 section.writeOperand(spec.IdRef, operands.id_result);
9999 section.writeOperand(Opcode, opcode);
100100
101 const fields = @typeInfo(opcode.Operands()).Struct.fields;
101 const fields = @typeInfo(opcode.Operands()).@"struct".fields;
102102 // First 2 fields are always id_result_type and id_result.
103103 inline for (fields[2..]) |field| {
104104 section.writeOperand(field.type, @field(operands, field.name));
......@@ -122,8 +122,8 @@ pub fn writeDoubleWord(section: *Section, dword: DoubleWord) void {
122122
123123fn writeOperands(section: *Section, comptime Operands: type, operands: Operands) void {
124124 const fields = switch (@typeInfo(Operands)) {
125 .Struct => |info| info.fields,
126 .Void => return,
125 .@"struct" => |info| info.fields,
126 .void => return,
127127 else => unreachable,
128128 };
129129
......@@ -154,24 +154,24 @@ pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand)
154154 spec.PairIdRefIdRef => section.writeWords(&.{ @intFromEnum(operand[0]), @intFromEnum(operand[1]) }),
155155
156156 else => switch (@typeInfo(Operand)) {
157 .Enum => section.writeWord(@intFromEnum(operand)),
158 .Optional => |info| if (operand) |child| {
157 .@"enum" => section.writeWord(@intFromEnum(operand)),
158 .optional => |info| if (operand) |child| {
159159 section.writeOperand(info.child, child);
160160 },
161 .Pointer => |info| {
161 .pointer => |info| {
162162 std.debug.assert(info.size == .Slice); // Should be no other pointer types in the spec.
163163 for (operand) |item| {
164164 section.writeOperand(info.child, item);
165165 }
166166 },
167 .Struct => |info| {
167 .@"struct" => |info| {
168168 if (info.layout == .@"packed") {
169169 section.writeWord(@as(Word, @bitCast(operand)));
170170 } else {
171171 section.writeExtendedMask(Operand, operand);
172172 }
173173 },
174 .Union => section.writeExtendedUnion(Operand, operand),
174 .@"union" => section.writeExtendedUnion(Operand, operand),
175175 else => unreachable,
176176 },
177177 }
......@@ -207,12 +207,12 @@ fn writeContextDependentNumber(section: *Section, operand: spec.LiteralContextDe
207207
208208fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand) void {
209209 var mask: Word = 0;
210 inline for (@typeInfo(Operand).Struct.fields, 0..) |field, bit| {
210 inline for (@typeInfo(Operand).@"struct".fields, 0..) |field, bit| {
211211 switch (@typeInfo(field.type)) {
212 .Optional => if (@field(operand, field.name) != null) {
212 .optional => if (@field(operand, field.name) != null) {
213213 mask |= 1 << @as(u5, @intCast(bit));
214214 },
215 .Bool => if (@field(operand, field.name)) {
215 .bool => if (@field(operand, field.name)) {
216216 mask |= 1 << @as(u5, @intCast(bit));
217217 },
218218 else => unreachable,
......@@ -221,12 +221,12 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand
221221
222222 section.writeWord(mask);
223223
224 inline for (@typeInfo(Operand).Struct.fields) |field| {
224 inline for (@typeInfo(Operand).@"struct".fields) |field| {
225225 switch (@typeInfo(field.type)) {
226 .Optional => |info| if (@field(operand, field.name)) |child| {
226 .optional => |info| if (@field(operand, field.name)) |child| {
227227 section.writeOperands(info.child, child);
228228 },
229 .Bool => {},
229 .bool => {},
230230 else => unreachable,
231231 }
232232 }
......@@ -236,7 +236,7 @@ fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operan
236236 const tag = std.meta.activeTag(operand);
237237 section.writeWord(@intFromEnum(tag));
238238
239 inline for (@typeInfo(Operand).Union.fields) |field| {
239 inline for (@typeInfo(Operand).@"union".fields) |field| {
240240 if (@field(Operand, field.name) == tag) {
241241 section.writeOperands(field.type, @field(operand, field.name));
242242 return;
......@@ -251,8 +251,8 @@ fn instructionSize(comptime opcode: spec.Opcode, operands: opcode.Operands()) us
251251
252252fn operandsSize(comptime Operands: type, operands: Operands) usize {
253253 const fields = switch (@typeInfo(Operands)) {
254 .Struct => |info| info.fields,
255 .Void => return 0,
254 .@"struct" => |info| info.fields,
255 .void => return 0,
256256 else => unreachable,
257257 };
258258
......@@ -289,9 +289,9 @@ fn operandSize(comptime Operand: type, operand: Operand) usize {
289289 => 2,
290290
291291 else => switch (@typeInfo(Operand)) {
292 .Enum => 1,
293 .Optional => |info| if (operand) |child| operandSize(info.child, child) else 0,
294 .Pointer => |info| blk: {
292 .@"enum" => 1,
293 .optional => |info| if (operand) |child| operandSize(info.child, child) else 0,
294 .pointer => |info| blk: {
295295 std.debug.assert(info.size == .Slice); // Should be no other pointer types in the spec.
296296 var total: usize = 0;
297297 for (operand) |item| {
......@@ -299,8 +299,8 @@ fn operandSize(comptime Operand: type, operand: Operand) usize {
299299 }
300300 break :blk total;
301301 },
302 .Struct => |info| if (info.layout == .@"packed") 1 else extendedMaskSize(Operand, operand),
303 .Union => extendedUnionSize(Operand, operand),
302 .@"struct" => |info| if (info.layout == .@"packed") 1 else extendedMaskSize(Operand, operand),
303 .@"union" => extendedUnionSize(Operand, operand),
304304 else => unreachable,
305305 },
306306 };
......@@ -309,13 +309,13 @@ fn operandSize(comptime Operand: type, operand: Operand) usize {
309309fn extendedMaskSize(comptime Operand: type, operand: Operand) usize {
310310 var total: usize = 0;
311311 var any_set = false;
312 inline for (@typeInfo(Operand).Struct.fields) |field| {
312 inline for (@typeInfo(Operand).@"struct".fields) |field| {
313313 switch (@typeInfo(field.type)) {
314 .Optional => |info| if (@field(operand, field.name)) |child| {
314 .optional => |info| if (@field(operand, field.name)) |child| {
315315 total += operandsSize(info.child, child);
316316 any_set = true;
317317 },
318 .Bool => if (@field(operand, field.name)) {
318 .bool => if (@field(operand, field.name)) {
319319 any_set = true;
320320 },
321321 else => unreachable,
......@@ -326,7 +326,7 @@ fn extendedMaskSize(comptime Operand: type, operand: Operand) usize {
326326
327327fn extendedUnionSize(comptime Operand: type, operand: Operand) usize {
328328 const tag = std.meta.activeTag(operand);
329 inline for (@typeInfo(Operand).Union.fields) |field| {
329 inline for (@typeInfo(Operand).@"union".fields) |field| {
330330 if (@field(Operand, field.name) == tag) {
331331 // Add one for the tag itself.
332332 return 1 + operandsSize(field.type, @field(operand, field.name));
src/link.zig+5-7
......@@ -936,13 +936,11 @@ pub const File = struct {
936936 missing_libc: bool = false,
937937
938938 const Int = blk: {
939 const bits = @typeInfo(@This()).Struct.fields.len;
940 break :blk @Type(.{
941 .Int = .{
942 .signedness = .unsigned,
943 .bits = bits,
944 },
945 });
939 const bits = @typeInfo(@This()).@"struct".fields.len;
940 break :blk @Type(.{ .int = .{
941 .signedness = .unsigned,
942 .bits = bits,
943 } });
946944 };
947945
948946 fn isSet(ef: ErrorFlags) bool {
src/link/Coff.zig+1-1
......@@ -1368,7 +1368,7 @@ fn getNavOutputSection(self: *Coff, nav_index: InternPool.Nav.Index) u16 {
13681368
13691369 switch (zig_ty) {
13701370 // TODO: what if this is a function pointer?
1371 .Fn => break :blk self.text_section_index.?,
1371 .@"fn" => break :blk self.text_section_index.?,
13721372 else => {
13731373 if (val.getVariable(zcu)) |_| {
13741374 break :blk self.data_section_index.?;
src/link/Dwarf.zig+18-10
......@@ -1756,7 +1756,7 @@ pub const WipNav = struct {
17561756 var bit: usize = 0;
17571757 var carry: u1 = 1;
17581758 while (bit < bits) : (bit += 7) {
1759 const limb_bits = @typeInfo(std.math.big.Limb).Int.bits;
1759 const limb_bits = @typeInfo(std.math.big.Limb).int.bits;
17601760 const limb_index = bit / limb_bits;
17611761 const limb_shift: std.math.Log2Int(std.math.big.Limb) = @intCast(bit % limb_bits);
17621762 const low_abs_part: u7 = @truncate(big_int.limbs[limb_index] >> limb_shift);
......@@ -2477,6 +2477,18 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
24772477 assert(file.zir_loaded);
24782478 const decl_inst = file.zir.instructions.get(@intFromEnum(inst_info.inst));
24792479 assert(decl_inst.tag == .declaration);
2480 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index);
2481
2482 const is_test = switch (decl_extra.data.name) {
2483 .unnamed_test, .decltest => true,
2484 .@"comptime", .@"usingnamespace" => false,
2485 _ => decl_extra.data.name.isNamedTest(file.zir),
2486 };
2487 if (is_test) {
2488 // This isn't actually a comptime Nav! It's a test, so it'll definitely never be referenced at comptime.
2489 return;
2490 }
2491
24802492 const tree = try file.getTree(dwarf.gpa);
24812493 const loc = tree.tokenLocation(0, tree.nodes.items(.main_token)[decl_inst.data.declaration.src_node]);
24822494 assert(loc.line == zcu.navSrcLine(nav_index));
......@@ -2515,7 +2527,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
25152527 ) != abbrev_code_buf.len) return error.InputOutput;
25162528 var abbrev_code_fbs = std.io.fixedBufferStream(&abbrev_code_buf);
25172529 const abbrev_code: AbbrevCode = @enumFromInt(
2518 std.leb.readUleb128(@typeInfo(AbbrevCode).Enum.tag_type, abbrev_code_fbs.reader()) catch unreachable,
2530 std.leb.readUleb128(@typeInfo(AbbrevCode).@"enum".tag_type, abbrev_code_fbs.reader()) catch unreachable,
25192531 );
25202532 switch (abbrev_code) {
25212533 else => unreachable,
......@@ -2582,7 +2594,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
25822594 if (loaded_struct.zir_index == .none) break :decl_struct;
25832595
25842596 const value_inst = value_inst: {
2585 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index);
25862597 const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body;
25872598 const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1]));
25882599 if (break_inst.tag != .break_inline) break :value_inst null;
......@@ -2704,7 +2715,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
27042715 if (loaded_enum.zir_index == .none) break :decl_enum;
27052716
27062717 const value_inst = value_inst: {
2707 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index);
27082718 const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body;
27092719 const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1]));
27102720 if (break_inst.tag != .break_inline) break :value_inst null;
......@@ -2788,7 +2798,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
27882798
27892799 decl_union: {
27902800 const value_inst = value_inst: {
2791 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index);
27922801 const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body;
27932802 const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1]));
27942803 if (break_inst.tag != .break_inline) break :value_inst null;
......@@ -2911,7 +2920,6 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
29112920
29122921 decl_opaque: {
29132922 const value_inst = value_inst: {
2914 const decl_extra = file.zir.extraData(Zir.Inst.Declaration, decl_inst.data.declaration.payload_index);
29152923 const decl_value_body = decl_extra.data.getBodies(@intCast(decl_extra.end), file.zir).value_body;
29162924 const break_inst = file.zir.instructions.get(@intFromEnum(decl_value_body[decl_value_body.len - 1]));
29172925 if (break_inst.tag != .break_inline) break :value_inst null;
......@@ -3685,7 +3693,7 @@ pub fn freeNav(dwarf: *Dwarf, nav_index: InternPool.Nav.Index) void {
36853693 _ = nav_index;
36863694}
36873695
3688fn refAbbrevCode(dwarf: *Dwarf, abbrev_code: AbbrevCode) UpdateError!@typeInfo(AbbrevCode).Enum.tag_type {
3696fn refAbbrevCode(dwarf: *Dwarf, abbrev_code: AbbrevCode) UpdateError!@typeInfo(AbbrevCode).@"enum".tag_type {
36893697 assert(abbrev_code != .null);
36903698 const entry: Entry.Index = @enumFromInt(@intFromEnum(abbrev_code));
36913699 if (dwarf.debug_abbrev.section.getUnit(DebugAbbrev.unit).getEntry(entry).len > 0) return @intFromEnum(abbrev_code);
......@@ -4087,7 +4095,7 @@ pub fn resolveRelocs(dwarf: *Dwarf) RelocError!void {
40874095}
40884096
40894097fn DeclValEnum(comptime T: type) type {
4090 const decls = @typeInfo(T).Struct.decls;
4098 const decls = @typeInfo(T).@"struct".decls;
40914099 @setEvalBranchQuota(7 * decls.len);
40924100 var fields: [decls.len]std.builtin.Type.EnumField = undefined;
40934101 var fields_len = 0;
......@@ -4101,7 +4109,7 @@ fn DeclValEnum(comptime T: type) type {
41014109 if (min_value == null or min_value.? > value) min_value = value;
41024110 if (max_value == null or max_value.? < value) max_value = value;
41034111 }
4104 return @Type(.{ .Enum = .{
4112 return @Type(.{ .@"enum" = .{
41054113 .tag_type = std.math.IntFittingRange(min_value orelse 0, max_value orelse 0),
41064114 .fields = fields[0..fields_len],
41074115 .decls = &.{},
......@@ -4665,7 +4673,7 @@ fn addCommonEntry(dwarf: *Dwarf, unit: Unit.Index) UpdateError!Entry.Index {
46654673
46664674fn writeInt(dwarf: *Dwarf, buf: []u8, int: u64) void {
46674675 switch (buf.len) {
4668 inline 0...8 => |len| std.mem.writeInt(@Type(.{ .Int = .{
4676 inline 0...8 => |len| std.mem.writeInt(@Type(.{ .int = .{
46694677 .signedness = .unsigned,
46704678 .bits = len * 8,
46714679 } }), buf[0..len], @intCast(int), dwarf.endian),
src/link/Elf/Atom.zig+1-1
......@@ -1008,7 +1008,7 @@ const AddExtraOpts = struct {
10081008pub fn addExtra(atom: *Atom, opts: AddExtraOpts, elf_file: *Elf) void {
10091009 const file_ptr = atom.file(elf_file).?;
10101010 var extras = file_ptr.atomExtra(atom.extra_index);
1011 inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| {
1011 inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| {
10121012 if (@field(opts, field.name)) |x| {
10131013 @field(extras, field.name) = x;
10141014 }
src/link/Elf/LdScript.zig+1-1
......@@ -108,7 +108,7 @@ const Command = enum {
108108 as_needed,
109109
110110 fn fromString(s: []const u8) ?Command {
111 inline for (@typeInfo(Command).Enum.fields) |field| {
111 inline for (@typeInfo(Command).@"enum".fields) |field| {
112112 const upper_name = n: {
113113 comptime var buf: [field.name.len]u8 = undefined;
114114 inline for (field.name, 0..) |c, i| {
src/link/Elf/LinkerDefined.zig+4-4
......@@ -394,14 +394,14 @@ fn addSymbolAssumeCapacity(self: *LinkerDefined) Symbol.Index {
394394}
395395
396396pub fn addSymbolExtra(self: *LinkerDefined, allocator: Allocator, extra: Symbol.Extra) !u32 {
397 const fields = @typeInfo(Symbol.Extra).Struct.fields;
397 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
398398 try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
399399 return self.addSymbolExtraAssumeCapacity(extra);
400400}
401401
402402pub fn addSymbolExtraAssumeCapacity(self: *LinkerDefined, extra: Symbol.Extra) u32 {
403403 const index = @as(u32, @intCast(self.symbols_extra.items.len));
404 const fields = @typeInfo(Symbol.Extra).Struct.fields;
404 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
405405 inline for (fields) |field| {
406406 self.symbols_extra.appendAssumeCapacity(switch (field.type) {
407407 u32 => @field(extra, field.name),
......@@ -412,7 +412,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *LinkerDefined, extra: Symbol.Extra) u
412412}
413413
414414pub fn symbolExtra(self: *LinkerDefined, index: u32) Symbol.Extra {
415 const fields = @typeInfo(Symbol.Extra).Struct.fields;
415 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
416416 var i: usize = index;
417417 var result: Symbol.Extra = undefined;
418418 inline for (fields) |field| {
......@@ -426,7 +426,7 @@ pub fn symbolExtra(self: *LinkerDefined, index: u32) Symbol.Extra {
426426}
427427
428428pub fn setSymbolExtra(self: *LinkerDefined, index: u32, extra: Symbol.Extra) void {
429 const fields = @typeInfo(Symbol.Extra).Struct.fields;
429 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
430430 inline for (fields, 0..) |field, i| {
431431 self.symbols_extra.items[index + i] = switch (field.type) {
432432 u32 => @field(extra, field.name),
src/link/Elf/Object.zig+8-8
......@@ -1215,14 +1215,14 @@ fn addSymbolAssumeCapacity(self: *Object) Symbol.Index {
12151215}
12161216
12171217pub fn addSymbolExtra(self: *Object, allocator: Allocator, extra: Symbol.Extra) !u32 {
1218 const fields = @typeInfo(Symbol.Extra).Struct.fields;
1218 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
12191219 try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
12201220 return self.addSymbolExtraAssumeCapacity(extra);
12211221}
12221222
12231223pub fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 {
12241224 const index = @as(u32, @intCast(self.symbols_extra.items.len));
1225 const fields = @typeInfo(Symbol.Extra).Struct.fields;
1225 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
12261226 inline for (fields) |field| {
12271227 self.symbols_extra.appendAssumeCapacity(switch (field.type) {
12281228 u32 => @field(extra, field.name),
......@@ -1233,7 +1233,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 {
12331233}
12341234
12351235pub fn symbolExtra(self: *Object, index: u32) Symbol.Extra {
1236 const fields = @typeInfo(Symbol.Extra).Struct.fields;
1236 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
12371237 var i: usize = index;
12381238 var result: Symbol.Extra = undefined;
12391239 inline for (fields) |field| {
......@@ -1247,7 +1247,7 @@ pub fn symbolExtra(self: *Object, index: u32) Symbol.Extra {
12471247}
12481248
12491249pub fn setSymbolExtra(self: *Object, index: u32, extra: Symbol.Extra) void {
1250 const fields = @typeInfo(Symbol.Extra).Struct.fields;
1250 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
12511251 inline for (fields, 0..) |field, i| {
12521252 self.symbols_extra.items[index + i] = switch (field.type) {
12531253 u32 => @field(extra, field.name),
......@@ -1325,14 +1325,14 @@ pub fn atom(self: *Object, atom_index: Atom.Index) ?*Atom {
13251325}
13261326
13271327pub fn addAtomExtra(self: *Object, allocator: Allocator, extra: Atom.Extra) !u32 {
1328 const fields = @typeInfo(Atom.Extra).Struct.fields;
1328 const fields = @typeInfo(Atom.Extra).@"struct".fields;
13291329 try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len);
13301330 return self.addAtomExtraAssumeCapacity(extra);
13311331}
13321332
13331333pub fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 {
13341334 const index = @as(u32, @intCast(self.atoms_extra.items.len));
1335 const fields = @typeInfo(Atom.Extra).Struct.fields;
1335 const fields = @typeInfo(Atom.Extra).@"struct".fields;
13361336 inline for (fields) |field| {
13371337 self.atoms_extra.appendAssumeCapacity(switch (field.type) {
13381338 u32 => @field(extra, field.name),
......@@ -1343,7 +1343,7 @@ pub fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 {
13431343}
13441344
13451345pub fn atomExtra(self: *Object, index: u32) Atom.Extra {
1346 const fields = @typeInfo(Atom.Extra).Struct.fields;
1346 const fields = @typeInfo(Atom.Extra).@"struct".fields;
13471347 var i: usize = index;
13481348 var result: Atom.Extra = undefined;
13491349 inline for (fields) |field| {
......@@ -1357,7 +1357,7 @@ pub fn atomExtra(self: *Object, index: u32) Atom.Extra {
13571357}
13581358
13591359pub fn setAtomExtra(self: *Object, index: u32, extra: Atom.Extra) void {
1360 const fields = @typeInfo(Atom.Extra).Struct.fields;
1360 const fields = @typeInfo(Atom.Extra).@"struct".fields;
13611361 inline for (fields, 0..) |field, i| {
13621362 self.atoms_extra.items[index + i] = switch (field.type) {
13631363 u32 => @field(extra, field.name),
src/link/Elf/SharedObject.zig+4-4
......@@ -423,14 +423,14 @@ fn addSymbolAssumeCapacity(self: *SharedObject) Symbol.Index {
423423}
424424
425425pub fn addSymbolExtra(self: *SharedObject, allocator: Allocator, extra: Symbol.Extra) !u32 {
426 const fields = @typeInfo(Symbol.Extra).Struct.fields;
426 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
427427 try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
428428 return self.addSymbolExtraAssumeCapacity(extra);
429429}
430430
431431pub fn addSymbolExtraAssumeCapacity(self: *SharedObject, extra: Symbol.Extra) u32 {
432432 const index = @as(u32, @intCast(self.symbols_extra.items.len));
433 const fields = @typeInfo(Symbol.Extra).Struct.fields;
433 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
434434 inline for (fields) |field| {
435435 self.symbols_extra.appendAssumeCapacity(switch (field.type) {
436436 u32 => @field(extra, field.name),
......@@ -441,7 +441,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *SharedObject, extra: Symbol.Extra) u3
441441}
442442
443443pub fn symbolExtra(self: *SharedObject, index: u32) Symbol.Extra {
444 const fields = @typeInfo(Symbol.Extra).Struct.fields;
444 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
445445 var i: usize = index;
446446 var result: Symbol.Extra = undefined;
447447 inline for (fields) |field| {
......@@ -455,7 +455,7 @@ pub fn symbolExtra(self: *SharedObject, index: u32) Symbol.Extra {
455455}
456456
457457pub fn setSymbolExtra(self: *SharedObject, index: u32, extra: Symbol.Extra) void {
458 const fields = @typeInfo(Symbol.Extra).Struct.fields;
458 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
459459 inline for (fields, 0..) |field, i| {
460460 self.symbols_extra.items[index + i] = switch (field.type) {
461461 u32 => @field(extra, field.name),
src/link/Elf/Symbol.zig+1-1
......@@ -255,7 +255,7 @@ const AddExtraOpts = struct {
255255
256256pub fn addExtra(symbol: *Symbol, opts: AddExtraOpts, elf_file: *Elf) void {
257257 var extras = symbol.extra(elf_file);
258 inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| {
258 inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| {
259259 if (@field(opts, field.name)) |x| {
260260 @field(extras, field.name) = x;
261261 }
src/link/Elf/ZigObject.zig+8-8
......@@ -2034,14 +2034,14 @@ pub fn atom(self: *ZigObject, atom_index: Atom.Index) ?*Atom {
20342034}
20352035
20362036fn addAtomExtra(self: *ZigObject, allocator: Allocator, extra: Atom.Extra) !u32 {
2037 const fields = @typeInfo(Atom.Extra).Struct.fields;
2037 const fields = @typeInfo(Atom.Extra).@"struct".fields;
20382038 try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len);
20392039 return self.addAtomExtraAssumeCapacity(extra);
20402040}
20412041
20422042fn addAtomExtraAssumeCapacity(self: *ZigObject, extra: Atom.Extra) u32 {
20432043 const index = @as(u32, @intCast(self.atoms_extra.items.len));
2044 const fields = @typeInfo(Atom.Extra).Struct.fields;
2044 const fields = @typeInfo(Atom.Extra).@"struct".fields;
20452045 inline for (fields) |field| {
20462046 self.atoms_extra.appendAssumeCapacity(switch (field.type) {
20472047 u32 => @field(extra, field.name),
......@@ -2052,7 +2052,7 @@ fn addAtomExtraAssumeCapacity(self: *ZigObject, extra: Atom.Extra) u32 {
20522052}
20532053
20542054pub fn atomExtra(self: ZigObject, index: u32) Atom.Extra {
2055 const fields = @typeInfo(Atom.Extra).Struct.fields;
2055 const fields = @typeInfo(Atom.Extra).@"struct".fields;
20562056 var i: usize = index;
20572057 var result: Atom.Extra = undefined;
20582058 inline for (fields) |field| {
......@@ -2067,7 +2067,7 @@ pub fn atomExtra(self: ZigObject, index: u32) Atom.Extra {
20672067
20682068pub fn setAtomExtra(self: *ZigObject, index: u32, extra: Atom.Extra) void {
20692069 assert(index > 0);
2070 const fields = @typeInfo(Atom.Extra).Struct.fields;
2070 const fields = @typeInfo(Atom.Extra).@"struct".fields;
20712071 inline for (fields, 0..) |field, i| {
20722072 self.atoms_extra.items[index + i] = switch (field.type) {
20732073 u32 => @field(extra, field.name),
......@@ -2106,14 +2106,14 @@ fn addSymbolAssumeCapacity(self: *ZigObject) Symbol.Index {
21062106}
21072107
21082108pub fn addSymbolExtra(self: *ZigObject, allocator: Allocator, extra: Symbol.Extra) !u32 {
2109 const fields = @typeInfo(Symbol.Extra).Struct.fields;
2109 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
21102110 try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
21112111 return self.addSymbolExtraAssumeCapacity(extra);
21122112}
21132113
21142114pub fn addSymbolExtraAssumeCapacity(self: *ZigObject, extra: Symbol.Extra) u32 {
21152115 const index = @as(u32, @intCast(self.symbols_extra.items.len));
2116 const fields = @typeInfo(Symbol.Extra).Struct.fields;
2116 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
21172117 inline for (fields) |field| {
21182118 self.symbols_extra.appendAssumeCapacity(switch (field.type) {
21192119 u32 => @field(extra, field.name),
......@@ -2124,7 +2124,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *ZigObject, extra: Symbol.Extra) u32 {
21242124}
21252125
21262126pub fn symbolExtra(self: *ZigObject, index: u32) Symbol.Extra {
2127 const fields = @typeInfo(Symbol.Extra).Struct.fields;
2127 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
21282128 var i: usize = index;
21292129 var result: Symbol.Extra = undefined;
21302130 inline for (fields) |field| {
......@@ -2138,7 +2138,7 @@ pub fn symbolExtra(self: *ZigObject, index: u32) Symbol.Extra {
21382138}
21392139
21402140pub fn setSymbolExtra(self: *ZigObject, index: u32, extra: Symbol.Extra) void {
2141 const fields = @typeInfo(Symbol.Extra).Struct.fields;
2141 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
21422142 inline for (fields, 0..) |field, i| {
21432143 self.symbols_extra.items[index + i] = switch (field.type) {
21442144 u32 => @field(extra, field.name),
src/link/MachO/Archive.zig+1-1
......@@ -90,7 +90,7 @@ pub fn writeHeader(
9090 .ar_fmag = undefined,
9191 };
9292 @memset(mem.asBytes(&hdr), 0x20);
93 inline for (@typeInfo(ar_hdr).Struct.fields) |field| {
93 inline for (@typeInfo(ar_hdr).@"struct".fields) |field| {
9494 var stream = std.io.fixedBufferStream(&@field(hdr, field.name));
9595 stream.writer().print("0", .{}) catch unreachable;
9696 }
src/link/MachO/Atom.zig+1-1
......@@ -129,7 +129,7 @@ const AddExtraOpts = struct {
129129pub fn addExtra(atom: *Atom, opts: AddExtraOpts, macho_file: *MachO) void {
130130 const file = atom.getFile(macho_file);
131131 var extra = file.getAtomExtra(atom.extra);
132 inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| {
132 inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| {
133133 if (@field(opts, field.name)) |x| {
134134 @field(extra, field.name) = x;
135135 }
src/link/MachO/Dylib.zig+4-4
......@@ -650,14 +650,14 @@ pub fn getSymbolRef(self: Dylib, index: Symbol.Index, macho_file: *MachO) MachO.
650650}
651651
652652pub fn addSymbolExtra(self: *Dylib, allocator: Allocator, extra: Symbol.Extra) !u32 {
653 const fields = @typeInfo(Symbol.Extra).Struct.fields;
653 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
654654 try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
655655 return self.addSymbolExtraAssumeCapacity(extra);
656656}
657657
658658fn addSymbolExtraAssumeCapacity(self: *Dylib, extra: Symbol.Extra) u32 {
659659 const index = @as(u32, @intCast(self.symbols_extra.items.len));
660 const fields = @typeInfo(Symbol.Extra).Struct.fields;
660 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
661661 inline for (fields) |field| {
662662 self.symbols_extra.appendAssumeCapacity(switch (field.type) {
663663 u32 => @field(extra, field.name),
......@@ -668,7 +668,7 @@ fn addSymbolExtraAssumeCapacity(self: *Dylib, extra: Symbol.Extra) u32 {
668668}
669669
670670pub fn getSymbolExtra(self: Dylib, index: u32) Symbol.Extra {
671 const fields = @typeInfo(Symbol.Extra).Struct.fields;
671 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
672672 var i: usize = index;
673673 var result: Symbol.Extra = undefined;
674674 inline for (fields) |field| {
......@@ -682,7 +682,7 @@ pub fn getSymbolExtra(self: Dylib, index: u32) Symbol.Extra {
682682}
683683
684684pub fn setSymbolExtra(self: *Dylib, index: u32, extra: Symbol.Extra) void {
685 const fields = @typeInfo(Symbol.Extra).Struct.fields;
685 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
686686 inline for (fields, 0..) |field, i| {
687687 self.symbols_extra.items[index + i] = switch (field.type) {
688688 u32 => @field(extra, field.name),
src/link/MachO/InternalObject.zig+8-8
......@@ -669,14 +669,14 @@ pub fn getAtoms(self: InternalObject) []const Atom.Index {
669669}
670670
671671fn addAtomExtra(self: *InternalObject, allocator: Allocator, extra: Atom.Extra) !u32 {
672 const fields = @typeInfo(Atom.Extra).Struct.fields;
672 const fields = @typeInfo(Atom.Extra).@"struct".fields;
673673 try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len);
674674 return self.addAtomExtraAssumeCapacity(extra);
675675}
676676
677677fn addAtomExtraAssumeCapacity(self: *InternalObject, extra: Atom.Extra) u32 {
678678 const index = @as(u32, @intCast(self.atoms_extra.items.len));
679 const fields = @typeInfo(Atom.Extra).Struct.fields;
679 const fields = @typeInfo(Atom.Extra).@"struct".fields;
680680 inline for (fields) |field| {
681681 self.atoms_extra.appendAssumeCapacity(switch (field.type) {
682682 u32 => @field(extra, field.name),
......@@ -687,7 +687,7 @@ fn addAtomExtraAssumeCapacity(self: *InternalObject, extra: Atom.Extra) u32 {
687687}
688688
689689pub fn getAtomExtra(self: InternalObject, index: u32) Atom.Extra {
690 const fields = @typeInfo(Atom.Extra).Struct.fields;
690 const fields = @typeInfo(Atom.Extra).@"struct".fields;
691691 var i: usize = index;
692692 var result: Atom.Extra = undefined;
693693 inline for (fields) |field| {
......@@ -702,7 +702,7 @@ pub fn getAtomExtra(self: InternalObject, index: u32) Atom.Extra {
702702
703703pub fn setAtomExtra(self: *InternalObject, index: u32, extra: Atom.Extra) void {
704704 assert(index > 0);
705 const fields = @typeInfo(Atom.Extra).Struct.fields;
705 const fields = @typeInfo(Atom.Extra).@"struct".fields;
706706 inline for (fields, 0..) |field, i| {
707707 self.atoms_extra.items[index + i] = switch (field.type) {
708708 u32 => @field(extra, field.name),
......@@ -750,14 +750,14 @@ pub fn getSymbolRef(self: InternalObject, index: Symbol.Index, macho_file: *Mach
750750}
751751
752752pub fn addSymbolExtra(self: *InternalObject, allocator: Allocator, extra: Symbol.Extra) !u32 {
753 const fields = @typeInfo(Symbol.Extra).Struct.fields;
753 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
754754 try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
755755 return self.addSymbolExtraAssumeCapacity(extra);
756756}
757757
758758fn addSymbolExtraAssumeCapacity(self: *InternalObject, extra: Symbol.Extra) u32 {
759759 const index = @as(u32, @intCast(self.symbols_extra.items.len));
760 const fields = @typeInfo(Symbol.Extra).Struct.fields;
760 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
761761 inline for (fields) |field| {
762762 self.symbols_extra.appendAssumeCapacity(switch (field.type) {
763763 u32 => @field(extra, field.name),
......@@ -768,7 +768,7 @@ fn addSymbolExtraAssumeCapacity(self: *InternalObject, extra: Symbol.Extra) u32
768768}
769769
770770pub fn getSymbolExtra(self: InternalObject, index: u32) Symbol.Extra {
771 const fields = @typeInfo(Symbol.Extra).Struct.fields;
771 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
772772 var i: usize = index;
773773 var result: Symbol.Extra = undefined;
774774 inline for (fields) |field| {
......@@ -782,7 +782,7 @@ pub fn getSymbolExtra(self: InternalObject, index: u32) Symbol.Extra {
782782}
783783
784784pub fn setSymbolExtra(self: *InternalObject, index: u32, extra: Symbol.Extra) void {
785 const fields = @typeInfo(Symbol.Extra).Struct.fields;
785 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
786786 inline for (fields, 0..) |field, i| {
787787 self.symbols_extra.items[index + i] = switch (field.type) {
788788 u32 => @field(extra, field.name),
src/link/MachO/Object.zig+8-8
......@@ -2386,14 +2386,14 @@ pub fn getAtoms(self: *Object) []const Atom.Index {
23862386}
23872387
23882388fn addAtomExtra(self: *Object, allocator: Allocator, extra: Atom.Extra) !u32 {
2389 const fields = @typeInfo(Atom.Extra).Struct.fields;
2389 const fields = @typeInfo(Atom.Extra).@"struct".fields;
23902390 try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len);
23912391 return self.addAtomExtraAssumeCapacity(extra);
23922392}
23932393
23942394fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 {
23952395 const index = @as(u32, @intCast(self.atoms_extra.items.len));
2396 const fields = @typeInfo(Atom.Extra).Struct.fields;
2396 const fields = @typeInfo(Atom.Extra).@"struct".fields;
23972397 inline for (fields) |field| {
23982398 self.atoms_extra.appendAssumeCapacity(switch (field.type) {
23992399 u32 => @field(extra, field.name),
......@@ -2404,7 +2404,7 @@ fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 {
24042404}
24052405
24062406pub fn getAtomExtra(self: Object, index: u32) Atom.Extra {
2407 const fields = @typeInfo(Atom.Extra).Struct.fields;
2407 const fields = @typeInfo(Atom.Extra).@"struct".fields;
24082408 var i: usize = index;
24092409 var result: Atom.Extra = undefined;
24102410 inline for (fields) |field| {
......@@ -2419,7 +2419,7 @@ pub fn getAtomExtra(self: Object, index: u32) Atom.Extra {
24192419
24202420pub fn setAtomExtra(self: *Object, index: u32, extra: Atom.Extra) void {
24212421 assert(index > 0);
2422 const fields = @typeInfo(Atom.Extra).Struct.fields;
2422 const fields = @typeInfo(Atom.Extra).@"struct".fields;
24232423 inline for (fields, 0..) |field, i| {
24242424 self.atoms_extra.items[index + i] = switch (field.type) {
24252425 u32 => @field(extra, field.name),
......@@ -2447,14 +2447,14 @@ pub fn getSymbolRef(self: Object, index: Symbol.Index, macho_file: *MachO) MachO
24472447}
24482448
24492449pub fn addSymbolExtra(self: *Object, allocator: Allocator, extra: Symbol.Extra) !u32 {
2450 const fields = @typeInfo(Symbol.Extra).Struct.fields;
2450 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
24512451 try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
24522452 return self.addSymbolExtraAssumeCapacity(extra);
24532453}
24542454
24552455fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 {
24562456 const index = @as(u32, @intCast(self.symbols_extra.items.len));
2457 const fields = @typeInfo(Symbol.Extra).Struct.fields;
2457 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
24582458 inline for (fields) |field| {
24592459 self.symbols_extra.appendAssumeCapacity(switch (field.type) {
24602460 u32 => @field(extra, field.name),
......@@ -2465,7 +2465,7 @@ fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 {
24652465}
24662466
24672467pub fn getSymbolExtra(self: Object, index: u32) Symbol.Extra {
2468 const fields = @typeInfo(Symbol.Extra).Struct.fields;
2468 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
24692469 var i: usize = index;
24702470 var result: Symbol.Extra = undefined;
24712471 inline for (fields) |field| {
......@@ -2479,7 +2479,7 @@ pub fn getSymbolExtra(self: Object, index: u32) Symbol.Extra {
24792479}
24802480
24812481pub fn setSymbolExtra(self: *Object, index: u32, extra: Symbol.Extra) void {
2482 const fields = @typeInfo(Symbol.Extra).Struct.fields;
2482 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
24832483 inline for (fields, 0..) |field, i| {
24842484 self.symbols_extra.items[index + i] = switch (field.type) {
24852485 u32 => @field(extra, field.name),
src/link/MachO/Symbol.zig+1-1
......@@ -211,7 +211,7 @@ const AddExtraOpts = struct {
211211
212212pub fn addExtra(symbol: *Symbol, opts: AddExtraOpts, macho_file: *MachO) void {
213213 var extra = symbol.getExtra(macho_file);
214 inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| {
214 inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| {
215215 if (@field(opts, field.name)) |x| {
216216 @field(extra, field.name) = x;
217217 }
src/link/MachO/ZigObject.zig+8-8
......@@ -1581,14 +1581,14 @@ pub fn getAtoms(self: *ZigObject) []const Atom.Index {
15811581}
15821582
15831583fn addAtomExtra(self: *ZigObject, allocator: Allocator, extra: Atom.Extra) !u32 {
1584 const fields = @typeInfo(Atom.Extra).Struct.fields;
1584 const fields = @typeInfo(Atom.Extra).@"struct".fields;
15851585 try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len);
15861586 return self.addAtomExtraAssumeCapacity(extra);
15871587}
15881588
15891589fn addAtomExtraAssumeCapacity(self: *ZigObject, extra: Atom.Extra) u32 {
15901590 const index = @as(u32, @intCast(self.atoms_extra.items.len));
1591 const fields = @typeInfo(Atom.Extra).Struct.fields;
1591 const fields = @typeInfo(Atom.Extra).@"struct".fields;
15921592 inline for (fields) |field| {
15931593 self.atoms_extra.appendAssumeCapacity(switch (field.type) {
15941594 u32 => @field(extra, field.name),
......@@ -1599,7 +1599,7 @@ fn addAtomExtraAssumeCapacity(self: *ZigObject, extra: Atom.Extra) u32 {
15991599}
16001600
16011601pub fn getAtomExtra(self: ZigObject, index: u32) Atom.Extra {
1602 const fields = @typeInfo(Atom.Extra).Struct.fields;
1602 const fields = @typeInfo(Atom.Extra).@"struct".fields;
16031603 var i: usize = index;
16041604 var result: Atom.Extra = undefined;
16051605 inline for (fields) |field| {
......@@ -1614,7 +1614,7 @@ pub fn getAtomExtra(self: ZigObject, index: u32) Atom.Extra {
16141614
16151615pub fn setAtomExtra(self: *ZigObject, index: u32, extra: Atom.Extra) void {
16161616 assert(index > 0);
1617 const fields = @typeInfo(Atom.Extra).Struct.fields;
1617 const fields = @typeInfo(Atom.Extra).@"struct".fields;
16181618 inline for (fields, 0..) |field, i| {
16191619 self.atoms_extra.items[index + i] = switch (field.type) {
16201620 u32 => @field(extra, field.name),
......@@ -1642,14 +1642,14 @@ pub fn getSymbolRef(self: ZigObject, index: Symbol.Index, macho_file: *MachO) Ma
16421642}
16431643
16441644pub fn addSymbolExtra(self: *ZigObject, allocator: Allocator, extra: Symbol.Extra) !u32 {
1645 const fields = @typeInfo(Symbol.Extra).Struct.fields;
1645 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
16461646 try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
16471647 return self.addSymbolExtraAssumeCapacity(extra);
16481648}
16491649
16501650fn addSymbolExtraAssumeCapacity(self: *ZigObject, extra: Symbol.Extra) u32 {
16511651 const index = @as(u32, @intCast(self.symbols_extra.items.len));
1652 const fields = @typeInfo(Symbol.Extra).Struct.fields;
1652 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
16531653 inline for (fields) |field| {
16541654 self.symbols_extra.appendAssumeCapacity(switch (field.type) {
16551655 u32 => @field(extra, field.name),
......@@ -1660,7 +1660,7 @@ fn addSymbolExtraAssumeCapacity(self: *ZigObject, extra: Symbol.Extra) u32 {
16601660}
16611661
16621662pub fn getSymbolExtra(self: ZigObject, index: u32) Symbol.Extra {
1663 const fields = @typeInfo(Symbol.Extra).Struct.fields;
1663 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
16641664 var i: usize = index;
16651665 var result: Symbol.Extra = undefined;
16661666 inline for (fields) |field| {
......@@ -1674,7 +1674,7 @@ pub fn getSymbolExtra(self: ZigObject, index: u32) Symbol.Extra {
16741674}
16751675
16761676pub fn setSymbolExtra(self: *ZigObject, index: u32, extra: Symbol.Extra) void {
1677 const fields = @typeInfo(Symbol.Extra).Struct.fields;
1677 const fields = @typeInfo(Symbol.Extra).@"struct".fields;
16781678 inline for (fields, 0..) |field, i| {
16791679 self.symbols_extra.items[index + i] = switch (field.type) {
16801680 u32 => @field(extra, field.name),
src/link/Wasm.zig+6-6
......@@ -1169,7 +1169,7 @@ fn setupTLSRelocationsFunction(wasm: *Wasm) !void {
11691169
11701170fn validateFeatures(
11711171 wasm: *const Wasm,
1172 to_emit: *[@typeInfo(types.Feature.Tag).Enum.fields.len]bool,
1172 to_emit: *[@typeInfo(types.Feature.Tag).@"enum".fields.len]bool,
11731173 emit_features_count: *u32,
11741174) !void {
11751175 const comp = wasm.base.comp;
......@@ -1177,7 +1177,7 @@ fn validateFeatures(
11771177 const shared_memory = comp.config.shared_memory;
11781178 const cpu_features = target.cpu.features;
11791179 const infer = cpu_features.isEmpty(); // when the user did not define any features, we infer them from linked objects.
1180 const known_features_count = @typeInfo(types.Feature.Tag).Enum.fields.len;
1180 const known_features_count = @typeInfo(types.Feature.Tag).@"enum".fields.len;
11811181
11821182 var allowed = [_]bool{false} ** known_features_count;
11831183 var used = [_]u17{0} ** known_features_count;
......@@ -1192,7 +1192,7 @@ fn validateFeatures(
11921192 // When the user has given an explicit list of features to enable,
11931193 // we extract them and insert each into the 'allowed' list.
11941194 if (!infer) {
1195 inline for (@typeInfo(std.Target.wasm.Feature).Enum.fields) |feature_field| {
1195 inline for (@typeInfo(std.Target.wasm.Feature).@"enum".fields) |feature_field| {
11961196 if (cpu_features.isEnabled(feature_field.value)) {
11971197 allowed[feature_field.value] = true;
11981198 emit_features_count.* += 1;
......@@ -2576,7 +2576,7 @@ pub fn flushModule(wasm: *Wasm, arena: Allocator, tid: Zcu.PerThread.Id, prog_no
25762576 if (wasm.base.hasErrors()) return error.FlushFailure;
25772577
25782578 var emit_features_count: u32 = 0;
2579 var enabled_features: [@typeInfo(types.Feature.Tag).Enum.fields.len]bool = undefined;
2579 var enabled_features: [@typeInfo(types.Feature.Tag).@"enum".fields.len]bool = undefined;
25802580 try wasm.validateFeatures(&enabled_features, &emit_features_count);
25812581 try wasm.resolveSymbolsInArchives();
25822582 if (wasm.base.hasErrors()) return error.FlushFailure;
......@@ -2610,7 +2610,7 @@ pub fn flushModule(wasm: *Wasm, arena: Allocator, tid: Zcu.PerThread.Id, prog_no
26102610/// Writes the WebAssembly in-memory module to the file
26112611fn writeToFile(
26122612 wasm: *Wasm,
2613 enabled_features: [@typeInfo(types.Feature.Tag).Enum.fields.len]bool,
2613 enabled_features: [@typeInfo(types.Feature.Tag).@"enum".fields.len]bool,
26142614 feature_count: u32,
26152615 arena: Allocator,
26162616) !void {
......@@ -3867,7 +3867,7 @@ fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.ArrayList(u8)) !void {
38673867
38683868pub fn getUleb128Size(uint_value: anytype) u32 {
38693869 const T = @TypeOf(uint_value);
3870 const U = if (@typeInfo(T).Int.bits < 8) u8 else T;
3870 const U = if (@typeInfo(T).int.bits < 8) u8 else T;
38713871 var value = @as(U, @intCast(uint_value));
38723872
38733873 var size: u32 = 0;
src/link/Wasm/Object.zig+2-2
......@@ -871,7 +871,7 @@ fn ElementType(comptime ptr: type) type {
871871/// signedness of the given type `T`.
872872/// Asserts `T` is an integer.
873873fn readLeb(comptime T: type, reader: anytype) !T {
874 return switch (@typeInfo(T).Int.signedness) {
874 return switch (@typeInfo(T).int.signedness) {
875875 .signed => try leb.readIleb128(T, reader),
876876 .unsigned => try leb.readUleb128(T, reader),
877877 };
......@@ -881,7 +881,7 @@ fn readLeb(comptime T: type, reader: anytype) !T {
881881/// Asserts `T` is an enum
882882fn readEnum(comptime T: type, reader: anytype) !T {
883883 switch (@typeInfo(T)) {
884 .Enum => |enum_type| return @as(T, @enumFromInt(try readLeb(enum_type.tag_type, reader))),
884 .@"enum" => |enum_type| return @as(T, @enumFromInt(try readLeb(enum_type.tag_type, reader))),
885885 else => @compileError("T must be an enum. Instead was given type " ++ @typeName(T)),
886886 }
887887}
src/link/Wasm/ZigObject.zig+1-1
......@@ -805,7 +805,7 @@ pub fn getUavVAddr(
805805 const is_wasm32 = target.cpu.arch == .wasm32;
806806 const zcu = wasm_file.base.comp.zcu.?;
807807 const ty = Type.fromInterned(zcu.intern_pool.typeOf(uav));
808 if (ty.zigTypeTag(zcu) == .Fn) {
808 if (ty.zigTypeTag(zcu) == .@"fn") {
809809 std.debug.assert(reloc_info.addend == 0); // addend not allowed for function relocations
810810 try parent_atom.relocs.append(gpa, .{
811811 .index = target_symbol_index,
src/link/riscv.zig+1-1
......@@ -12,7 +12,7 @@ pub fn writeSetSub6(comptime op: enum { set, sub }, code: *[1]u8, addend: anytyp
1212pub fn writeAddend(
1313 comptime Int: type,
1414 comptime op: enum { add, sub },
15 code: *[@typeInfo(Int).Int.bits / 8]u8,
15 code: *[@typeInfo(Int).int.bits / 8]u8,
1616 value: anytype,
1717) void {
1818 var V: Int = mem.readInt(Int, code, .little);
src/link/tapi/yaml.zig+28-28
......@@ -204,13 +204,13 @@ pub const Value = union(enum) {
204204
205205 fn encode(arena: Allocator, input: anytype) YamlError!?Value {
206206 switch (@typeInfo(@TypeOf(input))) {
207 .ComptimeInt,
208 .Int,
207 .comptime_int,
208 .int,
209209 => return Value{ .int = math.cast(i64, input) orelse return error.Overflow },
210210
211 .Float => return Value{ .float = math.lossyCast(f64, input) },
211 .float => return Value{ .float = math.lossyCast(f64, input) },
212212
213 .Struct => |info| if (info.is_tuple) {
213 .@"struct" => |info| if (info.is_tuple) {
214214 var list = std.ArrayList(Value).init(arena);
215215 errdefer list.deinit();
216216 try list.ensureTotalCapacityPrecise(info.fields.len);
......@@ -237,7 +237,7 @@ pub const Value = union(enum) {
237237 return Value{ .map = map };
238238 },
239239
240 .Union => |info| if (info.tag_type) |tag_type| {
240 .@"union" => |info| if (info.tag_type) |tag_type| {
241241 inline for (info.fields) |field| {
242242 if (@field(tag_type, field.name) == input) {
243243 return try encode(arena, @field(input, field.name));
......@@ -245,11 +245,11 @@ pub const Value = union(enum) {
245245 } else unreachable;
246246 } else return error.UntaggedUnion,
247247
248 .Array => return encode(arena, &input),
248 .array => return encode(arena, &input),
249249
250 .Pointer => |info| switch (info.size) {
250 .pointer => |info| switch (info.size) {
251251 .One => switch (@typeInfo(info.child)) {
252 .Array => |child_info| {
252 .array => |child_info| {
253253 const Slice = []const child_info.child;
254254 return encode(arena, @as(Slice, input));
255255 },
......@@ -284,9 +284,9 @@ pub const Value = union(enum) {
284284
285285 // TODO we should probably have an option to encode `null` and also
286286 // allow for some default value too.
287 .Optional => return if (input) |val| encode(arena, val) else null,
287 .optional => return if (input) |val| encode(arena, val) else null,
288288
289 .Null => return null,
289 .null => return null,
290290
291291 else => {
292292 @compileError("Unhandled type: {s}" ++ @typeName(@TypeOf(input)));
......@@ -339,7 +339,7 @@ pub const Yaml = struct {
339339
340340 pub fn parse(self: *Yaml, comptime T: type) Error!T {
341341 if (self.docs.items.len == 0) {
342 if (@typeInfo(T) == .Void) return {};
342 if (@typeInfo(T) == .void) return {};
343343 return error.TypeMismatch;
344344 }
345345
......@@ -348,14 +348,14 @@ pub const Yaml = struct {
348348 }
349349
350350 switch (@typeInfo(T)) {
351 .Array => |info| {
351 .array => |info| {
352352 var parsed: T = undefined;
353353 for (self.docs.items, 0..) |doc, i| {
354354 parsed[i] = try self.parseValue(info.child, doc);
355355 }
356356 return parsed;
357357 },
358 .Pointer => |info| {
358 .pointer => |info| {
359359 switch (info.size) {
360360 .Slice => {
361361 var parsed = try self.arena.allocator().alloc(info.child, self.docs.items.len);
......@@ -367,35 +367,35 @@ pub const Yaml = struct {
367367 else => return error.TypeMismatch,
368368 }
369369 },
370 .Union => return error.Unimplemented,
370 .@"union" => return error.Unimplemented,
371371 else => return error.TypeMismatch,
372372 }
373373 }
374374
375375 fn parseValue(self: *Yaml, comptime T: type, value: Value) Error!T {
376376 return switch (@typeInfo(T)) {
377 .Int => math.cast(T, try value.asInt()) orelse return error.Overflow,
378 .Float => if (value.asFloat()) |float| {
377 .int => math.cast(T, try value.asInt()) orelse return error.Overflow,
378 .float => if (value.asFloat()) |float| {
379379 return math.lossyCast(T, float);
380380 } else |_| {
381381 return math.lossyCast(T, try value.asInt());
382382 },
383 .Struct => self.parseStruct(T, try value.asMap()),
384 .Union => self.parseUnion(T, value),
385 .Array => self.parseArray(T, try value.asList()),
386 .Pointer => if (value.asList()) |list| {
383 .@"struct" => self.parseStruct(T, try value.asMap()),
384 .@"union" => self.parseUnion(T, value),
385 .array => self.parseArray(T, try value.asList()),
386 .pointer => if (value.asList()) |list| {
387387 return self.parsePointer(T, .{ .list = list });
388388 } else |_| {
389389 return self.parsePointer(T, .{ .string = try value.asString() });
390390 },
391 .Void => error.TypeMismatch,
392 .Optional => unreachable,
391 .void => error.TypeMismatch,
392 .optional => unreachable,
393393 else => error.Unimplemented,
394394 };
395395 }
396396
397397 fn parseUnion(self: *Yaml, comptime T: type, value: Value) Error!T {
398 const union_info = @typeInfo(T).Union;
398 const union_info = @typeInfo(T).@"union";
399399
400400 if (union_info.tag_type) |_| {
401401 inline for (union_info.fields) |field| {
......@@ -412,12 +412,12 @@ pub const Yaml = struct {
412412
413413 fn parseOptional(self: *Yaml, comptime T: type, value: ?Value) Error!T {
414414 const unwrapped = value orelse return null;
415 const opt_info = @typeInfo(T).Optional;
415 const opt_info = @typeInfo(T).optional;
416416 return @as(T, try self.parseValue(opt_info.child, unwrapped));
417417 }
418418
419419 fn parseStruct(self: *Yaml, comptime T: type, map: Map) Error!T {
420 const struct_info = @typeInfo(T).Struct;
420 const struct_info = @typeInfo(T).@"struct";
421421 var parsed: T = undefined;
422422
423423 inline for (struct_info.fields) |field| {
......@@ -426,7 +426,7 @@ pub const Yaml = struct {
426426 break :blk map.get(field_name);
427427 };
428428
429 if (@typeInfo(field.type) == .Optional) {
429 if (@typeInfo(field.type) == .optional) {
430430 @field(parsed, field.name) = try self.parseOptional(field.type, value);
431431 continue;
432432 }
......@@ -442,7 +442,7 @@ pub const Yaml = struct {
442442 }
443443
444444 fn parsePointer(self: *Yaml, comptime T: type, value: Value) Error!T {
445 const ptr_info = @typeInfo(T).Pointer;
445 const ptr_info = @typeInfo(T).pointer;
446446 const arena = self.arena.allocator();
447447
448448 switch (ptr_info.size) {
......@@ -462,7 +462,7 @@ pub const Yaml = struct {
462462 }
463463
464464 fn parseArray(self: *Yaml, comptime T: type, list: List) Error!T {
465 const array_info = @typeInfo(T).Array;
465 const array_info = @typeInfo(T).array;
466466 if (array_info.len != list.len) return error.ArraySizeMismatch;
467467
468468 var parsed: T = undefined;
src/main.zig+2-2
......@@ -130,7 +130,7 @@ var log_scopes: std.ArrayListUnmanaged([]const u8) = .{};
130130
131131pub fn log(
132132 comptime level: std.log.Level,
133 comptime scope: @TypeOf(.EnumLiteral),
133 comptime scope: @Type(.enum_literal),
134134 comptime format: []const u8,
135135 args: anytype,
136136) void {
......@@ -5315,7 +5315,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
53155315 var any_errors = false;
53165316 while (it.next()) |hash| {
53175317 if (hash.len == 0) continue;
5318 const digest_len = @typeInfo(Package.Manifest.MultiHashHexDigest).Array.len;
5318 const digest_len = @typeInfo(Package.Manifest.MultiHashHexDigest).array.len;
53195319 if (hash.len != digest_len) {
53205320 std.log.err("invalid digest (length {d} instead of {d}): '{s}'", .{
53215321 hash.len, digest_len, hash,
src/mutable_value.zig+12-12
......@@ -210,19 +210,19 @@ pub const MutableValue = union(enum) {
210210 },
211211 },
212212 .undef => |ty_ip| switch (Type.fromInterned(ty_ip).zigTypeTag(zcu)) {
213 .Struct, .Array, .Vector => |type_tag| {
213 .@"struct", .array, .vector => |type_tag| {
214214 const ty = Type.fromInterned(ty_ip);
215215 const opt_sent = ty.sentinel(zcu);
216 if (type_tag == .Struct or opt_sent != null or !allow_repeated) {
216 if (type_tag == .@"struct" or opt_sent != null or !allow_repeated) {
217217 const len_no_sent = ip.aggregateTypeLen(ty_ip);
218218 const elems = try arena.alloc(MutableValue, @intCast(len_no_sent + @intFromBool(opt_sent != null)));
219219 switch (type_tag) {
220 .Array, .Vector => {
220 .array, .vector => {
221221 const elem_ty = ip.childType(ty_ip);
222222 const undef_elem = try pt.intern(.{ .undef = elem_ty });
223223 @memset(elems[0..@intCast(len_no_sent)], .{ .interned = undef_elem });
224224 },
225 .Struct => for (elems[0..@intCast(len_no_sent)], 0..) |*mut_elem, i| {
225 .@"struct" => for (elems[0..@intCast(len_no_sent)], 0..) |*mut_elem, i| {
226226 const field_ty = ty.fieldType(i, zcu).toIntern();
227227 mut_elem.* = .{ .interned = try pt.intern(.{ .undef = field_ty }) };
228228 },
......@@ -244,7 +244,7 @@ pub const MutableValue = union(enum) {
244244 } };
245245 }
246246 },
247 .Union => {
247 .@"union" => {
248248 const payload = try arena.create(MutableValue);
249249 const backing_ty = try Type.fromInterned(ty_ip).unionBackingType(pt);
250250 payload.* = .{ .interned = try pt.intern(.{ .undef = backing_ty.toIntern() }) };
......@@ -254,7 +254,7 @@ pub const MutableValue = union(enum) {
254254 .payload = payload,
255255 } };
256256 },
257 .Pointer => {
257 .pointer => {
258258 const ptr_ty = ip.indexToKey(ty_ip).ptr_type;
259259 if (ptr_ty.flags.size != .Slice) return;
260260 const ptr = try arena.create(MutableValue);
......@@ -375,7 +375,7 @@ pub const MutableValue = union(enum) {
375375 if (field_val.eqlTrivial(r.child.*)) return;
376376 // We must switch to either the `aggregate` or the `bytes` representation.
377377 const len_inc_sent = ip.aggregateTypeLenIncludingSentinel(r.ty);
378 if (Type.fromInterned(r.ty).zigTypeTag(zcu) != .Struct and
378 if (Type.fromInterned(r.ty).zigTypeTag(zcu) != .@"struct" and
379379 is_trivial_int and
380380 Type.fromInterned(r.ty).childType(zcu).toIntern() == .u8_type and
381381 r.child.isTrivialInt(zcu))
......@@ -402,7 +402,7 @@ pub const MutableValue = union(enum) {
402402 },
403403 .aggregate => |a| {
404404 a.elems[field_idx] = field_val;
405 const is_struct = Type.fromInterned(a.ty).zigTypeTag(zcu) == .Struct;
405 const is_struct = Type.fromInterned(a.ty).zigTypeTag(zcu) == .@"struct";
406406 // Attempt to switch to a more efficient representation.
407407 const is_repeated = for (a.elems) |e| {
408408 if (!e.eqlTrivial(field_val)) break false;
......@@ -457,9 +457,9 @@ pub const MutableValue = union(enum) {
457457 .interned => |ip_index| {
458458 const ty = Type.fromInterned(pt.zcu.intern_pool.typeOf(ip_index));
459459 switch (ty.zigTypeTag(pt.zcu)) {
460 .Array, .Vector => return .{ .interned = (try Value.fromInterned(ip_index).elemValue(pt, field_idx)).toIntern() },
461 .Struct, .Union => return .{ .interned = (try Value.fromInterned(ip_index).fieldValue(pt, field_idx)).toIntern() },
462 .Pointer => {
460 .array, .vector => return .{ .interned = (try Value.fromInterned(ip_index).elemValue(pt, field_idx)).toIntern() },
461 .@"struct", .@"union" => return .{ .interned = (try Value.fromInterned(ip_index).fieldValue(pt, field_idx)).toIntern() },
462 .pointer => {
463463 assert(ty.isSlice(pt.zcu));
464464 return switch (field_idx) {
465465 Value.slice_ptr_index => .{ .interned = Value.fromInterned(ip_index).slicePtr(pt.zcu).toIntern() },
......@@ -551,7 +551,7 @@ pub const MutableValue = union(enum) {
551551 /// Used for deciding when to switch aggregate representations without fully
552552 /// interning many values.
553553 fn eqlTrivial(a: MutableValue, b: MutableValue) bool {
554 const Tag = @typeInfo(MutableValue).Union.tag_type.?;
554 const Tag = @typeInfo(MutableValue).@"union".tag_type.?;
555555 if (@as(Tag, a) != @as(Tag, b)) return false;
556556 return switch (a) {
557557 .interned => |a_ip| a_ip == b.interned,
src/print_env.zig+1-1
......@@ -47,7 +47,7 @@ pub fn cmdEnv(arena: Allocator, args: []const []const u8, stdout: std.fs.File.Wr
4747
4848 try jws.objectField("env");
4949 try jws.beginObject();
50 inline for (@typeInfo(std.zig.EnvVar).Enum.fields) |field| {
50 inline for (@typeInfo(std.zig.EnvVar).@"enum".fields) |field| {
5151 try jws.objectField(field.name);
5252 try jws.write(try @field(std.zig.EnvVar, field.name).get(arena));
5353 }
src/print_value.zig+6-6
......@@ -207,7 +207,7 @@ fn printAggregate(
207207 const ip = &zcu.intern_pool;
208208 const ty = Type.fromInterned(aggregate.ty);
209209 switch (ty.zigTypeTag(zcu)) {
210 .Struct => if (!ty.isTuple(zcu)) {
210 .@"struct" => if (!ty.isTuple(zcu)) {
211211 if (is_ref) try writer.writeByte('&');
212212 if (ty.structFieldCount(zcu) == 0) {
213213 return writer.writeAll(".{}");
......@@ -223,7 +223,7 @@ fn printAggregate(
223223 try writer.writeAll(" }");
224224 return;
225225 },
226 .Array => {
226 .array => {
227227 switch (aggregate.storage) {
228228 .bytes => |bytes| string: {
229229 const len = ty.arrayLenIncludingSentinel(zcu);
......@@ -253,7 +253,7 @@ fn printAggregate(
253253 else => {},
254254 }
255255 },
256 .Vector => if (ty.arrayLen(zcu) == 0) {
256 .vector => if (ty.arrayLen(zcu) == 0) {
257257 if (is_ref) try writer.writeByte('&');
258258 return writer.writeAll(".{}");
259259 },
......@@ -362,17 +362,17 @@ fn printPtrDerivation(
362362 try printPtrDerivation(field.parent.*, writer, level, pt, have_sema, sema);
363363 const agg_ty = (try field.parent.ptrType(pt)).childType(zcu);
364364 switch (agg_ty.zigTypeTag(zcu)) {
365 .Struct => if (agg_ty.structFieldName(field.field_idx, zcu).unwrap()) |field_name| {
365 .@"struct" => if (agg_ty.structFieldName(field.field_idx, zcu).unwrap()) |field_name| {
366366 try writer.print(".{i}", .{field_name.fmt(ip)});
367367 } else {
368368 try writer.print("[{d}]", .{field.field_idx});
369369 },
370 .Union => {
370 .@"union" => {
371371 const tag_ty = agg_ty.unionTagTypeHypothetical(zcu);
372372 const field_name = tag_ty.enumFieldName(field.field_idx, zcu);
373373 try writer.print(".{i}", .{field_name.fmt(ip)});
374374 },
375 .Pointer => switch (field.field_idx) {
375 .pointer => switch (field.field_idx) {
376376 Value.slice_ptr_index => try writer.writeAll(".ptr"),
377377 Value.slice_len_index => try writer.writeAll(".len"),
378378 else => unreachable,
src/print_zir.zig+3-3
......@@ -907,7 +907,7 @@ const Writer = struct {
907907
908908 fn writeFieldParentPtr(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
909909 const extra = self.code.extraData(Zir.Inst.FieldParentPtr, extended.operand).data;
910 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
910 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
911911 const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
912912 if (flags.align_cast) try stream.writeAll("align_cast, ");
913913 if (flags.addrspace_cast) try stream.writeAll("addrspace_cast, ");
......@@ -1065,7 +1065,7 @@ const Writer = struct {
10651065 }
10661066
10671067 fn writePtrCastFull(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
1068 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
1068 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
10691069 const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
10701070 const extra = self.code.extraData(Zir.Inst.BinNode, extended.operand).data;
10711071 if (flags.ptr_cast) try stream.writeAll("ptr_cast, ");
......@@ -1081,7 +1081,7 @@ const Writer = struct {
10811081 }
10821082
10831083 fn writePtrCastNoDest(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
1084 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
1084 const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
10851085 const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
10861086 const extra = self.code.extraData(Zir.Inst.UnNode, extended.operand).data;
10871087 if (flags.const_cast) try stream.writeAll("const_cast, ");
src/translate_c.zig+4-4
......@@ -161,7 +161,7 @@ pub fn translate(
161161 context.pattern_list.deinit(gpa);
162162 }
163163
164 inline for (@typeInfo(std.zig.c_builtins).Struct.decls) |decl| {
164 inline for (@typeInfo(std.zig.c_builtins).@"struct".decls) |decl| {
165165 const builtin = try Tag.pub_var_simple.create(arena, .{
166166 .name = decl.name,
167167 .init = try Tag.import_c_builtin.create(arena, decl.name),
......@@ -1324,7 +1324,7 @@ fn makeShuffleMask(c: *Context, scope: *Scope, expr: *const clang.ShuffleVectorE
13241324fn vectorTypeInfo(arena: mem.Allocator, vec_node: Node, field: []const u8) TransError!Node {
13251325 const typeof_call = try Tag.typeof.create(arena, vec_node);
13261326 const typeinfo_call = try Tag.typeinfo.create(arena, typeof_call);
1327 const vector_type_info = try Tag.field_access.create(arena, .{ .lhs = typeinfo_call, .field_name = "Vector" });
1327 const vector_type_info = try Tag.field_access.create(arena, .{ .lhs = typeinfo_call, .field_name = "vector" });
13281328 return Tag.field_access.create(arena, .{ .lhs = vector_type_info, .field_name = field });
13291329}
13301330
......@@ -2008,7 +2008,7 @@ fn transImplicitCastExpr(
20082008}
20092009
20102010fn isBuiltinDefined(name: []const u8) bool {
2011 inline for (@typeInfo(std.zig.c_builtins).Struct.decls) |decl| {
2011 inline for (@typeInfo(std.zig.c_builtins).@"struct".decls) |decl| {
20122012 if (std.mem.eql(u8, name, decl.name)) return true;
20132013 }
20142014 return false;
......@@ -4655,7 +4655,7 @@ fn transCreateNodeAPInt(c: *Context, int: *const clang.APSInt) !Node {
46554655
46564656fn transCreateNodeNumber(c: *Context, num: anytype, num_kind: enum { int, float }) !Node {
46574657 const fmt_s = switch (@typeInfo(@TypeOf(num))) {
4658 .Int, .ComptimeInt => "{d}",
4658 .int, .comptime_int => "{d}",
46594659 else => "{s}",
46604660 };
46614661 const str = try std.fmt.allocPrint(c.arena, fmt_s, .{num});
test/behavior/abs.zig+1-1
......@@ -104,7 +104,7 @@ test "@abs big int <= 128 bits" {
104104 try testAbsUnsignedBigInt();
105105}
106106
107fn abs(comptime T: type, a: T) std.meta.Int(.unsigned, @typeInfo(T).Int.bits) {
107fn abs(comptime T: type, a: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) {
108108 return @abs(a);
109109}
110110
test/behavior/align.zig+1-1
......@@ -7,7 +7,7 @@ const assert = std.debug.assert;
77var foo: u8 align(4) = 100;
88
99test "global variable alignment" {
10 comptime assert(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4);
10 comptime assert(@typeInfo(@TypeOf(&foo)).pointer.alignment == 4);
1111 comptime assert(@TypeOf(&foo) == *align(4) u8);
1212 {
1313 const slice = @as(*align(4) [1]u8, &foo)[0..];
test/behavior/async_fn.zig+3-3
......@@ -391,7 +391,7 @@ test "async fn with inferred error set" {
391391 var frame: [1]@Frame(middle) = undefined;
392392 var fn_ptr = middle;
393393 _ = &fn_ptr;
394 var result: @typeInfo(@typeInfo(@TypeOf(fn_ptr)).Fn.return_type.?).ErrorUnion.error_set!void = undefined;
394 var result: @typeInfo(@typeInfo(@TypeOf(fn_ptr)).@"fn".return_type.?).error_union.error_set!void = undefined;
395395 _ = @asyncCall(std.mem.sliceAsBytes(frame[0..]), &result, fn_ptr, .{});
396396 resume global_frame;
397397 try std.testing.expectError(error.Fail, result);
......@@ -1088,7 +1088,7 @@ test "@asyncCall with comptime-known function, but not awaited directly" {
10881088
10891089 fn doTheTest() !void {
10901090 var frame: [1]@Frame(middle) = undefined;
1091 var result: @typeInfo(@typeInfo(@TypeOf(middle)).Fn.return_type.?).ErrorUnion.error_set!void = undefined;
1091 var result: @typeInfo(@typeInfo(@TypeOf(middle)).@"fn".return_type.?).error_union.error_set!void = undefined;
10921092 _ = @asyncCall(std.mem.sliceAsBytes(frame[0..]), &result, middle, .{});
10931093 resume global_frame;
10941094 try std.testing.expectError(error.Fail, result);
......@@ -1166,7 +1166,7 @@ test "@TypeOf an async function call of generic fn with error union type" {
11661166 const S = struct {
11671167 fn func(comptime x: anytype) anyerror!i32 {
11681168 const T = @TypeOf(async func(x));
1169 comptime assert(T == @typeInfo(@TypeOf(@frame())).Pointer.child);
1169 comptime assert(T == @typeInfo(@TypeOf(@frame())).pointer.child);
11701170 return undefined;
11711171 }
11721172 };
test/behavior/atomics.zig+1-1
......@@ -414,7 +414,7 @@ fn testAtomicsWithType(comptime T: type, a: T, b: T) !void {
414414}
415415
416416fn testAtomicsWithPackedStruct(comptime T: type, a: T, b: T) !void {
417 const BackingInt = @typeInfo(T).Struct.backing_integer.?;
417 const BackingInt = @typeInfo(T).@"struct".backing_integer.?;
418418 var x: T = b;
419419 @atomicStore(T, &x, a, .seq_cst);
420420 try expect(@as(BackingInt, @bitCast(x)) == @as(BackingInt, @bitCast(a)));
test/behavior/basic.zig+5-5
......@@ -1193,7 +1193,7 @@ test "pointer to struct literal with runtime field is constant" {
11931193 var runtime_zero: usize = 0;
11941194 _ = &runtime_zero;
11951195 const ptr = &S{ .data = runtime_zero };
1196 try expect(@typeInfo(@TypeOf(ptr)).Pointer.is_const);
1196 try expect(@typeInfo(@TypeOf(ptr)).pointer.is_const);
11971197}
11981198
11991199fn testSignedCmp(comptime T: type) !void {
......@@ -1289,7 +1289,7 @@ test "reference to inferred local variable works as expected" {
12891289
12901290test "@Type returned from block" {
12911291 const T = comptime b: {
1292 break :b @Type(.{ .Int = .{
1292 break :b @Type(.{ .int = .{
12931293 .signedness = .unsigned,
12941294 .bits = 8,
12951295 } });
......@@ -1304,7 +1304,7 @@ test "comptime variable initialized with addresses of literals" {
13041304 };
13051305 _ = &st;
13061306
1307 inline for (@typeInfo(@TypeOf(st)).Struct.fields) |field| {
1307 inline for (@typeInfo(@TypeOf(st)).@"struct".fields) |field| {
13081308 _ = field;
13091309 }
13101310}
......@@ -1321,12 +1321,12 @@ test "proper value is returned from labeled block" {
13211321 const S = struct {
13221322 fn hash(v: *u32, key: anytype) void {
13231323 const Key = @TypeOf(key);
1324 if (@typeInfo(Key) == .ErrorSet) {
1324 if (@typeInfo(Key) == .error_set) {
13251325 v.* += 1;
13261326 return;
13271327 }
13281328 switch (@typeInfo(Key)) {
1329 .ErrorUnion => blk: {
1329 .error_union => blk: {
13301330 const payload = key catch |err| {
13311331 hash(v, err);
13321332 break :blk;
test/behavior/bit_shifting.zig+3-3
......@@ -3,7 +3,7 @@ const expect = std.testing.expect;
33const builtin = @import("builtin");
44
55fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, comptime V: type) type {
6 const key_bits = @typeInfo(Key).Int.bits;
6 const key_bits = @typeInfo(Key).int.bits;
77 std.debug.assert(Key == std.meta.Int(.unsigned, key_bits));
88 std.debug.assert(key_bits >= mask_bit_count);
99 const shard_key_bits = mask_bit_count;
......@@ -120,11 +120,11 @@ test "Saturating Shift Left where lhs is of a computed type" {
120120
121121 const S = struct {
122122 fn getIntShiftType(comptime T: type) type {
123 var unsigned_shift_type = @typeInfo(std.math.Log2Int(T)).Int;
123 var unsigned_shift_type = @typeInfo(std.math.Log2Int(T)).int;
124124 unsigned_shift_type.signedness = .signed;
125125
126126 return @Type(.{
127 .Int = unsigned_shift_type,
127 .int = unsigned_shift_type,
128128 });
129129 }
130130
test/behavior/bitcast.zig+2-2
......@@ -361,7 +361,7 @@ test "comptime @bitCast packed struct to int and back" {
361361 vectori: @Vector(2, u8) = .{ 127, 42 },
362362 vectorf: @Vector(2, f16) = .{ 3.14, 2.71 },
363363 };
364 const Int = @typeInfo(S).Struct.backing_integer.?;
364 const Int = @typeInfo(S).@"struct".backing_integer.?;
365365
366366 // S -> Int
367367 var s: S = .{};
......@@ -373,7 +373,7 @@ test "comptime @bitCast packed struct to int and back" {
373373 _ = &i;
374374 const rt_cast = @as(S, @bitCast(i));
375375 const ct_cast = comptime @as(S, @bitCast(@as(Int, 0)));
376 inline for (@typeInfo(S).Struct.fields) |field| {
376 inline for (@typeInfo(S).@"struct".fields) |field| {
377377 try expectEqual(@field(rt_cast, field.name), @field(ct_cast, field.name));
378378 }
379379}
test/behavior/call.zig+3-3
......@@ -374,7 +374,7 @@ test "Enum constructed by @Type passed as generic argument" {
374374 try expect(@intFromEnum(a) == b);
375375 }
376376 };
377 inline for (@typeInfo(S.E).Enum.fields, 0..) |_, i| {
377 inline for (@typeInfo(S.E).@"enum".fields, 0..) |_, i| {
378378 try S.foo(@as(S.E, @enumFromInt(i)), i);
379379 }
380380}
......@@ -578,11 +578,11 @@ test "generic function pointer can be called" {
578578test "value returned from comptime function is comptime known" {
579579 const S = struct {
580580 fn fields(comptime T: type) switch (@typeInfo(T)) {
581 .Struct => []const std.builtin.Type.StructField,
581 .@"struct" => []const std.builtin.Type.StructField,
582582 else => unreachable,
583583 } {
584584 return switch (@typeInfo(T)) {
585 .Struct => |info| info.fields,
585 .@"struct" => |info| info.fields,
586586 else => unreachable,
587587 };
588588 }
test/behavior/cast.zig+44-44
......@@ -704,20 +704,20 @@ test "peer type resolution: error set supersets" {
704704 {
705705 const ty = @TypeOf(a, b);
706706 const error_set_info = @typeInfo(ty);
707 try expect(error_set_info == .ErrorSet);
708 try expect(error_set_info.ErrorSet.?.len == 2);
709 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
710 try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
707 try expect(error_set_info == .error_set);
708 try expect(error_set_info.error_set.?.len == 2);
709 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
710 try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
711711 }
712712
713713 // B superset of A
714714 {
715715 const ty = @TypeOf(b, a);
716716 const error_set_info = @typeInfo(ty);
717 try expect(error_set_info == .ErrorSet);
718 try expect(error_set_info.ErrorSet.?.len == 2);
719 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
720 try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
717 try expect(error_set_info == .error_set);
718 try expect(error_set_info.error_set.?.len == 2);
719 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
720 try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
721721 }
722722}
723723
......@@ -732,21 +732,21 @@ test "peer type resolution: disjoint error sets" {
732732 {
733733 const ty = @TypeOf(a, b);
734734 const error_set_info = @typeInfo(ty);
735 try expect(error_set_info == .ErrorSet);
736 try expect(error_set_info.ErrorSet.?.len == 3);
737 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
738 try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
739 try expect(mem.eql(u8, error_set_info.ErrorSet.?[2].name, "Three"));
735 try expect(error_set_info == .error_set);
736 try expect(error_set_info.error_set.?.len == 3);
737 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
738 try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
739 try expect(mem.eql(u8, error_set_info.error_set.?[2].name, "Three"));
740740 }
741741
742742 {
743743 const ty = @TypeOf(b, a);
744744 const error_set_info = @typeInfo(ty);
745 try expect(error_set_info == .ErrorSet);
746 try expect(error_set_info.ErrorSet.?.len == 3);
747 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
748 try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
749 try expect(mem.eql(u8, error_set_info.ErrorSet.?[2].name, "Three"));
745 try expect(error_set_info == .error_set);
746 try expect(error_set_info.error_set.?.len == 3);
747 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
748 try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
749 try expect(mem.eql(u8, error_set_info.error_set.?[2].name, "Three"));
750750 }
751751}
752752
......@@ -762,25 +762,25 @@ test "peer type resolution: error union and error set" {
762762 {
763763 const ty = @TypeOf(a, b);
764764 const info = @typeInfo(ty);
765 try expect(info == .ErrorUnion);
765 try expect(info == .error_union);
766766
767 const error_set_info = @typeInfo(info.ErrorUnion.error_set);
768 try expect(error_set_info.ErrorSet.?.len == 3);
769 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
770 try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
771 try expect(mem.eql(u8, error_set_info.ErrorSet.?[2].name, "Three"));
767 const error_set_info = @typeInfo(info.error_union.error_set);
768 try expect(error_set_info.error_set.?.len == 3);
769 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
770 try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
771 try expect(mem.eql(u8, error_set_info.error_set.?[2].name, "Three"));
772772 }
773773
774774 {
775775 const ty = @TypeOf(b, a);
776776 const info = @typeInfo(ty);
777 try expect(info == .ErrorUnion);
777 try expect(info == .error_union);
778778
779 const error_set_info = @typeInfo(info.ErrorUnion.error_set);
780 try expect(error_set_info.ErrorSet.?.len == 3);
781 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
782 try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
783 try expect(mem.eql(u8, error_set_info.ErrorSet.?[2].name, "Three"));
779 const error_set_info = @typeInfo(info.error_union.error_set);
780 try expect(error_set_info.error_set.?.len == 3);
781 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
782 try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
783 try expect(mem.eql(u8, error_set_info.error_set.?[2].name, "Three"));
784784 }
785785}
786786
......@@ -795,25 +795,25 @@ test "peer type resolution: error union after non-error" {
795795 {
796796 const ty = @TypeOf(a, b);
797797 const info = @typeInfo(ty);
798 try expect(info == .ErrorUnion);
799 try expect(info.ErrorUnion.payload == u32);
798 try expect(info == .error_union);
799 try expect(info.error_union.payload == u32);
800800
801 const error_set_info = @typeInfo(info.ErrorUnion.error_set);
802 try expect(error_set_info.ErrorSet.?.len == 2);
803 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
804 try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
801 const error_set_info = @typeInfo(info.error_union.error_set);
802 try expect(error_set_info.error_set.?.len == 2);
803 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
804 try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
805805 }
806806
807807 {
808808 const ty = @TypeOf(b, a);
809809 const info = @typeInfo(ty);
810 try expect(info == .ErrorUnion);
811 try expect(info.ErrorUnion.payload == u32);
810 try expect(info == .error_union);
811 try expect(info.error_union.payload == u32);
812812
813 const error_set_info = @typeInfo(info.ErrorUnion.error_set);
814 try expect(error_set_info.ErrorSet.?.len == 2);
815 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
816 try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
813 const error_set_info = @typeInfo(info.error_union.error_set);
814 try expect(error_set_info.error_set.?.len == 2);
815 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
816 try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
817817 }
818818}
819819
......@@ -1484,7 +1484,7 @@ test "coerce between pointers of compatible differently-named floats" {
14841484 return error.SkipZigTest;
14851485 }
14861486
1487 const F = switch (@typeInfo(c_longdouble).Float.bits) {
1487 const F = switch (@typeInfo(c_longdouble).float.bits) {
14881488 16 => f16,
14891489 32 => f32,
14901490 64 => f64,
......@@ -2151,7 +2151,7 @@ test "peer type resolution: tuples with comptime fields" {
21512151 const ti1 = @typeInfo(@TypeOf(a, b));
21522152 const ti2 = @typeInfo(@TypeOf(b, a));
21532153 inline for (.{ ti1, ti2 }) |ti| {
2154 const s = ti.Struct;
2154 const s = ti.@"struct";
21552155 comptime assert(s.is_tuple);
21562156 comptime assert(s.fields.len == 2);
21572157 comptime assert(s.fields[0].type == u32);
test/behavior/comptime_memory.zig+1-1
......@@ -119,7 +119,7 @@ fn shuffle(ptr: usize, comptime From: type, comptime To: type) usize {
119119 const pResult = @as(*align(1) [array_len]To, @ptrCast(&result));
120120 var i: usize = 0;
121121 while (i < array_len) : (i += 1) {
122 inline for (@typeInfo(To).Struct.fields) |f| {
122 inline for (@typeInfo(To).@"struct".fields) |f| {
123123 @field(pResult[i], f.name) = @field(pSource[i], f.name);
124124 }
125125 }
test/behavior/empty_tuple_fields.zig+6-6
......@@ -9,9 +9,9 @@ test "empty file level struct" {
99
1010 const T = @import("empty_file_level_struct.zig");
1111 const info = @typeInfo(T);
12 try std.testing.expectEqual(@as(usize, 1), info.Struct.fields.len);
13 try std.testing.expectEqualStrings("0", info.Struct.fields[0].name);
14 try std.testing.expect(@typeInfo(info.Struct.fields[0].type) == .Struct);
12 try std.testing.expectEqual(@as(usize, 1), info.@"struct".fields.len);
13 try std.testing.expectEqualStrings("0", info.@"struct".fields[0].name);
14 try std.testing.expect(@typeInfo(info.@"struct".fields[0].type) == .@"struct");
1515}
1616
1717test "empty file level union" {
......@@ -22,7 +22,7 @@ test "empty file level union" {
2222
2323 const T = @import("empty_file_level_union.zig");
2424 const info = @typeInfo(T);
25 try std.testing.expectEqual(@as(usize, 1), info.Struct.fields.len);
26 try std.testing.expectEqualStrings("0", info.Struct.fields[0].name);
27 try std.testing.expect(@typeInfo(info.Struct.fields[0].type) == .Union);
25 try std.testing.expectEqual(@as(usize, 1), info.@"struct".fields.len);
26 try std.testing.expectEqualStrings("0", info.@"struct".fields[0].name);
27 try std.testing.expect(@typeInfo(info.@"struct".fields[0].type) == .@"union");
2828}
test/behavior/enum.zig+8-8
......@@ -647,12 +647,12 @@ test "non-exhaustive enum" {
647647 else => true,
648648 });
649649
650 try expect(@typeInfo(E).Enum.fields.len == 2);
650 try expect(@typeInfo(E).@"enum".fields.len == 2);
651651 e = @as(E, @enumFromInt(12));
652652 try expect(@intFromEnum(e) == 12);
653653 e = @as(E, @enumFromInt(y));
654654 try expect(@intFromEnum(e) == 52);
655 try expect(@typeInfo(E).Enum.is_exhaustive == false);
655 try expect(@typeInfo(E).@"enum".is_exhaustive == false);
656656 }
657657 };
658658 try S.doTheTest(52);
......@@ -671,8 +671,8 @@ test "empty non-exhaustive enum" {
671671 });
672672 try expect(@intFromEnum(e) == y);
673673
674 try expect(@typeInfo(E).Enum.fields.len == 0);
675 try expect(@typeInfo(E).Enum.is_exhaustive == false);
674 try expect(@typeInfo(E).@"enum".fields.len == 0);
675 try expect(@typeInfo(E).@"enum".is_exhaustive == false);
676676 }
677677 };
678678 try S.doTheTest(42);
......@@ -708,8 +708,8 @@ test "single field non-exhaustive enum" {
708708 });
709709
710710 try expect(@intFromEnum(@as(E, @enumFromInt(y))) == y);
711 try expect(@typeInfo(E).Enum.fields.len == 1);
712 try expect(@typeInfo(E).Enum.is_exhaustive == false);
711 try expect(@typeInfo(E).@"enum".fields.len == 1);
712 try expect(@typeInfo(E).@"enum".is_exhaustive == false);
713713 }
714714 };
715715 try S.doTheTest(23);
......@@ -1253,9 +1253,9 @@ test "Non-exhaustive enum backed by comptime_int" {
12531253test "matching captures causes enum equivalence" {
12541254 const S = struct {
12551255 fn Nonexhaustive(comptime I: type) type {
1256 const UTag = @Type(.{ .Int = .{
1256 const UTag = @Type(.{ .int = .{
12571257 .signedness = .unsigned,
1258 .bits = @typeInfo(I).Int.bits,
1258 .bits = @typeInfo(I).int.bits,
12591259 } });
12601260 return enum(UTag) { _ };
12611261 }
test/behavior/error.zig+8-8
......@@ -188,9 +188,9 @@ test "error union type " {
188188fn testErrorUnionType() !void {
189189 const x: anyerror!i32 = 1234;
190190 if (x) |value| try expect(value == 1234) else |_| unreachable;
191 try expect(@typeInfo(@TypeOf(x)) == .ErrorUnion);
192 try expect(@typeInfo(@typeInfo(@TypeOf(x)).ErrorUnion.error_set) == .ErrorSet);
193 try expect(@typeInfo(@TypeOf(x)).ErrorUnion.error_set == anyerror);
191 try expect(@typeInfo(@TypeOf(x)) == .error_union);
192 try expect(@typeInfo(@typeInfo(@TypeOf(x)).error_union.error_set) == .error_set);
193 try expect(@typeInfo(@TypeOf(x)).error_union.error_set == anyerror);
194194}
195195
196196test "error set type" {
......@@ -204,7 +204,7 @@ const MyErrSet = error{
204204};
205205
206206fn testErrorSetType() !void {
207 try expect(@typeInfo(MyErrSet).ErrorSet.?.len == 2);
207 try expect(@typeInfo(MyErrSet).error_set.?.len == 2);
208208
209209 const a: MyErrSet!i32 = 5678;
210210 const b: MyErrSet!i32 = MyErrSet.OutOfMemory;
......@@ -653,9 +653,9 @@ test "inferred error set equality" {
653653 fn quux() anyerror!void {}
654654 };
655655
656 const FooError = @typeInfo(@typeInfo(@TypeOf(S.foo)).Fn.return_type.?).ErrorUnion.error_set;
657 const BarError = @typeInfo(@typeInfo(@TypeOf(S.bar)).Fn.return_type.?).ErrorUnion.error_set;
658 const BazError = @typeInfo(@typeInfo(@TypeOf(S.baz)).Fn.return_type.?).ErrorUnion.error_set;
656 const FooError = @typeInfo(@typeInfo(@TypeOf(S.foo)).@"fn".return_type.?).error_union.error_set;
657 const BarError = @typeInfo(@typeInfo(@TypeOf(S.bar)).@"fn".return_type.?).error_union.error_set;
658 const BazError = @typeInfo(@typeInfo(@TypeOf(S.baz)).@"fn".return_type.?).error_union.error_set;
659659
660660 try expect(BarError != error{Bad});
661661
......@@ -1040,7 +1040,7 @@ test "generic type constructed from inferred error set of unresolved function" {
10401040 _ = bytes;
10411041 return 0;
10421042 }
1043 const T = std.io.Writer(void, @typeInfo(@typeInfo(@TypeOf(write)).Fn.return_type.?).ErrorUnion.error_set, write);
1043 const T = std.io.Writer(void, @typeInfo(@typeInfo(@TypeOf(write)).@"fn".return_type.?).error_union.error_set, write);
10441044 fn writer() T {
10451045 return .{ .context = {} };
10461046 }
test/behavior/eval.zig+2-2
......@@ -538,7 +538,7 @@ test "@tagName of @typeInfo" {
538538 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
539539
540540 const str = @tagName(@typeInfo(u8));
541 try expect(std.mem.eql(u8, str, "Int"));
541 try expect(std.mem.eql(u8, str, "int"));
542542}
543543
544544test "static eval list init" {
......@@ -951,7 +951,7 @@ test "const local with comptime init through array init" {
951951
952952 const S = struct {
953953 fn declarations(comptime T: type) []const std.builtin.Type.Declaration {
954 return @typeInfo(T).Enum.decls;
954 return @typeInfo(T).@"enum".decls;
955955 }
956956 };
957957
test/behavior/export_self_referential_type_info.zig+1-1
......@@ -1 +1 @@
1export const self_referential_type_info: c_int = @intFromBool(@typeInfo(@This()).Struct.is_tuple);
1export const self_referential_type_info: c_int = @intFromBool(@typeInfo(@This()).@"struct".is_tuple);
test/behavior/fn.zig+5-5
......@@ -393,7 +393,7 @@ test "ability to give comptime types and non comptime types to same parameter" {
393393 }
394394
395395 fn foo(arg: anytype) i32 {
396 if (@typeInfo(@TypeOf(arg)) == .Type and arg == i32) return 20;
396 if (@typeInfo(@TypeOf(arg)) == .type and arg == i32) return 20;
397397 return 9 + arg;
398398 }
399399 };
......@@ -406,8 +406,8 @@ test "function with inferred error set but returning no error" {
406406 fn foo() !void {}
407407 };
408408
409 const return_ty = @typeInfo(@TypeOf(S.foo)).Fn.return_type.?;
410 try expectEqual(0, @typeInfo(@typeInfo(return_ty).ErrorUnion.error_set).ErrorSet.?.len);
409 const return_ty = @typeInfo(@TypeOf(S.foo)).@"fn".return_type.?;
410 try expectEqual(0, @typeInfo(@typeInfo(return_ty).error_union.error_set).error_set.?.len);
411411}
412412
413413test "import passed byref to function in return type" {
......@@ -567,10 +567,10 @@ test "lazy values passed to anytype parameter" {
567567
568568test "pass and return comptime-only types" {
569569 const S = struct {
570 fn returnNull(comptime x: @Type(.Null)) @Type(.Null) {
570 fn returnNull(comptime x: @Type(.null)) @Type(.null) {
571571 return x;
572572 }
573 fn returnUndefined(comptime x: @Type(.Undefined)) @Type(.Undefined) {
573 fn returnUndefined(comptime x: @Type(.undefined)) @Type(.undefined) {
574574 return x;
575575 }
576576 };
test/behavior/generics.zig+6-6
......@@ -179,7 +179,7 @@ test "generic fn keeps non-generic parameter types" {
179179
180180 const S = struct {
181181 fn f(comptime T: type, s: []T) !void {
182 try expect(A != @typeInfo(@TypeOf(s)).Pointer.alignment);
182 try expect(A != @typeInfo(@TypeOf(s)).pointer.alignment);
183183 }
184184 };
185185
......@@ -258,17 +258,17 @@ test "generic function instantiation turns into comptime call" {
258258 }
259259
260260 pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeInfo(T)) {
261 .Enum => std.builtin.Type.EnumField,
261 .@"enum" => std.builtin.Type.EnumField,
262262 else => void,
263263 } {
264 return @typeInfo(T).Enum.fields[@intFromEnum(field)];
264 return @typeInfo(T).@"enum".fields[@intFromEnum(field)];
265265 }
266266
267267 pub fn FieldEnum(comptime T: type) type {
268268 _ = T;
269269 var enumFields: [1]std.builtin.Type.EnumField = .{.{ .name = "A", .value = 0 }};
270270 return @Type(.{
271 .Enum = .{
271 .@"enum" = .{
272272 .tag_type = u0,
273273 .fields = &enumFields,
274274 .decls = &.{},
......@@ -363,7 +363,7 @@ test "nested generic function" {
363363
364364 fn g(_: *const fn (anytype) void) void {}
365365 };
366 try expect(@typeInfo(@TypeOf(S.g)).Fn.is_generic);
366 try expect(@typeInfo(@TypeOf(S.g)).@"fn".is_generic);
367367 try S.foo(u32, S.bar, 123);
368368}
369369
......@@ -549,7 +549,7 @@ test "call generic function with from function called by the generic function" {
549549 const ArgSerializer = struct {
550550 fn isCommand(comptime T: type) bool {
551551 const tid = @typeInfo(T);
552 return (tid == .Struct or tid == .Enum or tid == .Union) and
552 return (tid == .@"struct" or tid == .@"enum" or tid == .@"union") and
553553 @hasDecl(T, "Redis") and @hasDecl(T.Redis, "Command");
554554 }
555555 fn serializeCommand(command: anytype) void {
test/behavior/math.zig+4-4
......@@ -135,8 +135,8 @@ fn testOneClzVector(
135135}
136136
137137fn expectVectorsEqual(a: anytype, b: anytype) !void {
138 const len_a = @typeInfo(@TypeOf(a)).Vector.len;
139 const len_b = @typeInfo(@TypeOf(b)).Vector.len;
138 const len_a = @typeInfo(@TypeOf(a)).vector.len;
139 const len_b = @typeInfo(@TypeOf(b)).vector.len;
140140 try expect(len_a == len_b);
141141
142142 var i: usize = 0;
......@@ -1683,12 +1683,12 @@ test "signed zeros are represented properly" {
16831683 }
16841684
16851685 fn testOne(comptime T: type) !void {
1686 const ST = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
1686 const ST = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
16871687 var as_fp_val = -@as(T, 0.0);
16881688 _ = &as_fp_val;
16891689 const as_uint_val: ST = @bitCast(as_fp_val);
16901690 // Ensure the sign bit is set.
1691 try expect(as_uint_val >> (@typeInfo(T).Float.bits - 1) == 1);
1691 try expect(as_uint_val >> (@typeInfo(T).float.bits - 1) == 1);
16921692 }
16931693 };
16941694
test/behavior/packed-struct.zig+2-2
......@@ -1186,9 +1186,9 @@ test "packed struct field pointer aligned properly" {
11861186 };
11871187
11881188 var f1: *align(16) Foo = @alignCast(@as(*align(1) Foo, @ptrCast(&Foo.buffer[0])));
1189 try expect(@typeInfo(@TypeOf(f1)).Pointer.alignment == 16);
1189 try expect(@typeInfo(@TypeOf(f1)).pointer.alignment == 16);
11901190 try expect(@intFromPtr(f1) == @intFromPtr(&f1.a));
1191 try expect(@typeInfo(@TypeOf(&f1.a)).Pointer.alignment == 16);
1191 try expect(@typeInfo(@TypeOf(&f1.a)).pointer.alignment == 16);
11921192}
11931193
11941194test "load flag from packed struct in union" {
test/behavior/pointers.zig+18-18
......@@ -266,8 +266,8 @@ test "allowzero pointer and slice" {
266266 comptime assert(@TypeOf(slice) == []allowzero i32);
267267 try expect(@intFromPtr(&slice[5]) == 20);
268268
269 comptime assert(@typeInfo(@TypeOf(ptr)).Pointer.is_allowzero);
270 comptime assert(@typeInfo(@TypeOf(slice)).Pointer.is_allowzero);
269 comptime assert(@typeInfo(@TypeOf(ptr)).pointer.is_allowzero);
270 comptime assert(@typeInfo(@TypeOf(slice)).pointer.is_allowzero);
271271}
272272
273273test "assign null directly to C pointer and test null equality" {
......@@ -441,15 +441,15 @@ test "pointer-integer arithmetic affects the alignment" {
441441 var x: usize = 1;
442442 _ = .{ &ptr, &x };
443443
444 try expect(@typeInfo(@TypeOf(ptr)).Pointer.alignment == 8);
444 try expect(@typeInfo(@TypeOf(ptr)).pointer.alignment == 8);
445445 const ptr1 = ptr + 1; // 1 * 4 = 4 -> lcd(4,8) = 4
446 try expect(@typeInfo(@TypeOf(ptr1)).Pointer.alignment == 4);
446 try expect(@typeInfo(@TypeOf(ptr1)).pointer.alignment == 4);
447447 const ptr2 = ptr + 4; // 4 * 4 = 16 -> lcd(16,8) = 8
448 try expect(@typeInfo(@TypeOf(ptr2)).Pointer.alignment == 8);
448 try expect(@typeInfo(@TypeOf(ptr2)).pointer.alignment == 8);
449449 const ptr3 = ptr + 0; // no-op
450 try expect(@typeInfo(@TypeOf(ptr3)).Pointer.alignment == 8);
450 try expect(@typeInfo(@TypeOf(ptr3)).pointer.alignment == 8);
451451 const ptr4 = ptr + x; // runtime-known addend
452 try expect(@typeInfo(@TypeOf(ptr4)).Pointer.alignment == 4);
452 try expect(@typeInfo(@TypeOf(ptr4)).pointer.alignment == 4);
453453 }
454454 {
455455 var ptr: [*]align(8) [3]u8 = undefined;
......@@ -457,13 +457,13 @@ test "pointer-integer arithmetic affects the alignment" {
457457 _ = .{ &ptr, &x };
458458
459459 const ptr1 = ptr + 17; // 3 * 17 = 51
460 try expect(@typeInfo(@TypeOf(ptr1)).Pointer.alignment == 1);
460 try expect(@typeInfo(@TypeOf(ptr1)).pointer.alignment == 1);
461461 const ptr2 = ptr + x; // runtime-known addend
462 try expect(@typeInfo(@TypeOf(ptr2)).Pointer.alignment == 1);
462 try expect(@typeInfo(@TypeOf(ptr2)).pointer.alignment == 1);
463463 const ptr3 = ptr + 8; // 3 * 8 = 24 -> lcd(8,24) = 8
464 try expect(@typeInfo(@TypeOf(ptr3)).Pointer.alignment == 8);
464 try expect(@typeInfo(@TypeOf(ptr3)).pointer.alignment == 8);
465465 const ptr4 = ptr + 4; // 3 * 4 = 12 -> lcd(8,12) = 4
466 try expect(@typeInfo(@TypeOf(ptr4)).Pointer.alignment == 4);
466 try expect(@typeInfo(@TypeOf(ptr4)).pointer.alignment == 4);
467467 }
468468}
469469
......@@ -560,7 +560,7 @@ test "pointer to constant decl preserves alignment" {
560560 const aligned align(8) = @This(){ .a = 3, .b = 4 };
561561 };
562562
563 const alignment = @typeInfo(@TypeOf(&S.aligned)).Pointer.alignment;
563 const alignment = @typeInfo(@TypeOf(&S.aligned)).pointer.alignment;
564564 try std.testing.expect(alignment == 8);
565565}
566566
......@@ -641,24 +641,24 @@ const Box2 = struct {
641641
642642fn mutable() !void {
643643 var box0: Box0 = .{ .items = undefined };
644 try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).Pointer.is_const == false);
644 try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).pointer.is_const == false);
645645
646646 var box1: Box1 = .{ .items = undefined };
647 try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).Pointer.is_const == false);
647 try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).pointer.is_const == false);
648648
649649 var box2: Box2 = .{ .items = undefined };
650 try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).Pointer.is_const == false);
650 try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).pointer.is_const == false);
651651}
652652
653653fn constant() !void {
654654 const box0: Box0 = .{ .items = undefined };
655 try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).Pointer.is_const == true);
655 try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).pointer.is_const == true);
656656
657657 const box1: Box1 = .{ .items = undefined };
658 try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).Pointer.is_const == true);
658 try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).pointer.is_const == true);
659659
660660 const box2: Box2 = .{ .items = undefined };
661 try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).Pointer.is_const == true);
661 try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).pointer.is_const == true);
662662}
663663
664664test "pointer-to-array constness for zero-size elements, var" {
test/behavior/reflection.zig+1-1
......@@ -6,7 +6,7 @@ const reflection = @This();
66
77test "reflection: function return type, var args, and param types" {
88 comptime {
9 const info = @typeInfo(@TypeOf(dummy)).Fn;
9 const info = @typeInfo(@TypeOf(dummy)).@"fn";
1010 try expect(info.return_type.? == i32);
1111 try expect(!info.is_var_args);
1212 try expect(info.params.len == 3);
test/behavior/slice.zig+3-3
......@@ -329,9 +329,9 @@ test "empty array to slice" {
329329 const align_1: []align(1) u8 = empty;
330330 const align_4: []align(4) u8 = empty;
331331 const align_16: []align(16) u8 = empty;
332 try expect(1 == @typeInfo(@TypeOf(align_1)).Pointer.alignment);
333 try expect(4 == @typeInfo(@TypeOf(align_4)).Pointer.alignment);
334 try expect(16 == @typeInfo(@TypeOf(align_16)).Pointer.alignment);
332 try expect(1 == @typeInfo(@TypeOf(align_1)).pointer.alignment);
333 try expect(4 == @typeInfo(@TypeOf(align_4)).pointer.alignment);
334 try expect(16 == @typeInfo(@TypeOf(align_16)).pointer.alignment);
335335 }
336336 };
337337
test/behavior/struct.zig+3-3
......@@ -1738,7 +1738,7 @@ test "packed struct field in anonymous struct" {
17381738 try std.testing.expect(countFields(.{ .t = T{} }) == 1);
17391739}
17401740fn countFields(v: anytype) usize {
1741 return @typeInfo(@TypeOf(v)).Struct.fields.len;
1741 return @typeInfo(@TypeOf(v)).@"struct".fields.len;
17421742}
17431743
17441744test "struct init with no result pointer sets field result types" {
......@@ -2144,9 +2144,9 @@ test "struct containing optional pointer to array of @This()" {
21442144test "matching captures causes struct equivalence" {
21452145 const S = struct {
21462146 fn UnsignedWrapper(comptime I: type) type {
2147 const bits = @typeInfo(I).Int.bits;
2147 const bits = @typeInfo(I).int.bits;
21482148 return struct {
2149 x: @Type(.{ .Int = .{
2149 x: @Type(.{ .int = .{
21502150 .signedness = .unsigned,
21512151 .bits = bits,
21522152 } }),
test/behavior/tuple.zig+6-6
......@@ -32,16 +32,16 @@ test "tuple multiplication" {
3232 fn doTheTest() !void {
3333 {
3434 const t = .{} ** 4;
35 try expect(@typeInfo(@TypeOf(t)).Struct.fields.len == 0);
35 try expect(@typeInfo(@TypeOf(t)).@"struct".fields.len == 0);
3636 }
3737 {
3838 const t = .{'a'} ** 4;
39 try expect(@typeInfo(@TypeOf(t)).Struct.fields.len == 4);
39 try expect(@typeInfo(@TypeOf(t)).@"struct".fields.len == 4);
4040 inline for (t) |x| try expect(x == 'a');
4141 }
4242 {
4343 const t = .{ 1, 2, 3 } ** 4;
44 try expect(@typeInfo(@TypeOf(t)).Struct.fields.len == 12);
44 try expect(@typeInfo(@TypeOf(t)).@"struct".fields.len == 12);
4545 inline for (t, 0..) |x, i| try expect(x == 1 + i % 3);
4646 }
4747 }
......@@ -133,7 +133,7 @@ test "array-like initializer for tuple types" {
133133 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
134134
135135 const T = @Type(.{
136 .Struct = .{
136 .@"struct" = .{
137137 .is_tuple = true,
138138 .layout = .auto,
139139 .decls = &.{},
......@@ -323,7 +323,7 @@ test "zero sized struct in tuple handled correctly" {
323323 const State = struct {
324324 const Self = @This();
325325 data: @Type(.{
326 .Struct = .{
326 .@"struct" = .{
327327 .is_tuple = true,
328328 .layout = .auto,
329329 .decls = &.{},
......@@ -474,7 +474,7 @@ test "coerce anon tuple to tuple" {
474474}
475475
476476test "empty tuple type" {
477 const S = @Type(.{ .Struct = .{
477 const S = @Type(.{ .@"struct" = .{
478478 .layout = .auto,
479479 .fields = &.{},
480480 .decls = &.{},
test/behavior/tuple_declarations.zig+1-1
......@@ -10,7 +10,7 @@ test "tuple declaration type info" {
1010
1111 {
1212 const T = struct { comptime u32 align(2) = 1, []const u8 };
13 const info = @typeInfo(T).Struct;
13 const info = @typeInfo(T).@"struct";
1414
1515 try expect(info.layout == .auto);
1616 try expect(info.backing_integer == null);
test/behavior/type.zig+59-59
......@@ -11,32 +11,32 @@ fn testTypes(comptime types: []const type) !void {
1111}
1212
1313test "Type.MetaType" {
14 try testing.expect(type == @Type(.{ .Type = {} }));
14 try testing.expect(type == @Type(.{ .type = {} }));
1515 try testTypes(&[_]type{type});
1616}
1717
1818test "Type.Void" {
19 try testing.expect(void == @Type(.{ .Void = {} }));
19 try testing.expect(void == @Type(.{ .void = {} }));
2020 try testTypes(&[_]type{void});
2121}
2222
2323test "Type.Bool" {
24 try testing.expect(bool == @Type(.{ .Bool = {} }));
24 try testing.expect(bool == @Type(.{ .bool = {} }));
2525 try testTypes(&[_]type{bool});
2626}
2727
2828test "Type.NoReturn" {
29 try testing.expect(noreturn == @Type(.{ .NoReturn = {} }));
29 try testing.expect(noreturn == @Type(.{ .noreturn = {} }));
3030 try testTypes(&[_]type{noreturn});
3131}
3232
3333test "Type.Int" {
34 try testing.expect(u1 == @Type(.{ .Int = .{ .signedness = .unsigned, .bits = 1 } }));
35 try testing.expect(i1 == @Type(.{ .Int = .{ .signedness = .signed, .bits = 1 } }));
36 try testing.expect(u8 == @Type(.{ .Int = .{ .signedness = .unsigned, .bits = 8 } }));
37 try testing.expect(i8 == @Type(.{ .Int = .{ .signedness = .signed, .bits = 8 } }));
38 try testing.expect(u64 == @Type(.{ .Int = .{ .signedness = .unsigned, .bits = 64 } }));
39 try testing.expect(i64 == @Type(.{ .Int = .{ .signedness = .signed, .bits = 64 } }));
34 try testing.expect(u1 == @Type(.{ .int = .{ .signedness = .unsigned, .bits = 1 } }));
35 try testing.expect(i1 == @Type(.{ .int = .{ .signedness = .signed, .bits = 1 } }));
36 try testing.expect(u8 == @Type(.{ .int = .{ .signedness = .unsigned, .bits = 8 } }));
37 try testing.expect(i8 == @Type(.{ .int = .{ .signedness = .signed, .bits = 8 } }));
38 try testing.expect(u64 == @Type(.{ .int = .{ .signedness = .unsigned, .bits = 64 } }));
39 try testing.expect(i64 == @Type(.{ .int = .{ .signedness = .signed, .bits = 64 } }));
4040 try testTypes(&[_]type{ u8, u32, i64 });
4141}
4242
......@@ -105,31 +105,31 @@ test "Type.Pointer" {
105105}
106106
107107test "Type.Float" {
108 try testing.expect(f16 == @Type(.{ .Float = .{ .bits = 16 } }));
109 try testing.expect(f32 == @Type(.{ .Float = .{ .bits = 32 } }));
110 try testing.expect(f64 == @Type(.{ .Float = .{ .bits = 64 } }));
111 try testing.expect(f80 == @Type(.{ .Float = .{ .bits = 80 } }));
112 try testing.expect(f128 == @Type(.{ .Float = .{ .bits = 128 } }));
108 try testing.expect(f16 == @Type(.{ .float = .{ .bits = 16 } }));
109 try testing.expect(f32 == @Type(.{ .float = .{ .bits = 32 } }));
110 try testing.expect(f64 == @Type(.{ .float = .{ .bits = 64 } }));
111 try testing.expect(f80 == @Type(.{ .float = .{ .bits = 80 } }));
112 try testing.expect(f128 == @Type(.{ .float = .{ .bits = 128 } }));
113113 try testTypes(&[_]type{ f16, f32, f64, f80, f128 });
114114}
115115
116116test "Type.Array" {
117117 try testing.expect([123]u8 == @Type(.{
118 .Array = .{
118 .array = .{
119119 .len = 123,
120120 .child = u8,
121121 .sentinel = null,
122122 },
123123 }));
124124 try testing.expect([2]u32 == @Type(.{
125 .Array = .{
125 .array = .{
126126 .len = 2,
127127 .child = u32,
128128 .sentinel = null,
129129 },
130130 }));
131131 try testing.expect([2:0]u32 == @Type(.{
132 .Array = .{
132 .array = .{
133133 .len = 2,
134134 .child = u32,
135135 .sentinel = &@as(u32, 0),
......@@ -140,7 +140,7 @@ test "Type.Array" {
140140
141141test "@Type create slice with null sentinel" {
142142 const Slice = @Type(.{
143 .Pointer = .{
143 .pointer = .{
144144 .size = .Slice,
145145 .is_const = true,
146146 .is_volatile = false,
......@@ -205,7 +205,7 @@ test "Type.Opaque" {
205205 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
206206
207207 const Opaque = @Type(.{
208 .Opaque = .{
208 .@"opaque" = .{
209209 .decls = &.{},
210210 },
211211 });
......@@ -213,7 +213,7 @@ test "Type.Opaque" {
213213 try testing.expectEqualSlices(
214214 Type.Declaration,
215215 &.{},
216 @typeInfo(Opaque).Opaque.decls,
216 @typeInfo(Opaque).@"opaque".decls,
217217 );
218218}
219219
......@@ -246,7 +246,7 @@ fn add(a: i32, b: i32) i32 {
246246}
247247
248248test "Type.ErrorSet" {
249 try testing.expect(@Type(.{ .ErrorSet = null }) == anyerror);
249 try testing.expect(@Type(.{ .error_set = null }) == anyerror);
250250
251251 // error sets don't compare equal so just check if they compile
252252 inline for (.{ error{}, error{A}, error{ A, B, C } }) |T| {
......@@ -262,7 +262,7 @@ test "Type.Struct" {
262262 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
263263
264264 const A = @Type(@typeInfo(struct { x: u8, y: u32 }));
265 const infoA = @typeInfo(A).Struct;
265 const infoA = @typeInfo(A).@"struct";
266266 try testing.expectEqual(Type.ContainerLayout.auto, infoA.layout);
267267 try testing.expectEqualSlices(u8, "x", infoA.fields[0].name);
268268 try testing.expectEqual(u8, infoA.fields[0].type);
......@@ -280,7 +280,7 @@ test "Type.Struct" {
280280 try testing.expectEqual(@as(u32, 2), a.y);
281281
282282 const B = @Type(@typeInfo(extern struct { x: u8, y: u32 = 5 }));
283 const infoB = @typeInfo(B).Struct;
283 const infoB = @typeInfo(B).@"struct";
284284 try testing.expectEqual(Type.ContainerLayout.@"extern", infoB.layout);
285285 try testing.expectEqualSlices(u8, "x", infoB.fields[0].name);
286286 try testing.expectEqual(u8, infoB.fields[0].type);
......@@ -292,7 +292,7 @@ test "Type.Struct" {
292292 try testing.expectEqual(@as(bool, false), infoB.is_tuple);
293293
294294 const C = @Type(@typeInfo(packed struct { x: u8 = 3, y: u32 = 5 }));
295 const infoC = @typeInfo(C).Struct;
295 const infoC = @typeInfo(C).@"struct";
296296 try testing.expectEqual(Type.ContainerLayout.@"packed", infoC.layout);
297297 try testing.expectEqualSlices(u8, "x", infoC.fields[0].name);
298298 try testing.expectEqual(u8, infoC.fields[0].type);
......@@ -305,7 +305,7 @@ test "Type.Struct" {
305305
306306 // anon structs
307307 const D = @Type(@typeInfo(@TypeOf(.{ .x = 3, .y = 5 })));
308 const infoD = @typeInfo(D).Struct;
308 const infoD = @typeInfo(D).@"struct";
309309 try testing.expectEqual(Type.ContainerLayout.auto, infoD.layout);
310310 try testing.expectEqualSlices(u8, "x", infoD.fields[0].name);
311311 try testing.expectEqual(comptime_int, infoD.fields[0].type);
......@@ -318,7 +318,7 @@ test "Type.Struct" {
318318
319319 // tuples
320320 const E = @Type(@typeInfo(@TypeOf(.{ 1, 2 })));
321 const infoE = @typeInfo(E).Struct;
321 const infoE = @typeInfo(E).@"struct";
322322 try testing.expectEqual(Type.ContainerLayout.auto, infoE.layout);
323323 try testing.expectEqualSlices(u8, "0", infoE.fields[0].name);
324324 try testing.expectEqual(comptime_int, infoE.fields[0].type);
......@@ -331,14 +331,14 @@ test "Type.Struct" {
331331
332332 // empty struct
333333 const F = @Type(@typeInfo(struct {}));
334 const infoF = @typeInfo(F).Struct;
334 const infoF = @typeInfo(F).@"struct";
335335 try testing.expectEqual(Type.ContainerLayout.auto, infoF.layout);
336336 try testing.expect(infoF.fields.len == 0);
337337 try testing.expectEqual(@as(bool, false), infoF.is_tuple);
338338
339339 // empty tuple
340340 const G = @Type(@typeInfo(@TypeOf(.{})));
341 const infoG = @typeInfo(G).Struct;
341 const infoG = @typeInfo(G).@"struct";
342342 try testing.expectEqual(Type.ContainerLayout.auto, infoG.layout);
343343 try testing.expect(infoG.fields.len == 0);
344344 try testing.expectEqual(@as(bool, true), infoG.is_tuple);
......@@ -349,7 +349,7 @@ test "Type.Enum" {
349349 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
350350
351351 const Foo = @Type(.{
352 .Enum = .{
352 .@"enum" = .{
353353 .tag_type = u8,
354354 .fields = &.{
355355 .{ .name = "a", .value = 1 },
......@@ -359,11 +359,11 @@ test "Type.Enum" {
359359 .is_exhaustive = true,
360360 },
361361 });
362 try testing.expectEqual(true, @typeInfo(Foo).Enum.is_exhaustive);
362 try testing.expectEqual(true, @typeInfo(Foo).@"enum".is_exhaustive);
363363 try testing.expectEqual(@as(u8, 1), @intFromEnum(Foo.a));
364364 try testing.expectEqual(@as(u8, 5), @intFromEnum(Foo.b));
365365 const Bar = @Type(.{
366 .Enum = .{
366 .@"enum" = .{
367367 .tag_type = u32,
368368 .fields = &.{
369369 .{ .name = "a", .value = 1 },
......@@ -373,7 +373,7 @@ test "Type.Enum" {
373373 .is_exhaustive = false,
374374 },
375375 });
376 try testing.expectEqual(false, @typeInfo(Bar).Enum.is_exhaustive);
376 try testing.expectEqual(false, @typeInfo(Bar).@"enum".is_exhaustive);
377377 try testing.expectEqual(@as(u32, 1), @intFromEnum(Bar.a));
378378 try testing.expectEqual(@as(u32, 5), @intFromEnum(Bar.b));
379379 try testing.expectEqual(@as(u32, 6), @intFromEnum(@as(Bar, @enumFromInt(6))));
......@@ -385,7 +385,7 @@ test "Type.Union" {
385385 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
386386
387387 const Untagged = @Type(.{
388 .Union = .{
388 .@"union" = .{
389389 .layout = .@"extern",
390390 .tag_type = null,
391391 .fields = &.{
......@@ -401,7 +401,7 @@ test "Type.Union" {
401401 try testing.expectEqual(@as(i32, 3), untagged.int);
402402
403403 const PackedUntagged = @Type(.{
404 .Union = .{
404 .@"union" = .{
405405 .layout = .@"packed",
406406 .tag_type = null,
407407 .fields = &.{
......@@ -417,7 +417,7 @@ test "Type.Union" {
417417 try testing.expectEqual(~@as(u32, 0), packed_untagged.unsigned);
418418
419419 const Tag = @Type(.{
420 .Enum = .{
420 .@"enum" = .{
421421 .tag_type = u1,
422422 .fields = &.{
423423 .{ .name = "signed", .value = 0 },
......@@ -428,7 +428,7 @@ test "Type.Union" {
428428 },
429429 });
430430 const Tagged = @Type(.{
431 .Union = .{
431 .@"union" = .{
432432 .layout = .auto,
433433 .tag_type = Tag,
434434 .fields = &.{
......@@ -446,7 +446,7 @@ test "Type.Union" {
446446
447447test "Type.Union from Type.Enum" {
448448 const Tag = @Type(.{
449 .Enum = .{
449 .@"enum" = .{
450450 .tag_type = u0,
451451 .fields = &.{
452452 .{ .name = "working_as_expected", .value = 0 },
......@@ -456,7 +456,7 @@ test "Type.Union from Type.Enum" {
456456 },
457457 });
458458 const T = @Type(.{
459 .Union = .{
459 .@"union" = .{
460460 .layout = .auto,
461461 .tag_type = Tag,
462462 .fields = &.{
......@@ -465,13 +465,13 @@ test "Type.Union from Type.Enum" {
465465 .decls = &.{},
466466 },
467467 });
468 _ = @typeInfo(T).Union;
468 _ = @typeInfo(T).@"union";
469469}
470470
471471test "Type.Union from regular enum" {
472472 const E = enum { working_as_expected };
473473 const T = @Type(.{
474 .Union = .{
474 .@"union" = .{
475475 .layout = .auto,
476476 .tag_type = E,
477477 .fields = &.{
......@@ -480,13 +480,13 @@ test "Type.Union from regular enum" {
480480 .decls = &.{},
481481 },
482482 });
483 _ = @typeInfo(T).Union;
483 _ = @typeInfo(T).@"union";
484484}
485485
486486test "Type.Union from empty regular enum" {
487487 const E = enum {};
488488 const U = @Type(.{
489 .Union = .{
489 .@"union" = .{
490490 .layout = .auto,
491491 .tag_type = E,
492492 .fields = &.{},
......@@ -498,7 +498,7 @@ test "Type.Union from empty regular enum" {
498498
499499test "Type.Union from empty Type.Enum" {
500500 const E = @Type(.{
501 .Enum = .{
501 .@"enum" = .{
502502 .tag_type = u0,
503503 .fields = &.{},
504504 .decls = &.{},
......@@ -506,7 +506,7 @@ test "Type.Union from empty Type.Enum" {
506506 },
507507 });
508508 const U = @Type(.{
509 .Union = .{
509 .@"union" = .{
510510 .layout = .auto,
511511 .tag_type = E,
512512 .fields = &.{},
......@@ -525,7 +525,7 @@ test "Type.Fn" {
525525 const T = fn (c_int, some_ptr) callconv(.C) void;
526526
527527 {
528 const fn_info = std.builtin.Type{ .Fn = .{
528 const fn_info = std.builtin.Type{ .@"fn" = .{
529529 .calling_convention = .C,
530530 .is_generic = false,
531531 .is_var_args = false,
......@@ -551,7 +551,7 @@ test "reified struct field name from optional payload" {
551551 comptime {
552552 const m_name: ?[1:0]u8 = "a".*;
553553 if (m_name) |*name| {
554 const T = @Type(.{ .Struct = .{
554 const T = @Type(.{ .@"struct" = .{
555555 .layout = .auto,
556556 .fields = &.{.{
557557 .name = name,
......@@ -573,7 +573,7 @@ test "reified union uses @alignOf" {
573573 const S = struct {
574574 fn CreateUnion(comptime T: type) type {
575575 return @Type(.{
576 .Union = .{
576 .@"union" = .{
577577 .layout = .auto,
578578 .tag_type = null,
579579 .fields = &[_]std.builtin.Type.UnionField{
......@@ -595,7 +595,7 @@ test "reified struct uses @alignOf" {
595595 const S = struct {
596596 fn NamespacedGlobals(comptime modules: anytype) type {
597597 return @Type(.{
598 .Struct = .{
598 .@"struct" = .{
599599 .layout = .auto,
600600 .is_tuple = false,
601601 .fields = &.{
......@@ -627,7 +627,7 @@ test "reified error set initialized with field pointer" {
627627 },
628628 };
629629 const Foo = @Type(.{
630 .ErrorSet = &info.args,
630 .error_set = &info.args,
631631 });
632632 };
633633 try testing.expect(S.Foo == error{bar});
......@@ -640,7 +640,7 @@ test "reified function type params initialized with field pointer" {
640640 },
641641 };
642642 const Bar = @Type(.{
643 .Fn = .{
643 .@"fn" = .{
644644 .calling_convention = .Unspecified,
645645 .is_generic = false,
646646 .is_var_args = false,
......@@ -649,14 +649,14 @@ test "reified function type params initialized with field pointer" {
649649 },
650650 });
651651 };
652 try testing.expect(@typeInfo(S.Bar) == .Fn);
652 try testing.expect(@typeInfo(S.Bar) == .@"fn");
653653}
654654
655655test "empty struct assigned to reified struct field" {
656656 const S = struct {
657657 fn NamespacedComponents(comptime modules: anytype) type {
658658 return @Type(.{
659 .Struct = .{
659 .@"struct" = .{
660660 .layout = .auto,
661661 .is_tuple = false,
662662 .fields = &.{.{
......@@ -689,7 +689,7 @@ test "@Type should resolve its children types" {
689689 const dense = enum(u2) { a, b, c, d };
690690
691691 comptime var sparse_info = @typeInfo(anyerror!sparse);
692 sparse_info.ErrorUnion.payload = dense;
692 sparse_info.error_union.payload = dense;
693693 const B = @Type(sparse_info);
694694 try testing.expectEqual(anyerror!dense, B);
695695}
......@@ -718,7 +718,7 @@ test "struct field names sliced at comptime from larger string" {
718718 }
719719
720720 const T = @Type(.{
721 .Struct = .{
721 .@"struct" = .{
722722 .layout = .auto,
723723 .is_tuple = false,
724724 .fields = fields,
......@@ -726,7 +726,7 @@ test "struct field names sliced at comptime from larger string" {
726726 },
727727 });
728728
729 const gen_fields = @typeInfo(T).Struct.fields;
729 const gen_fields = @typeInfo(T).@"struct".fields;
730730 try testing.expectEqual(3, gen_fields.len);
731731 try testing.expectEqualStrings("f1", gen_fields[0].name);
732732 try testing.expectEqualStrings("f2", gen_fields[1].name);
......@@ -737,9 +737,9 @@ test "struct field names sliced at comptime from larger string" {
737737test "matching captures causes opaque equivalence" {
738738 const S = struct {
739739 fn UnsignedId(comptime I: type) type {
740 const U = @Type(.{ .Int = .{
740 const U = @Type(.{ .int = .{
741741 .signedness = .unsigned,
742 .bits = @typeInfo(I).Int.bits,
742 .bits = @typeInfo(I).int.bits,
743743 } });
744744 return opaque {
745745 fn id(x: U) U {
......@@ -765,7 +765,7 @@ test "reify enum where fields refers to part of array" {
765765 .{ .name = "bar", .value = 1 },
766766 undefined,
767767 };
768 const E = @Type(.{ .Enum = .{
768 const E = @Type(.{ .@"enum" = .{
769769 .tag_type = u8,
770770 .fields = fields[0..2],
771771 .decls = &.{},
test/behavior/type_info.zig+175-175
......@@ -16,13 +16,13 @@ test "type info: integer, floating point type info" {
1616
1717fn testIntFloat() !void {
1818 const u8_info = @typeInfo(u8);
19 try expect(u8_info == .Int);
20 try expect(u8_info.Int.signedness == .unsigned);
21 try expect(u8_info.Int.bits == 8);
19 try expect(u8_info == .int);
20 try expect(u8_info.int.signedness == .unsigned);
21 try expect(u8_info.int.bits == 8);
2222
2323 const f64_info = @typeInfo(f64);
24 try expect(f64_info == .Float);
25 try expect(f64_info.Float.bits == 64);
24 try expect(f64_info == .float);
25 try expect(f64_info.float.bits == 64);
2626}
2727
2828test "type info: optional type info" {
......@@ -32,8 +32,8 @@ test "type info: optional type info" {
3232
3333fn testOptional() !void {
3434 const null_info = @typeInfo(?void);
35 try expect(null_info == .Optional);
36 try expect(null_info.Optional.child == void);
35 try expect(null_info == .optional);
36 try expect(null_info.optional.child == void);
3737}
3838
3939test "type info: C pointer type info" {
......@@ -43,19 +43,19 @@ test "type info: C pointer type info" {
4343
4444fn testCPtr() !void {
4545 const ptr_info = @typeInfo([*c]align(4) const i8);
46 try expect(ptr_info == .Pointer);
47 try expect(ptr_info.Pointer.size == .C);
48 try expect(ptr_info.Pointer.is_const);
49 try expect(!ptr_info.Pointer.is_volatile);
50 try expect(ptr_info.Pointer.alignment == 4);
51 try expect(ptr_info.Pointer.child == i8);
46 try expect(ptr_info == .pointer);
47 try expect(ptr_info.pointer.size == .C);
48 try expect(ptr_info.pointer.is_const);
49 try expect(!ptr_info.pointer.is_volatile);
50 try expect(ptr_info.pointer.alignment == 4);
51 try expect(ptr_info.pointer.child == i8);
5252}
5353
5454test "type info: value is correctly copied" {
5555 comptime {
5656 var ptrInfo = @typeInfo([]u32);
57 ptrInfo.Pointer.size = .One;
58 try expect(@typeInfo([]u32).Pointer.size == .Slice);
57 ptrInfo.pointer.size = .One;
58 try expect(@typeInfo([]u32).pointer.size == .Slice);
5959 }
6060}
6161
......@@ -65,10 +65,10 @@ test "type info: tag type, void info" {
6565}
6666
6767fn testBasic() !void {
68 try expect(@typeInfo(Type).Union.tag_type == TypeId);
68 try expect(@typeInfo(Type).@"union".tag_type == TypeId);
6969 const void_info = @typeInfo(void);
70 try expect(void_info == TypeId.Void);
71 try expect(void_info.Void == {});
70 try expect(void_info == TypeId.void);
71 try expect(void_info.void == {});
7272}
7373
7474test "type info: pointer type info" {
......@@ -78,13 +78,13 @@ test "type info: pointer type info" {
7878
7979fn testPointer() !void {
8080 const u32_ptr_info = @typeInfo(*u32);
81 try expect(u32_ptr_info == .Pointer);
82 try expect(u32_ptr_info.Pointer.size == .One);
83 try expect(u32_ptr_info.Pointer.is_const == false);
84 try expect(u32_ptr_info.Pointer.is_volatile == false);
85 try expect(u32_ptr_info.Pointer.alignment == @alignOf(u32));
86 try expect(u32_ptr_info.Pointer.child == u32);
87 try expect(u32_ptr_info.Pointer.sentinel == null);
81 try expect(u32_ptr_info == .pointer);
82 try expect(u32_ptr_info.pointer.size == .One);
83 try expect(u32_ptr_info.pointer.is_const == false);
84 try expect(u32_ptr_info.pointer.is_volatile == false);
85 try expect(u32_ptr_info.pointer.alignment == @alignOf(u32));
86 try expect(u32_ptr_info.pointer.child == u32);
87 try expect(u32_ptr_info.pointer.sentinel == null);
8888}
8989
9090test "type info: unknown length pointer type info" {
......@@ -94,13 +94,13 @@ test "type info: unknown length pointer type info" {
9494
9595fn testUnknownLenPtr() !void {
9696 const u32_ptr_info = @typeInfo([*]const volatile f64);
97 try expect(u32_ptr_info == .Pointer);
98 try expect(u32_ptr_info.Pointer.size == .Many);
99 try expect(u32_ptr_info.Pointer.is_const == true);
100 try expect(u32_ptr_info.Pointer.is_volatile == true);
101 try expect(u32_ptr_info.Pointer.sentinel == null);
102 try expect(u32_ptr_info.Pointer.alignment == @alignOf(f64));
103 try expect(u32_ptr_info.Pointer.child == f64);
97 try expect(u32_ptr_info == .pointer);
98 try expect(u32_ptr_info.pointer.size == .Many);
99 try expect(u32_ptr_info.pointer.is_const == true);
100 try expect(u32_ptr_info.pointer.is_volatile == true);
101 try expect(u32_ptr_info.pointer.sentinel == null);
102 try expect(u32_ptr_info.pointer.alignment == @alignOf(f64));
103 try expect(u32_ptr_info.pointer.child == f64);
104104}
105105
106106test "type info: null terminated pointer type info" {
......@@ -110,13 +110,13 @@ test "type info: null terminated pointer type info" {
110110
111111fn testNullTerminatedPtr() !void {
112112 const ptr_info = @typeInfo([*:0]u8);
113 try expect(ptr_info == .Pointer);
114 try expect(ptr_info.Pointer.size == .Many);
115 try expect(ptr_info.Pointer.is_const == false);
116 try expect(ptr_info.Pointer.is_volatile == false);
117 try expect(@as(*const u8, @ptrCast(ptr_info.Pointer.sentinel.?)).* == 0);
113 try expect(ptr_info == .pointer);
114 try expect(ptr_info.pointer.size == .Many);
115 try expect(ptr_info.pointer.is_const == false);
116 try expect(ptr_info.pointer.is_volatile == false);
117 try expect(@as(*const u8, @ptrCast(ptr_info.pointer.sentinel.?)).* == 0);
118118
119 try expect(@typeInfo([:0]u8).Pointer.sentinel != null);
119 try expect(@typeInfo([:0]u8).pointer.sentinel != null);
120120}
121121
122122test "type info: slice type info" {
......@@ -126,12 +126,12 @@ test "type info: slice type info" {
126126
127127fn testSlice() !void {
128128 const u32_slice_info = @typeInfo([]u32);
129 try expect(u32_slice_info == .Pointer);
130 try expect(u32_slice_info.Pointer.size == .Slice);
131 try expect(u32_slice_info.Pointer.is_const == false);
132 try expect(u32_slice_info.Pointer.is_volatile == false);
133 try expect(u32_slice_info.Pointer.alignment == 4);
134 try expect(u32_slice_info.Pointer.child == u32);
129 try expect(u32_slice_info == .pointer);
130 try expect(u32_slice_info.pointer.size == .Slice);
131 try expect(u32_slice_info.pointer.is_const == false);
132 try expect(u32_slice_info.pointer.is_volatile == false);
133 try expect(u32_slice_info.pointer.alignment == 4);
134 try expect(u32_slice_info.pointer.child == u32);
135135}
136136
137137test "type info: array type info" {
......@@ -142,18 +142,18 @@ test "type info: array type info" {
142142fn testArray() !void {
143143 {
144144 const info = @typeInfo([42]u8);
145 try expect(info == .Array);
146 try expect(info.Array.len == 42);
147 try expect(info.Array.child == u8);
148 try expect(info.Array.sentinel == null);
145 try expect(info == .array);
146 try expect(info.array.len == 42);
147 try expect(info.array.child == u8);
148 try expect(info.array.sentinel == null);
149149 }
150150
151151 {
152152 const info = @typeInfo([10:0]u8);
153 try expect(info.Array.len == 10);
154 try expect(info.Array.child == u8);
155 try expect(@as(*const u8, @ptrCast(info.Array.sentinel.?)).* == @as(u8, 0));
156 try expect(@sizeOf([10:0]u8) == info.Array.len + 1);
153 try expect(info.array.len == 10);
154 try expect(info.array.child == u8);
155 try expect(@as(*const u8, @ptrCast(info.array.sentinel.?)).* == @as(u8, 0));
156 try expect(@sizeOf([10:0]u8) == info.array.len + 1);
157157 }
158158}
159159
......@@ -174,18 +174,18 @@ fn testErrorSet() !void {
174174 };
175175
176176 const error_set_info = @typeInfo(TestErrorSet);
177 try expect(error_set_info == .ErrorSet);
178 try expect(error_set_info.ErrorSet.?.len == 3);
179 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "First"));
177 try expect(error_set_info == .error_set);
178 try expect(error_set_info.error_set.?.len == 3);
179 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "First"));
180180
181181 const error_union_info = @typeInfo(TestErrorSet!usize);
182 try expect(error_union_info == .ErrorUnion);
183 try expect(error_union_info.ErrorUnion.error_set == TestErrorSet);
184 try expect(error_union_info.ErrorUnion.payload == usize);
182 try expect(error_union_info == .error_union);
183 try expect(error_union_info.error_union.error_set == TestErrorSet);
184 try expect(error_union_info.error_union.payload == usize);
185185
186186 const global_info = @typeInfo(anyerror);
187 try expect(global_info == .ErrorSet);
188 try expect(global_info.ErrorSet == null);
187 try expect(global_info == .error_set);
188 try expect(global_info.error_set == null);
189189}
190190
191191test "type info: error set single value" {
......@@ -196,9 +196,9 @@ test "type info: error set single value" {
196196 const TestSet = error.One;
197197
198198 const error_set_info = @typeInfo(@TypeOf(TestSet));
199 try expect(error_set_info == .ErrorSet);
200 try expect(error_set_info.ErrorSet.?.len == 1);
201 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
199 try expect(error_set_info == .error_set);
200 try expect(error_set_info.error_set.?.len == 1);
201 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
202202}
203203
204204test "type info: error set merged" {
......@@ -209,11 +209,11 @@ test "type info: error set merged" {
209209 const TestSet = error{ One, Two } || error{Three};
210210
211211 const error_set_info = @typeInfo(TestSet);
212 try expect(error_set_info == .ErrorSet);
213 try expect(error_set_info.ErrorSet.?.len == 3);
214 try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
215 try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
216 try expect(mem.eql(u8, error_set_info.ErrorSet.?[2].name, "Three"));
212 try expect(error_set_info == .error_set);
213 try expect(error_set_info.error_set.?.len == 3);
214 try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
215 try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
216 try expect(mem.eql(u8, error_set_info.error_set.?[2].name, "Three"));
217217}
218218
219219test "type info: enum info" {
......@@ -234,12 +234,12 @@ fn testEnum() !void {
234234 };
235235
236236 const os_info = @typeInfo(Os);
237 try expect(os_info == .Enum);
238 try expect(os_info.Enum.fields.len == 4);
239 try expect(mem.eql(u8, os_info.Enum.fields[1].name, "Macos"));
240 try expect(os_info.Enum.fields[3].value == 3);
241 try expect(os_info.Enum.tag_type == u2);
242 try expect(os_info.Enum.decls.len == 0);
237 try expect(os_info == .@"enum");
238 try expect(os_info.@"enum".fields.len == 4);
239 try expect(mem.eql(u8, os_info.@"enum".fields[1].name, "Macos"));
240 try expect(os_info.@"enum".fields[3].value == 3);
241 try expect(os_info.@"enum".tag_type == u2);
242 try expect(os_info.@"enum".decls.len == 0);
243243}
244244
245245test "type info: union info" {
......@@ -249,12 +249,12 @@ test "type info: union info" {
249249
250250fn testUnion() !void {
251251 const typeinfo_info = @typeInfo(Type);
252 try expect(typeinfo_info == .Union);
253 try expect(typeinfo_info.Union.layout == .auto);
254 try expect(typeinfo_info.Union.tag_type.? == TypeId);
255 try expect(typeinfo_info.Union.fields.len == 24);
256 try expect(typeinfo_info.Union.fields[4].type == @TypeOf(@typeInfo(u8).Int));
257 try expect(typeinfo_info.Union.decls.len == 21);
252 try expect(typeinfo_info == .@"union");
253 try expect(typeinfo_info.@"union".layout == .auto);
254 try expect(typeinfo_info.@"union".tag_type.? == TypeId);
255 try expect(typeinfo_info.@"union".fields.len == 24);
256 try expect(typeinfo_info.@"union".fields[4].type == @TypeOf(@typeInfo(u8).int));
257 try expect(typeinfo_info.@"union".decls.len == 21);
258258
259259 const TestNoTagUnion = union {
260260 Foo: void,
......@@ -262,22 +262,22 @@ fn testUnion() !void {
262262 };
263263
264264 const notag_union_info = @typeInfo(TestNoTagUnion);
265 try expect(notag_union_info == .Union);
266 try expect(notag_union_info.Union.tag_type == null);
267 try expect(notag_union_info.Union.layout == .auto);
268 try expect(notag_union_info.Union.fields.len == 2);
269 try expect(notag_union_info.Union.fields[0].alignment == @alignOf(void));
270 try expect(notag_union_info.Union.fields[1].type == u32);
271 try expect(notag_union_info.Union.fields[1].alignment == @alignOf(u32));
265 try expect(notag_union_info == .@"union");
266 try expect(notag_union_info.@"union".tag_type == null);
267 try expect(notag_union_info.@"union".layout == .auto);
268 try expect(notag_union_info.@"union".fields.len == 2);
269 try expect(notag_union_info.@"union".fields[0].alignment == @alignOf(void));
270 try expect(notag_union_info.@"union".fields[1].type == u32);
271 try expect(notag_union_info.@"union".fields[1].alignment == @alignOf(u32));
272272
273273 const TestExternUnion = extern union {
274274 foo: *anyopaque,
275275 };
276276
277277 const extern_union_info = @typeInfo(TestExternUnion);
278 try expect(extern_union_info.Union.layout == .@"extern");
279 try expect(extern_union_info.Union.tag_type == null);
280 try expect(extern_union_info.Union.fields[0].type == *anyopaque);
278 try expect(extern_union_info.@"union".layout == .@"extern");
279 try expect(extern_union_info.@"union".tag_type == null);
280 try expect(extern_union_info.@"union".fields[0].type == *anyopaque);
281281}
282282
283283test "type info: struct info" {
......@@ -289,11 +289,11 @@ test "type info: struct info" {
289289
290290fn testStruct() !void {
291291 const unpacked_struct_info = @typeInfo(TestStruct);
292 try expect(unpacked_struct_info.Struct.is_tuple == false);
293 try expect(unpacked_struct_info.Struct.backing_integer == null);
294 try expect(unpacked_struct_info.Struct.fields[0].alignment == @alignOf(u32));
295 try expect(@as(*align(1) const u32, @ptrCast(unpacked_struct_info.Struct.fields[0].default_value.?)).* == 4);
296 try expect(mem.eql(u8, "foobar", @as(*align(1) const *const [6:0]u8, @ptrCast(unpacked_struct_info.Struct.fields[1].default_value.?)).*));
292 try expect(unpacked_struct_info.@"struct".is_tuple == false);
293 try expect(unpacked_struct_info.@"struct".backing_integer == null);
294 try expect(unpacked_struct_info.@"struct".fields[0].alignment == @alignOf(u32));
295 try expect(@as(*align(1) const u32, @ptrCast(unpacked_struct_info.@"struct".fields[0].default_value.?)).* == 4);
296 try expect(mem.eql(u8, "foobar", @as(*align(1) const *const [6:0]u8, @ptrCast(unpacked_struct_info.@"struct".fields[1].default_value.?)).*));
297297}
298298
299299const TestStruct = struct {
......@@ -308,17 +308,17 @@ test "type info: packed struct info" {
308308
309309fn testPackedStruct() !void {
310310 const struct_info = @typeInfo(TestPackedStruct);
311 try expect(struct_info == .Struct);
312 try expect(struct_info.Struct.is_tuple == false);
313 try expect(struct_info.Struct.layout == .@"packed");
314 try expect(struct_info.Struct.backing_integer == u128);
315 try expect(struct_info.Struct.fields.len == 4);
316 try expect(struct_info.Struct.fields[0].alignment == 0);
317 try expect(struct_info.Struct.fields[2].type == f32);
318 try expect(struct_info.Struct.fields[2].default_value == null);
319 try expect(@as(*align(1) const u32, @ptrCast(struct_info.Struct.fields[3].default_value.?)).* == 4);
320 try expect(struct_info.Struct.fields[3].alignment == 0);
321 try expect(struct_info.Struct.decls.len == 1);
311 try expect(struct_info == .@"struct");
312 try expect(struct_info.@"struct".is_tuple == false);
313 try expect(struct_info.@"struct".layout == .@"packed");
314 try expect(struct_info.@"struct".backing_integer == u128);
315 try expect(struct_info.@"struct".fields.len == 4);
316 try expect(struct_info.@"struct".fields[0].alignment == 0);
317 try expect(struct_info.@"struct".fields[2].type == f32);
318 try expect(struct_info.@"struct".fields[2].default_value == null);
319 try expect(@as(*align(1) const u32, @ptrCast(struct_info.@"struct".fields[3].default_value.?)).* == 4);
320 try expect(struct_info.@"struct".fields[3].alignment == 0);
321 try expect(struct_info.@"struct".decls.len == 1);
322322}
323323
324324const TestPackedStruct = packed struct {
......@@ -345,7 +345,7 @@ fn testOpaque() !void {
345345 };
346346
347347 const foo_info = @typeInfo(Foo);
348 try expect(foo_info.Opaque.decls.len == 2);
348 try expect(foo_info.@"opaque".decls.len == 2);
349349}
350350
351351test "type info: function type info" {
......@@ -358,36 +358,36 @@ test "type info: function type info" {
358358fn testFunction() !void {
359359 const foo_fn_type = @TypeOf(typeInfoFoo);
360360 const foo_fn_info = @typeInfo(foo_fn_type);
361 try expect(foo_fn_info.Fn.calling_convention == .C);
362 try expect(!foo_fn_info.Fn.is_generic);
363 try expect(foo_fn_info.Fn.params.len == 2);
364 try expect(foo_fn_info.Fn.is_var_args);
365 try expect(foo_fn_info.Fn.return_type.? == usize);
361 try expect(foo_fn_info.@"fn".calling_convention == .C);
362 try expect(!foo_fn_info.@"fn".is_generic);
363 try expect(foo_fn_info.@"fn".params.len == 2);
364 try expect(foo_fn_info.@"fn".is_var_args);
365 try expect(foo_fn_info.@"fn".return_type.? == usize);
366366 const foo_ptr_fn_info = @typeInfo(@TypeOf(&typeInfoFoo));
367 try expect(foo_ptr_fn_info.Pointer.size == .One);
368 try expect(foo_ptr_fn_info.Pointer.is_const);
369 try expect(!foo_ptr_fn_info.Pointer.is_volatile);
370 try expect(foo_ptr_fn_info.Pointer.address_space == .generic);
371 try expect(foo_ptr_fn_info.Pointer.child == foo_fn_type);
372 try expect(!foo_ptr_fn_info.Pointer.is_allowzero);
373 try expect(foo_ptr_fn_info.Pointer.sentinel == null);
367 try expect(foo_ptr_fn_info.pointer.size == .One);
368 try expect(foo_ptr_fn_info.pointer.is_const);
369 try expect(!foo_ptr_fn_info.pointer.is_volatile);
370 try expect(foo_ptr_fn_info.pointer.address_space == .generic);
371 try expect(foo_ptr_fn_info.pointer.child == foo_fn_type);
372 try expect(!foo_ptr_fn_info.pointer.is_allowzero);
373 try expect(foo_ptr_fn_info.pointer.sentinel == null);
374374
375375 const aligned_foo_fn_type = @TypeOf(typeInfoFooAligned);
376376 const aligned_foo_fn_info = @typeInfo(aligned_foo_fn_type);
377 try expect(aligned_foo_fn_info.Fn.calling_convention == .C);
378 try expect(!aligned_foo_fn_info.Fn.is_generic);
379 try expect(aligned_foo_fn_info.Fn.params.len == 2);
380 try expect(aligned_foo_fn_info.Fn.is_var_args);
381 try expect(aligned_foo_fn_info.Fn.return_type.? == usize);
377 try expect(aligned_foo_fn_info.@"fn".calling_convention == .C);
378 try expect(!aligned_foo_fn_info.@"fn".is_generic);
379 try expect(aligned_foo_fn_info.@"fn".params.len == 2);
380 try expect(aligned_foo_fn_info.@"fn".is_var_args);
381 try expect(aligned_foo_fn_info.@"fn".return_type.? == usize);
382382 const aligned_foo_ptr_fn_info = @typeInfo(@TypeOf(&typeInfoFooAligned));
383 try expect(aligned_foo_ptr_fn_info.Pointer.size == .One);
384 try expect(aligned_foo_ptr_fn_info.Pointer.is_const);
385 try expect(!aligned_foo_ptr_fn_info.Pointer.is_volatile);
386 try expect(aligned_foo_ptr_fn_info.Pointer.alignment == 4);
387 try expect(aligned_foo_ptr_fn_info.Pointer.address_space == .generic);
388 try expect(aligned_foo_ptr_fn_info.Pointer.child == aligned_foo_fn_type);
389 try expect(!aligned_foo_ptr_fn_info.Pointer.is_allowzero);
390 try expect(aligned_foo_ptr_fn_info.Pointer.sentinel == null);
383 try expect(aligned_foo_ptr_fn_info.pointer.size == .One);
384 try expect(aligned_foo_ptr_fn_info.pointer.is_const);
385 try expect(!aligned_foo_ptr_fn_info.pointer.is_volatile);
386 try expect(aligned_foo_ptr_fn_info.pointer.alignment == 4);
387 try expect(aligned_foo_ptr_fn_info.pointer.address_space == .generic);
388 try expect(aligned_foo_ptr_fn_info.pointer.child == aligned_foo_fn_type);
389 try expect(!aligned_foo_ptr_fn_info.pointer.is_allowzero);
390 try expect(aligned_foo_ptr_fn_info.pointer.sentinel == null);
391391}
392392
393393extern fn typeInfoFoo(a: usize, b: bool, ...) callconv(.C) usize;
......@@ -395,32 +395,32 @@ extern fn typeInfoFooAligned(a: usize, b: bool, ...) align(4) callconv(.C) usize
395395
396396test "type info: generic function types" {
397397 const G1 = @typeInfo(@TypeOf(generic1));
398 try expect(G1.Fn.params.len == 1);
399 try expect(G1.Fn.params[0].is_generic == true);
400 try expect(G1.Fn.params[0].type == null);
401 try expect(G1.Fn.return_type == void);
398 try expect(G1.@"fn".params.len == 1);
399 try expect(G1.@"fn".params[0].is_generic == true);
400 try expect(G1.@"fn".params[0].type == null);
401 try expect(G1.@"fn".return_type == void);
402402
403403 const G2 = @typeInfo(@TypeOf(generic2));
404 try expect(G2.Fn.params.len == 3);
405 try expect(G2.Fn.params[0].is_generic == false);
406 try expect(G2.Fn.params[0].type == type);
407 try expect(G2.Fn.params[1].is_generic == true);
408 try expect(G2.Fn.params[1].type == null);
409 try expect(G2.Fn.params[2].is_generic == false);
410 try expect(G2.Fn.params[2].type == u8);
411 try expect(G2.Fn.return_type == void);
404 try expect(G2.@"fn".params.len == 3);
405 try expect(G2.@"fn".params[0].is_generic == false);
406 try expect(G2.@"fn".params[0].type == type);
407 try expect(G2.@"fn".params[1].is_generic == true);
408 try expect(G2.@"fn".params[1].type == null);
409 try expect(G2.@"fn".params[2].is_generic == false);
410 try expect(G2.@"fn".params[2].type == u8);
411 try expect(G2.@"fn".return_type == void);
412412
413413 const G3 = @typeInfo(@TypeOf(generic3));
414 try expect(G3.Fn.params.len == 1);
415 try expect(G3.Fn.params[0].is_generic == true);
416 try expect(G3.Fn.params[0].type == null);
417 try expect(G3.Fn.return_type == null);
414 try expect(G3.@"fn".params.len == 1);
415 try expect(G3.@"fn".params[0].is_generic == true);
416 try expect(G3.@"fn".params[0].type == null);
417 try expect(G3.@"fn".return_type == null);
418418
419419 const G4 = @typeInfo(@TypeOf(generic4));
420 try expect(G4.Fn.params.len == 1);
421 try expect(G4.Fn.params[0].is_generic == true);
422 try expect(G4.Fn.params[0].type == null);
423 try expect(G4.Fn.return_type == null);
420 try expect(G4.@"fn".params.len == 1);
421 try expect(G4.@"fn".params[0].is_generic == true);
422 try expect(G4.@"fn".params[0].type == null);
423 try expect(G4.@"fn".return_type == null);
424424}
425425
426426fn generic1(param: anytype) void {
......@@ -450,9 +450,9 @@ test "type info: vectors" {
450450
451451fn testVector() !void {
452452 const vec_info = @typeInfo(@Vector(4, i32));
453 try expect(vec_info == .Vector);
454 try expect(vec_info.Vector.len == 4);
455 try expect(vec_info.Vector.child == i32);
453 try expect(vec_info == .vector);
454 try expect(vec_info.vector.len == 4);
455 try expect(vec_info.vector.child == i32);
456456}
457457
458458test "type info: anyframe and anyframe->T" {
......@@ -468,14 +468,14 @@ test "type info: anyframe and anyframe->T" {
468468fn testAnyFrame() !void {
469469 {
470470 const anyframe_info = @typeInfo(anyframe->i32);
471 try expect(anyframe_info == .AnyFrame);
472 try expect(anyframe_info.AnyFrame.child.? == i32);
471 try expect(anyframe_info == .@"anyframe");
472 try expect(anyframe_info.@"anyframe".child.? == i32);
473473 }
474474
475475 {
476476 const anyframe_info = @typeInfo(anyframe);
477 try expect(anyframe_info == .AnyFrame);
478 try expect(anyframe_info.AnyFrame.child == null);
477 try expect(anyframe_info == .@"anyframe");
478 try expect(anyframe_info.@"anyframe".child == null);
479479 }
480480}
481481
......@@ -490,13 +490,13 @@ fn passTypeInfo(comptime info: Type) type {
490490}
491491
492492test "type info: TypeId -> Type impl cast" {
493 _ = passTypeInfo(TypeId.Void);
494 _ = comptime passTypeInfo(TypeId.Void);
493 _ = passTypeInfo(TypeId.void);
494 _ = comptime passTypeInfo(TypeId.void);
495495}
496496
497497test "sentinel of opaque pointer type" {
498498 const c_void_info = @typeInfo(*anyopaque);
499 try expect(c_void_info.Pointer.sentinel == null);
499 try expect(c_void_info.pointer.sentinel == null);
500500}
501501
502502test "@typeInfo does not force declarations into existence" {
......@@ -507,7 +507,7 @@ test "@typeInfo does not force declarations into existence" {
507507 @compileError("test failed");
508508 }
509509 };
510 comptime assert(@typeInfo(S).Struct.fields.len == 1);
510 comptime assert(@typeInfo(S).@"struct".fields.len == 1);
511511}
512512
513513fn add(a: i32, b: i32) i32 {
......@@ -521,7 +521,7 @@ test "type info for async frames" {
521521 }
522522
523523 switch (@typeInfo(@Frame(add))) {
524 .Frame => |frame| {
524 .frame => |frame| {
525525 try expect(@as(@TypeOf(add), @ptrCast(frame.function)) == add);
526526 },
527527 else => unreachable,
......@@ -538,7 +538,7 @@ test "Declarations are returned in declaration order" {
538538 pub const d = 4;
539539 pub const e = 5;
540540 };
541 const d = @typeInfo(S).Struct.decls;
541 const d = @typeInfo(S).@"struct".decls;
542542 try expect(std.mem.eql(u8, d[0].name, "a"));
543543 try expect(std.mem.eql(u8, d[1].name, "b"));
544544 try expect(std.mem.eql(u8, d[2].name, "c"));
......@@ -547,19 +547,19 @@ test "Declarations are returned in declaration order" {
547547}
548548
549549test "Struct.is_tuple for anon list literal" {
550 try expect(@typeInfo(@TypeOf(.{0})).Struct.is_tuple);
550 try expect(@typeInfo(@TypeOf(.{0})).@"struct".is_tuple);
551551}
552552
553553test "Struct.is_tuple for anon struct literal" {
554554 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
555555
556556 const info = @typeInfo(@TypeOf(.{ .a = 0 }));
557 try expect(!info.Struct.is_tuple);
558 try expect(std.mem.eql(u8, info.Struct.fields[0].name, "a"));
557 try expect(!info.@"struct".is_tuple);
558 try expect(std.mem.eql(u8, info.@"struct".fields[0].name, "a"));
559559}
560560
561561test "StructField.is_comptime" {
562 const info = @typeInfo(struct { x: u8 = 3, comptime y: u32 = 5 }).Struct;
562 const info = @typeInfo(struct { x: u8 = 3, comptime y: u32 = 5 }).@"struct";
563563 try expect(!info.fields[0].is_comptime);
564564 try expect(info.fields[1].is_comptime);
565565}
......@@ -574,7 +574,7 @@ test "typeInfo resolves usingnamespace declarations" {
574574 pub usingnamespace A;
575575 };
576576
577 const decls = @typeInfo(B).Struct.decls;
577 const decls = @typeInfo(B).@"struct".decls;
578578 try expect(decls.len == 2);
579579 try expectEqualStrings(decls[0].name, "f0");
580580 try expectEqualStrings(decls[1].name, "f1");
......@@ -582,7 +582,7 @@ test "typeInfo resolves usingnamespace declarations" {
582582
583583test "value from struct @typeInfo default_value can be loaded at comptime" {
584584 comptime {
585 const a = @typeInfo(@TypeOf(.{ .foo = @as(u8, 1) })).Struct.fields[0].default_value;
585 const a = @typeInfo(@TypeOf(.{ .foo = @as(u8, 1) })).@"struct".fields[0].default_value;
586586 try expect(@as(*const u8, @ptrCast(a)).* == 1);
587587 }
588588}
......@@ -603,7 +603,7 @@ test "@typeInfo decls and usingnamespace" {
603603
604604 test {}
605605 };
606 const decls = @typeInfo(B).Struct.decls;
606 const decls = @typeInfo(B).@"struct".decls;
607607 try expect(decls.len == 3);
608608 try expectEqualStrings(decls[0].name, "z");
609609 try expectEqualStrings(decls[1].name, "x");
......@@ -613,7 +613,7 @@ test "@typeInfo decls and usingnamespace" {
613613test "@typeInfo decls ignore dependency loops" {
614614 const S = struct {
615615 pub fn Def(comptime T: type) type {
616 std.debug.assert(@typeInfo(T).Struct.decls.len == 1);
616 std.debug.assert(@typeInfo(T).@"struct".decls.len == 1);
617617 return struct {
618618 const foo = u32;
619619 };
......@@ -624,7 +624,7 @@ test "@typeInfo decls ignore dependency loops" {
624624}
625625
626626test "type info of tuple of string literal default value" {
627 const struct_field = @typeInfo(@TypeOf(.{"hi"})).Struct.fields[0];
627 const struct_field = @typeInfo(@TypeOf(.{"hi"})).@"struct".fields[0];
628628 const value = @as(*align(1) const *const [2:0]u8, @ptrCast(struct_field.default_value.?)).*;
629629 comptime std.debug.assert(value[0] == 'h');
630630}
......@@ -648,7 +648,7 @@ test "@typeInfo only contains pub decls" {
648648 };
649649 };
650650 const ti = @typeInfo(other);
651 const decls = ti.Struct.decls;
651 const decls = ti.@"struct".decls;
652652
653653 try std.testing.expectEqual(2, decls.len);
654654 try std.testing.expectEqualStrings("Enum", decls[0].name);
test/behavior/type_info_mul_linksection_addrspace_decls.zig+1-1
......@@ -7,6 +7,6 @@ pub const c addrspace("space_c") = 0;
77pub const d addrspace("space_d") = 0;
88
99test {
10 const decls = @typeInfo(@This()).Struct.decls;
10 const decls = @typeInfo(@This()).@"struct".decls;
1111 try expect(decls.len == 4);
1212}
test/behavior/typename.zig+1-1
......@@ -110,7 +110,7 @@ test "top level decl" {
110110 );
111111 // regular fn inside struct, with error
112112 try expectEqualStrings(
113 "fn () @typeInfo(@typeInfo(@TypeOf(behavior.typename.B.doTest)).Fn.return_type.?).ErrorUnion.error_set!void",
113 "fn () @typeInfo(@typeInfo(@TypeOf(behavior.typename.B.doTest)).@\"fn\".return_type.?).error_union.error_set!void",
114114 @typeName(@TypeOf(B.doTest)),
115115 );
116116 // generic fn
test/behavior/union.zig+6-6
......@@ -479,7 +479,7 @@ test "global union with single field is correctly initialized" {
479479 if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
480480
481481 glbl = Foo1{
482 .f = @typeInfo(Foo1).Union.fields[0].type{ .x = 123 },
482 .f = @typeInfo(Foo1).@"union".fields[0].type{ .x = 123 },
483483 };
484484 try expect(glbl.f.x == 123);
485485}
......@@ -600,8 +600,8 @@ test "tagged union type" {
600600 const baz = Baz.B;
601601
602602 try expect(baz == Baz.B);
603 try expect(@typeInfo(TaggedFoo).Union.fields.len == 3);
604 try expect(@typeInfo(Baz).Enum.fields.len == 4);
603 try expect(@typeInfo(TaggedFoo).@"union".fields.len == 3);
604 try expect(@typeInfo(Baz).@"enum".fields.len == 4);
605605 try expect(@sizeOf(TaggedFoo) == @sizeOf(FooNoVoid));
606606 try expect(@sizeOf(Baz) == 1);
607607}
......@@ -2305,13 +2305,13 @@ test "create union(enum) from other union(enum)" {
23052305test "matching captures causes union equivalence" {
23062306 const S = struct {
23072307 fn SignedUnsigned(comptime I: type) type {
2308 const bits = @typeInfo(I).Int.bits;
2308 const bits = @typeInfo(I).int.bits;
23092309 return union {
2310 u: @Type(.{ .Int = .{
2310 u: @Type(.{ .int = .{
23112311 .signedness = .unsigned,
23122312 .bits = bits,
23132313 } }),
2314 i: @Type(.{ .Int = .{
2314 i: @Type(.{ .int = .{
23152315 .signedness = .signed,
23162316 .bits = bits,
23172317 } }),
test/behavior/usingnamespace.zig+1-1
......@@ -109,7 +109,7 @@ test "container member access usingnamespace decls" {
109109
110110usingnamespace opaque {};
111111
112usingnamespace @Type(.{ .Struct = .{
112usingnamespace @Type(.{ .@"struct" = .{
113113 .layout = .auto,
114114 .fields = &.{},
115115 .decls = &.{},
test/behavior/vector.zig+17-17
......@@ -564,7 +564,7 @@ test "vector division operators" {
564564 const S = struct {
565565 fn doTheTestDiv(comptime T: type, x: @Vector(4, T), y: @Vector(4, T)) !void {
566566 const is_signed_int = switch (@typeInfo(T)) {
567 .Int => |info| info.signedness == .signed,
567 .int => |info| info.signedness == .signed,
568568 else => false,
569569 };
570570 if (!is_signed_int) {
......@@ -589,10 +589,10 @@ test "vector division operators" {
589589
590590 fn doTheTestMod(comptime T: type, x: @Vector(4, T), y: @Vector(4, T)) !void {
591591 const is_signed_int = switch (@typeInfo(T)) {
592 .Int => |info| info.signedness == .signed,
592 .int => |info| info.signedness == .signed,
593593 else => false,
594594 };
595 if (!is_signed_int and @typeInfo(T) != .Float) {
595 if (!is_signed_int and @typeInfo(T) != .float) {
596596 const r0 = x % y;
597597 for (@as([4]T, r0), 0..) |v, i| {
598598 try expect(x[i] % y[i] == v);
......@@ -686,9 +686,9 @@ test "vector shift operators" {
686686
687687 const S = struct {
688688 fn doTheTestShift(x: anytype, y: anytype) !void {
689 const N = @typeInfo(@TypeOf(x)).Array.len;
690 const TX = @typeInfo(@TypeOf(x)).Array.child;
691 const TY = @typeInfo(@TypeOf(y)).Array.child;
689 const N = @typeInfo(@TypeOf(x)).array.len;
690 const TX = @typeInfo(@TypeOf(x)).array.child;
691 const TY = @typeInfo(@TypeOf(y)).array.child;
692692
693693 const xv = @as(@Vector(N, TX), x);
694694 const yv = @as(@Vector(N, TY), y);
......@@ -703,9 +703,9 @@ test "vector shift operators" {
703703 }
704704 }
705705 fn doTheTestShiftExact(x: anytype, y: anytype, dir: enum { Left, Right }) !void {
706 const N = @typeInfo(@TypeOf(x)).Array.len;
707 const TX = @typeInfo(@TypeOf(x)).Array.child;
708 const TY = @typeInfo(@TypeOf(y)).Array.child;
706 const N = @typeInfo(@TypeOf(x)).array.len;
707 const TX = @typeInfo(@TypeOf(x)).array.child;
708 const TY = @typeInfo(@TypeOf(y)).array.child;
709709
710710 const xv = @as(@Vector(N, TX), x);
711711 const yv = @as(@Vector(N, TY), y);
......@@ -777,13 +777,13 @@ test "vector reduce operation" {
777777
778778 const S = struct {
779779 fn testReduce(comptime op: std.builtin.ReduceOp, x: anytype, expected: anytype) !void {
780 const N = @typeInfo(@TypeOf(x)).Array.len;
781 const TX = @typeInfo(@TypeOf(x)).Array.child;
780 const N = @typeInfo(@TypeOf(x)).array.len;
781 const TX = @typeInfo(@TypeOf(x)).array.child;
782782
783783 const r = @reduce(op, @as(@Vector(N, TX), x));
784784 switch (@typeInfo(TX)) {
785 .Int, .Bool => try expect(expected == r),
786 .Float => {
785 .int, .bool => try expect(expected == r),
786 .float => {
787787 const expected_nan = math.isNan(expected);
788788 const got_nan = math.isNan(r);
789789
......@@ -941,10 +941,10 @@ test "mask parameter of @shuffle is comptime scope" {
941941 var v4_b = __v4hi{ 5, 6, 7, 8 };
942942 _ = .{ &v4_a, &v4_b };
943943 const shuffled: __v4hi = @shuffle(i16, v4_a, v4_b, @Vector(4, i32){
944 std.zig.c_translation.shuffleVectorIndex(0, @typeInfo(@TypeOf(v4_a)).Vector.len),
945 std.zig.c_translation.shuffleVectorIndex(2, @typeInfo(@TypeOf(v4_a)).Vector.len),
946 std.zig.c_translation.shuffleVectorIndex(4, @typeInfo(@TypeOf(v4_a)).Vector.len),
947 std.zig.c_translation.shuffleVectorIndex(6, @typeInfo(@TypeOf(v4_a)).Vector.len),
944 std.zig.c_translation.shuffleVectorIndex(0, @typeInfo(@TypeOf(v4_a)).vector.len),
945 std.zig.c_translation.shuffleVectorIndex(2, @typeInfo(@TypeOf(v4_a)).vector.len),
946 std.zig.c_translation.shuffleVectorIndex(4, @typeInfo(@TypeOf(v4_a)).vector.len),
947 std.zig.c_translation.shuffleVectorIndex(6, @typeInfo(@TypeOf(v4_a)).vector.len),
948948 });
949949 try expect(shuffled[0] == 1);
950950 try expect(shuffled[1] == 3);
test/c_import/macros.zig+1-1
......@@ -222,7 +222,7 @@ test "Macro that uses remainder operator. Issue #13346" {
222222test "@typeInfo on @cImport result" {
223223 if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
224224
225 try expect(@typeInfo(h).Struct.decls.len > 1);
225 try expect(@typeInfo(h).@"struct".decls.len > 1);
226226}
227227
228228test "Macro that uses Long type concatenation casting" {
test/cases/compile_errors/@errorCast_with_bad_type.zig+2-2
......@@ -23,8 +23,8 @@ pub export fn entry4() void {
2323// backend=stage2
2424// target=x86_64-linux
2525//
26// :4:25: error: expected error set or error union type, found 'ComptimeInt'
27// :8:20: error: expected error set or error union type, found 'Int'
26// :4:25: error: expected error set or error union type, found 'comptime_int'
27// :8:20: error: expected error set or error union type, found 'int'
2828// :13:25: error: cannot cast an error union type to error set
2929// :18:29: error: payload types of error unions must match
3030// :18:29: note: destination payload is 'f32'
test/cases/compile_errors/access_invalid_typeInfo_decl.zig+1-1
......@@ -1,6 +1,6 @@
11const A = B;
22test "Crash" {
3 _ = @typeInfo(@This()).Struct.decls[0];
3 _ = @typeInfo(@This()).@"struct".decls[0];
44}
55
66// error
test/cases/compile_errors/addition_with_non_numbers.zig+1-1
......@@ -11,4 +11,4 @@ export fn entry() usize {
1111// backend=llvm
1212// target=native
1313//
14// :4:29: error: invalid operands to binary expression: 'Struct' and 'Struct'
14// :4:29: error: invalid operands to binary expression: 'struct' and 'struct'
test/cases/compile_errors/array_init_generic_fn_with_inferred_error_set.zig+2-2
......@@ -8,5 +8,5 @@ fn my_func(comptime T: type) !T {}
88
99// error
1010//
11// :2:9: error: expected type 'type', found 'fn (comptime type) @typeInfo(@typeInfo(@TypeOf(tmp.my_func)).Fn.return_type.?).ErrorUnion.error_set!anytype'
12// :5:9: error: expected type 'type', found 'fn (comptime type) @typeInfo(@typeInfo(@TypeOf(tmp.my_func)).Fn.return_type.?).ErrorUnion.error_set!anytype'
11// :2:9: error: expected type 'type', found 'fn (comptime type) @typeInfo(@typeInfo(@TypeOf(tmp.my_func)).@"fn".return_type.?).error_union.error_set!anytype'
12// :5:9: error: expected type 'type', found 'fn (comptime type) @typeInfo(@typeInfo(@TypeOf(tmp.my_func)).@"fn".return_type.?).error_union.error_set!anytype'
test/cases/compile_errors/attempt_to_create_17_bit_float_type.zig+1-1
......@@ -1,6 +1,6 @@
11const builtin = @import("std").builtin;
22comptime {
3 _ = @Type(.{ .Float = .{ .bits = 17 } });
3 _ = @Type(.{ .float = .{ .bits = 17 } });
44}
55
66// error
test/cases/compile_errors/binary_OR_operator_on_error_sets.zig+1-1
......@@ -9,4 +9,4 @@ export fn entry() void {
99// backend=stage2
1010// target=native
1111//
12// :2:18: error: invalid operands to binary bitwise expression: 'ErrorSet' and 'ErrorSet'
12// :2:18: error: invalid operands to binary bitwise expression: 'error_set' and 'error_set'
test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig+1-1
......@@ -6,7 +6,7 @@ pub export fn entry() void {
66 const Widget = union(enum) { a: u0 };
77
88 comptime var a = 1;
9 const info = @typeInfo(Widget).Union;
9 const info = @typeInfo(Widget).@"union";
1010 inline for (info.fields) |field| {
1111 if (foo()) {
1212 switch (field.type) {
test/cases/compile_errors/dereference_anyopaque.zig+2-2
......@@ -13,13 +13,13 @@ fn parse(comptime T: type, allocator: std.mem.Allocator) !void {
1313
1414fn parseFree(comptime T: type, value: T, allocator: std.mem.Allocator) void {
1515 switch (@typeInfo(T)) {
16 .Struct => |structInfo| {
16 .@"struct" => |structInfo| {
1717 inline for (structInfo.fields) |field| {
1818 if (!field.is_comptime)
1919 parseFree(field.type, undefined, allocator);
2020 }
2121 },
22 .Pointer => |ptrInfo| {
22 .pointer => |ptrInfo| {
2323 switch (ptrInfo.size) {
2424 .One => {
2525 parseFree(ptrInfo.child, value.*, allocator);
test/cases/compile_errors/error_set_membership.zig+1-1
......@@ -27,5 +27,5 @@ pub fn main() Error!void {
2727// backend=llvm
2828// target=native
2929//
30// :23:29: error: expected type 'error{InvalidCharacter}', found '@typeInfo(@typeInfo(@TypeOf(tmp.fooey)).Fn.return_type.?).ErrorUnion.error_set'
30// :23:29: error: expected type 'error{InvalidCharacter}', found '@typeInfo(@typeInfo(@TypeOf(tmp.fooey)).@"fn".return_type.?).error_union.error_set'
3131// :23:29: note: 'error.InvalidDirection' not a member of destination error set
test/cases/compile_errors/for_loop_error_union.zig+1-1
......@@ -10,6 +10,6 @@ export fn a() void {
1010// backend=stage2
1111// target=native
1212//
13// :6:11: error: type '@typeInfo(@typeInfo(@TypeOf(tmp.b)).Fn.return_type.?).ErrorUnion.error_set!u32' is not indexable and not a range
13// :6:11: error: type '@typeInfo(@typeInfo(@TypeOf(tmp.b)).@"fn".return_type.?).error_union.error_set!u32' is not indexable and not a range
1414// :6:11: note: for loop operand must be a range, array, slice, tuple, or vector
1515// :6:11: note: consider using 'try', 'catch', or 'if'
test/cases/compile_errors/generic_instantiation_failure_in_generic_function_return_type.zig+3-3
......@@ -5,7 +5,7 @@ pub export fn entry() void {
55 _ = sliceAsBytes(ohnoes);
66 _ = &ohnoes;
77}
8fn sliceAsBytes(slice: anytype) isPtrTo(.Array)(@TypeOf(slice)) {}
8fn sliceAsBytes(slice: anytype) isPtrTo(.array)(@TypeOf(slice)) {}
99
1010pub const TraitFn = fn (type) bool;
1111
......@@ -20,8 +20,8 @@ pub fn isPtrTo(comptime id: std.builtin.TypeId) TraitFn {
2020}
2121
2222pub fn isSingleItemPtr(comptime T: type) bool {
23 if (comptime is(.Pointer)(T)) {
24 return @typeInfo(T).Pointer.size == .One;
23 if (comptime is(.pointer)(T)) {
24 return @typeInfo(T).pointer.size == .One;
2525 }
2626 return false;
2727}
test/cases/compile_errors/helpful_return_type_error_message.zig+3-3
......@@ -21,12 +21,12 @@ export fn quux() u32 {
2121//
2222// :2:18: error: expected type 'u32', found 'error{Ohno}'
2323// :1:17: note: function cannot return an error
24// :8:5: error: expected type 'void', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).Fn.return_type.?).ErrorUnion.error_set'
24// :8:5: error: expected type 'void', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).@"fn".return_type.?).error_union.error_set'
2525// :7:17: note: function cannot return an error
26// :11:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).Fn.return_type.?).ErrorUnion.error_set!u32'
26// :11:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).@"fn".return_type.?).error_union.error_set!u32'
2727// :11:15: note: cannot convert error union to payload type
2828// :11:15: note: consider using 'try', 'catch', or 'if'
2929// :10:17: note: function cannot return an error
30// :15:14: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).Fn.return_type.?).ErrorUnion.error_set!u32'
30// :15:14: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).@"fn".return_type.?).error_union.error_set!u32'
3131// :15:14: note: cannot convert error union to payload type
3232// :15:14: note: consider using 'try', 'catch', or 'if'
test/cases/compile_errors/invalid_pointer_arithmetic.zig+1-1
......@@ -45,7 +45,7 @@ comptime {
4545// :2:11: note: pointer-integer arithmetic only supports addition and subtraction
4646// :6:11: error: invalid pointer-pointer arithmetic operator
4747// :6:11: note: pointer-pointer arithmetic only supports subtraction
48// :12:11: error: invalid operands to binary expression: 'Pointer' and 'Pointer'
48// :12:11: error: invalid operands to binary expression: 'pointer' and 'pointer'
4949// :20:11: error: incompatible pointer arithmetic operands '[*]u8' and '[*]u16'
5050// :26:11: error: incompatible pointer arithmetic operands '*u8' and '*u16'
5151// :31:11: error: pointer arithmetic requires element type 'u0' to have runtime bits
test/cases/compile_errors/invalid_pointer_with_reify_type.zig+1-1
......@@ -1,5 +1,5 @@
11export fn entry() void {
2 _ = @Type(.{ .Pointer = .{
2 _ = @Type(.{ .pointer = .{
33 .size = .One,
44 .is_const = false,
55 .is_volatile = false,
test/cases/compile_errors/issue_15572_break_on_inline_while.zig+1-1
......@@ -6,7 +6,7 @@ pub const DwarfSection = enum {
66};
77
88pub fn main() void {
9 const section = inline for (@typeInfo(DwarfSection).Enum.fields) |section| {
9 const section = inline for (@typeInfo(DwarfSection).@"enum".fields) |section| {
1010 if (std.mem.eql(u8, section.name, "eh_frame")) break section;
1111 };
1212
test/cases/compile_errors/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig+1-1
......@@ -7,7 +7,7 @@ export fn foo() void {
77 wrong_type: []u8 = "foo",
88 };
99
10 comptime ignore(@typeInfo(MyStruct).Struct.fields[0]);
10 comptime ignore(@typeInfo(MyStruct).@"struct".fields[0]);
1111}
1212
1313// error
test/cases/compile_errors/method_call_on_error_union.zig+1-1
......@@ -17,5 +17,5 @@ export fn entry() void {
1717// backend=stage2
1818// target=native
1919//
20// :13:6: error: no field or member function named 'a' in '@typeInfo(@typeInfo(@TypeOf(tmp.X.init)).Fn.return_type.?).ErrorUnion.error_set!tmp.X'
20// :13:6: error: no field or member function named 'a' in '@typeInfo(@typeInfo(@TypeOf(tmp.X.init)).@"fn".return_type.?).error_union.error_set!tmp.X'
2121// :13:6: note: consider using 'try', 'catch', or 'if'
test/cases/compile_errors/nested_vectors.zig+1-1
......@@ -1,6 +1,6 @@
11export fn entry() void {
22 const V1 = @Vector(4, u8);
3 const V2 = @Type(.{ .Vector = .{ .len = 4, .child = V1 } });
3 const V2 = @Type(.{ .vector = .{ .len = 4, .child = V1 } });
44 const v: V2 = undefined;
55 _ = v;
66}
test/cases/compile_errors/non-enum_tag_type_passed_to_union.zig+1-1
......@@ -2,7 +2,7 @@ const Foo = union(u32) {
22 A: i32,
33};
44export fn entry() void {
5 const x = @typeInfo(Foo).Union.tag_type.?;
5 const x = @typeInfo(Foo).@"union".tag_type.?;
66 _ = x;
77}
88
test/cases/compile_errors/non-integer_tag_type_to_automatic_union_enum.zig+1-1
......@@ -2,7 +2,7 @@ const Foo = union(enum(f32)) {
22 A: i32,
33};
44export fn entry() void {
5 const x = @typeInfo(Foo).Union.tag_type.?;
5 const x = @typeInfo(Foo).@"union".tag_type.?;
66 _ = x;
77}
88
test/cases/compile_errors/not_an_enum_type.zig+1-1
......@@ -16,5 +16,5 @@ const ExpectedVarDeclOrFn = struct {};
1616// backend=stage2
1717// target=native
1818//
19// :4:9: error: expected type '@typeInfo(tmp.Error).Union.tag_type.?', found 'type'
19// :4:9: error: expected type '@typeInfo(tmp.Error).@"union".tag_type.?', found 'type'
2020// :8:15: note: enum declared here
test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig+1-1
......@@ -1,5 +1,5 @@
11export fn entry() void {
2 _ = @Type(.{ .Struct = .{ .layout = .@"packed", .fields = &.{
2 _ = @Type(.{ .@"struct" = .{ .layout = .@"packed", .fields = &.{
33 .{ .name = "one", .type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
44 }, .decls = &.{}, .is_tuple = false } });
55}
test/cases/compile_errors/range_operator_in_switch_used_on_error_set.zig+1-1
......@@ -16,5 +16,5 @@ fn foo(x: i32) !void {
1616// backend=llvm
1717// target=native
1818//
19// :2:34: error: ranges not allowed when switching on type '@typeInfo(@typeInfo(@TypeOf(tmp.foo)).Fn.return_type.?).ErrorUnion.error_set'
19// :2:34: error: ranges not allowed when switching on type '@typeInfo(@typeInfo(@TypeOf(tmp.foo)).@"fn".return_type.?).error_union.error_set'
2020// :3:18: note: range here
test/cases/compile_errors/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig+1-1
......@@ -18,6 +18,6 @@ export fn entry() void {
1818// backend=stage2
1919// target=native
2020//
21// :12:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.get_uval)).Fn.return_type.?).ErrorUnion.error_set!u32'
21// :12:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.get_uval)).@"fn".return_type.?).error_union.error_set!u32'
2222// :12:15: note: cannot convert error union to payload type
2323// :12:15: note: consider using 'try', 'catch', or 'if'
test/cases/compile_errors/reified_enum_field_value_overflow.zig+1-1
......@@ -1,5 +1,5 @@
11comptime {
2 const E = @Type(.{ .Enum = .{
2 const E = @Type(.{ .@"enum" = .{
33 .tag_type = u1,
44 .fields = &.{
55 .{ .name = "f0", .value = 0 },
test/cases/compile_errors/reify_enum_with_duplicate_field.zig+1-1
......@@ -1,6 +1,6 @@
11export fn entry() void {
22 _ = @Type(.{
3 .Enum = .{
3 .@"enum" = .{
44 .tag_type = u32,
55 .fields = &.{
66 .{ .name = "A", .value = 0 },
test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig+1-1
......@@ -1,6 +1,6 @@
11export fn entry() void {
22 _ = @Type(.{
3 .Enum = .{
3 .@"enum" = .{
44 .tag_type = u32,
55 .fields = &.{
66 .{ .name = "A", .value = 10 },
test/cases/compile_errors/reify_struct.zig+5-5
......@@ -1,5 +1,5 @@
11comptime {
2 @Type(.{ .Struct = .{
2 @Type(.{ .@"struct" = .{
33 .layout = .auto,
44 .fields = &.{.{
55 .name = "foo",
......@@ -13,7 +13,7 @@ comptime {
1313 } });
1414}
1515comptime {
16 @Type(.{ .Struct = .{
16 @Type(.{ .@"struct" = .{
1717 .layout = .auto,
1818 .fields = &.{.{
1919 .name = "3",
......@@ -27,7 +27,7 @@ comptime {
2727 } });
2828}
2929comptime {
30 @Type(.{ .Struct = .{
30 @Type(.{ .@"struct" = .{
3131 .layout = .auto,
3232 .fields = &.{.{
3333 .name = "0",
......@@ -41,7 +41,7 @@ comptime {
4141 } });
4242}
4343comptime {
44 @Type(.{ .Struct = .{
44 @Type(.{ .@"struct" = .{
4545 .layout = .@"extern",
4646 .fields = &.{.{
4747 .name = "0",
......@@ -55,7 +55,7 @@ comptime {
5555 } });
5656}
5757comptime {
58 @Type(.{ .Struct = .{
58 @Type(.{ .@"struct" = .{
5959 .layout = .@"packed",
6060 .fields = &.{.{
6161 .name = "0",
test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig+1-1
......@@ -1,5 +1,5 @@
11const Foo = @Type(.{
2 .Fn = .{
2 .@"fn" = .{
33 .calling_convention = .Unspecified,
44 .is_generic = true,
55 .is_var_args = false,
test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig+1-1
......@@ -1,5 +1,5 @@
11const Foo = @Type(.{
2 .Fn = .{
2 .@"fn" = .{
33 .calling_convention = .Unspecified,
44 .is_generic = false,
55 .is_var_args = true,
test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig+1-1
......@@ -1,5 +1,5 @@
11const Foo = @Type(.{
2 .Fn = .{
2 .@"fn" = .{
33 .calling_convention = .Unspecified,
44 .is_generic = false,
55 .is_var_args = false,
test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig+1-1
......@@ -1,5 +1,5 @@
11const Tag = @Type(.{
2 .Enum = .{
2 .@"enum" = .{
33 .tag_type = bool,
44 .fields = &.{},
55 .decls = &.{},
test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig+1-1
......@@ -1,5 +1,5 @@
11const Tag = @Type(.{
2 .Enum = .{
2 .@"enum" = .{
33 .tag_type = undefined,
44 .fields = &.{},
55 .decls = &.{},
test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig+2-2
......@@ -1,5 +1,5 @@
11const Tag = @Type(.{
2 .Enum = .{
2 .@"enum" = .{
33 .tag_type = u2,
44 .fields = &.{
55 .{ .name = "signed", .value = 0 },
......@@ -11,7 +11,7 @@ const Tag = @Type(.{
1111 },
1212});
1313const Tagged = @Type(.{
14 .Union = .{
14 .@"union" = .{
1515 .layout = .auto,
1616 .tag_type = Tag,
1717 .fields = &.{
test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig+2-2
......@@ -1,5 +1,5 @@
11const Tag = @Type(.{
2 .Enum = .{
2 .@"enum" = .{
33 .tag_type = u1,
44 .fields = &.{
55 .{ .name = "signed", .value = 0 },
......@@ -10,7 +10,7 @@ const Tag = @Type(.{
1010 },
1111});
1212const Tagged = @Type(.{
13 .Union = .{
13 .@"union" = .{
1414 .layout = .auto,
1515 .tag_type = Tag,
1616 .fields = &.{
test/cases/compile_errors/reify_type_for_tagged_union_with_no_enum_fields.zig+2-2
......@@ -1,5 +1,5 @@
11const Tag = @Type(.{
2 .Enum = .{
2 .@"enum" = .{
33 .tag_type = u0,
44 .fields = &.{},
55 .decls = &.{},
......@@ -7,7 +7,7 @@ const Tag = @Type(.{
77 },
88});
99const Tagged = @Type(.{
10 .Union = .{
10 .@"union" = .{
1111 .layout = .auto,
1212 .tag_type = Tag,
1313 .fields = &.{
test/cases/compile_errors/reify_type_for_tagged_union_with_no_union_fields.zig+2-2
......@@ -1,5 +1,5 @@
11const Tag = @Type(.{
2 .Enum = .{
2 .@"enum" = .{
33 .tag_type = u1,
44 .fields = &.{
55 .{ .name = "signed", .value = 0 },
......@@ -10,7 +10,7 @@ const Tag = @Type(.{
1010 },
1111});
1212const Tagged = @Type(.{
13 .Union = .{
13 .@"union" = .{
1414 .layout = .auto,
1515 .tag_type = Tag,
1616 .fields = &.{},
test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig+1-1
......@@ -1,5 +1,5 @@
11const Untagged = @Type(.{
2 .Union = .{
2 .@"union" = .{
33 .layout = .auto,
44 .tag_type = null,
55 .fields = &.{
test/cases/compile_errors/reify_type_union_payload_is_undefined.zig+1-1
......@@ -1,5 +1,5 @@
11const Foo = @Type(.{
2 .Struct = undefined,
2 .@"struct" = undefined,
33});
44comptime {
55 _ = Foo;
test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig+3-3
......@@ -1,6 +1,6 @@
11comptime {
22 _ = @Type(.{
3 .Union = .{
3 .@"union" = .{
44 .layout = .auto,
55 .tag_type = null,
66 .fields = &.{
......@@ -12,7 +12,7 @@ comptime {
1212}
1313comptime {
1414 _ = @Type(.{
15 .Struct = .{
15 .@"struct" = .{
1616 .layout = .auto,
1717 .fields = &.{.{
1818 .name = "0",
......@@ -28,7 +28,7 @@ comptime {
2828}
2929comptime {
3030 _ = @Type(.{
31 .Pointer = .{
31 .pointer = .{
3232 .size = .Many,
3333 .is_const = true,
3434 .is_volatile = false,
test/cases/compile_errors/reify_type_with_undefined.zig+3-3
......@@ -1,9 +1,9 @@
11comptime {
2 _ = @Type(.{ .Array = .{ .len = 0, .child = u8, .sentinel = undefined } });
2 _ = @Type(.{ .array = .{ .len = 0, .child = u8, .sentinel = undefined } });
33}
44comptime {
55 _ = @Type(.{
6 .Struct = .{
6 .@"struct" = .{
77 .fields = undefined,
88 .decls = undefined,
99 .is_tuple = false,
......@@ -15,7 +15,7 @@ comptime {
1515 const std = @import("std");
1616 const fields: [1]std.builtin.Type.StructField = undefined;
1717 _ = @Type(.{
18 .Struct = .{
18 .@"struct" = .{
1919 .layout = .auto,
2020 .fields = &fields,
2121 .decls = &.{},
test/cases/compile_errors/resolve_inferred_error_set_of_generic_fn.zig+2-2
......@@ -5,8 +5,8 @@ fn foo(a: anytype) !void {
55const Error = error{ A, B };
66export fn entry() void {
77 const info = @typeInfo(@TypeOf(foo));
8 const ret_type = info.Fn.return_type.?;
9 const error_set = @typeInfo(ret_type).ErrorUnion.error_set;
8 const ret_type = info.@"fn".return_type.?;
9 const error_set = @typeInfo(ret_type).error_union.error_set;
1010 _ = Error || error_set;
1111}
1212
test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig+2-2
......@@ -6,7 +6,7 @@ fn getIndex() usize {
66}
77export fn entry() void {
88 const index = getIndex();
9 const field = @typeInfo(Struct).Struct.fields[index];
9 const field = @typeInfo(Struct).@"struct".fields[index];
1010 _ = field;
1111}
1212
......@@ -14,7 +14,7 @@ export fn entry() void {
1414// backend=stage2
1515// target=native
1616//
17// :9:51: error: values of type '[]const builtin.Type.StructField' must be comptime-known, but index value is runtime-known
17// :9:54: error: values of type '[]const builtin.Type.StructField' must be comptime-known, but index value is runtime-known
1818// : note: struct requires comptime because of this field
1919// : note: types are not available at runtime
2020// : struct requires comptime because of this field
test/cases/compile_errors/saturating_arithmetic_does_not_allow_floats.zig+1-1
......@@ -6,4 +6,4 @@ export fn a() void {
66// backend=stage2
77// target=native
88//
9// :2:23: error: invalid operands to binary expression: 'Float' and 'Float'
9// :2:23: error: invalid operands to binary expression: 'float' and 'float'
test/cases/compile_errors/switch_on_error_with_non_trivial_switch_operand.zig+2-2
......@@ -18,5 +18,5 @@ export fn entry2() void {
1818// backend=stage2
1919// target=native
2020//
21// :4:42: error: invalid operands to binary expression: 'ErrorSet' and 'ComptimeInt'
22// :12:35: error: invalid operands to binary expression: 'ErrorSet' and 'ComptimeInt'
21// :4:42: error: invalid operands to binary expression: 'error_set' and 'comptime_int'
22// :12:35: error: invalid operands to binary expression: 'error_set' and 'comptime_int'
test/cases/compile_errors/unable_to_evaluate_comptime_expr.zig+1-1
......@@ -16,7 +16,7 @@ pub export fn entry2() void {
1616 _ = b;
1717}
1818
19const Int = @typeInfo(bar).Struct.backing_integer.?;
19const Int = @typeInfo(bar).@"struct".backing_integer.?;
2020
2121const foo = enum(Int) {
2222 c = @bitCast(bar{
test/cases/compile_errors/union_fields_are_resolved_before_tag_type_is_needed.zig+1-1
......@@ -12,5 +12,5 @@ pub export fn entry() void {
1212// backend=stage2
1313// target=native
1414//
15// :8:8: error: no field or member function named 'f' in '@typeInfo(tmp.T).Union.tag_type.?'
15// :8:8: error: no field or member function named 'f' in '@typeInfo(tmp.T).@"union".tag_type.?'
1616// :1:11: note: enum declared here
test/cases/compile_errors/union_noreturn_field_initialized.zig+2-2
......@@ -23,7 +23,7 @@ pub export fn entry3() void {
2323 a: noreturn,
2424 b: void,
2525 };
26 var e = @typeInfo(U).Union.tag_type.?.a;
26 var e = @typeInfo(U).@"union".tag_type.?.a;
2727 var u: U = undefined;
2828 u = (&e).*;
2929}
......@@ -38,6 +38,6 @@ pub export fn entry3() void {
3838// :19:10: error: cannot initialize 'noreturn' field of union
3939// :16:9: note: field 'a' declared here
4040// :15:15: note: union declared here
41// :28:13: error: runtime coercion from enum '@typeInfo(tmp.entry3.U).Union.tag_type.?' to union 'tmp.entry3.U' which has a 'noreturn' field
41// :28:13: error: runtime coercion from enum '@typeInfo(tmp.entry3.U).@"union".tag_type.?' to union 'tmp.entry3.U' which has a 'noreturn' field
4242// :23:9: note: 'noreturn' field here
4343// :22:15: note: union 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.params[0].type.? == ?*c_int);
12 try std.testing.expect(info.@"fn".params[0].type.? == ?*c_int);
1313}
1414
1515// run
test/cases/safety/@tagName on corrupted union value.zig +1-1
......@@ -16,7 +16,7 @@ const U = union(enum(u32)) {
1616pub fn main() !void {
1717 var u: U = undefined;
1818 @memset(@as([*]u8, @ptrCast(&u))[0..@sizeOf(U)], 0x55);
19 const t: @typeInfo(U).Union.tag_type.? = u;
19 const t: @typeInfo(U).@"union".tag_type.? = u;
2020 const n = @tagName(t);
2121 _ = n;
2222 return error.TestFailed;
test/link/build.zig+1-1
......@@ -23,7 +23,7 @@ pub fn build(b: *std.Build) void {
2323 const dep_name, const dep_hash = available_dep;
2424
2525 const all_pkgs = @import("root").dependencies.packages;
26 inline for (@typeInfo(all_pkgs).Struct.decls) |decl| {
26 inline for (@typeInfo(all_pkgs).@"struct".decls) |decl| {
2727 const pkg_hash = decl.name;
2828 if (std.mem.eql(u8, dep_hash, pkg_hash)) {
2929 const pkg = @field(all_pkgs, pkg_hash);
test/src/Cases.zig+4-4
......@@ -1188,12 +1188,12 @@ const TestManifest = struct {
11881188 }.parse;
11891189
11901190 switch (@typeInfo(T)) {
1191 .Int => return struct {
1191 .int => return struct {
11921192 fn parse(str: []const u8) anyerror!T {
11931193 return try std.fmt.parseInt(T, str, 0);
11941194 }
11951195 }.parse,
1196 .Bool => return struct {
1196 .bool => return struct {
11971197 fn parse(str: []const u8) anyerror!T {
11981198 if (std.mem.eql(u8, str, "true")) return true;
11991199 if (std.mem.eql(u8, str, "false")) return false;
......@@ -1201,7 +1201,7 @@ const TestManifest = struct {
12011201 return error.InvalidBool;
12021202 }
12031203 }.parse,
1204 .Enum => return struct {
1204 .@"enum" => return struct {
12051205 fn parse(str: []const u8) anyerror!T {
12061206 return std.meta.stringToEnum(T, str) orelse {
12071207 std.log.err("unknown enum variant for {s}: {s}", .{ @typeName(T), str });
......@@ -1209,7 +1209,7 @@ const TestManifest = struct {
12091209 };
12101210 }
12111211 }.parse,
1212 .Struct => @compileError("no default parser for " ++ @typeName(T)),
1212 .@"struct" => @compileError("no default parser for " ++ @typeName(T)),
12131213 else => @compileError("no default parser for " ++ @typeName(T)),
12141214 }
12151215 }
test/standalone/build.zig+1-1
......@@ -60,7 +60,7 @@ pub fn build(b: *std.Build) void {
6060 if (std.mem.eql(u8, dep_name, "simple")) continue;
6161
6262 const all_pkgs = @import("root").dependencies.packages;
63 inline for (@typeInfo(all_pkgs).Struct.decls) |decl| {
63 inline for (@typeInfo(all_pkgs).@"struct".decls) |decl| {
6464 const pkg_hash = decl.name;
6565 if (std.mem.eql(u8, dep_hash, pkg_hash)) {
6666 const pkg = @field(all_pkgs, pkg_hash);
test/standalone/simple/issue_7030.zig+1-1
......@@ -6,7 +6,7 @@ pub const std_options = .{
66
77pub fn log(
88 comptime message_level: std.log.Level,
9 comptime scope: @Type(.EnumLiteral),
9 comptime scope: @Type(.enum_literal),
1010 comptime format: []const u8,
1111 args: anytype,
1212) void {
test/standalone/simple/std_enums_big_enums.zig+12-14
......@@ -3,21 +3,19 @@ const std = @import("std");
33// big enums should not hit the eval branch quota
44pub fn main() void {
55 const big = struct {
6 const Big = @Type(@as(std.builtin.Type, .{
7 .Enum = .{
8 .tag_type = u16,
9 .fields = make_fields: {
10 var fields: [1001]std.builtin.Type.EnumField = undefined;
11 for (&fields, 0..) |*field, i| {
12 field.* = .{ .name = std.fmt.comptimePrint("field_{d}", .{i}), .value = i };
13 }
14 fields[1000] = .{ .name = "field_9999", .value = 9999 };
15 break :make_fields &fields;
16 },
17 .decls = &.{},
18 .is_exhaustive = true,
6 const Big = @Type(.{ .@"enum" = .{
7 .tag_type = u16,
8 .fields = make_fields: {
9 var fields: [1001]std.builtin.Type.EnumField = undefined;
10 for (&fields, 0..) |*field, i| {
11 field.* = .{ .name = std.fmt.comptimePrint("field_{d}", .{i}), .value = i };
12 }
13 fields[1000] = .{ .name = "field_9999", .value = 9999 };
14 break :make_fields &fields;
1915 },
20 }));
16 .decls = &.{},
17 .is_exhaustive = true,
18 } });
2119 };
2220
2321 var set = std.enums.EnumSet(big.Big).init(.{});
tools/generate_c_size_and_align_checks.zig+1-1
......@@ -43,7 +43,7 @@ pub fn main() !void {
4343 const target = try std.zig.system.resolveTargetQuery(query);
4444
4545 const stdout = std.io.getStdOut().writer();
46 inline for (@typeInfo(std.Target.CType).Enum.fields) |field| {
46 inline for (@typeInfo(std.Target.CType).@"enum".fields) |field| {
4747 const c_type: std.Target.CType = @enumFromInt(field.value);
4848 try stdout.print("_Static_assert(sizeof({0s}) == {1d}, \"sizeof({0s}) == {1d}\");\n", .{
4949 cName(c_type),
tools/lldb_pretty_printers.py+1-1
......@@ -602,7 +602,7 @@ type_tag_handlers = {
602602 'error_set': lambda payload: type_tag_handlers['error_set_merged'](payload.GetChildMemberWithName('names')),
603603 'error_set_single': lambda payload: 'error{%s}' % zig_String_AsIdentifier(payload, zig_IsFieldName),
604604 'error_set_merged': lambda payload: 'error{%s}' % ','.join(zig_String_AsIdentifier(child.GetChildMemberWithName('key'), zig_IsFieldName) for child in payload.GetChildMemberWithName('entries').children),
605 'error_set_inferred': lambda payload: '@typeInfo(@typeInfo(@TypeOf(%s)).Fn.return_type.?).ErrorUnion.error_set' % OwnerDecl_RenderFullyQualifiedName(payload.GetChildMemberWithName('func')),
605 'error_set_inferred': lambda payload: '@typeInfo(@typeInfo(@TypeOf(%s)).@"fn".return_type.?).error_union.error_set' % OwnerDecl_RenderFullyQualifiedName(payload.GetChildMemberWithName('func')),
606606
607607 'enum_full': OwnerDecl_RenderFullyQualifiedName,
608608 'enum_nonexhaustive': OwnerDecl_RenderFullyQualifiedName,
tools/update_clang_options.zig+1-1
......@@ -616,7 +616,7 @@ pub fn main() anyerror!void {
616616
617617 var llvm_to_zig_cpu_features = std.StringHashMap([]const u8).init(allocator);
618618
619 inline for (@typeInfo(cpu_targets).Struct.decls) |decl| {
619 inline for (@typeInfo(cpu_targets).@"struct".decls) |decl| {
620620 const Feature = @field(cpu_targets, decl.name).Feature;
621621 const all_features = @field(cpu_targets, decl.name).all_features;
622622
tools/update_cpu_features.zig+2-2
......@@ -1348,7 +1348,7 @@ fn processOneTarget(job: Job) anyerror!void {
13481348 try w.print(" @setEvalBranchQuota({d});\n", .{branch_quota});
13491349 }
13501350 try w.writeAll(
1351 \\ const len = @typeInfo(Feature).Enum.fields.len;
1351 \\ const len = @typeInfo(Feature).@"enum".fields.len;
13521352 \\ std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
13531353 \\ var result: [len]CpuFeature = undefined;
13541354 \\
......@@ -1417,7 +1417,7 @@ fn processOneTarget(job: Job) anyerror!void {
14171417 \\ const ti = @typeInfo(Feature);
14181418 \\ for (&result, 0..) |*elem, i| {
14191419 \\ elem.index = i;
1420 \\ elem.name = ti.Enum.fields[i].name;
1420 \\ elem.name = ti.@"enum".fields[i].name;
14211421 \\ }
14221422 \\ break :blk result;
14231423 \\};
tools/update_spirv_features.zig+2-2
......@@ -129,7 +129,7 @@ pub fn main() !void {
129129 \\
130130 \\pub const all_features = blk: {
131131 \\ @setEvalBranchQuota(2000);
132 \\ const len = @typeInfo(Feature).Enum.fields.len;
132 \\ const len = @typeInfo(Feature).@"enum".fields.len;
133133 \\ std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
134134 \\ var result: [len]CpuFeature = undefined;
135135 \\
......@@ -210,7 +210,7 @@ pub fn main() !void {
210210 \\ const ti = @typeInfo(Feature);
211211 \\ for (&result, 0..) |*elem, i| {
212212 \\ elem.index = i;
213 \\ elem.name = ti.Enum.fields[i].name;
213 \\ elem.name = ti.@"enum".fields[i].name;
214214 \\ }
215215 \\ break :blk result;
216216 \\};