Truncated division. Rounds toward zero. For unsigned integers it is
the same as {#syntax#}numerator / denominator{#endsyntax#}. Caller guarantees {#syntax#}denominator != 0{#endsyntax#} and
- {#syntax#}!(@typeInfo(T) == .Int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
+ {#syntax#}!(@typeInfo(T) == .int and T.is_signed and numerator == std.math.minInt(T) and denominator == -1){#endsyntax#}.
- {#syntax#}@divTrunc(-5, 3) == -1{#endsyntax#}
@@ -5320,8 +5320,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
any bits that disagree with the resultant sign bit are shifted out.
- The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).Int.bits){#endsyntax#} bits.
- This is because {#syntax#}shift_amt >= @typeInfo(T).Int.bits{#endsyntax#} is undefined behavior.
+ The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).int.bits){#endsyntax#} bits.
+ This is because {#syntax#}shift_amt >= @typeInfo(T).int.bits{#endsyntax#} is undefined behavior.
{#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
Performs {#syntax#}a << b{#endsyntax#} and returns a tuple with the result and a possible overflow bit.
- The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(@TypeOf(a)).Int.bits){#endsyntax#} bits.
- This is because {#syntax#}shift_amt >= @typeInfo(@TypeOf(a)).Int.bits{#endsyntax#} is undefined behavior.
+ The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(@TypeOf(a)).int.bits){#endsyntax#} bits.
+ This is because {#syntax#}shift_amt >= @typeInfo(@TypeOf(a)).int.bits{#endsyntax#} is undefined behavior.
{#see_also|@shlExact|@shrExact#}
{#header_close#}
@@ -5350,8 +5350,8 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
that the shift will not shift any 1 bits out.
- The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).Int.bits){#endsyntax#} bits.
- This is because {#syntax#}shift_amt >= @typeInfo(T).Int.bits{#endsyntax#} is undefined behavior.
+ The type of {#syntax#}shift_amt{#endsyntax#} is an unsigned integer with {#syntax#}log2(@typeInfo(T).int.bits){#endsyntax#} bits.
+ This is because {#syntax#}shift_amt >= @typeInfo(T).int.bits{#endsyntax#} is undefined behavior.
{#see_also|@shlExact|@shlWithOverflow#}
{#header_close#}
@@ -5405,7 +5405,7 @@ fn cmpxchgWeakButNotAtomic(comptime T: type, ptr: *T, expected_value: T, new_val
This size may contain padding bytes. If there were two consecutive T in memory, the padding would be the offset
in bytes between element at index 0 and the element at index 1. For {#link|integer|Integers#},
consider whether you want to use {#syntax#}@sizeOf(T){#endsyntax#} or
- {#syntax#}@typeInfo(T).Int.bits{#endsyntax#}.
+ {#syntax#}@typeInfo(T).int.bits{#endsyntax#}.
This function measures the size at runtime. For types that are disallowed at runtime, such as
diff --git a/doc/langref/inline_prong_range.zig b/doc/langref/inline_prong_range.zig
index 95c799125df5..3d68324c5684 100644
--- a/doc/langref/inline_prong_range.zig
+++ b/doc/langref/inline_prong_range.zig
@@ -1,7 +1,7 @@
fn isFieldOptional(comptime T: type, field_index: usize) !bool {
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
return switch (field_index) {
- inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].type) == .Optional,
+ inline 0...fields.len - 1 => |idx| @typeInfo(fields[idx].type) == .optional,
else => return error.IndexOutOfBounds,
};
}
diff --git a/doc/langref/poc_printValue_fn.zig b/doc/langref/poc_printValue_fn.zig
index 4ac0d8b1b39c..e880081f9207 100644
--- a/doc/langref/poc_printValue_fn.zig
+++ b/doc/langref/poc_printValue_fn.zig
@@ -1,13 +1,13 @@
const Writer = struct {
pub fn printValue(self: *Writer, value: anytype) !void {
switch (@typeInfo(@TypeOf(value))) {
- .Int => {
+ .int => {
return self.writeInt(value);
},
- .Float => {
+ .float => {
return self.writeFloat(value);
},
- .Pointer => {
+ .pointer => {
return self.write(value);
},
else => {
diff --git a/doc/langref/test_enums.zig b/doc/langref/test_enums.zig
index be0433a7d0bc..4e0b3896f20e 100644
--- a/doc/langref/test_enums.zig
+++ b/doc/langref/test_enums.zig
@@ -95,13 +95,13 @@ const Small = enum {
four,
};
test "std.meta.Tag" {
- try expect(@typeInfo(Small).Enum.tag_type == u2);
+ try expect(@typeInfo(Small).@"enum".tag_type == u2);
}
// @typeInfo tells us the field count and the fields names:
test "@typeInfo" {
- try expect(@typeInfo(Small).Enum.fields.len == 4);
- try expect(mem.eql(u8, @typeInfo(Small).Enum.fields[1].name, "two"));
+ try expect(@typeInfo(Small).@"enum".fields.len == 4);
+ try expect(mem.eql(u8, @typeInfo(Small).@"enum".fields[1].name, "two"));
}
// @tagName gives a [:0]const u8 representation of an enum value:
diff --git a/doc/langref/test_error_union.zig b/doc/langref/test_error_union.zig
index 918c7e98f350..0cc01ec4a484 100644
--- a/doc/langref/test_error_union.zig
+++ b/doc/langref/test_error_union.zig
@@ -10,10 +10,10 @@ test "error union" {
foo = error.SomeError;
// Use compile-time reflection to access the payload type of an error union:
- try comptime expect(@typeInfo(@TypeOf(foo)).ErrorUnion.payload == i32);
+ try comptime expect(@typeInfo(@TypeOf(foo)).error_union.payload == i32);
// Use compile-time reflection to access the error set type of an error union:
- try comptime expect(@typeInfo(@TypeOf(foo)).ErrorUnion.error_set == anyerror);
+ try comptime expect(@typeInfo(@TypeOf(foo)).error_union.error_set == anyerror);
}
// test
diff --git a/doc/langref/test_fn_reflection.zig b/doc/langref/test_fn_reflection.zig
index 378024cfadb5..cc4dd50b3340 100644
--- a/doc/langref/test_fn_reflection.zig
+++ b/doc/langref/test_fn_reflection.zig
@@ -3,10 +3,10 @@ const math = std.math;
const testing = std.testing;
test "fn reflection" {
- try testing.expect(@typeInfo(@TypeOf(testing.expect)).Fn.params[0].type.? == bool);
- try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).Fn.return_type.? == testing.TmpDir);
+ try testing.expect(@typeInfo(@TypeOf(testing.expect)).@"fn".params[0].type.? == bool);
+ try testing.expect(@typeInfo(@TypeOf(testing.tmpDir)).@"fn".return_type.? == testing.TmpDir);
- try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).Fn.is_generic);
+ try testing.expect(@typeInfo(@TypeOf(math.Log2Int)).@"fn".is_generic);
}
// test
diff --git a/doc/langref/test_inline_else.zig b/doc/langref/test_inline_else.zig
index 40525749b65d..e535115935de 100644
--- a/doc/langref/test_inline_else.zig
+++ b/doc/langref/test_inline_else.zig
@@ -17,8 +17,8 @@ const AnySlice = union(enum) {
};
fn withFor(any: AnySlice) usize {
- const Tag = @typeInfo(AnySlice).Union.tag_type.?;
- inline for (@typeInfo(Tag).Enum.fields) |field| {
+ const Tag = @typeInfo(AnySlice).@"union".tag_type.?;
+ inline for (@typeInfo(Tag).@"enum".fields) |field| {
// With `inline for` the function gets generated as
// a series of `if` statements relying on the optimizer
// to convert it to a switch.
diff --git a/doc/langref/test_inline_switch.zig b/doc/langref/test_inline_switch.zig
index a8ffdb8175c3..b19c467ef5b5 100644
--- a/doc/langref/test_inline_switch.zig
+++ b/doc/langref/test_inline_switch.zig
@@ -3,11 +3,11 @@ const expect = std.testing.expect;
const expectError = std.testing.expectError;
fn isFieldOptional(comptime T: type, field_index: usize) !bool {
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
return switch (field_index) {
// This prong is analyzed twice with `idx` being a
// comptime-known value each time.
- inline 0, 1 => |idx| @typeInfo(fields[idx].type) == .Optional,
+ inline 0, 1 => |idx| @typeInfo(fields[idx].type) == .optional,
else => return error.IndexOutOfBounds,
};
}
diff --git a/doc/langref/test_optional_type.zig b/doc/langref/test_optional_type.zig
index b0004b3c9971..594198b49e30 100644
--- a/doc/langref/test_optional_type.zig
+++ b/doc/langref/test_optional_type.zig
@@ -8,7 +8,7 @@ test "optional type" {
foo = 1234;
// Use compile-time reflection to access the child type of the optional:
- try comptime expect(@typeInfo(@TypeOf(foo)).Optional.child == i32);
+ try comptime expect(@typeInfo(@TypeOf(foo)).optional.child == i32);
}
// test
diff --git a/doc/langref/test_pointer_casting.zig b/doc/langref/test_pointer_casting.zig
index 59c4a0a79667..359d1dc8389c 100644
--- a/doc/langref/test_pointer_casting.zig
+++ b/doc/langref/test_pointer_casting.zig
@@ -17,7 +17,7 @@ test "pointer casting" {
test "pointer child type" {
// pointer types have a `child` field which tells you the type they point to.
- try expect(@typeInfo(*u32).Pointer.child == u32);
+ try expect(@typeInfo(*u32).pointer.child == u32);
}
// test
diff --git a/doc/langref/test_variable_alignment.zig b/doc/langref/test_variable_alignment.zig
index 2f1d7da5d471..ea0024f98861 100644
--- a/doc/langref/test_variable_alignment.zig
+++ b/doc/langref/test_variable_alignment.zig
@@ -8,7 +8,7 @@ test "variable alignment" {
try expect(@TypeOf(&x) == *i32);
try expect(*i32 == *align(align_of_i32) i32);
if (builtin.target.cpu.arch == .x86_64) {
- try expect(@typeInfo(*i32).Pointer.alignment == 4);
+ try expect(@typeInfo(*i32).pointer.alignment == 4);
}
}
diff --git a/doc/langref/test_variable_func_alignment.zig b/doc/langref/test_variable_func_alignment.zig
index 70aa44253a17..e0aa949cee6c 100644
--- a/doc/langref/test_variable_func_alignment.zig
+++ b/doc/langref/test_variable_func_alignment.zig
@@ -3,7 +3,7 @@ const expect = @import("std").testing.expect;
var foo: u8 align(4) = 100;
test "global variable alignment" {
- try expect(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4);
+ try expect(@typeInfo(@TypeOf(&foo)).pointer.alignment == 4);
try expect(@TypeOf(&foo) == *align(4) u8);
const as_pointer_to_array: *align(4) [1]u8 = &foo;
const as_slice: []align(4) u8 = as_pointer_to_array;
diff --git a/doc/langref/test_variadic_function.zig b/doc/langref/test_variadic_function.zig
index b47b75e1a893..e5d9777f6411 100644
--- a/doc/langref/test_variadic_function.zig
+++ b/doc/langref/test_variadic_function.zig
@@ -5,7 +5,7 @@ pub extern "c" fn printf(format: [*:0]const u8, ...) c_int;
test "variadic function" {
try testing.expect(printf("Hello, world!\n") == 14);
- try testing.expect(@typeInfo(@TypeOf(printf)).Fn.is_var_args);
+ try testing.expect(@typeInfo(@TypeOf(printf)).@"fn".is_var_args);
}
// test
diff --git a/lib/compiler/aro/aro/Attribute.zig b/lib/compiler/aro/aro/Attribute.zig
index e6fcb8e8cf87..4671028b8fa5 100644
--- a/lib/compiler/aro/aro/Attribute.zig
+++ b/lib/compiler/aro/aro/Attribute.zig
@@ -67,7 +67,7 @@ pub fn requiredArgCount(attr: Tag) u32 {
comptime {
const fields = std.meta.fields(@field(attributes, @tagName(tag)));
for (fields) |arg_field| {
- if (!mem.eql(u8, arg_field.name, "__name_tok") and @typeInfo(arg_field.type) != .Optional) needed += 1;
+ if (!mem.eql(u8, arg_field.name, "__name_tok") and @typeInfo(arg_field.type) != .optional) needed += 1;
}
}
return needed;
@@ -93,7 +93,7 @@ pub fn maxArgCount(attr: Tag) u32 {
fn UnwrapOptional(comptime T: type) type {
return switch (@typeInfo(T)) {
- .Optional => |optional| optional.child,
+ .optional => |optional| optional.child,
else => T,
};
}
@@ -110,7 +110,7 @@ pub const Formatting = struct {
if (fields.len == 0) unreachable;
const Unwrapped = UnwrapOptional(fields[0].type);
- if (@typeInfo(Unwrapped) != .Enum) unreachable;
+ if (@typeInfo(Unwrapped) != .@"enum") unreachable;
return if (Unwrapped.opts.enum_kind == .identifier) "'" else "\"";
},
@@ -127,9 +127,9 @@ pub const Formatting = struct {
if (fields.len == 0) unreachable;
const Unwrapped = UnwrapOptional(fields[0].type);
- if (@typeInfo(Unwrapped) != .Enum) unreachable;
+ if (@typeInfo(Unwrapped) != .@"enum") unreachable;
- const enum_fields = @typeInfo(Unwrapped).Enum.fields;
+ const enum_fields = @typeInfo(Unwrapped).@"enum".fields;
@setEvalBranchQuota(3000);
const quote = comptime quoteChar(@enumFromInt(@intFromEnum(tag)));
comptime var values: []const u8 = quote ++ enum_fields[0].name ++ quote;
@@ -152,7 +152,7 @@ pub fn wantsIdentEnum(attr: Tag) bool {
if (fields.len == 0) return false;
const Unwrapped = UnwrapOptional(fields[0].type);
- if (@typeInfo(Unwrapped) != .Enum) return false;
+ if (@typeInfo(Unwrapped) != .@"enum") return false;
return Unwrapped.opts.enum_kind == .identifier;
},
@@ -165,7 +165,7 @@ pub fn diagnoseIdent(attr: Tag, arguments: *Arguments, ident: []const u8) ?Diagn
const fields = std.meta.fields(@field(attributes, @tagName(tag)));
if (fields.len == 0) unreachable;
const Unwrapped = UnwrapOptional(fields[0].type);
- if (@typeInfo(Unwrapped) != .Enum) unreachable;
+ if (@typeInfo(Unwrapped) != .@"enum") unreachable;
if (std.meta.stringToEnum(Unwrapped, normalize(ident))) |enum_val| {
@field(@field(arguments, @tagName(tag)), fields[0].name) = enum_val;
return null;
@@ -239,7 +239,7 @@ fn diagnoseField(
const key = p.comp.interner.get(res.val.ref());
switch (key) {
.int => {
- if (@typeInfo(Wanted) == .Int) {
+ if (@typeInfo(Wanted) == .int) {
@field(@field(arguments, decl.name), field.name) = res.val.toInt(Wanted, p.comp) orelse return .{
.tag = .attribute_int_out_of_range,
.extra = .{ .str = try res.str(p) },
@@ -258,7 +258,7 @@ fn diagnoseField(
}
@field(@field(arguments, decl.name), field.name) = try p.removeNull(res.val);
return null;
- } else if (@typeInfo(Wanted) == .Enum and @hasDecl(Wanted, "opts") and Wanted.opts.enum_kind == .string) {
+ } else if (@typeInfo(Wanted) == .@"enum" and @hasDecl(Wanted, "opts") and Wanted.opts.enum_kind == .string) {
const str = bytes[0 .. bytes.len - 1];
if (std.meta.stringToEnum(Wanted, str)) |enum_val| {
@field(@field(arguments, decl.name), field.name) = enum_val;
@@ -293,7 +293,7 @@ fn invalidArgMsg(comptime Expected: type, actual: ArgumentType) Diagnostics.Mess
Alignment => .alignment,
CallingConvention => .identifier,
else => switch (@typeInfo(Expected)) {
- .Enum => if (Expected.opts.enum_kind == .string) .string else .identifier,
+ .@"enum" => if (Expected.opts.enum_kind == .string) .string else .identifier,
else => unreachable,
},
}, .actual = actual } },
@@ -303,7 +303,7 @@ fn invalidArgMsg(comptime Expected: type, actual: ArgumentType) Diagnostics.Mess
pub fn diagnose(attr: Tag, arguments: *Arguments, arg_idx: u32, res: Parser.Result, node: Tree.Node, p: *Parser) !?Diagnostics.Message {
switch (attr) {
inline else => |tag| {
- const decl = @typeInfo(attributes).Struct.decls[@intFromEnum(tag)];
+ const decl = @typeInfo(attributes).@"struct".decls[@intFromEnum(tag)];
const max_arg_count = comptime maxArgCount(tag);
if (arg_idx >= max_arg_count) return Diagnostics.Message{
.tag = .attribute_too_many_args,
@@ -641,7 +641,7 @@ const attributes = struct {
pub const Tag = std.meta.DeclEnum(attributes);
pub const Arguments = blk: {
- const decls = @typeInfo(attributes).Struct.decls;
+ const decls = @typeInfo(attributes).@"struct".decls;
var union_fields: [decls.len]ZigType.UnionField = undefined;
for (decls, &union_fields) |decl, *field| {
field.* = .{
@@ -652,7 +652,7 @@ pub const Arguments = blk: {
}
break :blk @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = null,
.fields = &union_fields,
@@ -662,7 +662,7 @@ pub const Arguments = blk: {
};
pub fn ArgumentsForTag(comptime tag: Tag) type {
- const decl = @typeInfo(attributes).Struct.decls[@intFromEnum(tag)];
+ const decl = @typeInfo(attributes).@"struct".decls[@intFromEnum(tag)];
return @field(attributes, decl.name);
}
diff --git a/lib/compiler/aro/aro/Compilation.zig b/lib/compiler/aro/aro/Compilation.zig
index d361f42c904b..f04df5001ef1 100644
--- a/lib/compiler/aro/aro/Compilation.zig
+++ b/lib/compiler/aro/aro/Compilation.zig
@@ -61,7 +61,7 @@ pub const Environment = struct {
var env: Environment = .{};
errdefer env.deinit(allocator);
- inline for (@typeInfo(@TypeOf(env)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(env)).@"struct".fields) |field| {
std.debug.assert(@field(env, field.name) == null);
var env_var_buf: [field.name.len]u8 = undefined;
@@ -78,7 +78,7 @@ pub const Environment = struct {
/// Use this only if environment slices were allocated with `allocator` (such as via `loadAll`)
pub fn deinit(self: *Environment, allocator: std.mem.Allocator) void {
- inline for (@typeInfo(@TypeOf(self.*)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(self.*)).@"struct".fields) |field| {
if (@field(self, field.name)) |slice| {
allocator.free(slice);
}
diff --git a/lib/compiler/aro/aro/Tree.zig b/lib/compiler/aro/aro/Tree.zig
index efd5a8b56db1..e353beaebc62 100644
--- a/lib/compiler/aro/aro/Tree.zig
+++ b/lib/compiler/aro/aro/Tree.zig
@@ -707,7 +707,7 @@ fn dumpAttribute(tree: *const Tree, attr: Attribute, writer: anytype) !void {
switch (attr.tag) {
inline else => |tag| {
const args = @field(attr.args, @tagName(tag));
- const fields = @typeInfo(@TypeOf(args)).Struct.fields;
+ const fields = @typeInfo(@TypeOf(args)).@"struct".fields;
if (fields.len == 0) {
try writer.writeByte('\n');
return;
@@ -724,7 +724,7 @@ fn dumpAttribute(tree: *const Tree, attr: Attribute, writer: anytype) !void {
Interner.Ref => try writer.print("\"{s}\"", .{tree.interner.get(@field(args, f.name)).bytes}),
?Interner.Ref => try writer.print("\"{?s}\"", .{if (@field(args, f.name)) |str| tree.interner.get(str).bytes else null}),
else => switch (@typeInfo(f.type)) {
- .Enum => try writer.writeAll(@tagName(@field(args, f.name))),
+ .@"enum" => try writer.writeAll(@tagName(@field(args, f.name))),
else => try writer.print("{any}", .{@field(args, f.name)}),
},
}
diff --git a/lib/compiler/aro/aro/Value.zig b/lib/compiler/aro/aro/Value.zig
index 45d49c99ffa3..2dd9a86abe24 100644
--- a/lib/compiler/aro/aro/Value.zig
+++ b/lib/compiler/aro/aro/Value.zig
@@ -24,7 +24,7 @@ pub fn intern(comp: *Compilation, k: Interner.Key) !Value {
pub fn int(i: anytype, comp: *Compilation) !Value {
const info = @typeInfo(@TypeOf(i));
- if (info == .ComptimeInt or info.Int.signedness == .unsigned) {
+ if (info == .comptime_int or info.int.signedness == .unsigned) {
return intern(comp, .{ .int = .{ .u64 = i } });
} else {
return intern(comp, .{ .int = .{ .i64 = i } });
diff --git a/lib/compiler/aro/backend/Interner.zig b/lib/compiler/aro/backend/Interner.zig
index 028b45fa9e7d..45b6e51fd950 100644
--- a/lib/compiler/aro/backend/Interner.zig
+++ b/lib/compiler/aro/backend/Interner.zig
@@ -505,7 +505,7 @@ pub fn put(i: *Interner, gpa: Allocator, key: Key) !Ref {
});
},
.record_ty => |elems| {
- try i.extra.ensureUnusedCapacity(gpa, @typeInfo(Tag.Record).Struct.fields.len +
+ try i.extra.ensureUnusedCapacity(gpa, @typeInfo(Tag.Record).@"struct".fields.len +
elems.len);
i.items.appendAssumeCapacity(.{
.tag = .record_ty,
@@ -527,14 +527,14 @@ pub fn put(i: *Interner, gpa: Allocator, key: Key) !Ref {
}
fn addExtra(i: *Interner, gpa: Allocator, extra: anytype) Allocator.Error!u32 {
- const fields = @typeInfo(@TypeOf(extra)).Struct.fields;
+ const fields = @typeInfo(@TypeOf(extra)).@"struct".fields;
try i.extra.ensureUnusedCapacity(gpa, fields.len);
return i.addExtraAssumeCapacity(extra);
}
fn addExtraAssumeCapacity(i: *Interner, extra: anytype) u32 {
const result = @as(u32, @intCast(i.extra.items.len));
- inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
i.extra.appendAssumeCapacity(switch (field.type) {
Ref => @intFromEnum(@field(extra, field.name)),
u32 => @field(extra, field.name),
@@ -631,7 +631,7 @@ fn extraData(i: *const Interner, comptime T: type, index: usize) T {
fn extraDataTrail(i: *const Interner, comptime T: type, index: usize) struct { data: T, end: u32 } {
var result: T = undefined;
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
inline for (fields, 0..) |field, field_i| {
const int32 = i.extra.items[field_i + index];
@field(result, field.name) = switch (field.type) {
diff --git a/lib/compiler/aro_translate_c.zig b/lib/compiler/aro_translate_c.zig
index ad7584c7266d..692786c2bead 100644
--- a/lib/compiler/aro_translate_c.zig
+++ b/lib/compiler/aro_translate_c.zig
@@ -168,7 +168,7 @@ pub fn translate(
context.pattern_list.deinit(gpa);
}
- inline for (@typeInfo(std.zig.c_builtins).Struct.decls) |decl| {
+ inline for (@typeInfo(std.zig.c_builtins).@"struct".decls) |decl| {
const builtin_fn = try ZigTag.pub_var_simple.create(arena, .{
.name = decl.name,
.init = try ZigTag.import_c_builtin.create(arena, decl.name),
diff --git a/lib/compiler/resinator/bmp.zig b/lib/compiler/resinator/bmp.zig
index 134ee81966c2..03a8638ad75d 100644
--- a/lib/compiler/resinator/bmp.zig
+++ b/lib/compiler/resinator/bmp.zig
@@ -224,7 +224,7 @@ pub const Compression = enum(u32) {
};
fn structFieldsLittleToNative(comptime T: type, x: *T) void {
- inline for (@typeInfo(T).Struct.fields) |field| {
+ inline for (@typeInfo(T).@"struct".fields) |field| {
@field(x, field.name) = std.mem.littleToNative(field.type, @field(x, field.name));
}
}
diff --git a/lib/compiler/resinator/code_pages.zig b/lib/compiler/resinator/code_pages.zig
index cacd5acded3a..48131678114a 100644
--- a/lib/compiler/resinator/code_pages.zig
+++ b/lib/compiler/resinator/code_pages.zig
@@ -259,7 +259,7 @@ pub const CodePage = enum(u16) {
pub fn getByIdentifier(identifier: u16) !CodePage {
// There's probably a more efficient way to do this (e.g. ComptimeHashMap?) but
// this should be fine, especially since this function likely won't be called much.
- inline for (@typeInfo(CodePage).Enum.fields) |enumField| {
+ inline for (@typeInfo(CodePage).@"enum".fields) |enumField| {
if (identifier == enumField.value) {
return @field(CodePage, enumField.name);
}
diff --git a/lib/compiler/resinator/errors.zig b/lib/compiler/resinator/errors.zig
index 5cfa766ac124..90744e993419 100644
--- a/lib/compiler/resinator/errors.zig
+++ b/lib/compiler/resinator/errors.zig
@@ -250,7 +250,7 @@ pub const ErrorDetails = struct {
});
pub fn writeCommaSeparated(self: ExpectedTypes, writer: anytype) !void {
- const struct_info = @typeInfo(ExpectedTypes).Struct;
+ const struct_info = @typeInfo(ExpectedTypes).@"struct";
const num_real_fields = struct_info.fields.len - 1;
const num_padding_bits = @bitSizeOf(ExpectedTypes) - num_real_fields;
const mask = std.math.maxInt(struct_info.backing_integer.?) >> num_padding_bits;
diff --git a/lib/compiler/resinator/ico.zig b/lib/compiler/resinator/ico.zig
index 664def038be4..e6de1d469e91 100644
--- a/lib/compiler/resinator/ico.zig
+++ b/lib/compiler/resinator/ico.zig
@@ -14,7 +14,7 @@ pub fn read(allocator: std.mem.Allocator, reader: anytype, max_size: u64) ReadEr
// Some Reader implementations have an empty ReadError error set which would
// cause 'unreachable else' if we tried to use an else in the switch, so we
// need to detect this case and not try to translate to ReadError
- const empty_reader_errorset = @typeInfo(@TypeOf(reader).Error).ErrorSet == null or @typeInfo(@TypeOf(reader).Error).ErrorSet.?.len == 0;
+ const empty_reader_errorset = @typeInfo(@TypeOf(reader).Error).error_set == null or @typeInfo(@TypeOf(reader).Error).error_set.?.len == 0;
if (empty_reader_errorset) {
return readAnyError(allocator, reader, max_size) catch |err| switch (err) {
error.EndOfStream => error.UnexpectedEOF,
diff --git a/lib/compiler/resinator/lang.zig b/lib/compiler/resinator/lang.zig
index 51843cff8716..bf3668071007 100644
--- a/lib/compiler/resinator/lang.zig
+++ b/lib/compiler/resinator/lang.zig
@@ -87,7 +87,7 @@ pub fn tagToId(tag: []const u8) error{InvalidLanguageTag}!?LanguageId {
if (parsed.multiple_suffixes) return null;
const longest_known_tag = comptime blk: {
var len = 0;
- for (@typeInfo(LanguageId).Enum.fields) |field| {
+ for (@typeInfo(LanguageId).@"enum".fields) |field| {
if (field.name.len > len) len = field.name.len;
}
break :blk len;
diff --git a/lib/compiler/test_runner.zig b/lib/compiler/test_runner.zig
index 4be261912c1b..836f70f93131 100644
--- a/lib/compiler/test_runner.zig
+++ b/lib/compiler/test_runner.zig
@@ -265,7 +265,7 @@ fn mainTerminal() void {
pub fn log(
comptime message_level: std.log.Level,
- comptime scope: @Type(.EnumLiteral),
+ comptime scope: @Type(.enum_literal),
comptime format: []const u8,
args: anytype,
) void {
diff --git a/lib/compiler_rt/addf3.zig b/lib/compiler_rt/addf3.zig
index ee6a2b6be4cb..60ae0165a8da 100644
--- a/lib/compiler_rt/addf3.zig
+++ b/lib/compiler_rt/addf3.zig
@@ -7,7 +7,7 @@ const normalize = common.normalize;
///
/// https://github.com/llvm/llvm-project/blob/02d85149a05cb1f6dc49f0ba7a2ceca53718ae17/compiler-rt/lib/builtins/fp_add_impl.inc
pub inline fn addf3(comptime T: type, a: T, b: T) T {
- const bits = @typeInfo(T).Float.bits;
+ const bits = @typeInfo(T).float.bits;
const Z = std.meta.Int(.unsigned, bits);
const typeWidth = bits;
diff --git a/lib/compiler_rt/ceil.zig b/lib/compiler_rt/ceil.zig
index e417567e62ff..e1139ff9f46b 100644
--- a/lib/compiler_rt/ceil.zig
+++ b/lib/compiler_rt/ceil.zig
@@ -130,7 +130,7 @@ pub fn ceilq(x: f128) callconv(.C) f128 {
}
pub fn ceill(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __ceilh(x),
32 => return ceilf(x),
64 => return ceil(x),
diff --git a/lib/compiler_rt/common.zig b/lib/compiler_rt/common.zig
index 1645a3951deb..1dfd4be07f7c 100644
--- a/lib/compiler_rt/common.zig
+++ b/lib/compiler_rt/common.zig
@@ -219,8 +219,8 @@ pub fn wideMultiply(comptime Z: type, a: Z, b: Z, hi: *Z, lo: *Z) void {
}
}
-pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).Float.bits)) i32 {
- const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeInfo(T).float.bits)) i32 {
+ const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const integerBit = @as(Z, 1) << std.math.floatFractionalBits(T);
const shift = @clz(significand.*) - @clz(integerBit);
@@ -230,8 +230,8 @@ pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeIn
pub inline fn fneg(a: anytype) @TypeOf(a) {
const F = @TypeOf(a);
- const bits = @typeInfo(F).Float.bits;
- const U = @Type(.{ .Int = .{
+ const bits = @typeInfo(F).float.bits;
+ const U = @Type(.{ .int = .{
.signedness = .unsigned,
.bits = bits,
} });
@@ -244,7 +244,7 @@ pub inline fn fneg(a: anytype) @TypeOf(a) {
/// signed or unsigned integers.
pub fn HalveInt(comptime T: type, comptime signed_half: bool) type {
return extern union {
- pub const bits = @divExact(@typeInfo(T).Int.bits, 2);
+ pub const bits = @divExact(@typeInfo(T).int.bits, 2);
pub const HalfTU = std.meta.Int(.unsigned, bits);
pub const HalfTS = std.meta.Int(.signed, bits);
pub const HalfT = if (signed_half) HalfTS else HalfTU;
diff --git a/lib/compiler_rt/comparef.zig b/lib/compiler_rt/comparef.zig
index 25b54019110e..512eba05945f 100644
--- a/lib/compiler_rt/comparef.zig
+++ b/lib/compiler_rt/comparef.zig
@@ -17,7 +17,7 @@ pub const GE = enum(i32) {
};
pub inline fn cmpf2(comptime T: type, comptime RT: type, a: T, b: T) RT {
- const bits = @typeInfo(T).Float.bits;
+ const bits = @typeInfo(T).float.bits;
const srep_t = std.meta.Int(.signed, bits);
const rep_t = std.meta.Int(.unsigned, bits);
@@ -109,7 +109,7 @@ test "cmp_f80" {
}
pub inline fn unordcmp(comptime T: type, a: T, b: T) i32 {
- const rep_t = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const rep_t = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const significandBits = std.math.floatMantissaBits(T);
const exponentBits = std.math.floatExponentBits(T);
diff --git a/lib/compiler_rt/cos.zig b/lib/compiler_rt/cos.zig
index 336e106d11f2..5cbe5af6e8be 100644
--- a/lib/compiler_rt/cos.zig
+++ b/lib/compiler_rt/cos.zig
@@ -124,7 +124,7 @@ pub fn cosq(a: f128) callconv(.C) f128 {
}
pub fn cosl(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __cosh(x),
32 => return cosf(x),
64 => return cos(x),
diff --git a/lib/compiler_rt/count0bits.zig b/lib/compiler_rt/count0bits.zig
index cb05cfb63613..60da0390da2f 100644
--- a/lib/compiler_rt/count0bits.zig
+++ b/lib/compiler_rt/count0bits.zig
@@ -203,7 +203,7 @@ pub fn __ctzti2(a: i128) callconv(.C) i32 {
}
inline fn ffsXi2(comptime T: type, a: T) i32 {
- var x: std.meta.Int(.unsigned, @typeInfo(T).Int.bits) = @bitCast(a);
+ var x: std.meta.Int(.unsigned, @typeInfo(T).int.bits) = @bitCast(a);
var n: T = 1;
// adapted from Number of trailing zeroes (see ctzXi2)
var mask: @TypeOf(x) = std.math.maxInt(@TypeOf(x));
diff --git a/lib/compiler_rt/exp.zig b/lib/compiler_rt/exp.zig
index 4a714e4d8042..7245abe19112 100644
--- a/lib/compiler_rt/exp.zig
+++ b/lib/compiler_rt/exp.zig
@@ -201,7 +201,7 @@ pub fn expq(a: f128) callconv(.C) f128 {
}
pub fn expl(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __exph(x),
32 => return expf(x),
64 => return exp(x),
diff --git a/lib/compiler_rt/exp2.zig b/lib/compiler_rt/exp2.zig
index bdea392ff177..5aa43a6543bf 100644
--- a/lib/compiler_rt/exp2.zig
+++ b/lib/compiler_rt/exp2.zig
@@ -168,7 +168,7 @@ pub fn exp2q(x: f128) callconv(.C) f128 {
}
pub fn exp2l(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __exp2h(x),
32 => return exp2f(x),
64 => return exp2(x),
diff --git a/lib/compiler_rt/extendf.zig b/lib/compiler_rt/extendf.zig
index b4e3f37f38dc..5c7c2fecde9a 100644
--- a/lib/compiler_rt/extendf.zig
+++ b/lib/compiler_rt/extendf.zig
@@ -3,10 +3,10 @@ const std = @import("std");
pub inline fn extendf(
comptime dst_t: type,
comptime src_t: type,
- a: std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits),
+ a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits),
) dst_t {
- const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits);
- const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).Float.bits);
+ const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);
+ const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);
const srcSigBits = std.math.floatMantissaBits(src_t);
const dstSigBits = std.math.floatMantissaBits(dst_t);
@@ -70,8 +70,8 @@ pub inline fn extendf(
return @bitCast(result);
}
-pub inline fn extend_f80(comptime src_t: type, a: std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits)) f80 {
- const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits);
+pub inline fn extend_f80(comptime src_t: type, a: std.meta.Int(.unsigned, @typeInfo(src_t).float.bits)) f80 {
+ const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);
const src_sig_bits = std.math.floatMantissaBits(src_t);
const dst_int_bit = 0x8000000000000000;
const dst_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit
diff --git a/lib/compiler_rt/fabs.zig b/lib/compiler_rt/fabs.zig
index 166c27fcd1e4..2ab6db591369 100644
--- a/lib/compiler_rt/fabs.zig
+++ b/lib/compiler_rt/fabs.zig
@@ -38,7 +38,7 @@ pub fn fabsq(a: f128) callconv(.C) f128 {
}
pub fn fabsl(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __fabsh(x),
32 => return fabsf(x),
64 => return fabs(x),
@@ -50,7 +50,7 @@ pub fn fabsl(x: c_longdouble) callconv(.C) c_longdouble {
inline fn generic_fabs(x: anytype) @TypeOf(x) {
const T = @TypeOf(x);
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const float_bits: TBits = @bitCast(x);
const remove_sign = ~@as(TBits, 0) >> 1;
return @bitCast(float_bits & remove_sign);
diff --git a/lib/compiler_rt/float_from_int.zig b/lib/compiler_rt/float_from_int.zig
index 66f5eb0587ff..f552a3ae5c58 100644
--- a/lib/compiler_rt/float_from_int.zig
+++ b/lib/compiler_rt/float_from_int.zig
@@ -18,7 +18,7 @@ pub fn floatFromInt(comptime T: type, x: anytype) T {
const max_exp = exp_bias;
// Sign
- const abs_val = if (@TypeOf(x) == comptime_int or @typeInfo(@TypeOf(x)).Int.signedness == .signed) @abs(x) else x;
+ const abs_val = if (@TypeOf(x) == comptime_int or @typeInfo(@TypeOf(x)).int.signedness == .signed) @abs(x) else x;
const sign_bit = if (x < 0) @as(uT, 1) << (float_bits - 1) else 0;
var result: uT = sign_bit;
diff --git a/lib/compiler_rt/floor.zig b/lib/compiler_rt/floor.zig
index 4551266adbe3..b9eb4e32515e 100644
--- a/lib/compiler_rt/floor.zig
+++ b/lib/compiler_rt/floor.zig
@@ -160,7 +160,7 @@ pub fn floorq(x: f128) callconv(.C) f128 {
}
pub fn floorl(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __floorh(x),
32 => return floorf(x),
64 => return floor(x),
diff --git a/lib/compiler_rt/fma.zig b/lib/compiler_rt/fma.zig
index 163377adf2ea..46377bdc2e52 100644
--- a/lib/compiler_rt/fma.zig
+++ b/lib/compiler_rt/fma.zig
@@ -151,7 +151,7 @@ pub fn fmaq(x: f128, y: f128, z: f128) callconv(.C) f128 {
}
pub fn fmal(x: c_longdouble, y: c_longdouble, z: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __fmah(x, y, z),
32 => return fmaf(x, y, z),
64 => return fma(x, y, z),
diff --git a/lib/compiler_rt/fmax.zig b/lib/compiler_rt/fmax.zig
index 27285c575b57..a26d41a2b316 100644
--- a/lib/compiler_rt/fmax.zig
+++ b/lib/compiler_rt/fmax.zig
@@ -39,7 +39,7 @@ pub fn fmaxq(x: f128, y: f128) callconv(.C) f128 {
}
pub fn fmaxl(x: c_longdouble, y: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __fmaxh(x, y),
32 => return fmaxf(x, y),
64 => return fmax(x, y),
diff --git a/lib/compiler_rt/fmin.zig b/lib/compiler_rt/fmin.zig
index 2a61f8068794..079e5032185d 100644
--- a/lib/compiler_rt/fmin.zig
+++ b/lib/compiler_rt/fmin.zig
@@ -39,7 +39,7 @@ pub fn fminq(x: f128, y: f128) callconv(.C) f128 {
}
pub fn fminl(x: c_longdouble, y: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __fminh(x, y),
32 => return fminf(x, y),
64 => return fmin(x, y),
diff --git a/lib/compiler_rt/fmod.zig b/lib/compiler_rt/fmod.zig
index 69f77d8adb1d..592a563e7e86 100644
--- a/lib/compiler_rt/fmod.zig
+++ b/lib/compiler_rt/fmod.zig
@@ -251,7 +251,7 @@ pub fn fmodq(a: f128, b: f128) callconv(.C) f128 {
}
pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __fmodh(a, b),
32 => return fmodf(a, b),
64 => return fmod(a, b),
@@ -262,7 +262,7 @@ pub fn fmodl(a: c_longdouble, b: c_longdouble) callconv(.C) c_longdouble {
}
inline fn generic_fmod(comptime T: type, x: T, y: T) T {
- const bits = @typeInfo(T).Float.bits;
+ const bits = @typeInfo(T).float.bits;
const uint = std.meta.Int(.unsigned, bits);
comptime assert(T == f32 or T == f64);
const digits = if (T == f32) 23 else 52;
diff --git a/lib/compiler_rt/int_from_float.zig b/lib/compiler_rt/int_from_float.zig
index 7149bf53bf9f..f0624ebb592f 100644
--- a/lib/compiler_rt/int_from_float.zig
+++ b/lib/compiler_rt/int_from_float.zig
@@ -4,8 +4,8 @@ const Log2Int = math.Log2Int;
pub inline fn intFromFloat(comptime I: type, a: anytype) I {
const F = @TypeOf(a);
- const float_bits = @typeInfo(F).Float.bits;
- const int_bits = @typeInfo(I).Int.bits;
+ const float_bits = @typeInfo(F).float.bits;
+ const int_bits = @typeInfo(I).int.bits;
const rep_t = Int(.unsigned, float_bits);
const sig_bits = math.floatMantissaBits(F);
const exp_bits = math.floatExponentBits(F);
@@ -26,7 +26,7 @@ pub inline fn intFromFloat(comptime I: type, a: anytype) I {
if (exponent < 0) return 0;
// If the value is too large for the integer type, saturate.
- switch (@typeInfo(I).Int.signedness) {
+ switch (@typeInfo(I).int.signedness) {
.unsigned => {
if (negative) return 0;
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 {
result = @as(I, @intCast(significand)) << @intCast(exponent - fractional_bits);
}
- if ((@typeInfo(I).Int.signedness == .signed) and negative)
+ if ((@typeInfo(I).int.signedness == .signed) and negative)
return ~result +% 1;
return result;
}
diff --git a/lib/compiler_rt/log.zig b/lib/compiler_rt/log.zig
index 45e4b16f1572..6b179fd19951 100644
--- a/lib/compiler_rt/log.zig
+++ b/lib/compiler_rt/log.zig
@@ -149,7 +149,7 @@ pub fn logq(a: f128) callconv(.C) f128 {
}
pub fn logl(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __logh(x),
32 => return logf(x),
64 => return log(x),
diff --git a/lib/compiler_rt/log10.zig b/lib/compiler_rt/log10.zig
index ae859cb0e45c..7b32362534dc 100644
--- a/lib/compiler_rt/log10.zig
+++ b/lib/compiler_rt/log10.zig
@@ -177,7 +177,7 @@ pub fn log10q(a: f128) callconv(.C) f128 {
}
pub fn log10l(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __log10h(x),
32 => return log10f(x),
64 => return log10(x),
diff --git a/lib/compiler_rt/log2.zig b/lib/compiler_rt/log2.zig
index 027a5c653797..e152d5a6b496 100644
--- a/lib/compiler_rt/log2.zig
+++ b/lib/compiler_rt/log2.zig
@@ -169,7 +169,7 @@ pub fn log2q(a: f128) callconv(.C) f128 {
}
pub fn log2l(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __log2h(x),
32 => return log2f(x),
64 => return log2(x),
diff --git a/lib/compiler_rt/mulf3.zig b/lib/compiler_rt/mulf3.zig
index c61ade8e5500..ad60ec41a5bf 100644
--- a/lib/compiler_rt/mulf3.zig
+++ b/lib/compiler_rt/mulf3.zig
@@ -7,7 +7,7 @@ const common = @import("./common.zig");
/// https://github.com/llvm/llvm-project/blob/2ffb1b0413efa9a24eb3c49e710e36f92e2cb50b/compiler-rt/lib/builtins/fp_mul_impl.inc
pub inline fn mulf3(comptime T: type, a: T, b: T) T {
@setRuntimeSafety(builtin.is_test);
- const typeWidth = @typeInfo(T).Float.bits;
+ const typeWidth = @typeInfo(T).float.bits;
const significandBits = math.floatMantissaBits(T);
const fractionalBits = math.floatFractionalBits(T);
const exponentBits = math.floatExponentBits(T);
@@ -16,7 +16,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {
// ZSignificand is large enough to contain the significand, including an explicit integer bit
const ZSignificand = PowerOfTwoSignificandZ(T);
- const ZSignificandBits = @typeInfo(ZSignificand).Int.bits;
+ const ZSignificandBits = @typeInfo(ZSignificand).int.bits;
const roundBit = (1 << (ZSignificandBits - 1));
const signBit = (@as(Z, 1) << (significandBits + exponentBits));
@@ -164,7 +164,7 @@ pub inline fn mulf3(comptime T: type, a: T, b: T) T {
/// This is analogous to an shr version of `@shlWithOverflow`
fn wideShrWithTruncation(comptime Z: type, hi: *Z, lo: *Z, count: u32) bool {
@setRuntimeSafety(builtin.is_test);
- const typeWidth = @typeInfo(Z).Int.bits;
+ const typeWidth = @typeInfo(Z).int.bits;
var inexact = false;
if (count < typeWidth) {
inexact = (lo.* << @intCast(typeWidth -% count)) != 0;
diff --git a/lib/compiler_rt/parity.zig b/lib/compiler_rt/parity.zig
index 25d536c4062e..37faa1a4b1b0 100644
--- a/lib/compiler_rt/parity.zig
+++ b/lib/compiler_rt/parity.zig
@@ -26,7 +26,7 @@ pub fn __parityti2(a: i128) callconv(.C) i32 {
}
inline fn parityXi2(comptime T: type, a: T) i32 {
- var x: std.meta.Int(.unsigned, @typeInfo(T).Int.bits) = @bitCast(a);
+ var x: std.meta.Int(.unsigned, @typeInfo(T).int.bits) = @bitCast(a);
// Bit Twiddling Hacks: Compute parity in parallel
comptime var shift: u8 = @bitSizeOf(T) / 2;
inline while (shift > 2) {
diff --git a/lib/compiler_rt/round.zig b/lib/compiler_rt/round.zig
index 78377066fc14..f0745feb49b2 100644
--- a/lib/compiler_rt/round.zig
+++ b/lib/compiler_rt/round.zig
@@ -142,7 +142,7 @@ pub fn roundq(x_: f128) callconv(.C) f128 {
}
pub fn roundl(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __roundh(x),
32 => return roundf(x),
64 => return round(x),
diff --git a/lib/compiler_rt/sin.zig b/lib/compiler_rt/sin.zig
index ce71c6049f7f..505bf59fd4b0 100644
--- a/lib/compiler_rt/sin.zig
+++ b/lib/compiler_rt/sin.zig
@@ -130,7 +130,7 @@ pub fn sinq(x: f128) callconv(.C) f128 {
}
pub fn sinl(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __sinh(x),
32 => return sinf(x),
64 => return sin(x),
diff --git a/lib/compiler_rt/sincos.zig b/lib/compiler_rt/sincos.zig
index 30fcd34df82e..7763be42db51 100644
--- a/lib/compiler_rt/sincos.zig
+++ b/lib/compiler_rt/sincos.zig
@@ -198,7 +198,7 @@ pub fn sincosq(x: f128, r_sin: *f128, r_cos: *f128) callconv(.C) void {
}
pub fn sincosl(x: c_longdouble, r_sin: *c_longdouble, r_cos: *c_longdouble) callconv(.C) void {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __sincosh(x, r_sin, r_cos),
32 => return sincosf(x, r_sin, r_cos),
64 => return sincos(x, r_sin, r_cos),
@@ -216,7 +216,7 @@ pub const rem_pio2_generic = @compileError("TODO");
/// * trig.cos_generic ported from __cosl.c
inline fn sincos_generic(comptime F: type, x: F, r_sin: *F, r_cos: *F) void {
const sc1pio4: F = 1.0 * math.pi / 4.0;
- const bits = @typeInfo(F).Float.bits;
+ const bits = @typeInfo(F).float.bits;
const I = std.meta.Int(.unsigned, bits);
const ix = @as(I, @bitCast(x)) & (math.maxInt(I) >> 1);
const se: u16 = @truncate(ix >> (bits - 16));
diff --git a/lib/compiler_rt/sqrt.zig b/lib/compiler_rt/sqrt.zig
index aec33a1b3a81..b804ff9359f8 100644
--- a/lib/compiler_rt/sqrt.zig
+++ b/lib/compiler_rt/sqrt.zig
@@ -243,7 +243,7 @@ pub fn sqrtq(x: f128) callconv(.C) f128 {
}
pub fn sqrtl(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __sqrth(x),
32 => return sqrtf(x),
64 => return sqrt(x),
diff --git a/lib/compiler_rt/tan.zig b/lib/compiler_rt/tan.zig
index 1d2ec8909d14..067164a3a7ba 100644
--- a/lib/compiler_rt/tan.zig
+++ b/lib/compiler_rt/tan.zig
@@ -116,7 +116,7 @@ pub fn tanq(x: f128) callconv(.C) f128 {
}
pub fn tanl(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __tanh(x),
32 => return tanf(x),
64 => return tan(x),
diff --git a/lib/compiler_rt/trunc.zig b/lib/compiler_rt/trunc.zig
index 9bb06d31e72a..ea655fbb181a 100644
--- a/lib/compiler_rt/trunc.zig
+++ b/lib/compiler_rt/trunc.zig
@@ -100,7 +100,7 @@ pub fn truncq(x: f128) callconv(.C) f128 {
}
pub fn truncl(x: c_longdouble) callconv(.C) c_longdouble {
- switch (@typeInfo(c_longdouble).Float.bits) {
+ switch (@typeInfo(c_longdouble).float.bits) {
16 => return __trunch(x),
32 => return truncf(x),
64 => return trunc(x),
diff --git a/lib/compiler_rt/truncf.zig b/lib/compiler_rt/truncf.zig
index 02b6c7d4bd32..d8b7c6b682b1 100644
--- a/lib/compiler_rt/truncf.zig
+++ b/lib/compiler_rt/truncf.zig
@@ -1,14 +1,14 @@
const std = @import("std");
pub inline fn truncf(comptime dst_t: type, comptime src_t: type, a: src_t) dst_t {
- const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).Float.bits);
- const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).Float.bits);
+ const src_rep_t = std.meta.Int(.unsigned, @typeInfo(src_t).float.bits);
+ const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);
const srcSigBits = std.math.floatMantissaBits(src_t);
const dstSigBits = std.math.floatMantissaBits(dst_t);
// Various constants whose values follow from the type parameters.
// Any reasonable optimizer will fold and propagate all of these.
- const srcBits = @typeInfo(src_t).Float.bits;
+ const srcBits = @typeInfo(src_t).float.bits;
const srcExpBits = srcBits - srcSigBits - 1;
const srcInfExp = (1 << srcExpBits) - 1;
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
const srcQNaN = 1 << (srcSigBits - 1);
const srcNaNCode = srcQNaN - 1;
- const dstBits = @typeInfo(dst_t).Float.bits;
+ const dstBits = @typeInfo(dst_t).float.bits;
const dstExpBits = dstBits - dstSigBits - 1;
const dstInfExp = (1 << dstExpBits) - 1;
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
}
pub inline fn trunc_f80(comptime dst_t: type, a: f80) dst_t {
- const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).Float.bits);
+ const dst_rep_t = std.meta.Int(.unsigned, @typeInfo(dst_t).float.bits);
const src_sig_bits = std.math.floatMantissaBits(f80) - 1; // -1 for the integer bit
const dst_sig_bits = std.math.floatMantissaBits(dst_t);
@@ -109,7 +109,7 @@ pub inline fn trunc_f80(comptime dst_t: type, a: f80) dst_t {
const round_mask = (1 << (src_sig_bits - dst_sig_bits)) - 1;
const halfway = 1 << (src_sig_bits - dst_sig_bits - 1);
- const dst_bits = @typeInfo(dst_t).Float.bits;
+ const dst_bits = @typeInfo(dst_t).float.bits;
const dst_exp_bits = dst_bits - dst_sig_bits - 1;
const dst_inf_exp = (1 << dst_exp_bits) - 1;
const dst_exp_bias = dst_inf_exp >> 1;
diff --git a/lib/compiler_rt/trunctfxf2.zig b/lib/compiler_rt/trunctfxf2.zig
index 2aee5b8fcc3f..b7c2b1cb1d23 100644
--- a/lib/compiler_rt/trunctfxf2.zig
+++ b/lib/compiler_rt/trunctfxf2.zig
@@ -14,7 +14,7 @@ pub fn __trunctfxf2(a: f128) callconv(.C) f80 {
// Various constants whose values follow from the type parameters.
// Any reasonable optimizer will fold and propagate all of these.
- const src_bits = @typeInfo(f128).Float.bits;
+ const src_bits = @typeInfo(f128).float.bits;
const src_exp_bits = src_bits - src_sig_bits - 1;
const src_inf_exp = 0x7FFF;
diff --git a/lib/docs/wasm/Walk.zig b/lib/docs/wasm/Walk.zig
index ae924b8c3825..611830fcb89d 100644
--- a/lib/docs/wasm/Walk.zig
+++ b/lib/docs/wasm/Walk.zig
@@ -36,7 +36,7 @@ pub const Category = union(enum(u8)) {
/// A function that returns a type.
type_function: Ast.Node.Index,
- pub const Tag = @typeInfo(Category).Union.tag_type.?;
+ pub const Tag = @typeInfo(Category).@"union".tag_type.?;
};
pub const File = struct {
diff --git a/lib/docs/wasm/markdown/Document.zig b/lib/docs/wasm/markdown/Document.zig
index 8eec97415c0e..59a40135d67e 100644
--- a/lib/docs/wasm/markdown/Document.zig
+++ b/lib/docs/wasm/markdown/Document.zig
@@ -170,7 +170,7 @@ pub fn ExtraData(comptime T: type) type {
}
pub fn extraData(doc: Document, comptime T: type, index: ExtraIndex) ExtraData(T) {
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
var i: usize = @intFromEnum(index);
var result: T = undefined;
inline for (fields) |field| {
diff --git a/lib/docs/wasm/markdown/Parser.zig b/lib/docs/wasm/markdown/Parser.zig
index fe4fc2f9b02d..024a16a2d7a3 100644
--- a/lib/docs/wasm/markdown/Parser.zig
+++ b/lib/docs/wasm/markdown/Parser.zig
@@ -1564,7 +1564,7 @@ fn parseInlines(p: *Parser, content: []const u8) !ExtraIndex {
}
pub fn extraData(p: Parser, comptime T: type, index: ExtraIndex) ExtraData(T) {
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
var i: usize = @intFromEnum(index);
var result: T = undefined;
inline for (fields) |field| {
diff --git a/lib/fuzzer.zig b/lib/fuzzer.zig
index 2a6794235eff..48b0b8d9ef46 100644
--- a/lib/fuzzer.zig
+++ b/lib/fuzzer.zig
@@ -13,7 +13,7 @@ var log_file: ?std.fs.File = null;
fn logOverride(
comptime level: std.log.Level,
- comptime scope: @TypeOf(.EnumLiteral),
+ comptime scope: @Type(.enum_literal),
comptime format: []const u8,
args: anytype,
) void {
@@ -178,7 +178,7 @@ const Fuzzer = struct {
addr: usize,
flags: packed struct(usize) {
entry: bool,
- _: @Type(.{ .Int = .{ .signedness = .unsigned, .bits = @bitSizeOf(usize) - 1 } }),
+ _: @Type(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(usize) - 1 } }),
},
};
diff --git a/lib/std/Build.zig b/lib/std/Build.zig
index f8ab20cac169..109ebc8be26b 100644
--- a/lib/std/Build.zig
+++ b/lib/std/Build.zig
@@ -408,7 +408,7 @@ fn createChildOnly(
fn userInputOptionsFromArgs(allocator: Allocator, args: anytype) UserInputOptionsMap {
var user_input_options = UserInputOptionsMap.init(allocator);
- inline for (@typeInfo(@TypeOf(args)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(args)).@"struct".fields) |field| {
const v = @field(args, field.name);
const T = @TypeOf(v);
switch (T) {
@@ -454,28 +454,28 @@ fn userInputOptionsFromArgs(allocator: Allocator, args: anytype) UserInputOption
}) catch @panic("OOM");
},
else => switch (@typeInfo(T)) {
- .Bool => {
+ .bool => {
user_input_options.put(field.name, .{
.name = field.name,
.value = .{ .scalar = if (v) "true" else "false" },
.used = false,
}) catch @panic("OOM");
},
- .Enum, .EnumLiteral => {
+ .@"enum", .enum_literal => {
user_input_options.put(field.name, .{
.name = field.name,
.value = .{ .scalar = @tagName(v) },
.used = false,
}) catch @panic("OOM");
},
- .ComptimeInt, .Int => {
+ .comptime_int, .int => {
user_input_options.put(field.name, .{
.name = field.name,
.value = .{ .scalar = std.fmt.allocPrint(allocator, "{d}", .{v}) catch @panic("OOM") },
.used = false,
}) catch @panic("OOM");
},
- .ComptimeFloat, .Float => {
+ .comptime_float, .float => {
user_input_options.put(field.name, .{
.name = field.name,
.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
const description = b.dupe(description_raw);
const type_id = comptime typeToEnum(T);
const enum_options = if (type_id == .@"enum" or type_id == .enum_list) blk: {
- const EnumType = if (type_id == .enum_list) @typeInfo(T).Pointer.child else T;
+ const EnumType = if (type_id == .enum_list) @typeInfo(T).pointer.child else T;
const fields = comptime std.meta.fields(EnumType);
var options = ArrayList([]const u8).initCapacity(b.allocator, fields.len) catch @panic("OOM");
@@ -1265,7 +1265,7 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw
return null;
},
.scalar => |s| {
- const Child = @typeInfo(T).Pointer.child;
+ const Child = @typeInfo(T).pointer.child;
const value = std.meta.stringToEnum(Child, s) orelse {
log.err("Expected -D{s} to be of type {s}.", .{ name, @typeName(Child) });
b.markInvalidUserInput();
@@ -1274,7 +1274,7 @@ pub fn option(b: *Build, comptime T: type, name_raw: []const u8, description_raw
return b.allocator.dupe(Child, &[_]Child{value}) catch @panic("OOM");
},
.list => |lst| {
- const Child = @typeInfo(T).Pointer.child;
+ const Child = @typeInfo(T).pointer.child;
var new_list = b.allocator.alloc(Child, lst.items.len) catch @panic("OOM");
for (lst.items, 0..) |str, i| {
const value = std.meta.stringToEnum(Child, str) orelse {
@@ -1542,15 +1542,15 @@ fn typeToEnum(comptime T: type) TypeId {
return switch (T) {
std.zig.BuildId => .build_id,
else => return switch (@typeInfo(T)) {
- .Int => .int,
- .Float => .float,
- .Bool => .bool,
- .Enum => .@"enum",
- .Pointer => |pointer| switch (pointer.child) {
+ .int => .int,
+ .float => .float,
+ .bool => .bool,
+ .@"enum" => .@"enum",
+ .pointer => |pointer| switch (pointer.child) {
u8 => .string,
[]const u8 => .list,
else => switch (@typeInfo(pointer.child)) {
- .Enum => .enum_list,
+ .@"enum" => .enum_list,
else => @compileError("Unsupported type: " ++ @typeName(T)),
},
},
@@ -1726,7 +1726,7 @@ pub fn fmt(b: *Build, comptime format: []const u8, args: anytype) []u8 {
}
fn supportedWindowsProgramExtension(ext: []const u8) bool {
- inline for (@typeInfo(std.process.Child.WindowsExtension).Enum.fields) |field| {
+ inline for (@typeInfo(std.process.Child.WindowsExtension).@"enum".fields) |field| {
if (std.ascii.eqlIgnoreCase(ext, "." ++ field.name)) return true;
}
return false;
@@ -1925,7 +1925,7 @@ inline fn findImportPkgHashOrFatal(b: *Build, comptime asking_build_zig: type, c
const build_runner = @import("root");
const deps = build_runner.dependencies;
- const b_pkg_hash, const b_pkg_deps = comptime for (@typeInfo(deps.packages).Struct.decls) |decl| {
+ const b_pkg_hash, const b_pkg_deps = comptime for (@typeInfo(deps.packages).@"struct".decls) |decl| {
const pkg_hash = decl.name;
const pkg = @field(deps.packages, pkg_hash);
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 {
const deps = build_runner.dependencies;
const pkg_hash = findPkgHashOrFatal(b, name);
- inline for (@typeInfo(deps.packages).Struct.decls) |decl| {
+ inline for (@typeInfo(deps.packages).@"struct".decls) |decl| {
if (mem.eql(u8, decl.name, pkg_hash)) {
const pkg = @field(deps.packages, decl.name);
const available = !@hasDecl(pkg, "available") or pkg.available;
@@ -1983,7 +1983,7 @@ pub fn dependency(b: *Build, name: []const u8, args: anytype) *Dependency {
const deps = build_runner.dependencies;
const pkg_hash = findPkgHashOrFatal(b, name);
- inline for (@typeInfo(deps.packages).Struct.decls) |decl| {
+ inline for (@typeInfo(deps.packages).@"struct".decls) |decl| {
if (mem.eql(u8, decl.name, pkg_hash)) {
const pkg = @field(deps.packages, decl.name);
if (@hasDecl(pkg, "available")) {
@@ -2013,7 +2013,7 @@ pub inline fn lazyImport(
const deps = build_runner.dependencies;
const pkg_hash = findImportPkgHashOrFatal(b, asking_build_zig, dep_name);
- inline for (@typeInfo(deps.packages).Struct.decls) |decl| {
+ inline for (@typeInfo(deps.packages).@"struct".decls) |decl| {
if (comptime mem.eql(u8, decl.name, pkg_hash)) {
const pkg = @field(deps.packages, decl.name);
const available = !@hasDecl(pkg, "available") or pkg.available;
@@ -2042,7 +2042,7 @@ pub fn dependencyFromBuildZig(
const deps = build_runner.dependencies;
find_dep: {
- const pkg, const pkg_hash = inline for (@typeInfo(deps.packages).Struct.decls) |decl| {
+ const pkg, const pkg_hash = inline for (@typeInfo(deps.packages).@"struct".decls) |decl| {
const pkg_hash = decl.name;
const pkg = @field(deps.packages, pkg_hash);
if (@hasDecl(pkg, "build_zig") and pkg.build_zig == build_zig) break .{ pkg, pkg_hash };
@@ -2150,9 +2150,9 @@ fn dependencyInner(
}
pub fn runBuild(b: *Build, build_zig: anytype) anyerror!void {
- switch (@typeInfo(@typeInfo(@TypeOf(build_zig.build)).Fn.return_type.?)) {
- .Void => build_zig.build(b),
- .ErrorUnion => try build_zig.build(b),
+ switch (@typeInfo(@typeInfo(@TypeOf(build_zig.build)).@"fn".return_type.?)) {
+ .void => build_zig.build(b),
+ .error_union => try build_zig.build(b),
else => @compileError("expected return type of build to be 'void' or '!void'"),
}
}
diff --git a/lib/std/Build/Cache.zig b/lib/std/Build/Cache.zig
index 1eabdd54e66a..93908807ebba 100644
--- a/lib/std/Build/Cache.zig
+++ b/lib/std/Build/Cache.zig
@@ -222,7 +222,7 @@ pub const HashHelper = struct {
.hexstring => |hex_string| hh.addBytes(hex_string.toSlice()),
},
else => switch (@typeInfo(@TypeOf(x))) {
- .Bool, .Int, .Enum, .Array => hh.addBytes(mem.asBytes(&x)),
+ .bool, .int, .@"enum", .array => hh.addBytes(mem.asBytes(&x)),
else => @compileError("unable to hash type " ++ @typeName(@TypeOf(x))),
},
}
@@ -1014,7 +1014,7 @@ pub const Manifest = struct {
}
pub fn populateFileSystemInputs(man: *Manifest, buf: *std.ArrayListUnmanaged(u8)) Allocator.Error!void {
- assert(@typeInfo(std.zig.Server.Message.PathPrefix).Enum.fields.len == man.cache.prefixes_len);
+ assert(@typeInfo(std.zig.Server.Message.PathPrefix).@"enum".fields.len == man.cache.prefixes_len);
buf.clearRetainingCapacity();
const gpa = man.cache.gpa;
const files = man.files.keys();
@@ -1032,7 +1032,7 @@ pub const Manifest = struct {
pub fn populateOtherManifest(man: *Manifest, other: *Manifest, prefix_map: [4]u8) Allocator.Error!void {
const gpa = other.cache.gpa;
- assert(@typeInfo(std.zig.Server.Message.PathPrefix).Enum.fields.len == man.cache.prefixes_len);
+ assert(@typeInfo(std.zig.Server.Message.PathPrefix).@"enum".fields.len == man.cache.prefixes_len);
assert(man.cache.prefixes_len == 4);
for (man.files.keys()) |file| {
const prefixed_path: PrefixedPath = .{
diff --git a/lib/std/Build/Cache/Path.zig b/lib/std/Build/Cache/Path.zig
index 65c6f6a9bc1a..ee0666b70afc 100644
--- a/lib/std/Build/Cache/Path.zig
+++ b/lib/std/Build/Cache/Path.zig
@@ -189,8 +189,8 @@ pub const TableAdapter = struct {
pub fn hash(self: TableAdapter, a: Cache.Path) u32 {
_ = self;
const seed = switch (@typeInfo(@TypeOf(a.root_dir.handle.fd))) {
- .Pointer => @intFromPtr(a.root_dir.handle.fd),
- .Int => @as(u32, @bitCast(a.root_dir.handle.fd)),
+ .pointer => @intFromPtr(a.root_dir.handle.fd),
+ .int => @as(u32, @bitCast(a.root_dir.handle.fd)),
else => @compileError("unimplemented hash function"),
};
return @truncate(Hash.hash(seed, a.sub_path));
diff --git a/lib/std/Build/Step/ConfigHeader.zig b/lib/std/Build/Step/ConfigHeader.zig
index 512460a53255..895f50f5d05b 100644
--- a/lib/std/Build/Step/ConfigHeader.zig
+++ b/lib/std/Build/Step/ConfigHeader.zig
@@ -109,47 +109,47 @@ pub fn getOutput(config_header: *ConfigHeader) std.Build.LazyPath {
}
fn addValuesInner(config_header: *ConfigHeader, values: anytype) !void {
- inline for (@typeInfo(@TypeOf(values)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(values)).@"struct".fields) |field| {
try putValue(config_header, field.name, field.type, @field(values, field.name));
}
}
fn putValue(config_header: *ConfigHeader, field_name: []const u8, comptime T: type, v: T) !void {
switch (@typeInfo(T)) {
- .Null => {
+ .null => {
try config_header.values.put(field_name, .undef);
},
- .Void => {
+ .void => {
try config_header.values.put(field_name, .defined);
},
- .Bool => {
+ .bool => {
try config_header.values.put(field_name, .{ .boolean = v });
},
- .Int => {
+ .int => {
try config_header.values.put(field_name, .{ .int = v });
},
- .ComptimeInt => {
+ .comptime_int => {
try config_header.values.put(field_name, .{ .int = v });
},
- .EnumLiteral => {
+ .enum_literal => {
try config_header.values.put(field_name, .{ .ident = @tagName(v) });
},
- .Optional => {
+ .optional => {
if (v) |x| {
return putValue(config_header, field_name, @TypeOf(x), x);
} else {
try config_header.values.put(field_name, .undef);
}
},
- .Pointer => |ptr| {
+ .pointer => |ptr| {
switch (@typeInfo(ptr.child)) {
- .Array => |array| {
+ .array => |array| {
if (ptr.size == .One and array.child == u8) {
try config_header.values.put(field_name, .{ .string = v });
return;
}
},
- .Int => {
+ .int => {
if (ptr.size == .Slice and ptr.child == u8) {
try config_header.values.put(field_name, .{ .string = v });
return;
diff --git a/lib/std/Build/Step/Options.zig b/lib/std/Build/Step/Options.zig
index 6131912b1bf4..41739dba471e 100644
--- a/lib/std/Build/Step/Options.zig
+++ b/lib/std/Build/Step/Options.zig
@@ -151,7 +151,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
switch (@typeInfo(T)) {
- .Array => {
+ .array => {
if (name) |some| {
try out.print("pub const {}: {s} = ", .{ std.zig.fmtId(some), @typeName(T) });
}
@@ -171,7 +171,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
return;
},
- .Pointer => |p| {
+ .pointer => |p| {
if (p.size != .Slice) {
@compileError("Non-slice pointers are not yet supported in build options");
}
@@ -195,7 +195,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
return;
},
- .Optional => {
+ .optional => {
if (name) |some| {
try out.print("pub const {}: {s} = ", .{ std.zig.fmtId(some), @typeName(T) });
}
@@ -216,12 +216,12 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
return;
},
- .Void,
- .Bool,
- .Int,
- .ComptimeInt,
- .Float,
- .Null,
+ .void,
+ .bool,
+ .int,
+ .comptime_int,
+ .float,
+ .null,
=> {
if (name) |some| {
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
}
return;
},
- .Enum => |info| {
+ .@"enum" => |info| {
try printEnum(options, out, T, info, indent);
if (name) |some| {
@@ -242,7 +242,7 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
}
return;
},
- .Struct => |info| {
+ .@"struct" => |info| {
try printStruct(options, out, T, info, indent);
if (name) |some| {
@@ -260,10 +260,10 @@ fn printType(options: *Options, out: anytype, comptime T: type, value: T, indent
fn printUserDefinedType(options: *Options, out: anytype, comptime T: type, indent: u8) !void {
switch (@typeInfo(T)) {
- .Enum => |info| {
+ .@"enum" => |info| {
return try printEnum(options, out, T, info, indent);
},
- .Struct => |info| {
+ .@"struct" => |info| {
return try printStruct(options, out, T, info, indent);
},
else => {},
@@ -323,8 +323,8 @@ fn printStruct(options: *Options, out: anytype, comptime T: type, comptime val:
try out.writeAll(" = ");
switch (@typeInfo(@TypeOf(default_value))) {
- .Enum => try out.print(".{s},\n", .{@tagName(default_value)}),
- .Struct => |info| {
+ .@"enum" => try out.print(".{s},\n", .{@tagName(default_value)}),
+ .@"struct" => |info| {
try printStructValue(options, out, info, default_value, indent + 4);
},
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
const field_name = @field(val, field.name);
switch (@typeInfo(@TypeOf(field_name))) {
- .Enum => try out.print(".{s},\n", .{@tagName(field_name)}),
- .Struct => |struct_info| {
+ .@"enum" => try out.print(".{s},\n", .{@tagName(field_name)}),
+ .@"struct" => |struct_info| {
try printStructValue(options, out, struct_info, field_name, indent + 4);
},
else => try printType(options, out, @TypeOf(field_name), field_name, indent, null),
diff --git a/lib/std/Build/Step/Run.zig b/lib/std/Build/Step/Run.zig
index 0c011e25eddd..e37b97ddb37b 100644
--- a/lib/std/Build/Step/Run.zig
+++ b/lib/std/Build/Step/Run.zig
@@ -614,7 +614,7 @@ fn checksContainStderr(checks: []const StdIo.Check) bool {
const IndexedOutput = struct {
index: usize,
- tag: @typeInfo(Arg).Union.tag_type.?,
+ tag: @typeInfo(Arg).@"union".tag_type.?,
output: *Output,
};
fn make(step: *Step, options: Step.MakeOptions) !void {
diff --git a/lib/std/Progress.zig b/lib/std/Progress.zig
index 9c34cbbec99d..7e24f25c7393 100644
--- a/lib/std/Progress.zig
+++ b/lib/std/Progress.zig
@@ -95,8 +95,8 @@ pub const Node = struct {
/// Not thread-safe.
fn getIpcFd(s: Storage) ?posix.fd_t {
return if (s.estimated_total_count == std.math.maxInt(u32)) switch (@typeInfo(posix.fd_t)) {
- .Int => @bitCast(s.completed_count),
- .Pointer => @ptrFromInt(s.completed_count),
+ .int => @bitCast(s.completed_count),
+ .pointer => @ptrFromInt(s.completed_count),
else => @compileError("unsupported fd_t of " ++ @typeName(posix.fd_t)),
} else null;
}
@@ -104,8 +104,8 @@ pub const Node = struct {
/// Thread-safe.
fn setIpcFd(s: *Storage, fd: posix.fd_t) void {
const integer: u32 = switch (@typeInfo(posix.fd_t)) {
- .Int => @bitCast(fd),
- .Pointer => @intFromPtr(fd),
+ .int => @bitCast(fd),
+ .pointer => @intFromPtr(fd),
else => @compileError("unsupported fd_t of " ++ @typeName(posix.fd_t)),
};
// `estimated_total_count` max int indicates the special state that
@@ -276,8 +276,8 @@ pub const Node = struct {
const storage = storageByIndex(index);
const int = @atomicLoad(u32, &storage.completed_count, .monotonic);
return switch (@typeInfo(posix.fd_t)) {
- .Int => @bitCast(int),
- .Pointer => @ptrFromInt(int),
+ .int => @bitCast(int),
+ .pointer => @ptrFromInt(int),
else => @compileError("unsupported fd_t of " ++ @typeName(posix.fd_t)),
};
}
@@ -381,8 +381,8 @@ pub fn start(options: Options) Node {
if (std.process.parseEnvVarInt("ZIG_PROGRESS", u31, 10)) |ipc_fd| {
global_progress.update_thread = std.Thread.spawn(.{}, ipcThreadRun, .{
@as(posix.fd_t, switch (@typeInfo(posix.fd_t)) {
- .Int => ipc_fd,
- .Pointer => @ptrFromInt(ipc_fd),
+ .int => ipc_fd,
+ .pointer => @ptrFromInt(ipc_fd),
else => @compileError("unsupported fd_t of " ++ @typeName(posix.fd_t)),
}),
}) catch |err| {
@@ -633,7 +633,7 @@ const TreeSymbol = enum {
fn maxByteLen(symbol: TreeSymbol) usize {
var max: usize = 0;
- inline for (@typeInfo(Encoding).Enum.fields) |field| {
+ inline for (@typeInfo(Encoding).@"enum".fields) |field| {
const len = symbol.bytes(@field(Encoding, field.name)).len;
max = @max(max, len);
}
diff --git a/lib/std/Random.zig b/lib/std/Random.zig
index 0ba048eb0c88..3de754c6def8 100644
--- a/lib/std/Random.zig
+++ b/lib/std/Random.zig
@@ -34,9 +34,9 @@ fillFn: *const fn (ptr: *anyopaque, buf: []u8) void,
pub fn init(pointer: anytype, comptime fillFn: fn (ptr: @TypeOf(pointer), buf: []u8) void) Random {
const Ptr = @TypeOf(pointer);
- assert(@typeInfo(Ptr) == .Pointer); // Must be a pointer
- assert(@typeInfo(Ptr).Pointer.size == .One); // Must be a single-item pointer
- assert(@typeInfo(@typeInfo(Ptr).Pointer.child) == .Struct); // Must point to a struct
+ assert(@typeInfo(Ptr) == .pointer); // Must be a pointer
+ assert(@typeInfo(Ptr).pointer.size == .One); // Must be a single-item pointer
+ assert(@typeInfo(@typeInfo(Ptr).pointer.child) == .@"struct"); // Must point to a struct
const gen = struct {
fn fill(ptr: *anyopaque, buf: []u8) void {
const self: Ptr = @ptrCast(@alignCast(ptr));
@@ -79,7 +79,7 @@ pub inline fn enumValue(r: Random, comptime EnumType: type) EnumType {
/// See `uintLessThan`, which this function uses in most cases,
/// for commentary on the runtime of this function.
pub fn enumValueWithIndex(r: Random, comptime EnumType: type, comptime Index: type) EnumType {
- comptime assert(@typeInfo(EnumType) == .Enum);
+ comptime assert(@typeInfo(EnumType) == .@"enum");
// We won't use int -> enum casting because enum elements can have
// 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
/// Returns a random int `i` such that `minInt(T) <= i <= maxInt(T)`.
/// `i` is evenly distributed.
pub fn int(r: Random, comptime T: type) T {
- const bits = @typeInfo(T).Int.bits;
+ const bits = @typeInfo(T).int.bits;
const UnsignedT = std.meta.Int(.unsigned, bits);
const ceil_bytes = comptime std.math.divCeil(u16, bits, 8) catch unreachable;
const ByteAlignedT = std.meta.Int(.unsigned, ceil_bytes * 8);
@@ -119,7 +119,7 @@ pub fn int(r: Random, comptime T: type) T {
/// Constant-time implementation off `uintLessThan`.
/// The results of this function may be biased.
pub fn uintLessThanBiased(r: Random, comptime T: type, less_than: T) T {
- comptime assert(@typeInfo(T).Int.signedness == .unsigned);
+ comptime assert(@typeInfo(T).int.signedness == .unsigned);
assert(0 < less_than);
return limitRangeBiased(T, r.int(T), less_than);
}
@@ -133,8 +133,8 @@ pub fn uintLessThanBiased(r: Random, comptime T: type, less_than: T) T {
/// this function is guaranteed to return.
/// If you need deterministic runtime bounds, use `uintLessThanBiased`.
pub fn uintLessThan(r: Random, comptime T: type, less_than: T) T {
- comptime assert(@typeInfo(T).Int.signedness == .unsigned);
- const bits = @typeInfo(T).Int.bits;
+ comptime assert(@typeInfo(T).int.signedness == .unsigned);
+ const bits = @typeInfo(T).int.bits;
assert(0 < less_than);
// adapted from:
@@ -164,7 +164,7 @@ pub fn uintLessThan(r: Random, comptime T: type, less_than: T) T {
/// Constant-time implementation off `uintAtMost`.
/// The results of this function may be biased.
pub fn uintAtMostBiased(r: Random, comptime T: type, at_most: T) T {
- assert(@typeInfo(T).Int.signedness == .unsigned);
+ assert(@typeInfo(T).int.signedness == .unsigned);
if (at_most == maxInt(T)) {
// have the full range
return r.int(T);
@@ -176,7 +176,7 @@ pub fn uintAtMostBiased(r: Random, comptime T: type, at_most: T) T {
/// See `uintLessThan`, which this function uses in most cases,
/// for commentary on the runtime of this function.
pub fn uintAtMost(r: Random, comptime T: type, at_most: T) T {
- assert(@typeInfo(T).Int.signedness == .unsigned);
+ assert(@typeInfo(T).int.signedness == .unsigned);
if (at_most == maxInt(T)) {
// have the full range
return r.int(T);
@@ -188,7 +188,7 @@ pub fn uintAtMost(r: Random, comptime T: type, at_most: T) T {
/// The results of this function may be biased.
pub fn intRangeLessThanBiased(r: Random, comptime T: type, at_least: T, less_than: T) T {
assert(at_least < less_than);
- const info = @typeInfo(T).Int;
+ const info = @typeInfo(T).int;
if (info.signedness == .signed) {
// Two's complement makes this math pretty easy.
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
/// for commentary on the runtime of this function.
pub fn intRangeLessThan(r: Random, comptime T: type, at_least: T, less_than: T) T {
assert(at_least < less_than);
- const info = @typeInfo(T).Int;
+ const info = @typeInfo(T).int;
if (info.signedness == .signed) {
// Two's complement makes this math pretty easy.
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)
/// The results of this function may be biased.
pub fn intRangeAtMostBiased(r: Random, comptime T: type, at_least: T, at_most: T) T {
assert(at_least <= at_most);
- const info = @typeInfo(T).Int;
+ const info = @typeInfo(T).int;
if (info.signedness == .signed) {
// Two's complement makes this math pretty easy.
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
/// for commentary on the runtime of this function.
pub fn intRangeAtMost(r: Random, comptime T: type, at_least: T, at_most: T) T {
assert(at_least <= at_most);
- const info = @typeInfo(T).Int;
+ const info = @typeInfo(T).int;
if (info.signedness == .signed) {
// Two's complement makes this math pretty easy.
const UnsignedT = std.meta.Int(.unsigned, info.bits);
@@ -392,12 +392,12 @@ pub fn weightedIndex(r: Random, comptime T: type, proportions: []const T) usize
};
const point = switch (@typeInfo(T)) {
- .Int => |int_info| switch (int_info.signedness) {
+ .int => |int_info| switch (int_info.signedness) {
.signed => r.intRangeLessThan(T, 0, sum),
.unsigned => r.uintLessThan(T, sum),
},
// take care that imprecision doesn't lead to a value slightly greater than sum
- .Float => @min(r.float(T) * sum, sum - std.math.floatEps(T)),
+ .float => @min(r.float(T) * sum, sum - std.math.floatEps(T)),
else => @compileError("weightedIndex does not support proportions of type " ++
@typeName(T)),
};
@@ -415,8 +415,8 @@ pub fn weightedIndex(r: Random, comptime T: type, proportions: []const T) usize
/// into an integer 0 <= result < less_than.
/// This function introduces a minor bias.
pub fn limitRangeBiased(comptime T: type, random_int: T, less_than: T) T {
- comptime assert(@typeInfo(T).Int.signedness == .unsigned);
- const bits = @typeInfo(T).Int.bits;
+ comptime assert(@typeInfo(T).int.signedness == .unsigned);
+ const bits = @typeInfo(T).int.bits;
// adapted from:
// 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 {
/// Returns the smallest of `Index` and `usize`.
fn MinArrayIndex(comptime Index: type) type {
- const index_info = @typeInfo(Index).Int;
+ const index_info = @typeInfo(Index).int;
assert(index_info.signedness == .unsigned);
- return if (index_info.bits >= @typeInfo(usize).Int.bits) usize else Index;
+ return if (index_info.bits >= @typeInfo(usize).int.bits) usize else Index;
}
test {
diff --git a/lib/std/Target.zig b/lib/std/Target.zig
index a231892e6e31..3580813aeced 100644
--- a/lib/std/Target.zig
+++ b/lib/std/Target.zig
@@ -154,7 +154,7 @@ pub const Os = struct {
};
}
- pub inline fn getVersionRangeTag(tag: Tag) @typeInfo(TaggedVersionRange).Union.tag_type.? {
+ pub inline fn getVersionRangeTag(tag: Tag) @typeInfo(TaggedVersionRange).@"union".tag_type.? {
return switch (tag) {
.freestanding,
.fuchsia,
@@ -1458,7 +1458,7 @@ pub const Cpu = struct {
fn allCpusFromDecls(comptime cpus: type) []const *const Cpu.Model {
@setEvalBranchQuota(2000);
- const decls = @typeInfo(cpus).Struct.decls;
+ const decls = @typeInfo(cpus).@"struct".decls;
var array: [decls.len]*const Cpu.Model = undefined;
for (decls, 0..) |decl, i| {
array[i] = &@field(cpus, decl.name);
diff --git a/lib/std/Target/Query.zig b/lib/std/Target/Query.zig
index 4241e425ad50..f18d211853be 100644
--- a/lib/std/Target/Query.zig
+++ b/lib/std/Target/Query.zig
@@ -53,7 +53,7 @@ pub const CpuModel = union(enum) {
explicit: *const Target.Cpu.Model,
pub fn eql(a: CpuModel, b: CpuModel) bool {
- const Tag = @typeInfo(CpuModel).Union.tag_type.?;
+ const Tag = @typeInfo(CpuModel).@"union".tag_type.?;
const a_tag: Tag = a;
const b_tag: Tag = b;
if (a_tag != b_tag) return false;
@@ -70,7 +70,7 @@ pub const OsVersion = union(enum) {
windows: Target.Os.WindowsVersion,
pub fn eql(a: OsVersion, b: OsVersion) bool {
- const Tag = @typeInfo(OsVersion).Union.tag_type.?;
+ const Tag = @typeInfo(OsVersion).@"union".tag_type.?;
const a_tag: Tag = a;
const b_tag: Tag = b;
if (a_tag != b_tag) return false;
diff --git a/lib/std/Target/aarch64.zig b/lib/std/Target/aarch64.zig
index 7755f7959a49..b0b895cfeb58 100644
--- a/lib/std/Target/aarch64.zig
+++ b/lib/std/Target/aarch64.zig
@@ -242,7 +242,7 @@ pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
@setEvalBranchQuota(2000);
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.a510)] = .{
@@ -1660,7 +1660,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/amdgpu.zig b/lib/std/Target/amdgpu.zig
index 9fe574bd852b..0cc7eafe8959 100644
--- a/lib/std/Target/amdgpu.zig
+++ b/lib/std/Target/amdgpu.zig
@@ -183,7 +183,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"16_bit_insts")] = .{
@@ -1284,7 +1284,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/arc.zig b/lib/std/Target/arc.zig
index 37fc2243c320..4642a085aa58 100644
--- a/lib/std/Target/arc.zig
+++ b/lib/std/Target/arc.zig
@@ -14,7 +14,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.norm)] = .{
@@ -25,7 +25,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/arm.zig b/lib/std/Target/arm.zig
index d8b3216a1268..7bb2d6b6006c 100644
--- a/lib/std/Target/arm.zig
+++ b/lib/std/Target/arm.zig
@@ -215,7 +215,7 @@ pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
@setEvalBranchQuota(10000);
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"32bit")] = .{
@@ -1735,7 +1735,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/avr.zig b/lib/std/Target/avr.zig
index 0512bd871818..3183aa4f4dbc 100644
--- a/lib/std/Target/avr.zig
+++ b/lib/std/Target/avr.zig
@@ -49,7 +49,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.addsubiw)] = .{
@@ -340,7 +340,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/bpf.zig b/lib/std/Target/bpf.zig
index 2d17805fbc20..5f314a545588 100644
--- a/lib/std/Target/bpf.zig
+++ b/lib/std/Target/bpf.zig
@@ -16,7 +16,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.alu32)] = .{
@@ -37,7 +37,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/csky.zig b/lib/std/Target/csky.zig
index bdb8637709ae..9ea4c3f41eba 100644
--- a/lib/std/Target/csky.zig
+++ b/lib/std/Target/csky.zig
@@ -76,7 +76,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"10e60")] = .{
@@ -418,7 +418,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/hexagon.zig b/lib/std/Target/hexagon.zig
index c1cfc777e5b2..7b1d619e8750 100644
--- a/lib/std/Target/hexagon.zig
+++ b/lib/std/Target/hexagon.zig
@@ -55,7 +55,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.audio)] = .{
@@ -298,7 +298,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/loongarch.zig b/lib/std/Target/loongarch.zig
index 999c33f9c257..c5a905dc11ca 100644
--- a/lib/std/Target/loongarch.zig
+++ b/lib/std/Target/loongarch.zig
@@ -28,7 +28,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"32bit")] = .{
@@ -115,7 +115,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/m68k.zig b/lib/std/Target/m68k.zig
index 549ecd46682c..a9fcf9e231d7 100644
--- a/lib/std/Target/m68k.zig
+++ b/lib/std/Target/m68k.zig
@@ -36,7 +36,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.isa_68000)] = .{
@@ -170,7 +170,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/mips.zig b/lib/std/Target/mips.zig
index 0d3f587683fb..9638cb390743 100644
--- a/lib/std/Target/mips.zig
+++ b/lib/std/Target/mips.zig
@@ -65,7 +65,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.abs2008)] = .{
@@ -389,7 +389,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/msp430.zig b/lib/std/Target/msp430.zig
index 1fb473420d08..9ee76ca8940d 100644
--- a/lib/std/Target/msp430.zig
+++ b/lib/std/Target/msp430.zig
@@ -17,7 +17,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.ext)] = .{
@@ -43,7 +43,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/nvptx.zig b/lib/std/Target/nvptx.zig
index a97994a0d170..bcdf91027b14 100644
--- a/lib/std/Target/nvptx.zig
+++ b/lib/std/Target/nvptx.zig
@@ -58,7 +58,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.ptx32)] = .{
@@ -289,7 +289,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/powerpc.zig b/lib/std/Target/powerpc.zig
index 3397446bd1f6..19c8735bb361 100644
--- a/lib/std/Target/powerpc.zig
+++ b/lib/std/Target/powerpc.zig
@@ -95,7 +95,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"64bit")] = .{
@@ -606,7 +606,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/riscv.zig b/lib/std/Target/riscv.zig
index ac310709805b..9ee2ea911408 100644
--- a/lib/std/Target/riscv.zig
+++ b/lib/std/Target/riscv.zig
@@ -201,7 +201,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"32bit")] = .{
@@ -1298,7 +1298,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/s390x.zig b/lib/std/Target/s390x.zig
index c9516be0740b..2e7dda40f48b 100644
--- a/lib/std/Target/s390x.zig
+++ b/lib/std/Target/s390x.zig
@@ -55,7 +55,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.backchain)] = .{
@@ -271,7 +271,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/sparc.zig b/lib/std/Target/sparc.zig
index 7b550fd2c5bf..b08d5420b9cd 100644
--- a/lib/std/Target/sparc.zig
+++ b/lib/std/Target/sparc.zig
@@ -60,7 +60,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.deprecated_v8)] = .{
@@ -303,7 +303,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/spirv.zig b/lib/std/Target/spirv.zig
index 8bc81e189d8e..6c58fd48eb47 100644
--- a/lib/std/Target/spirv.zig
+++ b/lib/std/Target/spirv.zig
@@ -301,7 +301,7 @@ pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
@setEvalBranchQuota(2000);
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.v1_1)] = .{
@@ -2077,7 +2077,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/ve.zig b/lib/std/Target/ve.zig
index cfd6576ff746..6c0d93d1cb4d 100644
--- a/lib/std/Target/ve.zig
+++ b/lib/std/Target/ve.zig
@@ -14,7 +14,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.vpu)] = .{
@@ -25,7 +25,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/wasm.zig b/lib/std/Target/wasm.zig
index 7f0ae49a78a7..172c3ecf7993 100644
--- a/lib/std/Target/wasm.zig
+++ b/lib/std/Target/wasm.zig
@@ -26,7 +26,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.atomics)] = .{
@@ -97,7 +97,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/x86.zig b/lib/std/Target/x86.zig
index 09ce8cd33e21..50d8d48593c0 100644
--- a/lib/std/Target/x86.zig
+++ b/lib/std/Target/x86.zig
@@ -199,7 +199,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"16bit_mode")] = .{
@@ -1272,7 +1272,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Target/xtensa.zig b/lib/std/Target/xtensa.zig
index 40143512c0f3..4b27e8e12fbf 100644
--- a/lib/std/Target/xtensa.zig
+++ b/lib/std/Target/xtensa.zig
@@ -14,7 +14,7 @@ pub const featureSetHasAny = CpuFeature.FeatureSetFns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.FeatureSetFns(Feature).featureSetHasAll;
pub const all_features = blk: {
- const len = @typeInfo(Feature).Enum.fields.len;
+ const len = @typeInfo(Feature).@"enum".fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.density)] = .{
@@ -25,7 +25,7 @@ pub const all_features = blk: {
const ti = @typeInfo(Feature);
for (&result, 0..) |*elem, i| {
elem.index = i;
- elem.name = ti.Enum.fields[i].name;
+ elem.name = ti.@"enum".fields[i].name;
}
break :blk result;
};
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index 87a4eec9213c..60021346e448 100644
--- a/lib/std/Thread.zig
+++ b/lib/std/Thread.zig
@@ -401,15 +401,15 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) {
const default_value = if (Impl == PosixThreadImpl) null else 0;
const bad_fn_ret = "expected return type of startFn to be 'u8', 'noreturn', '!noreturn', 'void', or '!void'";
- switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) {
- .NoReturn => {
+ switch (@typeInfo(@typeInfo(@TypeOf(f)).@"fn".return_type.?)) {
+ .noreturn => {
@call(.auto, f, args);
},
- .Void => {
+ .void => {
@call(.auto, f, args);
return default_value;
},
- .Int => |info| {
+ .int => |info| {
if (info.bits != 8) {
@compileError(bad_fn_ret);
}
@@ -422,7 +422,7 @@ fn callFn(comptime f: anytype, args: anytype) switch (Impl) {
// pthreads don't support exit status, ignore value
return default_value;
},
- .ErrorUnion => |info| {
+ .error_union => |info| {
switch (info.payload) {
void, noreturn => {
@call(.auto, f, args) catch |err| {
@@ -850,17 +850,17 @@ const WasiThreadImpl = struct {
fn entry(ptr: usize) void {
const w: *@This() = @ptrFromInt(ptr);
const bad_fn_ret = "expected return type of startFn to be 'u8', 'noreturn', 'void', or '!void'";
- switch (@typeInfo(@typeInfo(@TypeOf(f)).Fn.return_type.?)) {
- .NoReturn, .Void => {
+ switch (@typeInfo(@typeInfo(@TypeOf(f)).@"fn".return_type.?)) {
+ .noreturn, .void => {
@call(.auto, f, w.args);
},
- .Int => |info| {
+ .int => |info| {
if (info.bits != 8) {
@compileError(bad_fn_ret);
}
_ = @call(.auto, f, w.args); // WASI threads don't support exit status, ignore value
},
- .ErrorUnion => |info| {
+ .error_union => |info| {
if (info.payload != void) {
@compileError(bad_fn_ret);
}
diff --git a/lib/std/array_hash_map.zig b/lib/std/array_hash_map.zig
index 62e875ff0a5a..eb31d1cae3de 100644
--- a/lib/std/array_hash_map.zig
+++ b/lib/std/array_hash_map.zig
@@ -2584,17 +2584,17 @@ pub fn getAutoEqlFn(comptime K: type, comptime Context: type) (fn (Context, K, K
pub fn autoEqlIsCheap(comptime K: type) bool {
return switch (@typeInfo(K)) {
- .Bool,
- .Int,
- .Float,
- .Pointer,
- .ComptimeFloat,
- .ComptimeInt,
- .Enum,
- .Fn,
- .ErrorSet,
- .AnyFrame,
- .EnumLiteral,
+ .bool,
+ .int,
+ .float,
+ .pointer,
+ .comptime_float,
+ .comptime_int,
+ .@"enum",
+ .@"fn",
+ .error_set,
+ .@"anyframe",
+ .enum_literal,
=> true,
else => false,
};
diff --git a/lib/std/bit_set.zig b/lib/std/bit_set.zig
index d70f425e612d..1e2a0179ef9e 100644
--- a/lib/std/bit_set.zig
+++ b/lib/std/bit_set.zig
@@ -319,10 +319,10 @@ pub fn ArrayBitSet(comptime MaskIntType: type, comptime size: usize) type {
const mask_info: std.builtin.Type = @typeInfo(MaskIntType);
// Make sure the mask int is indeed an int
- if (mask_info != .Int) @compileError("ArrayBitSet can only operate on integer masks, but was passed " ++ @typeName(MaskIntType));
+ if (mask_info != .int) @compileError("ArrayBitSet can only operate on integer masks, but was passed " ++ @typeName(MaskIntType));
// It must also be unsigned.
- if (mask_info.Int.signedness != .unsigned) @compileError("ArrayBitSet requires an unsigned integer mask type, but was passed " ++ @typeName(MaskIntType));
+ if (mask_info.int.signedness != .unsigned) @compileError("ArrayBitSet requires an unsigned integer mask type, but was passed " ++ @typeName(MaskIntType));
// And it must not be empty.
if (MaskIntType == u0)
diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig
index 6028db83a013..d585bcb94dd9 100644
--- a/lib/std/builtin.zig
+++ b/lib/std/builtin.zig
@@ -257,30 +257,30 @@ pub const TypeId = std.meta.Tag(Type);
/// This data structure is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
pub const Type = union(enum) {
- Type: void,
- Void: void,
- Bool: void,
- NoReturn: void,
- Int: Int,
- Float: Float,
- Pointer: Pointer,
- Array: Array,
- Struct: Struct,
- ComptimeFloat: void,
- ComptimeInt: void,
- Undefined: void,
- Null: void,
- Optional: Optional,
- ErrorUnion: ErrorUnion,
- ErrorSet: ErrorSet,
- Enum: Enum,
- Union: Union,
- Fn: Fn,
- Opaque: Opaque,
- Frame: Frame,
- AnyFrame: AnyFrame,
- Vector: Vector,
- EnumLiteral: void,
+ type: void,
+ void: void,
+ bool: void,
+ noreturn: void,
+ int: Int,
+ float: Float,
+ pointer: Pointer,
+ array: Array,
+ @"struct": Struct,
+ comptime_float: void,
+ comptime_int: void,
+ undefined: void,
+ null: void,
+ optional: Optional,
+ error_union: ErrorUnion,
+ error_set: ErrorSet,
+ @"enum": Enum,
+ @"union": Union,
+ @"fn": Fn,
+ @"opaque": Opaque,
+ frame: Frame,
+ @"anyframe": AnyFrame,
+ vector: Vector,
+ enum_literal: void,
/// This data structure is used by the Zig language code generation and
/// therefore must be kept in sync with the compiler implementation.
diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig
index 3e2cf53b60b9..60a349868e32 100644
--- a/lib/std/c/darwin.zig
+++ b/lib/std/c/darwin.zig
@@ -54,7 +54,7 @@ pub const EXC = enum(exception_type_t) {
/// Abnormal process exited to corpse state
CORPSE_NOTIFY = 13,
- pub const TYPES_COUNT = @typeInfo(EXC).Enum.fields.len;
+ pub const TYPES_COUNT = @typeInfo(EXC).@"enum".fields.len;
pub const SOFT_SIGNAL = 0x10003;
pub const MASK = packed struct(u32) {
diff --git a/lib/std/compress/flate/huffman_encoder.zig b/lib/std/compress/flate/huffman_encoder.zig
index 42cf9a20c238..3e92e55a630d 100644
--- a/lib/std/compress/flate/huffman_encoder.zig
+++ b/lib/std/compress/flate/huffman_encoder.zig
@@ -455,7 +455,7 @@ test "generate a Huffman code for the 30 possible relative distances (LZ77 dista
// Reverse bit-by-bit a N-bit code.
fn bitReverse(comptime T: type, value: T, n: usize) T {
const r = @bitReverse(value);
- return r >> @as(math.Log2Int(T), @intCast(@typeInfo(T).Int.bits - n));
+ return r >> @as(math.Log2Int(T), @intCast(@typeInfo(T).int.bits - n));
}
test bitReverse {
diff --git a/lib/std/crypto/cmac.zig b/lib/std/crypto/cmac.zig
index 902bac591c79..c026850ea665 100644
--- a/lib/std/crypto/cmac.zig
+++ b/lib/std/crypto/cmac.zig
@@ -8,7 +8,7 @@ pub const CmacAes128 = Cmac(crypto.core.aes.Aes128);
/// NIST Special Publication 800-38B - The CMAC Mode for Authentication
/// https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38b.pdf
pub fn Cmac(comptime BlockCipher: type) type {
- const BlockCipherCtx = @typeInfo(@TypeOf(BlockCipher.initEnc)).Fn.return_type.?;
+ const BlockCipherCtx = @typeInfo(@TypeOf(BlockCipher.initEnc)).@"fn".return_type.?;
const Block = [BlockCipher.block.block_length]u8;
return struct {
diff --git a/lib/std/crypto/ff.zig b/lib/std/crypto/ff.zig
index ba37a428adf4..ff018b3c9b04 100644
--- a/lib/std/crypto/ff.zig
+++ b/lib/std/crypto/ff.zig
@@ -848,7 +848,7 @@ const ct_protected = struct {
// Multiplies two limbs and returns the result as a wide limb.
fn mulWide(x: Limb, y: Limb) WideLimb {
- const half_bits = @typeInfo(Limb).Int.bits / 2;
+ const half_bits = @typeInfo(Limb).int.bits / 2;
const Half = meta.Int(.unsigned, half_bits);
const x0 = @as(Half, @truncate(x));
const x1 = @as(Half, @truncate(x >> half_bits));
@@ -901,7 +901,7 @@ const ct_unprotected = struct {
fn mulWide(x: Limb, y: Limb) WideLimb {
const wide = math.mulWide(Limb, x, y);
return .{
- .hi = @as(Limb, @truncate(wide >> @typeInfo(Limb).Int.bits)),
+ .hi = @as(Limb, @truncate(wide >> @typeInfo(Limb).int.bits)),
.lo = @as(Limb, @truncate(wide)),
};
}
diff --git a/lib/std/crypto/phc_encoding.zig b/lib/std/crypto/phc_encoding.zig
index fecd7f1239f9..3442073632b5 100644
--- a/lib/std/crypto/phc_encoding.zig
+++ b/lib/std/crypto/phc_encoding.zig
@@ -91,7 +91,7 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
if (mem.eql(u8, opt_version.key, version_param_name)) {
if (@hasField(HashResult, "alg_version")) {
const value_type_info = switch (@typeInfo(@TypeOf(out.alg_version))) {
- .Optional => |opt| comptime @typeInfo(opt.child),
+ .optional => |opt| @typeInfo(opt.child),
else => |t| t,
};
out.alg_version = fmt.parseUnsigned(
@@ -114,16 +114,16 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
inline for (comptime meta.fields(HashResult)) |p| {
if (mem.eql(u8, p.name, param.key)) {
switch (@typeInfo(p.type)) {
- .Int => @field(out, p.name) = fmt.parseUnsigned(
+ .int => @field(out, p.name) = fmt.parseUnsigned(
p.type,
param.value,
10,
) catch return Error.InvalidEncoding,
- .Pointer => |ptr| {
+ .pointer => |ptr| {
if (!ptr.is_const) @compileError("Value slice must be constant");
@field(out, p.name) = param.value;
},
- .Struct => try @field(out, p.name).fromB64(param.value),
+ .@"struct" => try @field(out, p.name).fromB64(param.value),
else => std.debug.panic(
"Value for [{s}] must be an integer, a constant slice or a BinValue",
.{p.name},
@@ -164,7 +164,7 @@ pub fn deserialize(comptime HashResult: type, str: []const u8) Error!HashResult
// with default values
var expected_fields: usize = 0;
inline for (comptime meta.fields(HashResult)) |p| {
- if (@typeInfo(p.type) != .Optional and p.default_value == null) {
+ if (@typeInfo(p.type) != .optional and p.default_value == null) {
expected_fields += 1;
}
}
@@ -202,7 +202,7 @@ fn serializeTo(params: anytype, out: anytype) !void {
try out.writeAll(params.alg_id);
if (@hasField(HashResult, "alg_version")) {
- if (@typeInfo(@TypeOf(params.alg_version)) == .Optional) {
+ if (@typeInfo(@TypeOf(params.alg_version)) == .optional) {
if (params.alg_version) |alg_version| {
try out.print(
"{s}{s}{s}{}",
@@ -226,12 +226,12 @@ fn serializeTo(params: anytype, out: anytype) !void {
{
const value = @field(params, p.name);
try out.writeAll(if (has_params) params_delimiter else fields_delimiter);
- if (@typeInfo(p.type) == .Struct) {
+ if (@typeInfo(p.type) == .@"struct") {
var buf: [@TypeOf(value).max_encoded_length]u8 = undefined;
try out.print("{s}{s}{s}", .{ p.name, kv_delimiter, try value.toB64(&buf) });
} else {
try out.print(
- if (@typeInfo(@TypeOf(value)) == .Pointer) "{s}{s}{s}" else "{s}{s}{}",
+ if (@typeInfo(@TypeOf(value)) == .pointer) "{s}{s}{s}" else "{s}{s}{}",
.{ p.name, kv_delimiter, value },
);
}
diff --git a/lib/std/crypto/timing_safe.zig b/lib/std/crypto/timing_safe.zig
index 4adeb9cf69de..72543340c3b4 100644
--- a/lib/std/crypto/timing_safe.zig
+++ b/lib/std/crypto/timing_safe.zig
@@ -11,27 +11,27 @@ const Order = std.math.Order;
/// For all other applications, use mem.eql() instead.
pub fn eql(comptime T: type, a: T, b: T) bool {
switch (@typeInfo(T)) {
- .Array => |info| {
+ .array => |info| {
const C = info.child;
- if (@typeInfo(C) != .Int) {
+ if (@typeInfo(C) != .int) {
@compileError("Elements to be compared must be integers");
}
var acc = @as(C, 0);
for (a, 0..) |x, i| {
acc |= x ^ b[i];
}
- const s = @typeInfo(C).Int.bits;
+ const s = @typeInfo(C).int.bits;
const Cu = std.meta.Int(.unsigned, s);
const Cext = std.meta.Int(.unsigned, s + 1);
return @as(bool, @bitCast(@as(u1, @truncate((@as(Cext, @as(Cu, @bitCast(acc))) -% 1) >> s))));
},
- .Vector => |info| {
+ .vector => |info| {
const C = info.child;
- if (@typeInfo(C) != .Int) {
+ if (@typeInfo(C) != .int) {
@compileError("Elements to be compared must be integers");
}
const acc = @reduce(.Or, a ^ b);
- const s = @typeInfo(C).Int.bits;
+ const s = @typeInfo(C).int.bits;
const Cu = std.meta.Int(.unsigned, s);
const Cext = std.meta.Int(.unsigned, s + 1);
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 {
pub fn compare(comptime T: type, a: []const T, b: []const T, endian: Endian) Order {
assert(a.len == b.len);
const bits = switch (@typeInfo(T)) {
- .Int => |cinfo| if (cinfo.signedness != .unsigned) @compileError("Elements to be compared must be unsigned") else cinfo.bits,
+ .int => |cinfo| if (cinfo.signedness != .unsigned) @compileError("Elements to be compared must be unsigned") else cinfo.bits,
else => @compileError("Elements to be compared must be integers"),
};
const Cext = std.meta.Int(.unsigned, bits + 1);
diff --git a/lib/std/crypto/tls.zig b/lib/std/crypto/tls.zig
index fbb41a3fd7ab..b3d0dcb59fb5 100644
--- a/lib/std/crypto/tls.zig
+++ b/lib/std/crypto/tls.zig
@@ -491,7 +491,7 @@ pub const Decoder = struct {
/// Use this function to increase `idx`.
pub fn decode(d: *Decoder, comptime T: type) T {
switch (@typeInfo(T)) {
- .Int => |info| switch (info.bits) {
+ .int => |info| switch (info.bits) {
8 => {
skip(d, 1);
return d.buf[d.idx - 1];
@@ -511,7 +511,7 @@ pub const Decoder = struct {
},
else => @compileError("unsupported int type: " ++ @typeName(T)),
},
- .Enum => |info| {
+ .@"enum" => |info| {
const int = d.decode(info.tag_type);
if (info.is_exhaustive) @compileError("exhaustive enum cannot be used");
return @as(T, @enumFromInt(int));
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index 4672f7ac0610..4424bb1af123 100644
--- a/lib/std/debug.zig
+++ b/lib/std/debug.zig
@@ -547,7 +547,7 @@ pub fn writeStackTrace(
}
pub const UnwindError = if (have_ucontext)
- @typeInfo(@typeInfo(@TypeOf(StackIterator.next_unwind)).Fn.return_type.?).ErrorUnion.error_set
+ @typeInfo(@typeInfo(@TypeOf(StackIterator.next_unwind)).@"fn".return_type.?).error_union.error_set
else
void;
diff --git a/lib/std/debug/Dwarf.zig b/lib/std/debug/Dwarf.zig
index 7cce30df384e..c311dc4cf65c 100644
--- a/lib/std/debug/Dwarf.zig
+++ b/lib/std/debug/Dwarf.zig
@@ -2216,7 +2216,7 @@ pub const ElfModule = struct {
}
var section_index: ?usize = null;
- inline for (@typeInfo(Dwarf.Section.Id).Enum.fields, 0..) |sect, i| {
+ inline for (@typeInfo(Dwarf.Section.Id).@"enum".fields, 0..) |sect, i| {
if (mem.eql(u8, "." ++ sect.name, name)) section_index = i;
}
if (section_index == null) continue;
diff --git a/lib/std/debug/Dwarf/expression.zig b/lib/std/debug/Dwarf/expression.zig
index 5fab56de6e41..f71a4e02c171 100644
--- a/lib/std/debug/Dwarf/expression.zig
+++ b/lib/std/debug/Dwarf/expression.zig
@@ -164,7 +164,7 @@ pub fn StackMachine(comptime options: Options) type {
}
fn generic(value: anytype) Operand {
- const int_info = @typeInfo(@TypeOf(value)).Int;
+ const int_info = @typeInfo(@TypeOf(value)).int;
if (@sizeOf(@TypeOf(value)) > options.addr_size) {
return .{ .generic = switch (int_info.signedness) {
.signed => @bitCast(@as(addr_type_signed, @truncate(value))),
@@ -843,7 +843,7 @@ pub fn Builder(comptime options: Options) type {
}
pub fn writeConst(writer: anytype, comptime T: type, value: T) !void {
- if (@typeInfo(T) != .Int) @compileError("Constants must be integers");
+ if (@typeInfo(T) != .int) @compileError("Constants must be integers");
switch (T) {
u8, i8, u16, i16, u32, i32, u64, i64 => {
@@ -861,7 +861,7 @@ pub fn Builder(comptime options: Options) type {
try writer.writeInt(T, value, options.endian);
},
- else => switch (@typeInfo(T).Int.signedness) {
+ else => switch (@typeInfo(T).int.signedness) {
.unsigned => {
try writer.writeByte(OP.constu);
try leb.writeUleb128(writer, value);
diff --git a/lib/std/debug/FixedBufferReader.zig b/lib/std/debug/FixedBufferReader.zig
index 494245a9e979..e4aec1a9c675 100644
--- a/lib/std/debug/FixedBufferReader.zig
+++ b/lib/std/debug/FixedBufferReader.zig
@@ -32,7 +32,7 @@ pub fn readByteSigned(fbr: *FixedBufferReader) Error!i8 {
}
pub fn readInt(fbr: *FixedBufferReader, comptime T: type) Error!T {
- const size = @divExact(@typeInfo(T).Int.bits, 8);
+ const size = @divExact(@typeInfo(T).int.bits, 8);
if (fbr.buf.len - fbr.pos < size) return error.EndOfBuffer;
defer fbr.pos += size;
return std.mem.readInt(T, fbr.buf[fbr.pos..][0..size], fbr.endian);
diff --git a/lib/std/debug/Pdb.zig b/lib/std/debug/Pdb.zig
index bdcc108c1dc0..2b2f37e7b6aa 100644
--- a/lib/std/debug/Pdb.zig
+++ b/lib/std/debug/Pdb.zig
@@ -495,7 +495,7 @@ const MsfStream = struct {
blocks: []u32 = undefined,
block_size: u32 = undefined,
- pub const Error = @typeInfo(@typeInfo(@TypeOf(read)).Fn.return_type.?).ErrorUnion.error_set;
+ pub const Error = @typeInfo(@typeInfo(@TypeOf(read)).@"fn".return_type.?).error_union.error_set;
fn init(block_size: u32, file: File, blocks: []u32) MsfStream {
const stream = MsfStream{
diff --git a/lib/std/debug/SelfInfo.zig b/lib/std/debug/SelfInfo.zig
index 5d2dca960b47..19adebf711f0 100644
--- a/lib/std/debug/SelfInfo.zig
+++ b/lib/std/debug/SelfInfo.zig
@@ -37,7 +37,7 @@ modules: if (native_os == .windows) std.ArrayListUnmanaged(WindowsModule) else v
pub const OpenError = error{
MissingDebugInfo,
UnsupportedOperatingSystem,
-} || @typeInfo(@typeInfo(@TypeOf(SelfInfo.init)).Fn.return_type.?).ErrorUnion.error_set;
+} || @typeInfo(@typeInfo(@TypeOf(SelfInfo.init)).@"fn".return_type.?).error_union.error_set;
pub fn open(allocator: Allocator) OpenError!SelfInfo {
nosuspend {
@@ -582,7 +582,7 @@ pub const Module = switch (native_os) {
if (!std.mem.eql(u8, "__DWARF", sect.segName())) continue;
var section_index: ?usize = null;
- inline for (@typeInfo(Dwarf.Section.Id).Enum.fields, 0..) |section, i| {
+ inline for (@typeInfo(Dwarf.Section.Id).@"enum".fields, 0..) |section, i| {
if (mem.eql(u8, "__" ++ section.name, sect.sectName())) section_index = i;
}
if (section_index == null) continue;
@@ -981,7 +981,7 @@ fn readCoffDebugInfo(allocator: Allocator, coff_obj: *coff.Coff) !Module {
var sections: Dwarf.SectionArray = Dwarf.null_section_array;
errdefer for (sections) |section| if (section) |s| if (s.owned) allocator.free(s.data);
- inline for (@typeInfo(Dwarf.Section.Id).Enum.fields, 0..) |section, i| {
+ inline for (@typeInfo(Dwarf.Section.Id).@"enum".fields, 0..) |section, i| {
sections[i] = if (coff_obj.getSectionByName("." ++ section.name)) |section_header| blk: {
break :blk .{
.data = try coff_obj.getSectionDataAlloc(section_header, allocator),
@@ -1443,7 +1443,7 @@ pub fn unwindFrameMachO(
if (ma.load(usize, new_sp) == null or ma.load(usize, min_reg_addr) == null) return error.InvalidUnwindInfo;
var reg_addr = fp - @sizeOf(usize);
- inline for (@typeInfo(@TypeOf(encoding.value.arm64.frame.x_reg_pairs)).Struct.fields, 0..) |field, i| {
+ inline for (@typeInfo(@TypeOf(encoding.value.arm64.frame.x_reg_pairs)).@"struct".fields, 0..) |field, i| {
if (@field(encoding.value.arm64.frame.x_reg_pairs, field.name) != 0) {
(try regValueNative(context.thread_context, 19 + i, reg_context)).* = @as(*const usize, @ptrFromInt(reg_addr)).*;
reg_addr += @sizeOf(usize);
@@ -1452,7 +1452,7 @@ pub fn unwindFrameMachO(
}
}
- inline for (@typeInfo(@TypeOf(encoding.value.arm64.frame.d_reg_pairs)).Struct.fields, 0..) |field, i| {
+ inline for (@typeInfo(@TypeOf(encoding.value.arm64.frame.d_reg_pairs)).@"struct".fields, 0..) |field, i| {
if (@field(encoding.value.arm64.frame.d_reg_pairs, field.name) != 0) {
// Only the lower half of the 128-bit V registers are restored during unwinding
@memcpy(
diff --git a/lib/std/enums.zig b/lib/std/enums.zig
index 1cc7bde8d275..a051d96112ae 100644
--- a/lib/std/enums.zig
+++ b/lib/std/enums.zig
@@ -13,9 +13,9 @@ const eval_branch_quota_cushion = 10;
/// the first name is used. Each field is of type Data and has the provided
/// default, which may be undefined.
pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_default: ?Data) type {
- @setEvalBranchQuota(@typeInfo(E).Enum.fields.len + eval_branch_quota_cushion);
- var struct_fields: [@typeInfo(E).Enum.fields.len]std.builtin.Type.StructField = undefined;
- for (&struct_fields, @typeInfo(E).Enum.fields) |*struct_field, enum_field| {
+ @setEvalBranchQuota(@typeInfo(E).@"enum".fields.len + eval_branch_quota_cushion);
+ var struct_fields: [@typeInfo(E).@"enum".fields.len]std.builtin.Type.StructField = undefined;
+ for (&struct_fields, @typeInfo(E).@"enum".fields) |*struct_field, enum_field| {
struct_field.* = .{
.name = enum_field.name ++ "",
.type = Data,
@@ -24,7 +24,7 @@ pub fn EnumFieldStruct(comptime E: type, comptime Data: type, comptime field_def
.alignment = if (@sizeOf(Data) > 0) @alignOf(Data) else 0,
};
}
- return @Type(.{ .Struct = .{
+ return @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &struct_fields,
.decls = &.{},
@@ -49,14 +49,14 @@ pub inline fn valuesFromFields(comptime E: type, comptime fields: []const EnumFi
/// Returns the set of all named values in the given enum, in
/// declaration order.
pub fn values(comptime E: type) []const E {
- return comptime valuesFromFields(E, @typeInfo(E).Enum.fields);
+ return comptime valuesFromFields(E, @typeInfo(E).@"enum".fields);
}
/// A safe alternative to @tagName() for non-exhaustive enums that doesn't
/// panic when `e` has no tagged value.
/// Returns the tag name for `e` or null if no tag exists.
pub fn tagName(comptime E: type, e: E) ?[]const u8 {
- return inline for (@typeInfo(E).Enum.fields) |f| {
+ return inline for (@typeInfo(E).@"enum".fields) |f| {
if (@intFromEnum(e) == f.value) break f.name;
} else null;
}
@@ -80,7 +80,7 @@ test tagName {
pub fn directEnumArrayLen(comptime E: type, comptime max_unused_slots: comptime_int) comptime_int {
var max_value: comptime_int = -1;
const max_usize: comptime_int = ~@as(usize, 0);
- const fields = @typeInfo(E).Enum.fields;
+ const fields = @typeInfo(E).@"enum".fields;
for (fields) |f| {
if (f.value < 0) {
@compileError("Cannot create a direct enum array for " ++ @typeName(E) ++ ", field ." ++ f.name ++ " has a negative value.");
@@ -159,7 +159,7 @@ pub fn directEnumArrayDefault(
) [directEnumArrayLen(E, max_unused_slots)]Data {
const len = comptime directEnumArrayLen(E, max_unused_slots);
var result: [len]Data = if (default) |d| [_]Data{d} ** len else undefined;
- inline for (@typeInfo(@TypeOf(init_values)).Struct.fields) |f| {
+ inline for (@typeInfo(@TypeOf(init_values)).@"struct".fields) |f| {
const enum_value = @field(E, f.name);
const index = @as(usize, @intCast(@intFromEnum(enum_value)));
result[index] = @field(init_values, f.name);
@@ -204,8 +204,8 @@ pub fn nameCast(comptime E: type, comptime value: anytype) E {
const V = @TypeOf(value);
if (V == E) break :blk value;
const name: ?[]const u8 = switch (@typeInfo(V)) {
- .EnumLiteral, .Enum => @tagName(value),
- .Pointer => value,
+ .enum_literal, .@"enum" => @tagName(value),
+ .pointer => value,
else => null,
};
if (name) |n| {
@@ -262,9 +262,9 @@ pub fn EnumSet(comptime E: type) type {
/// Initializes the set using a struct of bools
pub fn init(init_values: EnumFieldStruct(E, bool, false)) Self {
- @setEvalBranchQuota(2 * @typeInfo(E).Enum.fields.len);
+ @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
var result: Self = .{};
- if (@typeInfo(E).Enum.is_exhaustive) {
+ if (@typeInfo(E).@"enum".is_exhaustive) {
inline for (0..Self.len) |i| {
const key = comptime Indexer.keyForIndex(i);
const tag = @tagName(key);
@@ -453,9 +453,9 @@ pub fn EnumMap(comptime E: type, comptime V: type) type {
/// Initializes the map using a sparse struct of optionals
pub fn init(init_values: EnumFieldStruct(E, ?Value, @as(?Value, null))) Self {
- @setEvalBranchQuota(2 * @typeInfo(E).Enum.fields.len);
+ @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
var result: Self = .{};
- if (@typeInfo(E).Enum.is_exhaustive) {
+ if (@typeInfo(E).@"enum".is_exhaustive) {
inline for (0..Self.len) |i| {
const key = comptime Indexer.keyForIndex(i);
const tag = @tagName(key);
@@ -497,7 +497,7 @@ pub fn EnumMap(comptime E: type, comptime V: type) type {
/// Initializes a full mapping with a provided default.
/// Consider using EnumArray instead if the map will remain full.
pub fn initFullWithDefault(comptime default: ?Value, init_values: EnumFieldStruct(E, Value, default)) Self {
- @setEvalBranchQuota(2 * @typeInfo(E).Enum.fields.len);
+ @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
var result: Self = .{
.bits = Self.BitSet.initFull(),
.values = undefined,
@@ -683,9 +683,9 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
/// Initializes the multiset using a struct of counts.
pub fn init(init_counts: EnumFieldStruct(E, CountSize, 0)) Self {
- @setEvalBranchQuota(2 * @typeInfo(E).Enum.fields.len);
+ @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
var self = initWithCount(0);
- inline for (@typeInfo(E).Enum.fields) |field| {
+ inline for (@typeInfo(E).@"enum".fields) |field| {
const c = @field(init_counts, field.name);
const key = @as(E, @enumFromInt(field.value));
self.counts.set(key, c);
@@ -757,7 +757,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
/// Increases the all key counts by given multiset. Caller
/// asserts operation will not overflow any key.
pub fn addSetAssertSafe(self: *Self, other: Self) void {
- inline for (@typeInfo(E).Enum.fields) |field| {
+ inline for (@typeInfo(E).@"enum".fields) |field| {
const key = @as(E, @enumFromInt(field.value));
self.addAssertSafe(key, other.getCount(key));
}
@@ -765,7 +765,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
/// Increases the all key counts by given multiset.
pub fn addSet(self: *Self, other: Self) error{Overflow}!void {
- inline for (@typeInfo(E).Enum.fields) |field| {
+ inline for (@typeInfo(E).@"enum".fields) |field| {
const key = @as(E, @enumFromInt(field.value));
try self.add(key, other.getCount(key));
}
@@ -775,7 +775,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
/// the given multiset has more key counts than this,
/// then that key will have a key count of zero.
pub fn removeSet(self: *Self, other: Self) void {
- inline for (@typeInfo(E).Enum.fields) |field| {
+ inline for (@typeInfo(E).@"enum".fields) |field| {
const key = @as(E, @enumFromInt(field.value));
self.remove(key, other.getCount(key));
}
@@ -784,7 +784,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
/// Returns true iff all key counts are the same as
/// given multiset.
pub fn eql(self: Self, other: Self) bool {
- inline for (@typeInfo(E).Enum.fields) |field| {
+ inline for (@typeInfo(E).@"enum".fields) |field| {
const key = @as(E, @enumFromInt(field.value));
if (self.getCount(key) != other.getCount(key)) {
return false;
@@ -796,7 +796,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
/// Returns true iff all key counts less than or
/// equal to the given multiset.
pub fn subsetOf(self: Self, other: Self) bool {
- inline for (@typeInfo(E).Enum.fields) |field| {
+ inline for (@typeInfo(E).@"enum".fields) |field| {
const key = @as(E, @enumFromInt(field.value));
if (self.getCount(key) > other.getCount(key)) {
return false;
@@ -808,7 +808,7 @@ pub fn BoundedEnumMultiset(comptime E: type, comptime CountSize: type) type {
/// Returns true iff all key counts greater than or
/// equal to the given multiset.
pub fn supersetOf(self: Self, other: Self) bool {
- inline for (@typeInfo(E).Enum.fields) |field| {
+ inline for (@typeInfo(E).@"enum".fields) |field| {
const key = @as(E, @enumFromInt(field.value));
if (self.getCount(key) < other.getCount(key)) {
return false;
@@ -1087,7 +1087,7 @@ pub fn EnumArray(comptime E: type, comptime V: type) type {
/// Initializes values in the enum array, with the specified default.
pub fn initDefault(comptime default: ?Value, init_values: EnumFieldStruct(E, Value, default)) Self {
- @setEvalBranchQuota(2 * @typeInfo(E).Enum.fields.len);
+ @setEvalBranchQuota(2 * @typeInfo(E).@"enum".fields.len);
var result: Self = .{ .values = undefined };
inline for (0..Self.len) |i| {
const key = comptime Indexer.keyForIndex(i);
@@ -1277,17 +1277,17 @@ test "EnumSet non-exhaustive" {
pub fn EnumIndexer(comptime E: type) type {
// Assumes that the enum fields are sorted in ascending order (optimistic).
// Unsorted enums may require the user to manually increase the quota.
- @setEvalBranchQuota(3 * @typeInfo(E).Enum.fields.len + eval_branch_quota_cushion);
+ @setEvalBranchQuota(3 * @typeInfo(E).@"enum".fields.len + eval_branch_quota_cushion);
- if (!@typeInfo(E).Enum.is_exhaustive) {
- const BackingInt = @typeInfo(E).Enum.tag_type;
+ if (!@typeInfo(E).@"enum".is_exhaustive) {
+ const BackingInt = @typeInfo(E).@"enum".tag_type;
if (@bitSizeOf(BackingInt) > @bitSizeOf(usize))
@compileError("Cannot create an enum indexer for a given non-exhaustive enum, tag_type is larger than usize.");
return struct {
pub const Key: type = E;
- const backing_int_sign = @typeInfo(BackingInt).Int.signedness;
+ const backing_int_sign = @typeInfo(BackingInt).int.signedness;
const min_value = std.math.minInt(BackingInt);
const max_value = std.math.maxInt(BackingInt);
@@ -1312,7 +1312,7 @@ pub fn EnumIndexer(comptime E: type) type {
};
}
- const const_fields = @typeInfo(E).Enum.fields;
+ const const_fields = @typeInfo(E).@"enum".fields;
var fields = const_fields[0..const_fields.len].*;
const fields_len = fields.len;
@@ -1359,7 +1359,7 @@ pub fn EnumIndexer(comptime E: type) type {
// gives up some safety to avoid artificially limiting
// the range of signed enum values to max_isize.
const enum_value = if (min < 0) @as(isize, @bitCast(i)) +% min else i + min;
- return @as(E, @enumFromInt(@as(@typeInfo(E).Enum.tag_type, @intCast(enum_value))));
+ return @as(E, @enumFromInt(@as(@typeInfo(E).@"enum".tag_type, @intCast(enum_value))));
}
};
}
@@ -1411,7 +1411,7 @@ test "EnumIndexer non-exhaustive" {
const RangedType = std.meta.Int(.unsigned, @bitSizeOf(BackingInt));
const max_index: comptime_int = std.math.maxInt(RangedType);
- const number_zero_tag_index: usize = switch (@typeInfo(BackingInt).Int.signedness) {
+ const number_zero_tag_index: usize = switch (@typeInfo(BackingInt).int.signedness) {
.unsigned => 0,
.signed => std.math.divCeil(comptime_int, max_index, 2) catch unreachable,
};
diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig
index a7136d99bb80..7f323248cf4f 100644
--- a/lib/std/fmt.zig
+++ b/lib/std/fmt.zig
@@ -87,11 +87,11 @@ pub fn format(
) !void {
const ArgsType = @TypeOf(args);
const args_type_info = @typeInfo(ArgsType);
- if (args_type_info != .Struct) {
+ if (args_type_info != .@"struct") {
@compileError("expected tuple or struct argument, found " ++ @typeName(ArgsType));
}
- const fields_info = args_type_info.Struct.fields;
+ const fields_info = args_type_info.@"struct".fields;
if (fields_info.len > max_format_args) {
@compileError("32 arguments max are supported per format call");
}
@@ -397,7 +397,7 @@ pub const Parser = struct {
};
pub const ArgSetType = u32;
-const max_format_args = @typeInfo(ArgSetType).Int.bits;
+const max_format_args = @typeInfo(ArgSetType).int.bits;
pub const ArgState = struct {
next_arg: usize = 0,
@@ -430,7 +430,7 @@ pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @T
const T = @TypeOf(value);
switch (@typeInfo(T)) {
- .Pointer => |info| {
+ .pointer => |info| {
try writer.writeAll(@typeName(info.child) ++ "@");
if (info.size == .Slice)
try formatInt(@intFromPtr(value.ptr), 16, .lower, FormatOptions{}, writer)
@@ -438,8 +438,8 @@ pub fn formatAddress(value: anytype, options: FormatOptions, writer: anytype) @T
try formatInt(@intFromPtr(value), 16, .lower, FormatOptions{}, writer);
return;
},
- .Optional => |info| {
- if (@typeInfo(info.child) == .Pointer) {
+ .optional => |info| {
+ if (@typeInfo(info.child) == .pointer) {
try writer.writeAll(@typeName(info.child) ++ "@");
try formatInt(@intFromPtr(value), 16, .lower, FormatOptions{}, writer);
return;
@@ -456,17 +456,17 @@ const ANY = "any";
pub fn defaultSpec(comptime T: type) [:0]const u8 {
switch (@typeInfo(T)) {
- .Array => |_| return ANY,
- .Pointer => |ptr_info| switch (ptr_info.size) {
+ .array => |_| return ANY,
+ .pointer => |ptr_info| switch (ptr_info.size) {
.One => switch (@typeInfo(ptr_info.child)) {
- .Array => |_| return ANY,
+ .array => |_| return ANY,
else => {},
},
.Many, .C => return "*",
.Slice => return ANY,
},
- .Optional => |info| return "?" ++ defaultSpec(info.child),
- .ErrorUnion => |info| return "!" ++ defaultSpec(info.payload),
+ .optional => |info| return "?" ++ defaultSpec(info.child),
+ .error_union => |info| return "!" ++ defaultSpec(info.payload),
else => {},
}
return "";
@@ -494,7 +494,7 @@ pub fn formatType(
const actual_fmt = comptime if (std.mem.eql(u8, fmt, ANY))
defaultSpec(T)
else if (fmt.len != 0 and (fmt[0] == '?' or fmt[0] == '!')) switch (@typeInfo(T)) {
- .Optional, .ErrorUnion => fmt,
+ .optional, .error_union => fmt,
else => stripOptionalOrErrorUnionSpec(fmt),
} else fmt;
@@ -507,18 +507,18 @@ pub fn formatType(
}
switch (@typeInfo(T)) {
- .ComptimeInt, .Int, .ComptimeFloat, .Float => {
+ .comptime_int, .int, .comptime_float, .float => {
return formatValue(value, actual_fmt, options, writer);
},
- .Void => {
+ .void => {
if (actual_fmt.len != 0) invalidFmtError(fmt, value);
return formatBuf("void", options, writer);
},
- .Bool => {
+ .bool => {
if (actual_fmt.len != 0) invalidFmtError(fmt, value);
return formatBuf(if (value) "true" else "false", options, writer);
},
- .Optional => {
+ .optional => {
if (actual_fmt.len == 0 or actual_fmt[0] != '?')
@compileError("cannot format optional without a specifier (i.e. {?} or {any})");
const remaining_fmt = comptime stripOptionalOrErrorUnionSpec(actual_fmt);
@@ -528,7 +528,7 @@ pub fn formatType(
return formatBuf("null", options, writer);
}
},
- .ErrorUnion => {
+ .error_union => {
if (actual_fmt.len == 0 or actual_fmt[0] != '!')
@compileError("cannot format error union without a specifier (i.e. {!} or {any})");
const remaining_fmt = comptime stripOptionalOrErrorUnionSpec(actual_fmt);
@@ -538,12 +538,12 @@ pub fn formatType(
return formatType(err, "", options, writer, max_depth);
}
},
- .ErrorSet => {
+ .error_set => {
if (actual_fmt.len != 0) invalidFmtError(fmt, value);
try writer.writeAll("error.");
return writer.writeAll(@errorName(value));
},
- .Enum => |enumInfo| {
+ .@"enum" => |enumInfo| {
try writer.writeAll(@typeName(T));
if (enumInfo.is_exhaustive) {
if (actual_fmt.len != 0) invalidFmtError(fmt, value);
@@ -566,7 +566,7 @@ pub fn formatType(
try formatType(@intFromEnum(value), actual_fmt, options, writer, max_depth);
try writer.writeAll(")");
},
- .Union => |info| {
+ .@"union" => |info| {
if (actual_fmt.len != 0) invalidFmtError(fmt, value);
try writer.writeAll(@typeName(T));
if (max_depth == 0) {
@@ -586,7 +586,7 @@ pub fn formatType(
try format(writer, "@{x}", .{@intFromPtr(&value)});
}
},
- .Struct => |info| {
+ .@"struct" => |info| {
if (actual_fmt.len != 0) invalidFmtError(fmt, value);
if (info.is_tuple) {
// Skip the type and field names when formatting tuples.
@@ -621,9 +621,9 @@ pub fn formatType(
}
try writer.writeAll(" }");
},
- .Pointer => |ptr_info| switch (ptr_info.size) {
+ .pointer => |ptr_info| switch (ptr_info.size) {
.One => switch (@typeInfo(ptr_info.child)) {
- .Array, .Enum, .Union, .Struct => {
+ .array, .@"enum", .@"union", .@"struct" => {
return formatType(value.*, actual_fmt, options, writer, max_depth);
},
else => return format(writer, "{s}@{x}", .{ @typeName(ptr_info.child), @intFromPtr(value) }),
@@ -658,7 +658,7 @@ pub fn formatType(
try writer.writeAll(" }");
},
},
- .Array => |info| {
+ .array => |info| {
if (actual_fmt.len == 0)
@compileError("cannot format array without a specifier (i.e. {s} or {any})");
if (max_depth == 0) {
@@ -676,7 +676,7 @@ pub fn formatType(
}
try writer.writeAll(" }");
},
- .Vector => |info| {
+ .vector => |info| {
try writer.writeAll("{ ");
var i: usize = 0;
while (i < info.len) : (i += 1) {
@@ -687,17 +687,17 @@ pub fn formatType(
}
try writer.writeAll(" }");
},
- .Fn => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),
- .Type => {
+ .@"fn" => @compileError("unable to format function body type, use '*const " ++ @typeName(T) ++ "' for a function pointer type"),
+ .type => {
if (actual_fmt.len != 0) invalidFmtError(fmt, value);
return formatBuf(@typeName(value), options, writer);
},
- .EnumLiteral => {
+ .enum_literal => {
if (actual_fmt.len != 0) invalidFmtError(fmt, value);
const buffer = [_]u8{'.'} ++ @tagName(value);
return formatBuf(buffer, options, writer);
},
- .Null => {
+ .null => {
if (actual_fmt.len != 0) invalidFmtError(fmt, value);
return formatBuf("null", options, writer);
},
@@ -713,9 +713,9 @@ fn formatValue(
) !void {
const T = @TypeOf(value);
switch (@typeInfo(T)) {
- .Float, .ComptimeFloat => return formatFloatValue(value, fmt, options, writer),
- .Int, .ComptimeInt => return formatIntValue(value, fmt, options, writer),
- .Bool => return formatBuf(if (value) "true" else "false", options, writer),
+ .float, .comptime_float => return formatFloatValue(value, fmt, options, writer),
+ .int, .comptime_int => return formatIntValue(value, fmt, options, writer),
+ .bool => return formatBuf(if (value) "true" else "false", options, writer),
else => comptime unreachable,
}
}
@@ -738,13 +738,13 @@ pub fn formatIntValue(
base = 10;
case = .lower;
} else if (comptime std.mem.eql(u8, fmt, "c")) {
- if (@typeInfo(@TypeOf(int_value)).Int.bits <= 8) {
+ if (@typeInfo(@TypeOf(int_value)).int.bits <= 8) {
return formatAsciiChar(@as(u8, int_value), options, writer);
} else {
@compileError("cannot print integer that is larger than 8 bits as an ASCII character");
}
} else if (comptime std.mem.eql(u8, fmt, "u")) {
- if (@typeInfo(@TypeOf(int_value)).Int.bits <= 21) {
+ if (@typeInfo(@TypeOf(int_value)).int.bits <= 21) {
return formatUnicodeCodepoint(@as(u21, int_value), options, writer);
} else {
@compileError("cannot print integer that is larger than 21 bits as an UTF-8 sequence");
@@ -1179,7 +1179,7 @@ pub fn formatInt(
break :blk @as(Int, value);
} else value;
- const value_info = @typeInfo(@TypeOf(int_value)).Int;
+ const value_info = @typeInfo(@TypeOf(int_value)).int;
// The type must have the same size as `base` or be wider in order for the
// division to work
@@ -1480,7 +1480,7 @@ pub const ParseIntError = error{
/// ) !void;
///
pub fn Formatter(comptime format_fn: anytype) type {
- const Data = @typeInfo(@TypeOf(format_fn)).Fn.params[0].type.?;
+ const Data = @typeInfo(@TypeOf(format_fn)).@"fn".params[0].type.?;
return struct {
data: Data,
pub fn format(
@@ -1624,7 +1624,7 @@ fn parseIntWithSign(
// accumulate into Accumulate which is always 8 bits or larger. this prevents
// `buf_base` from overflowing Result.
const info = @typeInfo(Result);
- const Accumulate = std.meta.Int(info.Int.signedness, @max(8, info.Int.bits));
+ const Accumulate = std.meta.Int(info.int.signedness, @max(8, info.int.bits));
var accumulate: Accumulate = 0;
if (buf_start[0] == '_' or buf_start[buf_start.len - 1] == '_') return error.InvalidCharacter;
@@ -2724,7 +2724,7 @@ pub const hex_charset = "0123456789abcdef";
/// Converts an unsigned integer of any multiple of u8 to an array of lowercase
/// hex bytes, little endian.
pub fn hex(x: anytype) [@sizeOf(@TypeOf(x)) * 2]u8 {
- comptime assert(@typeInfo(@TypeOf(x)).Int.signedness == .unsigned);
+ comptime assert(@typeInfo(@TypeOf(x)).int.signedness == .unsigned);
var result: [@sizeOf(@TypeOf(x)) * 2]u8 = undefined;
var i: usize = 0;
while (i < result.len / 2) : (i += 1) {
diff --git a/lib/std/fmt/format_float.zig b/lib/std/fmt/format_float.zig
index b7b08281a7f2..4c4c1a29229c 100644
--- a/lib/std/fmt/format_float.zig
+++ b/lib/std/fmt/format_float.zig
@@ -12,7 +12,7 @@ pub const min_buffer_size = 53;
/// Returns the minimum buffer size needed to print every float of a specific type and format.
pub fn bufferSize(comptime mode: Format, comptime T: type) comptime_int {
- comptime std.debug.assert(@typeInfo(T) == .Float);
+ comptime std.debug.assert(@typeInfo(T) == .float);
return switch (mode) {
.scientific => 53,
// Based on minimum subnormal values.
@@ -60,8 +60,8 @@ pub fn formatFloat(buf: []u8, v_: anytype, options: FormatOptions) FormatError![
};
const T = @TypeOf(v);
- comptime std.debug.assert(@typeInfo(T) == .Float);
- const I = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
+ comptime std.debug.assert(@typeInfo(T) == .float);
+ const I = @Type(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
const DT = if (@bitSizeOf(T) <= 64) u64 else u128;
const tables = switch (DT) {
@@ -563,13 +563,13 @@ fn pow5Factor(value_: anytype) u32 {
fn multipleOfPowerOf5(value: anytype, p: u32) bool {
const T = @TypeOf(value);
- std.debug.assert(@typeInfo(T) == .Int);
+ std.debug.assert(@typeInfo(T) == .int);
return pow5Factor(value) >= p;
}
fn multipleOfPowerOf2(value: anytype, p: u32) bool {
const T = @TypeOf(value);
- std.debug.assert(@typeInfo(T) == .Int);
+ std.debug.assert(@typeInfo(T) == .int);
return (value & ((@as(T, 1) << @as(std.math.Log2Int(T), @intCast(p))) - 1)) == 0;
}
@@ -1516,7 +1516,7 @@ const FLOAT128_POW5_INV_ERRORS: [154]u64 = .{
const builtin = @import("builtin");
fn check(comptime T: type, value: T, comptime expected: []const u8) !void {
- const I = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
+ const I = @Type(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
var buf: [6000]u8 = undefined;
const value_bits: I = @bitCast(value);
diff --git a/lib/std/fmt/parse_float.zig b/lib/std/fmt/parse_float.zig
index 425286ff0716..cb47faee8d31 100644
--- a/lib/std/fmt/parse_float.zig
+++ b/lib/std/fmt/parse_float.zig
@@ -17,7 +17,7 @@ pub const ParseFloatError = error{
};
pub fn parseFloat(comptime T: type, s: []const u8) ParseFloatError!T {
- if (@typeInfo(T) != .Float) {
+ if (@typeInfo(T) != .float) {
@compileError("Cannot parse a float into a non-floating point type.");
}
@@ -128,7 +128,7 @@ test parseFloat {
test "nan and inf" {
inline for ([_]type{ f16, f32, f64, f80, f128 }) |T| {
- const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const Z = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
try expectEqual(@as(Z, @bitCast(try parseFloat(T, "nAn"))), @as(Z, @bitCast(std.math.nan(T))));
try expectEqual(try parseFloat(T, "inF"), std.math.inf(T));
diff --git a/lib/std/hash/auto_hash.zig b/lib/std/hash/auto_hash.zig
index b7321c0b9e87..d9d3b1836d73 100644
--- a/lib/std/hash/auto_hash.zig
+++ b/lib/std/hash/auto_hash.zig
@@ -22,7 +22,7 @@ pub const HashStrategy = enum {
pub fn hashPointer(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
const info = @typeInfo(@TypeOf(key));
- switch (info.Pointer.size) {
+ switch (info.pointer.size) {
.One => switch (strat) {
.Shallow => hash(hasher, @intFromPtr(key), .Shallow),
.Deep => hash(hasher, key.*, .Shallow),
@@ -64,7 +64,7 @@ pub fn hashArray(hasher: anytype, key: anytype, comptime strat: HashStrategy) vo
pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
const Key = @TypeOf(key);
const Hasher = switch (@typeInfo(@TypeOf(hasher))) {
- .Pointer => |ptr| ptr.child,
+ .pointer => |ptr| ptr.child,
else => @TypeOf(hasher),
};
@@ -74,24 +74,24 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
}
switch (@typeInfo(Key)) {
- .NoReturn,
- .Opaque,
- .Undefined,
- .Null,
- .ComptimeFloat,
- .ComptimeInt,
- .Type,
- .EnumLiteral,
- .Frame,
- .Float,
+ .noreturn,
+ .@"opaque",
+ .undefined,
+ .null,
+ .comptime_float,
+ .comptime_int,
+ .type,
+ .enum_literal,
+ .frame,
+ .float,
=> @compileError("unable to hash type " ++ @typeName(Key)),
- .Void => return,
+ .void => return,
// Help the optimizer see that hashing an int is easy by inlining!
// TODO Check if the situation is better after #561 is resolved.
- .Int => |int| switch (int.signedness) {
- .signed => hash(hasher, @as(@Type(.{ .Int = .{
+ .int => |int| switch (int.signedness) {
+ .signed => hash(hasher, @as(@Type(.{ .int = .{
.bits = int.bits,
.signedness = .unsigned,
} }), @bitCast(key)), strat),
@@ -107,18 +107,18 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
},
},
- .Bool => hash(hasher, @intFromBool(key), strat),
- .Enum => hash(hasher, @intFromEnum(key), strat),
- .ErrorSet => hash(hasher, @intFromError(key), strat),
- .AnyFrame, .Fn => hash(hasher, @intFromPtr(key), strat),
+ .bool => hash(hasher, @intFromBool(key), strat),
+ .@"enum" => hash(hasher, @intFromEnum(key), strat),
+ .error_set => hash(hasher, @intFromError(key), strat),
+ .@"anyframe", .@"fn" => hash(hasher, @intFromPtr(key), strat),
- .Pointer => @call(.always_inline, hashPointer, .{ hasher, key, strat }),
+ .pointer => @call(.always_inline, hashPointer, .{ hasher, key, strat }),
- .Optional => if (key) |k| hash(hasher, k, strat),
+ .optional => if (key) |k| hash(hasher, k, strat),
- .Array => hashArray(hasher, key, strat),
+ .array => hashArray(hasher, key, strat),
- .Vector => |info| {
+ .vector => |info| {
if (std.meta.hasUniqueRepresentation(Key)) {
hasher.update(mem.asBytes(&key));
} else {
@@ -129,7 +129,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
}
},
- .Struct => |info| {
+ .@"struct" => |info| {
inline for (info.fields) |field| {
// We reuse the hash of the previous field as the seed for the
// next one so that they're dependant.
@@ -137,7 +137,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
}
},
- .Union => |info| {
+ .@"union" => |info| {
if (info.tag_type) |tag_type| {
const tag = std.meta.activeTag(key);
hash(hasher, tag, strat);
@@ -155,7 +155,7 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
} else @compileError("cannot hash untagged union type: " ++ @typeName(Key) ++ ", provide your own hash function");
},
- .ErrorUnion => blk: {
+ .error_union => blk: {
const payload = key catch |err| {
hash(hasher, err, strat);
break :blk;
@@ -167,9 +167,9 @@ pub fn hash(hasher: anytype, key: anytype, comptime strat: HashStrategy) void {
inline fn typeContainsSlice(comptime K: type) bool {
return switch (@typeInfo(K)) {
- .Pointer => |info| info.size == .Slice,
+ .pointer => |info| info.size == .Slice,
- inline .Struct, .Union => |info| {
+ inline .@"struct", .@"union" => |info| {
inline for (info.fields) |field| {
if (typeContainsSlice(field.type)) {
return true;
diff --git a/lib/std/hash/verify.zig b/lib/std/hash/verify.zig
index 485a1fd976a2..61f501a8813d 100644
--- a/lib/std/hash/verify.zig
+++ b/lib/std/hash/verify.zig
@@ -1,9 +1,9 @@
const std = @import("std");
-fn hashMaybeSeed(comptime hash_fn: anytype, seed: anytype, buf: []const u8) @typeInfo(@TypeOf(hash_fn)).Fn.return_type.? {
- const HashFn = @typeInfo(@TypeOf(hash_fn)).Fn;
+fn hashMaybeSeed(comptime hash_fn: anytype, seed: anytype, buf: []const u8) @typeInfo(@TypeOf(hash_fn)).@"fn".return_type.? {
+ const HashFn = @typeInfo(@TypeOf(hash_fn)).@"fn";
if (HashFn.params.len > 1) {
- if (@typeInfo(HashFn.params[0].type.?) == .Int) {
+ if (@typeInfo(HashFn.params[0].type.?) == .int) {
return hash_fn(@intCast(seed), buf);
} else {
return hash_fn(buf, @intCast(seed));
@@ -14,7 +14,7 @@ fn hashMaybeSeed(comptime hash_fn: anytype, seed: anytype, buf: []const u8) @typ
}
fn initMaybeSeed(comptime Hash: anytype, seed: anytype) Hash {
- const HashFn = @typeInfo(@TypeOf(Hash.init)).Fn;
+ const HashFn = @typeInfo(@TypeOf(Hash.init)).@"fn";
if (HashFn.params.len == 1) {
return Hash.init(@intCast(seed));
} else {
@@ -27,7 +27,7 @@ fn initMaybeSeed(comptime Hash: anytype, seed: anytype) Hash {
// Hash keys of the form {0}, {0,1}, {0,1,2}... up to N=255, using 256-N as seed.
// First four-bytes of the hash, interpreted as little-endian is the verification code.
pub fn smhasher(comptime hash_fn: anytype) u32 {
- const HashFnTy = @typeInfo(@TypeOf(hash_fn)).Fn;
+ const HashFnTy = @typeInfo(@TypeOf(hash_fn)).@"fn";
const HashResult = HashFnTy.return_type.?;
const hash_size = @sizeOf(HashResult);
diff --git a/lib/std/hash_map.zig b/lib/std/hash_map.zig
index c0ae4596dcf6..1c8a5d78afb9 100644
--- a/lib/std/hash_map.zig
+++ b/lib/std/hash_map.zig
@@ -139,10 +139,10 @@ pub fn verifyContext(
var Context = RawContext;
// Make sure the context is a namespace type which may have member functions
switch (@typeInfo(Context)) {
- .Struct, .Union, .Enum => {},
- // Special-case .Opaque for a better error message
- .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."),
- .Pointer => |ptr| {
+ .@"struct", .@"union", .@"enum" => {},
+ // Special-case .@"opaque" for a better error message
+ .@"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."),
+ .pointer => |ptr| {
if (ptr.size != .One) {
@compileError("Hash context must be a type with hash and eql member functions. Cannot use " ++ @typeName(Context) ++ " because it is not a single pointer.");
}
@@ -150,7 +150,7 @@ pub fn verifyContext(
allow_const_ptr = true;
allow_mutable_ptr = !ptr.is_const;
switch (@typeInfo(Context)) {
- .Struct, .Union, .Enum, .Opaque => {},
+ .@"struct", .@"union", .@"enum", .@"opaque" => {},
else => @compileError("Hash context must be a type with hash and eql member functions. Cannot use " ++ @typeName(Context)),
}
},
@@ -179,8 +179,8 @@ pub fn verifyContext(
if (@hasDecl(Context, "hash")) {
const hash = Context.hash;
const info = @typeInfo(@TypeOf(hash));
- if (info == .Fn) {
- const func = info.Fn;
+ if (info == .@"fn") {
+ const func = info.@"fn";
if (func.params.len != 2) {
errors = errors ++ lazy.err_invalid_hash_signature;
} else {
@@ -255,8 +255,8 @@ pub fn verifyContext(
if (@hasDecl(Context, "eql")) {
const eql = Context.eql;
const info = @typeInfo(@TypeOf(eql));
- if (info == .Fn) {
- const func = info.Fn;
+ if (info == .@"fn") {
+ const func = info.@"fn";
const args_len = if (is_array) 4 else 3;
if (func.params.len != args_len) {
errors = errors ++ lazy.err_invalid_eql_signature;
@@ -824,8 +824,8 @@ pub fn HashMapUnmanaged(
}
pub fn takeFingerprint(hash: Hash) FingerPrint {
- const hash_bits = @typeInfo(Hash).Int.bits;
- const fp_bits = @typeInfo(FingerPrint).Int.bits;
+ const hash_bits = @typeInfo(Hash).int.bits;
+ const fp_bits = @typeInfo(FingerPrint).int.bits;
return @as(FingerPrint, @truncate(hash >> (hash_bits - fp_bits)));
}
diff --git a/lib/std/heap/logging_allocator.zig b/lib/std/heap/logging_allocator.zig
index 6924a284e3b0..706f2ac544e3 100644
--- a/lib/std/heap/logging_allocator.zig
+++ b/lib/std/heap/logging_allocator.zig
@@ -15,7 +15,7 @@ pub fn LoggingAllocator(
/// with the given scope on every call to the allocator.
/// For logging to a `std.io.Writer` see `std.heap.LogToWriterAllocator`
pub fn ScopedLoggingAllocator(
- comptime scope: @Type(.EnumLiteral),
+ comptime scope: @Type(.enum_literal),
comptime success_log_level: std.log.Level,
comptime failure_log_level: std.log.Level,
) type {
diff --git a/lib/std/io.zig b/lib/std/io.zig
index 1f4cb411b442..6455693d67b5 100644
--- a/lib/std/io.zig
+++ b/lib/std/io.zig
@@ -434,7 +434,7 @@ pub fn poll(
comptime StreamEnum: type,
files: PollFiles(StreamEnum),
) Poller(StreamEnum) {
- const enum_fields = @typeInfo(StreamEnum).Enum.fields;
+ const enum_fields = @typeInfo(StreamEnum).@"enum".fields;
var result: Poller(StreamEnum) = undefined;
if (is_windows) result.windows = .{
@@ -473,7 +473,7 @@ pub const PollFifo = std.fifo.LinearFifo(u8, .Dynamic);
pub fn Poller(comptime StreamEnum: type) type {
return struct {
- const enum_fields = @typeInfo(StreamEnum).Enum.fields;
+ const enum_fields = @typeInfo(StreamEnum).@"enum".fields;
const PollFd = if (is_windows) void else posix.pollfd;
fifos: [enum_fields.len]PollFifo,
@@ -676,7 +676,7 @@ fn windowsAsyncRead(
/// Given an enum, returns a struct with fields of that enum, each field
/// representing an I/O stream for polling.
pub fn PollFiles(comptime StreamEnum: type) type {
- const enum_fields = @typeInfo(StreamEnum).Enum.fields;
+ const enum_fields = @typeInfo(StreamEnum).@"enum".fields;
var struct_fields: [enum_fields.len]std.builtin.Type.StructField = undefined;
for (&struct_fields, enum_fields) |*struct_field, enum_field| {
struct_field.* = .{
@@ -687,7 +687,7 @@ pub fn PollFiles(comptime StreamEnum: type) type {
.alignment = @alignOf(fs.File),
};
}
- return @Type(.{ .Struct = .{
+ return @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &struct_fields,
.decls = &.{},
diff --git a/lib/std/io/Reader.zig b/lib/std/io/Reader.zig
index a769fe4c0421..33187125b86b 100644
--- a/lib/std/io/Reader.zig
+++ b/lib/std/io/Reader.zig
@@ -277,7 +277,7 @@ pub fn readBoundedBytes(self: Self, comptime num_bytes: usize) anyerror!std.Boun
}
pub inline fn readInt(self: Self, comptime T: type, endian: std.builtin.Endian) anyerror!T {
- const bytes = try self.readBytesNoEof(@divExact(@typeInfo(T).Int.bits, 8));
+ const bytes = try self.readBytesNoEof(@divExact(@typeInfo(T).int.bits, 8));
return mem.readInt(T, &bytes, endian);
}
@@ -326,7 +326,7 @@ pub fn isBytes(self: Self, slice: []const u8) anyerror!bool {
pub fn readStruct(self: Self, comptime T: type) anyerror!T {
// Only extern and packed structs have defined in-memory layout.
- comptime assert(@typeInfo(T).Struct.layout != .auto);
+ comptime assert(@typeInfo(T).@"struct".layout != .auto);
var res: [1]T = undefined;
try self.readNoEof(mem.sliceAsBytes(res[0..]));
return res[0];
@@ -348,7 +348,7 @@ pub fn readEnum(self: Self, comptime Enum: type, endian: std.builtin.Endian) any
/// An integer was read, but it did not match any of the tags in the supplied enum.
InvalidValue,
};
- const type_info = @typeInfo(Enum).Enum;
+ const type_info = @typeInfo(Enum).@"enum";
const tag = try self.readInt(type_info.tag_type, endian);
inline for (std.meta.fields(Enum)) |field| {
diff --git a/lib/std/io/Writer.zig b/lib/std/io/Writer.zig
index 0c80393e4527..26d4f88def80 100644
--- a/lib/std/io/Writer.zig
+++ b/lib/std/io/Writer.zig
@@ -49,14 +49,14 @@ pub fn writeBytesNTimes(self: Self, bytes: []const u8, n: usize) anyerror!void {
}
pub inline fn writeInt(self: Self, comptime T: type, value: T, endian: std.builtin.Endian) anyerror!void {
- var bytes: [@divExact(@typeInfo(T).Int.bits, 8)]u8 = undefined;
+ var bytes: [@divExact(@typeInfo(T).int.bits, 8)]u8 = undefined;
mem.writeInt(std.math.ByteAlignedInt(@TypeOf(value)), &bytes, value, endian);
return self.writeAll(&bytes);
}
pub fn writeStruct(self: Self, value: anytype) anyerror!void {
// Only extern and packed structs have defined in-memory layout.
- comptime assert(@typeInfo(@TypeOf(value)).Struct.layout != .auto);
+ comptime assert(@typeInfo(@TypeOf(value)).@"struct".layout != .auto);
return self.writeAll(mem.asBytes(&value));
}
diff --git a/lib/std/io/bit_writer.zig b/lib/std/io/bit_writer.zig
index 14e7f994eda1..b5db45898be8 100644
--- a/lib/std/io/bit_writer.zig
+++ b/lib/std/io/bit_writer.zig
@@ -33,7 +33,7 @@ pub fn BitWriter(comptime endian: std.builtin.Endian, comptime WriterType: type)
if (bits == 0) return;
const U = @TypeOf(value);
- comptime assert(@typeInfo(U).Int.signedness == .unsigned);
+ comptime assert(@typeInfo(U).int.signedness == .unsigned);
//by extending the buffer to a minimum of u8 we can cover a number of edge cases
// related to shifting and casting.
diff --git a/lib/std/io/fixed_buffer_stream.zig b/lib/std/io/fixed_buffer_stream.zig
index 14e5e5de43eb..7750c29fc8c0 100644
--- a/lib/std/io/fixed_buffer_stream.zig
+++ b/lib/std/io/fixed_buffer_stream.zig
@@ -115,18 +115,18 @@ pub fn fixedBufferStream(buffer: anytype) FixedBufferStream(Slice(@TypeOf(buffer
fn Slice(comptime T: type) type {
switch (@typeInfo(T)) {
- .Pointer => |ptr_info| {
+ .pointer => |ptr_info| {
var new_ptr_info = ptr_info;
switch (ptr_info.size) {
.Slice => {},
.One => switch (@typeInfo(ptr_info.child)) {
- .Array => |info| new_ptr_info.child = info.child,
+ .array => |info| new_ptr_info.child = info.child,
else => @compileError("invalid type given to fixedBufferStream"),
},
else => @compileError("invalid type given to fixedBufferStream"),
}
new_ptr_info.size = .Slice;
- return @Type(.{ .Pointer = new_ptr_info });
+ return @Type(.{ .pointer = new_ptr_info });
},
else => @compileError("invalid type given to fixedBufferStream"),
}
diff --git a/lib/std/io/multi_writer.zig b/lib/std/io/multi_writer.zig
index 9cd4600e634c..be109867b781 100644
--- a/lib/std/io/multi_writer.zig
+++ b/lib/std/io/multi_writer.zig
@@ -4,7 +4,7 @@ const io = std.io;
/// Takes a tuple of streams, and constructs a new stream that writes to all of them
pub fn MultiWriter(comptime Writers: type) type {
comptime var ErrSet = error{};
- inline for (@typeInfo(Writers).Struct.fields) |field| {
+ inline for (@typeInfo(Writers).@"struct".fields) |field| {
const StreamType = field.type;
ErrSet = ErrSet || StreamType.Error;
}
diff --git a/lib/std/io/tty.zig b/lib/std/io/tty.zig
index 83206a6a677d..013057649ec1 100644
--- a/lib/std/io/tty.zig
+++ b/lib/std/io/tty.zig
@@ -75,7 +75,7 @@ pub const Config = union(enum) {
conf: Config,
writer: anytype,
color: Color,
- ) (@typeInfo(@TypeOf(writer.writeAll(""))).ErrorUnion.error_set ||
+ ) (@typeInfo(@TypeOf(writer.writeAll(""))).error_union.error_set ||
windows.SetConsoleTextAttributeError)!void {
nosuspend switch (conf) {
.no_color => return,
diff --git a/lib/std/json/static.zig b/lib/std/json/static.zig
index 74901f85a885..15cb5bc75a16 100644
--- a/lib/std/json/static.zig
+++ b/lib/std/json/static.zig
@@ -219,14 +219,14 @@ pub fn innerParse(
options: ParseOptions,
) ParseError(@TypeOf(source.*))!T {
switch (@typeInfo(T)) {
- .Bool => {
+ .bool => {
return switch (try source.next()) {
.true => true,
.false => false,
else => error.UnexpectedToken,
};
},
- .Float, .ComptimeFloat => {
+ .float, .comptime_float => {
const token = try source.nextAllocMax(allocator, .alloc_if_needed, options.max_value_len.?);
defer freeAllocated(allocator, token);
const slice = switch (token) {
@@ -235,7 +235,7 @@ pub fn innerParse(
};
return try std.fmt.parseFloat(T, slice);
},
- .Int, .ComptimeInt => {
+ .int, .comptime_int => {
const token = try source.nextAllocMax(allocator, .alloc_if_needed, options.max_value_len.?);
defer freeAllocated(allocator, token);
const slice = switch (token) {
@@ -244,7 +244,7 @@ pub fn innerParse(
};
return sliceToInt(T, slice);
},
- .Optional => |optionalInfo| {
+ .optional => |optionalInfo| {
switch (try source.peekNextTokenType()) {
.null => {
_ = try source.next();
@@ -255,7 +255,7 @@ pub fn innerParse(
},
}
},
- .Enum => {
+ .@"enum" => {
if (std.meta.hasFn(T, "jsonParse")) {
return T.jsonParse(allocator, source, options);
}
@@ -268,7 +268,7 @@ pub fn innerParse(
};
return sliceToEnum(T, slice);
},
- .Union => |unionInfo| {
+ .@"union" => |unionInfo| {
if (std.meta.hasFn(T, "jsonParse")) {
return T.jsonParse(allocator, source, options);
}
@@ -313,7 +313,7 @@ pub fn innerParse(
return result.?;
},
- .Struct => |structInfo| {
+ .@"struct" => |structInfo| {
if (structInfo.is_tuple) {
if (.array_begin != try source.next()) return error.UnexpectedToken;
@@ -385,7 +385,7 @@ pub fn innerParse(
return r;
},
- .Array => |arrayInfo| {
+ .array => |arrayInfo| {
switch (try source.peekNextTokenType()) {
.array_begin => {
// Typical array.
@@ -440,7 +440,7 @@ pub fn innerParse(
}
},
- .Vector => |vecInfo| {
+ .vector => |vecInfo| {
switch (try source.peekNextTokenType()) {
.array_begin => {
return internalParseArray(T, vecInfo.child, vecInfo.len, allocator, source, options);
@@ -449,7 +449,7 @@ pub fn innerParse(
}
},
- .Pointer => |ptrInfo| {
+ .pointer => |ptrInfo| {
switch (ptrInfo.size) {
.One => {
const r: *ptrInfo.child = try allocator.create(ptrInfo.child);
@@ -550,13 +550,13 @@ pub fn innerParseFromValue(
options: ParseOptions,
) ParseFromValueError!T {
switch (@typeInfo(T)) {
- .Bool => {
+ .bool => {
switch (source) {
.bool => |b| return b,
else => return error.UnexpectedToken,
}
},
- .Float, .ComptimeFloat => {
+ .float, .comptime_float => {
switch (source) {
.float => |f| return @as(T, @floatCast(f)),
.integer => |i| return @as(T, @floatFromInt(i)),
@@ -564,7 +564,7 @@ pub fn innerParseFromValue(
else => return error.UnexpectedToken,
}
},
- .Int, .ComptimeInt => {
+ .int, .comptime_int => {
switch (source) {
.float => |f| {
if (@round(f) != f) return error.InvalidNumber;
@@ -583,13 +583,13 @@ pub fn innerParseFromValue(
else => return error.UnexpectedToken,
}
},
- .Optional => |optionalInfo| {
+ .optional => |optionalInfo| {
switch (source) {
.null => return null,
else => return try innerParseFromValue(optionalInfo.child, allocator, source, options),
}
},
- .Enum => {
+ .@"enum" => {
if (std.meta.hasFn(T, "jsonParseFromValue")) {
return T.jsonParseFromValue(allocator, source, options);
}
@@ -601,7 +601,7 @@ pub fn innerParseFromValue(
else => return error.UnexpectedToken,
}
},
- .Union => |unionInfo| {
+ .@"union" => |unionInfo| {
if (std.meta.hasFn(T, "jsonParseFromValue")) {
return T.jsonParseFromValue(allocator, source, options);
}
@@ -631,7 +631,7 @@ pub fn innerParseFromValue(
return error.UnknownField;
},
- .Struct => |structInfo| {
+ .@"struct" => |structInfo| {
if (structInfo.is_tuple) {
if (source != .array) return error.UnexpectedToken;
if (source.array.items.len != structInfo.fields.len) return error.UnexpectedToken;
@@ -674,7 +674,7 @@ pub fn innerParseFromValue(
return r;
},
- .Array => |arrayInfo| {
+ .array => |arrayInfo| {
switch (source) {
.array => |array| {
// Typical array.
@@ -695,7 +695,7 @@ pub fn innerParseFromValue(
}
},
- .Vector => |vecInfo| {
+ .vector => |vecInfo| {
switch (source) {
.array => |array| {
return innerParseArrayFromArrayValue(T, vecInfo.child, vecInfo.len, allocator, array, options);
@@ -704,7 +704,7 @@ pub fn innerParseFromValue(
}
},
- .Pointer => |ptrInfo| {
+ .pointer => |ptrInfo| {
switch (ptrInfo.size) {
.One => {
const r: *ptrInfo.child = try allocator.create(ptrInfo.child);
@@ -780,12 +780,12 @@ fn sliceToEnum(comptime T: type, slice: []const u8) !T {
if (std.meta.stringToEnum(T, slice)) |value| return value;
// Check for a numeric value.
if (!isNumberFormattedLikeAnInteger(slice)) return error.InvalidEnumTag;
- const n = std.fmt.parseInt(@typeInfo(T).Enum.tag_type, slice, 10) catch return error.InvalidEnumTag;
+ const n = std.fmt.parseInt(@typeInfo(T).@"enum".tag_type, slice, 10) catch return error.InvalidEnumTag;
return std.meta.intToEnum(T, n);
}
-fn fillDefaultStructValues(comptime T: type, r: *T, fields_seen: *[@typeInfo(T).Struct.fields.len]bool) !void {
- inline for (@typeInfo(T).Struct.fields, 0..) |field, i| {
+fn fillDefaultStructValues(comptime T: type, r: *T, fields_seen: *[@typeInfo(T).@"struct".fields.len]bool) !void {
+ inline for (@typeInfo(T).@"struct".fields, 0..) |field, i| {
if (!fields_seen[i]) {
if (field.default_value) |default_ptr| {
const default = @as(*align(1) const field.type, @ptrCast(default_ptr)).*;
diff --git a/lib/std/json/stringify.zig b/lib/std/json/stringify.zig
index 965b7c3113c9..11e1dcf710bf 100644
--- a/lib/std/json/stringify.zig
+++ b/lib/std/json/stringify.zig
@@ -493,7 +493,7 @@ pub fn WriteStream(
if (build_mode_has_safety) assert(self.raw_streaming_mode == .none);
const T = @TypeOf(value);
switch (@typeInfo(T)) {
- .Int => {
+ .int => {
try self.valueStart();
if (self.options.emit_nonportable_numbers_as_strings and
(value <= -(1 << 53) or value >= (1 << 53)))
@@ -505,10 +505,10 @@ pub fn WriteStream(
self.valueDone();
return;
},
- .ComptimeInt => {
+ .comptime_int => {
return self.write(@as(std.math.IntFittingRange(value, value), value));
},
- .Float, .ComptimeFloat => {
+ .float, .comptime_float => {
if (@as(f64, @floatCast(value)) == value) {
try self.valueStart();
try self.stream.print("{}", .{@as(f64, @floatCast(value))});
@@ -521,38 +521,38 @@ pub fn WriteStream(
return;
},
- .Bool => {
+ .bool => {
try self.valueStart();
try self.stream.writeAll(if (value) "true" else "false");
self.valueDone();
return;
},
- .Null => {
+ .null => {
try self.valueStart();
try self.stream.writeAll("null");
self.valueDone();
return;
},
- .Optional => {
+ .optional => {
if (value) |payload| {
return try self.write(payload);
} else {
return try self.write(null);
}
},
- .Enum, .EnumLiteral => {
+ .@"enum", .enum_literal => {
if (std.meta.hasFn(T, "jsonStringify")) {
return value.jsonStringify(self);
}
return self.stringValue(@tagName(value));
},
- .Union => {
+ .@"union" => {
if (std.meta.hasFn(T, "jsonStringify")) {
return value.jsonStringify(self);
}
- const info = @typeInfo(T).Union;
+ const info = @typeInfo(T).@"union";
if (info.tag_type) |UnionTagType| {
try self.beginObject();
inline for (info.fields) |u_field| {
@@ -576,7 +576,7 @@ pub fn WriteStream(
@compileError("Unable to stringify untagged union '" ++ @typeName(T) ++ "'");
}
},
- .Struct => |S| {
+ .@"struct" => |S| {
if (std.meta.hasFn(T, "jsonStringify")) {
return value.jsonStringify(self);
}
@@ -593,7 +593,7 @@ pub fn WriteStream(
var emit_field = true;
// don't include optional fields that are null when emit_null_optional_fields is set to false
- if (@typeInfo(Field.type) == .Optional) {
+ if (@typeInfo(Field.type) == .optional) {
if (self.options.emit_null_optional_fields == false) {
if (@field(value, Field.name) == null) {
emit_field = false;
@@ -615,10 +615,10 @@ pub fn WriteStream(
}
return;
},
- .ErrorSet => return self.stringValue(@errorName(value)),
- .Pointer => |ptr_info| switch (ptr_info.size) {
+ .error_set => return self.stringValue(@errorName(value)),
+ .pointer => |ptr_info| switch (ptr_info.size) {
.One => switch (@typeInfo(ptr_info.child)) {
- .Array => {
+ .array => {
// Coerce `*[N]T` to `[]const T`.
const Slice = []const std.meta.Elem(ptr_info.child);
return self.write(@as(Slice, value));
@@ -648,11 +648,11 @@ pub fn WriteStream(
},
else => @compileError("Unable to stringify type '" ++ @typeName(T) ++ "'"),
},
- .Array => {
+ .array => {
// Coerce `[N]T` to `*const [N]T` (and then to `[]const T`).
return self.write(&value);
},
- .Vector => |info| {
+ .vector => |info| {
const array: [info.len]info.child = value;
return self.write(&array);
},
diff --git a/lib/std/leb128.zig b/lib/std/leb128.zig
index d9e0556231e8..2a5d9b20fc87 100644
--- a/lib/std/leb128.zig
+++ b/lib/std/leb128.zig
@@ -4,10 +4,10 @@ const testing = std.testing;
/// Read a single unsigned LEB128 value from the given reader as type T,
/// or error.Overflow if the value cannot fit.
pub fn readUleb128(comptime T: type, reader: anytype) !T {
- const U = if (@typeInfo(T).Int.bits < 8) u8 else T;
+ const U = if (@typeInfo(T).int.bits < 8) u8 else T;
const ShiftT = std.math.Log2Int(U);
- const max_group = (@typeInfo(U).Int.bits + 6) / 7;
+ const max_group = (@typeInfo(U).int.bits + 6) / 7;
var value: U = 0;
var group: ShiftT = 0;
@@ -42,7 +42,7 @@ pub fn writeUleb128(writer: anytype, arg: anytype) !void {
comptime_int => std.math.IntFittingRange(arg, arg),
else => Arg,
};
- const Value = if (@typeInfo(Int).Int.bits < 8) u8 else Int;
+ const Value = if (@typeInfo(Int).int.bits < 8) u8 else Int;
var value: Value = arg;
while (true) {
@@ -63,11 +63,11 @@ pub const writeULEB128 = writeUleb128;
/// Read a single signed LEB128 value from the given reader as type T,
/// or error.Overflow if the value cannot fit.
pub fn readIleb128(comptime T: type, reader: anytype) !T {
- const S = if (@typeInfo(T).Int.bits < 8) i8 else T;
- const U = std.meta.Int(.unsigned, @typeInfo(S).Int.bits);
+ const S = if (@typeInfo(T).int.bits < 8) i8 else T;
+ const U = std.meta.Int(.unsigned, @typeInfo(S).int.bits);
const ShiftU = std.math.Log2Int(U);
- const max_group = (@typeInfo(U).Int.bits + 6) / 7;
+ const max_group = (@typeInfo(U).int.bits + 6) / 7;
var value = @as(U, 0);
var group = @as(ShiftU, 0);
@@ -83,14 +83,14 @@ pub fn readIleb128(comptime T: type, reader: anytype) !T {
if (@as(S, @bitCast(ov[0])) >= 0) return error.Overflow;
// and all the overflowed bits are 1
- const remaining_shift = @as(u3, @intCast(@typeInfo(U).Int.bits - @as(u16, shift)));
+ const remaining_shift = @as(u3, @intCast(@typeInfo(U).int.bits - @as(u16, shift)));
const remaining_bits = @as(i8, @bitCast(byte | 0x80)) >> remaining_shift;
if (remaining_bits != -1) return error.Overflow;
} else {
// If we don't overflow and this is the last byte and the number being decoded
// is negative, check that the remaining bits are 1
if ((byte & 0x80 == 0) and (@as(S, @bitCast(ov[0])) < 0)) {
- const remaining_shift = @as(u3, @intCast(@typeInfo(U).Int.bits - @as(u16, shift)));
+ const remaining_shift = @as(u3, @intCast(@typeInfo(U).int.bits - @as(u16, shift)));
const remaining_bits = @as(i8, @bitCast(byte | 0x80)) >> remaining_shift;
if (remaining_bits != -1) return error.Overflow;
}
@@ -128,8 +128,8 @@ pub fn writeIleb128(writer: anytype, arg: anytype) !void {
comptime_int => std.math.IntFittingRange(-@abs(arg), @abs(arg)),
else => Arg,
};
- const Signed = if (@typeInfo(Int).Int.bits < 8) i8 else Int;
- const Unsigned = std.meta.Int(.unsigned, @typeInfo(Signed).Int.bits);
+ const Signed = if (@typeInfo(Int).int.bits < 8) i8 else Int;
+ const Unsigned = std.meta.Int(.unsigned, @typeInfo(Signed).int.bits);
var value: Signed = arg;
while (true) {
@@ -165,7 +165,7 @@ pub fn writeUnsignedExtended(slice: []u8, arg: anytype) void {
comptime_int => std.math.IntFittingRange(arg, arg),
else => Arg,
};
- const Value = if (@typeInfo(Int).Int.bits < 8) u8 else Int;
+ const Value = if (@typeInfo(Int).int.bits < 8) u8 else Int;
var value: Value = arg;
for (slice[0 .. slice.len - 1]) |*byte| {
@@ -210,7 +210,7 @@ test writeUnsignedFixed {
/// different value without shifting all the following code.
pub fn writeSignedFixed(comptime l: usize, ptr: *[l]u8, int: std.meta.Int(.signed, l * 7)) void {
const T = @TypeOf(int);
- const U = if (@typeInfo(T).Int.bits < 8) u8 else T;
+ const U = if (@typeInfo(T).int.bits < 8) u8 else T;
var value: U = @intCast(int);
comptime var i = 0;
@@ -388,7 +388,7 @@ test "deserialize unsigned LEB128" {
fn test_write_leb128(value: anytype) !void {
const T = @TypeOf(value);
- const signedness = @typeInfo(T).Int.signedness;
+ const signedness = @typeInfo(T).int.signedness;
const t_signed = signedness == .signed;
const writeStream = if (t_signed) writeIleb128 else writeUleb128;
@@ -396,19 +396,19 @@ fn test_write_leb128(value: anytype) !void {
// decode to a larger bit size too, to ensure sign extension
// is working as expected
- const larger_type_bits = ((@typeInfo(T).Int.bits + 8) / 8) * 8;
+ const larger_type_bits = ((@typeInfo(T).int.bits + 8) / 8) * 8;
const B = std.meta.Int(signedness, larger_type_bits);
const bytes_needed = bn: {
- if (@typeInfo(T).Int.bits <= 7) break :bn @as(u16, 1);
+ if (@typeInfo(T).int.bits <= 7) break :bn @as(u16, 1);
const unused_bits = if (value < 0) @clz(~value) else @clz(value);
- const used_bits: u16 = (@typeInfo(T).Int.bits - unused_bits) + @intFromBool(t_signed);
+ const used_bits: u16 = (@typeInfo(T).int.bits - unused_bits) + @intFromBool(t_signed);
if (used_bits <= 7) break :bn @as(u16, 1);
break :bn ((used_bits + 6) / 7);
};
- const max_groups = if (@typeInfo(T).Int.bits == 0) 1 else (@typeInfo(T).Int.bits + 6) / 7;
+ const max_groups = if (@typeInfo(T).int.bits == 0) 1 else (@typeInfo(T).int.bits + 6) / 7;
var buf: [max_groups]u8 = undefined;
var fbs = std.io.fixedBufferStream(&buf);
@@ -439,7 +439,7 @@ test "serialize unsigned LEB128" {
const T = std.meta.Int(.unsigned, t);
const min = std.math.minInt(T);
const max = std.math.maxInt(T);
- var i = @as(std.meta.Int(.unsigned, @typeInfo(T).Int.bits + 1), min);
+ var i = @as(std.meta.Int(.unsigned, @typeInfo(T).int.bits + 1), min);
while (i <= max) : (i += 1) try test_write_leb128(@as(T, @intCast(i)));
}
@@ -457,7 +457,7 @@ test "serialize signed LEB128" {
const T = std.meta.Int(.signed, t);
const min = std.math.minInt(T);
const max = std.math.maxInt(T);
- var i = @as(std.meta.Int(.signed, @typeInfo(T).Int.bits + 1), min);
+ var i = @as(std.meta.Int(.signed, @typeInfo(T).int.bits + 1), min);
while (i <= max) : (i += 1) try test_write_leb128(@as(T, @intCast(i)));
}
diff --git a/lib/std/log.zig b/lib/std/log.zig
index 1533161cbae4..81a0ab094764 100644
--- a/lib/std/log.zig
+++ b/lib/std/log.zig
@@ -28,7 +28,7 @@
//!
//! pub fn myLogFn(
//! comptime level: std.log.Level,
-//! comptime scope: @TypeOf(.EnumLiteral),
+//! comptime scope: @Type(.enum_literal),
//! comptime format: []const u8,
//! args: anytype,
//! ) void {
@@ -108,7 +108,7 @@ pub const default_level: Level = switch (builtin.mode) {
const level = std.options.log_level;
pub const ScopeLevel = struct {
- scope: @Type(.EnumLiteral),
+ scope: @Type(.enum_literal),
level: Level,
};
@@ -116,7 +116,7 @@ const scope_levels = std.options.log_scope_levels;
fn log(
comptime message_level: Level,
- comptime scope: @Type(.EnumLiteral),
+ comptime scope: @Type(.enum_literal),
comptime format: []const u8,
args: anytype,
) void {
@@ -126,7 +126,7 @@ fn log(
}
/// Determine if a specific log message level and scope combination are enabled for logging.
-pub fn logEnabled(comptime message_level: Level, comptime scope: @Type(.EnumLiteral)) bool {
+pub fn logEnabled(comptime message_level: Level, comptime scope: @Type(.enum_literal)) bool {
inline for (scope_levels) |scope_level| {
if (scope_level.scope == scope) return @intFromEnum(message_level) <= @intFromEnum(scope_level.level);
}
@@ -142,7 +142,7 @@ pub fn defaultLogEnabled(comptime message_level: Level) bool {
/// forward log messages to this function.
pub fn defaultLog(
comptime message_level: Level,
- comptime scope: @Type(.EnumLiteral),
+ comptime scope: @Type(.enum_literal),
comptime format: []const u8,
args: anytype,
) void {
@@ -162,7 +162,7 @@ pub fn defaultLog(
/// Returns a scoped logging namespace that logs all messages using the scope
/// provided here.
-pub fn scoped(comptime scope: @Type(.EnumLiteral)) type {
+pub fn scoped(comptime scope: @Type(.enum_literal)) type {
return struct {
/// Log an error message. This log level is intended to be used
/// when something has gone wrong. This might be recoverable or might
diff --git a/lib/std/math.zig b/lib/std/math.zig
index f18739095c3d..67782bf93b25 100644
--- a/lib/std/math.zig
+++ b/lib/std/math.zig
@@ -71,7 +71,7 @@ pub const snan = float.snan;
///
/// NaN values are never considered equal to any value.
pub fn approxEqAbs(comptime T: type, x: T, y: T, tolerance: T) bool {
- assert(@typeInfo(T) == .Float or @typeInfo(T) == .ComptimeFloat);
+ assert(@typeInfo(T) == .float or @typeInfo(T) == .comptime_float);
assert(tolerance >= 0);
// 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 {
///
/// NaN values are never considered equal to any value.
pub fn approxEqRel(comptime T: type, x: T, y: T, tolerance: T) bool {
- assert(@typeInfo(T) == .Float or @typeInfo(T) == .ComptimeFloat);
+ assert(@typeInfo(T) == .float or @typeInfo(T) == .comptime_float);
assert(tolerance > 0);
// Fast path for equal values (and signed zeros and infinites).
@@ -263,8 +263,8 @@ pub inline fn tan(value: anytype) @TypeOf(value) {
pub fn radiansToDegrees(ang: anytype) if (@TypeOf(ang) == comptime_int) comptime_float else @TypeOf(ang) {
const T = @TypeOf(ang);
switch (@typeInfo(T)) {
- .Float, .ComptimeFloat, .ComptimeInt => return ang * deg_per_rad,
- .Vector => |V| if (@typeInfo(V.child) == .Float) return ang * @as(T, @splat(deg_per_rad)),
+ .float, .comptime_float, .comptime_int => return ang * deg_per_rad,
+ .vector => |V| if (@typeInfo(V.child) == .float) return ang * @as(T, @splat(deg_per_rad)),
else => {},
}
@compileError("Input must be float or a comptime number, or a vector of floats.");
@@ -298,8 +298,8 @@ test radiansToDegrees {
pub fn degreesToRadians(ang: anytype) if (@TypeOf(ang) == comptime_int) comptime_float else @TypeOf(ang) {
const T = @TypeOf(ang);
switch (@typeInfo(T)) {
- .Float, .ComptimeFloat, .ComptimeInt => return ang * rad_per_deg,
- .Vector => |V| if (@typeInfo(V.child) == .Float) return ang * @as(T, @splat(rad_per_deg)),
+ .float, .comptime_float, .comptime_int => return ang * rad_per_deg,
+ .vector => |V| if (@typeInfo(V.child) == .float) return ang * @as(T, @splat(rad_per_deg)),
else => {},
}
@compileError("Input must be float or a comptime number, or a vector of floats.");
@@ -408,8 +408,8 @@ test {
/// full range of the minimum value.
pub fn Min(comptime A: type, comptime B: type) type {
switch (@typeInfo(A)) {
- .Int => |a_info| switch (@typeInfo(B)) {
- .Int => |b_info| if (a_info.signedness == .unsigned and b_info.signedness == .unsigned) {
+ .int => |a_info| switch (@typeInfo(B)) {
+ .int => |b_info| if (a_info.signedness == .unsigned and b_info.signedness == .unsigned) {
if (a_info.bits < b_info.bits) {
return A;
} else {
@@ -437,21 +437,21 @@ pub fn Min(comptime A: type, comptime B: type) type {
pub fn wrap(x: anytype, r: anytype) @TypeOf(x) {
const info_x = @typeInfo(@TypeOf(x));
const info_r = @typeInfo(@TypeOf(r));
- if (info_x == .Int and info_x.Int.signedness != .signed) {
+ if (info_x == .int and info_x.int.signedness != .signed) {
@compileError("x must be floating point, comptime integer, or signed integer.");
}
switch (info_r) {
- .Int => {
+ .int => {
// in the rare usecase of r not being comptime_int or float,
// take the penalty of having an intermediary type conversion,
// otherwise the alternative is to unwind iteratively to avoid overflow
const R = comptime do: {
var info = info_r;
- info.Int.bits += 1;
- info.Int.signedness = .signed;
+ info.int.bits += 1;
+ info.int.signedness = .signed;
break :do @Type(info);
};
- const radius: if (info_r.Int.signedness == .signed) @TypeOf(r) else R = r;
+ const radius: if (info_r.int.signedness == .signed) @TypeOf(r) else R = r;
return @intCast(@mod(x - radius, 2 * @as(R, r)) - r); // provably impossible to overflow
},
else => {
@@ -520,9 +520,9 @@ test wrap {
pub fn clamp(val: anytype, lower: anytype, upper: anytype) @TypeOf(val, lower, upper) {
const T = @TypeOf(val, lower, upper);
switch (@typeInfo(T)) {
- .Int, .Float, .ComptimeInt, .ComptimeFloat => assert(lower <= upper),
- .Vector => |vinfo| switch (@typeInfo(vinfo.child)) {
- .Int, .Float => assert(@reduce(.And, lower <= upper)),
+ .int, .float, .comptime_int, .comptime_float => assert(lower <= upper),
+ .vector => |vinfo| switch (@typeInfo(vinfo.child)) {
+ .int, .float => assert(@reduce(.And, lower <= upper)),
else => @compileError("Expected vector of ints or floats, found " ++ @typeName(T)),
},
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 {
const abs_shift_amt = @abs(shift_amt);
const casted_shift_amt = blk: {
- if (@typeInfo(T) == .Vector) {
- const C = @typeInfo(T).Vector.child;
- const len = @typeInfo(T).Vector.len;
- if (abs_shift_amt >= @typeInfo(C).Int.bits) return @splat(0);
+ if (@typeInfo(T) == .vector) {
+ const C = @typeInfo(T).vector.child;
+ const len = @typeInfo(T).vector.len;
+ if (abs_shift_amt >= @typeInfo(C).int.bits) return @splat(0);
break :blk @as(@Vector(len, Log2Int(C)), @splat(@as(Log2Int(C), @intCast(abs_shift_amt))));
} else {
- if (abs_shift_amt >= @typeInfo(T).Int.bits) return 0;
+ if (abs_shift_amt >= @typeInfo(T).int.bits) return 0;
break :blk @as(Log2Int(T), @intCast(abs_shift_amt));
}
};
- if (@TypeOf(shift_amt) == comptime_int or @typeInfo(@TypeOf(shift_amt)).Int.signedness == .signed) {
+ if (@TypeOf(shift_amt) == comptime_int or @typeInfo(@TypeOf(shift_amt)).int.signedness == .signed) {
if (shift_amt < 0) {
return a >> casted_shift_amt;
}
@@ -633,18 +633,18 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T {
const abs_shift_amt = @abs(shift_amt);
const casted_shift_amt = blk: {
- if (@typeInfo(T) == .Vector) {
- const C = @typeInfo(T).Vector.child;
- const len = @typeInfo(T).Vector.len;
- if (abs_shift_amt >= @typeInfo(C).Int.bits) return @splat(0);
+ if (@typeInfo(T) == .vector) {
+ const C = @typeInfo(T).vector.child;
+ const len = @typeInfo(T).vector.len;
+ if (abs_shift_amt >= @typeInfo(C).int.bits) return @splat(0);
break :blk @as(@Vector(len, Log2Int(C)), @splat(@as(Log2Int(C), @intCast(abs_shift_amt))));
} else {
- if (abs_shift_amt >= @typeInfo(T).Int.bits) return 0;
+ if (abs_shift_amt >= @typeInfo(T).int.bits) return 0;
break :blk @as(Log2Int(T), @intCast(abs_shift_amt));
}
};
- if (@TypeOf(shift_amt) == comptime_int or @typeInfo(@TypeOf(shift_amt)).Int.signedness == .signed) {
+ if (@TypeOf(shift_amt) == comptime_int or @typeInfo(@TypeOf(shift_amt)).int.signedness == .signed) {
if (shift_amt < 0) {
return a << casted_shift_amt;
}
@@ -670,26 +670,26 @@ test shr {
/// Rotates right. Only unsigned values can be rotated. Negative shift
/// values result in shift modulo the bit count.
pub fn rotr(comptime T: type, x: T, r: anytype) T {
- if (@typeInfo(T) == .Vector) {
- const C = @typeInfo(T).Vector.child;
+ if (@typeInfo(T) == .vector) {
+ const C = @typeInfo(T).vector.child;
if (C == u0) return 0;
- if (@typeInfo(C).Int.signedness == .signed) {
+ if (@typeInfo(C).int.signedness == .signed) {
@compileError("cannot rotate signed integers");
}
- const ar: Log2Int(C) = @intCast(@mod(r, @typeInfo(C).Int.bits));
+ const ar: Log2Int(C) = @intCast(@mod(r, @typeInfo(C).int.bits));
return (x >> @splat(ar)) | (x << @splat(1 + ~ar));
- } else if (@typeInfo(T).Int.signedness == .signed) {
+ } else if (@typeInfo(T).int.signedness == .signed) {
@compileError("cannot rotate signed integer");
} else {
if (T == u0) return 0;
- if (comptime isPowerOfTwo(@typeInfo(T).Int.bits)) {
- const ar: Log2Int(T) = @intCast(@mod(r, @typeInfo(T).Int.bits));
+ if (comptime isPowerOfTwo(@typeInfo(T).int.bits)) {
+ const ar: Log2Int(T) = @intCast(@mod(r, @typeInfo(T).int.bits));
return x >> ar | x << (1 +% ~ar);
} else {
- const ar = @mod(r, @typeInfo(T).Int.bits);
- return shr(T, x, ar) | shl(T, x, @typeInfo(T).Int.bits - ar);
+ const ar = @mod(r, @typeInfo(T).int.bits);
+ return shr(T, x, ar) | shl(T, x, @typeInfo(T).int.bits - ar);
}
}
}
@@ -711,26 +711,26 @@ test rotr {
/// Rotates left. Only unsigned values can be rotated. Negative shift
/// values result in shift modulo the bit count.
pub fn rotl(comptime T: type, x: T, r: anytype) T {
- if (@typeInfo(T) == .Vector) {
- const C = @typeInfo(T).Vector.child;
+ if (@typeInfo(T) == .vector) {
+ const C = @typeInfo(T).vector.child;
if (C == u0) return 0;
- if (@typeInfo(C).Int.signedness == .signed) {
+ if (@typeInfo(C).int.signedness == .signed) {
@compileError("cannot rotate signed integers");
}
- const ar: Log2Int(C) = @intCast(@mod(r, @typeInfo(C).Int.bits));
+ const ar: Log2Int(C) = @intCast(@mod(r, @typeInfo(C).int.bits));
return (x << @splat(ar)) | (x >> @splat(1 +% ~ar));
- } else if (@typeInfo(T).Int.signedness == .signed) {
+ } else if (@typeInfo(T).int.signedness == .signed) {
@compileError("cannot rotate signed integer");
} else {
if (T == u0) return 0;
- if (comptime isPowerOfTwo(@typeInfo(T).Int.bits)) {
- const ar: Log2Int(T) = @intCast(@mod(r, @typeInfo(T).Int.bits));
+ if (comptime isPowerOfTwo(@typeInfo(T).int.bits)) {
+ const ar: Log2Int(T) = @intCast(@mod(r, @typeInfo(T).int.bits));
return x << ar | x >> 1 +% ~ar;
} else {
- const ar = @mod(r, @typeInfo(T).Int.bits);
- return shl(T, x, ar) | shr(T, x, @typeInfo(T).Int.bits - ar);
+ const ar = @mod(r, @typeInfo(T).int.bits);
+ return shl(T, x, ar) | shr(T, x, @typeInfo(T).int.bits - ar);
}
}
}
@@ -754,7 +754,7 @@ test rotl {
pub fn Log2Int(comptime T: type) type {
// comptime ceil log2
if (T == comptime_int) return comptime_int;
- const bits: u16 = @typeInfo(T).Int.bits;
+ const bits: u16 = @typeInfo(T).int.bits;
const log2_bits = 16 - @clz(bits - 1);
return std.meta.Int(.unsigned, log2_bits);
}
@@ -763,7 +763,7 @@ pub fn Log2Int(comptime T: type) type {
pub fn Log2IntCeil(comptime T: type) type {
// comptime ceil log2
if (T == comptime_int) return comptime_int;
- const bits: u16 = @typeInfo(T).Int.bits;
+ const bits: u16 = @typeInfo(T).int.bits;
const log2_bits = 16 - @clz(bits);
return std.meta.Int(.unsigned, log2_bits);
}
@@ -849,7 +849,7 @@ fn testOverflow() !void {
pub fn divTrunc(comptime T: type, numerator: T, denominator: T) !T {
@setRuntimeSafety(false);
if (denominator == 0) return error.DivisionByZero;
- if (@typeInfo(T) == .Int and @typeInfo(T).Int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
+ if (@typeInfo(T) == .int and @typeInfo(T).int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
return @divTrunc(numerator, denominator);
}
@@ -873,7 +873,7 @@ fn testDivTrunc() !void {
pub fn divFloor(comptime T: type, numerator: T, denominator: T) !T {
@setRuntimeSafety(false);
if (denominator == 0) return error.DivisionByZero;
- if (@typeInfo(T) == .Int and @typeInfo(T).Int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
+ if (@typeInfo(T) == .int and @typeInfo(T).int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
return @divFloor(numerator, denominator);
}
@@ -899,10 +899,10 @@ pub fn divCeil(comptime T: type, numerator: T, denominator: T) !T {
if (denominator == 0) return error.DivisionByZero;
const info = @typeInfo(T);
switch (info) {
- .ComptimeFloat, .Float => return @ceil(numerator / denominator),
- .ComptimeInt, .Int => {
+ .comptime_float, .float => return @ceil(numerator / denominator),
+ .comptime_int, .int => {
if (numerator < 0 and denominator < 0) {
- if (info == .Int and numerator == minInt(T) and denominator == -1)
+ if (info == .int and numerator == minInt(T) and denominator == -1)
return error.Overflow;
return @divFloor(numerator + 1, denominator) + 1;
}
@@ -952,7 +952,7 @@ fn testDivCeil() !void {
pub fn divExact(comptime T: type, numerator: T, denominator: T) !T {
@setRuntimeSafety(false);
if (denominator == 0) return error.DivisionByZero;
- if (@typeInfo(T) == .Int and @typeInfo(T).Int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
+ if (@typeInfo(T) == .int and @typeInfo(T).int.signedness == .signed and numerator == minInt(T) and denominator == -1) return error.Overflow;
const result = @divTrunc(numerator, denominator);
if (result * denominator != numerator) return error.UnexpectedRemainder;
return result;
@@ -1029,7 +1029,7 @@ fn testRem() !void {
/// Returns the negation of the integer parameter.
/// Result is a signed integer.
pub fn negateCast(x: anytype) !std.meta.Int(.signed, @bitSizeOf(@TypeOf(x))) {
- if (@typeInfo(@TypeOf(x)).Int.signedness == .signed) return negate(x);
+ if (@typeInfo(@TypeOf(x)).int.signedness == .signed) return negate(x);
const int = std.meta.Int(.signed, @bitSizeOf(@TypeOf(x)));
if (x > -minInt(int)) return error.Overflow;
@@ -1052,9 +1052,9 @@ test negateCast {
/// Cast an integer to a different integer type. If the value doesn't fit,
/// return null.
pub fn cast(comptime T: type, x: anytype) ?T {
- comptime assert(@typeInfo(T) == .Int); // must pass an integer
+ comptime assert(@typeInfo(T) == .int); // must pass an integer
const is_comptime = @TypeOf(x) == comptime_int;
- comptime assert(is_comptime or @typeInfo(@TypeOf(x)) == .Int); // must pass an integer
+ comptime assert(is_comptime or @typeInfo(@TypeOf(x)) == .int); // must pass an integer
if ((is_comptime or maxInt(@TypeOf(x)) > maxInt(T)) and x > maxInt(T)) {
return null;
} else if ((is_comptime or minInt(@TypeOf(x)) < minInt(T)) and x < minInt(T)) {
@@ -1084,7 +1084,7 @@ pub const AlignCastError = error{UnalignedMemory};
fn AlignCastResult(comptime alignment: u29, comptime Ptr: type) type {
var ptr_info = @typeInfo(Ptr);
- ptr_info.Pointer.alignment = alignment;
+ ptr_info.pointer.alignment = alignment;
return @Type(ptr_info);
}
@@ -1117,7 +1117,7 @@ test isPowerOfTwo {
/// Aligns the given integer type bit width to a width divisible by 8.
pub fn ByteAlignedInt(comptime T: type) type {
- const info = @typeInfo(T).Int;
+ const info = @typeInfo(T).int;
const bits = (info.bits + 7) / 8 * 8;
const extended_type = std.meta.Int(info.signedness, bits);
return extended_type;
@@ -1157,7 +1157,7 @@ pub inline fn floor(value: anytype) @TypeOf(value) {
/// Returns the nearest power of two less than or equal to value, or
/// zero if value is less than or equal to zero.
pub fn floorPowerOfTwo(comptime T: type, value: T) T {
- const uT = std.meta.Int(.unsigned, @typeInfo(T).Int.bits);
+ const uT = std.meta.Int(.unsigned, @typeInfo(T).int.bits);
if (value <= 0) return 0;
return @as(T, 1) << log2_int(uT, @as(uT, @intCast(value)));
}
@@ -1192,21 +1192,21 @@ pub inline fn ceil(value: anytype) @TypeOf(value) {
/// Returns the next power of two (if the value is not already a power of two).
/// Only unsigned integers can be used. Zero is not an allowed input.
/// Result is a type with 1 more bit than the input type.
-pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo(T).Int.signedness, @typeInfo(T).Int.bits + 1) {
- comptime assert(@typeInfo(T) == .Int);
- comptime assert(@typeInfo(T).Int.signedness == .unsigned);
+pub fn ceilPowerOfTwoPromote(comptime T: type, value: T) std.meta.Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1) {
+ comptime assert(@typeInfo(T) == .int);
+ comptime assert(@typeInfo(T).int.signedness == .unsigned);
assert(value != 0);
- const PromotedType = std.meta.Int(@typeInfo(T).Int.signedness, @typeInfo(T).Int.bits + 1);
+ const PromotedType = std.meta.Int(@typeInfo(T).int.signedness, @typeInfo(T).int.bits + 1);
const ShiftType = std.math.Log2Int(PromotedType);
- return @as(PromotedType, 1) << @as(ShiftType, @intCast(@typeInfo(T).Int.bits - @clz(value - 1)));
+ return @as(PromotedType, 1) << @as(ShiftType, @intCast(@typeInfo(T).int.bits - @clz(value - 1)));
}
/// Returns the next power of two (if the value is not already a power of two).
/// Only unsigned integers can be used. Zero is not an allowed input.
/// If the value doesn't fit, returns an error.
pub fn ceilPowerOfTwo(comptime T: type, value: T) (error{Overflow}!T) {
- comptime assert(@typeInfo(T) == .Int);
- const info = @typeInfo(T).Int;
+ comptime assert(@typeInfo(T) == .int);
+ const info = @typeInfo(T).int;
comptime assert(info.signedness == .unsigned);
const PromotedType = std.meta.Int(info.signedness, info.bits + 1);
const overflowBit = @as(PromotedType, 1) << info.bits;
@@ -1261,16 +1261,16 @@ fn testCeilPowerOfTwo() !void {
/// Return the log base 2 of integer value x, rounding down to the
/// nearest integer.
pub fn log2_int(comptime T: type, x: T) Log2Int(T) {
- if (@typeInfo(T) != .Int or @typeInfo(T).Int.signedness != .unsigned)
+ if (@typeInfo(T) != .int or @typeInfo(T).int.signedness != .unsigned)
@compileError("log2_int requires an unsigned integer, found " ++ @typeName(T));
assert(x != 0);
- return @as(Log2Int(T), @intCast(@typeInfo(T).Int.bits - 1 - @clz(x)));
+ return @as(Log2Int(T), @intCast(@typeInfo(T).int.bits - 1 - @clz(x)));
}
/// Return the log base 2 of integer value x, rounding up to the
/// nearest integer.
pub fn log2_int_ceil(comptime T: type, x: T) Log2IntCeil(T) {
- if (@typeInfo(T) != .Int or @typeInfo(T).Int.signedness != .unsigned)
+ if (@typeInfo(T) != .int or @typeInfo(T).int.signedness != .unsigned)
@compileError("log2_int_ceil requires an unsigned integer, found " ++ @typeName(T));
assert(x != 0);
if (x == 1) return 0;
@@ -1296,35 +1296,35 @@ test log2_int_ceil {
/// converted to the closest possible representation.
pub fn lossyCast(comptime T: type, value: anytype) T {
switch (@typeInfo(T)) {
- .Float => {
+ .float => {
switch (@typeInfo(@TypeOf(value))) {
- .Int => return @as(T, @floatFromInt(value)),
- .Float => return @as(T, @floatCast(value)),
- .ComptimeInt => return @as(T, value),
- .ComptimeFloat => return @as(T, value),
+ .int => return @floatFromInt(value),
+ .float => return @floatCast(value),
+ .comptime_int => return value,
+ .comptime_float => return value,
else => @compileError("bad type"),
}
},
- .Int => {
+ .int => {
switch (@typeInfo(@TypeOf(value))) {
- .Int, .ComptimeInt => {
+ .int, .comptime_int => {
if (value >= maxInt(T)) {
- return @as(T, maxInt(T));
+ return maxInt(T);
} else if (value <= minInt(T)) {
- return @as(T, minInt(T));
+ return minInt(T);
} else {
- return @as(T, @intCast(value));
+ return @intCast(value);
}
},
- .Float, .ComptimeFloat => {
+ .float, .comptime_float => {
if (isNan(value)) {
return 0;
} else if (value >= maxInt(T)) {
- return @as(T, maxInt(T));
+ return maxInt(T);
} else if (value <= minInt(T)) {
- return @as(T, minInt(T));
+ return minInt(T);
} else {
- return @as(T, @intFromFloat(value));
+ return @intFromFloat(value);
}
},
else => @compileError("bad type"),
@@ -1405,16 +1405,16 @@ test lerp {
/// Returns the maximum value of integer type T.
pub fn maxInt(comptime T: type) comptime_int {
const info = @typeInfo(T);
- const bit_count = info.Int.bits;
+ const bit_count = info.int.bits;
if (bit_count == 0) return 0;
- return (1 << (bit_count - @intFromBool(info.Int.signedness == .signed))) - 1;
+ return (1 << (bit_count - @intFromBool(info.int.signedness == .signed))) - 1;
}
/// Returns the minimum value of integer type T.
pub fn minInt(comptime T: type) comptime_int {
const info = @typeInfo(T);
- const bit_count = info.Int.bits;
- if (info.Int.signedness == .unsigned) return 0;
+ const bit_count = info.int.bits;
+ if (info.int.signedness == .unsigned) return 0;
if (bit_count == 0) return 0;
return -(1 << (bit_count - 1));
}
@@ -1466,12 +1466,12 @@ test "max value type" {
/// Multiply a and b. Return type is wide enough to guarantee no
/// overflow.
pub fn mulWide(comptime T: type, a: T, b: T) std.meta.Int(
- @typeInfo(T).Int.signedness,
- @typeInfo(T).Int.bits * 2,
+ @typeInfo(T).int.signedness,
+ @typeInfo(T).int.bits * 2,
) {
const ResultInt = std.meta.Int(
- @typeInfo(T).Int.signedness,
- @typeInfo(T).Int.bits * 2,
+ @typeInfo(T).int.signedness,
+ @typeInfo(T).int.bits * 2,
);
return @as(ResultInt, a) * @as(ResultInt, b);
}
@@ -1616,7 +1616,7 @@ pub const CompareOperator = enum {
}
test reverse {
- inline for (@typeInfo(CompareOperator).Enum.fields) |op_field| {
+ inline for (@typeInfo(CompareOperator).@"enum".fields) |op_field| {
const op = @as(CompareOperator, @enumFromInt(op_field.value));
try testing.expect(compare(2, op, 3) == compare(3, op.reverse(), 2));
try testing.expect(compare(3, op, 3) == compare(3, op.reverse(), 3));
@@ -1669,7 +1669,7 @@ test order {
/// and a mask of all zeroes if value is false.
/// Compiles to one instruction for register sized integers.
pub inline fn boolMask(comptime MaskInt: type, value: bool) MaskInt {
- if (@typeInfo(MaskInt) != .Int)
+ if (@typeInfo(MaskInt) != .int)
@compileError("boolMask requires an integer mask type.");
if (MaskInt == u0 or MaskInt == i0)
@@ -1742,11 +1742,11 @@ pub fn break_f80(x: f80) F80 {
pub inline fn sign(i: anytype) @TypeOf(i) {
const T = @TypeOf(i);
return switch (@typeInfo(T)) {
- .Int, .ComptimeInt => @as(T, @intFromBool(i > 0)) - @as(T, @intFromBool(i < 0)),
- .Float, .ComptimeFloat => @as(T, @floatFromInt(@intFromBool(i > 0))) - @as(T, @floatFromInt(@intFromBool(i < 0))),
- .Vector => |vinfo| blk: {
+ .int, .comptime_int => @as(T, @intFromBool(i > 0)) - @as(T, @intFromBool(i < 0)),
+ .float, .comptime_float => @as(T, @floatFromInt(@intFromBool(i > 0))) - @as(T, @floatFromInt(@intFromBool(i < 0))),
+ .vector => |vinfo| blk: {
switch (@typeInfo(vinfo.child)) {
- .Int, .Float => {
+ .int, .float => {
const zero: T = @splat(0);
const one: T = @splat(1);
break :blk @select(vinfo.child, i > zero, one, zero) - @select(vinfo.child, i < zero, one, zero);
diff --git a/lib/std/math/big.zig b/lib/std/math/big.zig
index c0d8e74eb28b..c201bf1df29b 100644
--- a/lib/std/math/big.zig
+++ b/lib/std/math/big.zig
@@ -4,7 +4,7 @@ const assert = std.debug.assert;
pub const Rational = @import("big/rational.zig").Rational;
pub const int = @import("big/int.zig");
pub const Limb = usize;
-const limb_info = @typeInfo(Limb).Int;
+const limb_info = @typeInfo(Limb).int;
pub const SignedLimb = std.meta.Int(.signed, limb_info.bits);
pub const DoubleLimb = std.meta.Int(.unsigned, 2 * limb_info.bits);
pub const HalfLimb = std.meta.Int(.unsigned, limb_info.bits / 2);
diff --git a/lib/std/math/big/int.zig b/lib/std/math/big/int.zig
index f0fd6fca4e37..2c656033e91b 100644
--- a/lib/std/math/big/int.zig
+++ b/lib/std/math/big/int.zig
@@ -2,9 +2,9 @@ const std = @import("../../std.zig");
const builtin = @import("builtin");
const math = std.math;
const Limb = std.math.big.Limb;
-const limb_bits = @typeInfo(Limb).Int.bits;
+const limb_bits = @typeInfo(Limb).int.bits;
const HalfLimb = std.math.big.HalfLimb;
-const half_limb_bits = @typeInfo(HalfLimb).Int.bits;
+const half_limb_bits = @typeInfo(HalfLimb).int.bits;
const DoubleLimb = std.math.big.DoubleLimb;
const SignedDoubleLimb = std.math.big.SignedDoubleLimb;
const Log2Limb = std.math.big.Log2Limb;
@@ -23,7 +23,7 @@ const debug_safety = false;
/// primitive integer value.
/// Note: A comptime-known upper bound of this value that may be used
/// instead if `scalar` is not already comptime-known is
-/// `calcTwosCompLimbCount(@typeInfo(@TypeOf(scalar)).Int.bits)`
+/// `calcTwosCompLimbCount(@typeInfo(@TypeOf(scalar)).int.bits)`
pub fn calcLimbLen(scalar: anytype) usize {
if (scalar == 0) {
return 1;
@@ -236,7 +236,7 @@ pub const Mutable = struct {
self.positive = value >= 0;
switch (@typeInfo(T)) {
- .Int => |info| {
+ .int => |info| {
var w_value = @abs(value);
if (info.bits <= limb_bits) {
@@ -251,7 +251,7 @@ pub const Mutable = struct {
}
}
},
- .ComptimeInt => {
+ .comptime_int => {
comptime var w_value = @abs(value);
if (w_value <= maxInt(Limb)) {
@@ -405,8 +405,8 @@ pub const Mutable = struct {
// is well worth being able to use the stack and not needing an allocator passed in.
// Note that Mutable.init still sets len to calcLimbLen(scalar) in any case.
const limb_len = comptime switch (@typeInfo(@TypeOf(scalar))) {
- .ComptimeInt => calcLimbLen(scalar),
- .Int => |info| calcTwosCompLimbCount(info.bits),
+ .comptime_int => calcLimbLen(scalar),
+ .int => |info| calcTwosCompLimbCount(info.bits),
else => @compileError("expected scalar to be an int"),
};
var limbs: [limb_len]Limb = undefined;
@@ -2158,7 +2158,7 @@ pub const Const = struct {
/// Returns whether self can fit into an integer of the requested type.
pub fn fits(self: Const, comptime T: type) bool {
- const info = @typeInfo(T).Int;
+ const info = @typeInfo(T).int;
return self.fitsInTwosComp(info.signedness, info.bits);
}
@@ -2181,7 +2181,7 @@ pub const Const = struct {
/// Returns an error if self cannot be narrowed into the requested type without truncation.
pub fn to(self: Const, comptime T: type) ConvertError!T {
switch (@typeInfo(T)) {
- .Int => |info| {
+ .int => |info| {
// Make sure -0 is handled correctly.
if (self.eqlZero()) return 0;
@@ -2495,8 +2495,8 @@ pub const Const = struct {
// is well worth being able to use the stack and not needing an allocator passed in.
// Note that Mutable.init still sets len to calcLimbLen(scalar) in any case.
const limb_len = comptime switch (@typeInfo(@TypeOf(scalar))) {
- .ComptimeInt => calcLimbLen(scalar),
- .Int => |info| calcTwosCompLimbCount(info.bits),
+ .comptime_int => calcLimbLen(scalar),
+ .int => |info| calcTwosCompLimbCount(info.bits),
else => @compileError("expected scalar to be an int"),
};
var limbs: [limb_len]Limb = undefined;
@@ -2555,7 +2555,7 @@ pub const Const = struct {
/// Memory is allocated as needed to ensure operations never overflow. The range
/// is bounded only by available memory.
pub const Managed = struct {
- pub const sign_bit: usize = 1 << (@typeInfo(usize).Int.bits - 1);
+ pub const sign_bit: usize = 1 << (@typeInfo(usize).int.bits - 1);
/// Default number of limbs to allocate on creation of a `Managed`.
pub const default_capacity = 4;
diff --git a/lib/std/math/big/int_test.zig b/lib/std/math/big/int_test.zig
index f06917f0f2e5..17652179f599 100644
--- a/lib/std/math/big/int_test.zig
+++ b/lib/std/math/big/int_test.zig
@@ -22,13 +22,13 @@ test "comptime_int set" {
var a = try Managed.initSet(testing.allocator, s);
defer a.deinit();
- const s_limb_count = 128 / @typeInfo(Limb).Int.bits;
+ const s_limb_count = 128 / @typeInfo(Limb).int.bits;
comptime var i: usize = 0;
inline while (i < s_limb_count) : (i += 1) {
const result = @as(Limb, s & maxInt(Limb));
- s >>= @typeInfo(Limb).Int.bits / 2;
- s >>= @typeInfo(Limb).Int.bits / 2;
+ s >>= @typeInfo(Limb).int.bits / 2;
+ s >>= @typeInfo(Limb).int.bits / 2;
try testing.expect(a.limbs[i] == result);
}
}
@@ -299,7 +299,7 @@ test "twos complement limit set" {
}
fn testTwosComplementLimit(comptime T: type) !void {
- const int_info = @typeInfo(T).Int;
+ const int_info = @typeInfo(T).int;
var a = try Managed.init(testing.allocator);
defer a.deinit();
@@ -1893,7 +1893,7 @@ test "truncate multi to single signed" {
}
test "truncate multi to multi unsigned" {
- const bits = @typeInfo(SignedDoubleLimb).Int.bits;
+ const bits = @typeInfo(SignedDoubleLimb).int.bits;
const Int = std.meta.Int(.unsigned, bits - 1);
var a = try Managed.initSet(testing.allocator, maxInt(SignedDoubleLimb));
@@ -2239,11 +2239,11 @@ test "bitNotWrap more than two limbs" {
const bits = @bitSizeOf(Limb) * 4 + 2;
try res.bitNotWrap(&a, .unsigned, bits);
- const Unsigned = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = bits } });
+ const Unsigned = @Type(.{ .int = .{ .signedness = .unsigned, .bits = bits } });
try testing.expectEqual((try res.to(Unsigned)), ~@as(Unsigned, maxInt(Limb)));
try res.bitNotWrap(&a, .signed, bits);
- const Signed = @Type(.{ .Int = .{ .signedness = .signed, .bits = bits } });
+ const Signed = @Type(.{ .int = .{ .signedness = .signed, .bits = bits } });
try testing.expectEqual((try res.to(Signed)), ~@as(Signed, maxInt(Limb)));
}
@@ -3037,8 +3037,8 @@ test "big int conversion write twos complement zero" {
}
fn bitReverseTest(comptime T: type, comptime input: comptime_int, comptime expected_output: comptime_int) !void {
- const bit_count = @typeInfo(T).Int.bits;
- const signedness = @typeInfo(T).Int.signedness;
+ const bit_count = @typeInfo(T).int.bits;
+ const signedness = @typeInfo(T).int.signedness;
var a = try Managed.initSet(testing.allocator, input);
defer a.deinit();
@@ -3084,8 +3084,8 @@ test "big int bit reverse" {
}
fn byteSwapTest(comptime T: type, comptime input: comptime_int, comptime expected_output: comptime_int) !void {
- const byte_count = @typeInfo(T).Int.bits / 8;
- const signedness = @typeInfo(T).Int.signedness;
+ const byte_count = @typeInfo(T).int.bits / 8;
+ const signedness = @typeInfo(T).int.signedness;
var a = try Managed.initSet(testing.allocator, input);
defer a.deinit();
@@ -3151,7 +3151,7 @@ test "mul multi-multi alias r with a and b" {
try testing.expect(a.eql(want));
- if (@typeInfo(Limb).Int.bits == 64) {
+ if (@typeInfo(Limb).int.bits == 64) {
try testing.expectEqual(@as(usize, 5), a.limbs.len);
}
}
@@ -3167,7 +3167,7 @@ test "sqr multi alias r with a" {
try testing.expect(a.eql(want));
- if (@typeInfo(Limb).Int.bits == 64) {
+ if (@typeInfo(Limb).int.bits == 64) {
try testing.expectEqual(@as(usize, 5), a.limbs.len);
}
}
diff --git a/lib/std/math/big/rational.zig b/lib/std/math/big/rational.zig
index bbfea9de74ec..ce93f40a25f2 100644
--- a/lib/std/math/big/rational.zig
+++ b/lib/std/math/big/rational.zig
@@ -135,9 +135,9 @@ pub const Rational = struct {
/// completely represent the provided float.
pub fn setFloat(self: *Rational, comptime T: type, f: T) !void {
// Translated from golang.go/src/math/big/rat.go.
- debug.assert(@typeInfo(T) == .Float);
+ debug.assert(@typeInfo(T) == .float);
- const UnsignedInt = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const UnsignedInt = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const f_bits = @as(UnsignedInt, @bitCast(f));
const exponent_bits = math.floatExponentBits(T);
@@ -193,9 +193,9 @@ pub const Rational = struct {
pub fn toFloat(self: Rational, comptime T: type) !T {
// Translated from golang.go/src/math/big/rat.go.
// TODO: Indicate whether the result is not exact.
- debug.assert(@typeInfo(T) == .Float);
+ debug.assert(@typeInfo(T) == .float);
- const fsize = @typeInfo(T).Float.bits;
+ const fsize = @typeInfo(T).float.bits;
const BitReprType = std.meta.Int(.unsigned, fsize);
const msize = math.floatMantissaBits(T);
@@ -473,10 +473,10 @@ pub const Rational = struct {
};
fn extractLowBits(a: Int, comptime T: type) T {
- debug.assert(@typeInfo(T) == .Int);
+ debug.assert(@typeInfo(T) == .int);
- const t_bits = @typeInfo(T).Int.bits;
- const limb_bits = @typeInfo(Limb).Int.bits;
+ const t_bits = @typeInfo(T).int.bits;
+ const limb_bits = @typeInfo(Limb).int.bits;
if (t_bits <= limb_bits) {
return @as(T, @truncate(a.limbs[0]));
} else {
diff --git a/lib/std/math/copysign.zig b/lib/std/math/copysign.zig
index 63daf5904769..65144dfe3f2a 100644
--- a/lib/std/math/copysign.zig
+++ b/lib/std/math/copysign.zig
@@ -5,7 +5,7 @@ const expect = std.testing.expect;
/// Returns a value with the magnitude of `magnitude` and the sign of `sign`.
pub fn copysign(magnitude: anytype, sign: @TypeOf(magnitude)) @TypeOf(magnitude) {
const T = @TypeOf(magnitude);
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const sign_bit_mask = @as(TBits, 1) << (@bitSizeOf(T) - 1);
const mag = @as(TBits, @bitCast(magnitude)) & ~sign_bit_mask;
const sgn = @as(TBits, @bitCast(sign)) & sign_bit_mask;
diff --git a/lib/std/math/float.zig b/lib/std/math/float.zig
index 1d19fdc57cc4..a10332f86383 100644
--- a/lib/std/math/float.zig
+++ b/lib/std/math/float.zig
@@ -6,21 +6,21 @@ const expectEqual = std.testing.expectEqual;
/// Creates a raw "1.0" mantissa for floating point type T. Used to dedupe f80 logic.
inline fn mantissaOne(comptime T: type) comptime_int {
- return if (@typeInfo(T).Float.bits == 80) 1 << floatFractionalBits(T) else 0;
+ return if (@typeInfo(T).float.bits == 80) 1 << floatFractionalBits(T) else 0;
}
/// Creates floating point type T from an unbiased exponent and raw mantissa.
inline fn reconstructFloat(comptime T: type, comptime exponent: comptime_int, comptime mantissa: comptime_int) T {
- const TBits = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
+ const TBits = @Type(.{ .int = .{ .signedness = .unsigned, .bits = @bitSizeOf(T) } });
const biased_exponent = @as(TBits, exponent + floatExponentMax(T));
return @as(T, @bitCast((biased_exponent << floatMantissaBits(T)) | @as(TBits, mantissa)));
}
/// Returns the number of bits in the exponent of floating point type T.
pub inline fn floatExponentBits(comptime T: type) comptime_int {
- comptime assert(@typeInfo(T) == .Float);
+ comptime assert(@typeInfo(T) == .float);
- return switch (@typeInfo(T).Float.bits) {
+ return switch (@typeInfo(T).float.bits) {
16 => 5,
32 => 8,
64 => 11,
@@ -32,9 +32,9 @@ pub inline fn floatExponentBits(comptime T: type) comptime_int {
/// Returns the number of bits in the mantissa of floating point type T.
pub inline fn floatMantissaBits(comptime T: type) comptime_int {
- comptime assert(@typeInfo(T) == .Float);
+ comptime assert(@typeInfo(T) == .float);
- return switch (@typeInfo(T).Float.bits) {
+ return switch (@typeInfo(T).float.bits) {
16 => 10,
32 => 23,
64 => 52,
@@ -46,12 +46,12 @@ pub inline fn floatMantissaBits(comptime T: type) comptime_int {
/// Returns the number of fractional bits in the mantissa of floating point type T.
pub inline fn floatFractionalBits(comptime T: type) comptime_int {
- comptime assert(@typeInfo(T) == .Float);
+ comptime assert(@typeInfo(T) == .float);
// standard IEEE floats have an implicit 0.m or 1.m integer part
// f80 is special and has an explicitly stored bit in the MSB
// this function corresponds to `MANT_DIG - 1' from C
- return switch (@typeInfo(T).Float.bits) {
+ return switch (@typeInfo(T).float.bits) {
16 => 10,
32 => 23,
64 => 52,
@@ -97,8 +97,8 @@ pub inline fn floatEps(comptime T: type) T {
/// Returns the local epsilon of floating point type T.
pub inline fn floatEpsAt(comptime T: type, x: T) T {
switch (@typeInfo(T)) {
- .Float => |F| {
- const U: type = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = F.bits } });
+ .float => |F| {
+ const U: type = @Type(.{ .int = .{ .signedness = .unsigned, .bits = F.bits } });
const u: U = @bitCast(x);
const y: T = @bitCast(u ^ 1);
return @abs(x - y);
diff --git a/lib/std/math/frexp.zig b/lib/std/math/frexp.zig
index 97b578db9852..3fb340607599 100644
--- a/lib/std/math/frexp.zig
+++ b/lib/std/math/frexp.zig
@@ -21,7 +21,7 @@ pub fn Frexp(comptime T: type) type {
pub fn frexp(x: anytype) Frexp(@TypeOf(x)) {
const T: type = @TypeOf(x);
- const bits: comptime_int = @typeInfo(T).Float.bits;
+ const bits: comptime_int = @typeInfo(T).float.bits;
const Int: type = std.meta.Int(.unsigned, bits);
const exp_bits: comptime_int = math.floatExponentBits(T);
diff --git a/lib/std/math/gcd.zig b/lib/std/math/gcd.zig
index 298bf5fc2b70..36ba8e3614ce 100644
--- a/lib/std/math/gcd.zig
+++ b/lib/std/math/gcd.zig
@@ -8,8 +8,8 @@ pub fn gcd(a: anytype, b: anytype) @TypeOf(a, b) {
// only unsigned integers are allowed and not both must be zero
comptime switch (@typeInfo(@TypeOf(a, b))) {
- .Int => |int| std.debug.assert(int.signedness == .unsigned),
- .ComptimeInt => {
+ .int => |int| std.debug.assert(int.signedness == .unsigned),
+ .comptime_int => {
std.debug.assert(a >= 0);
std.debug.assert(b >= 0);
},
diff --git a/lib/std/math/hypot.zig b/lib/std/math/hypot.zig
index ddc9408aba6c..e90b6505ce04 100644
--- a/lib/std/math/hypot.zig
+++ b/lib/std/math/hypot.zig
@@ -23,8 +23,8 @@ const floatMax = math.floatMax;
pub fn hypot(x: anytype, y: anytype) @TypeOf(x, y) {
const T = @TypeOf(x, y);
switch (@typeInfo(T)) {
- .Float => {},
- .ComptimeFloat => return @sqrt(x * x + y * y),
+ .float => {},
+ .comptime_float => return @sqrt(x * x + y * y),
else => @compileError("hypot not implemented for " ++ @typeName(T)),
}
const lower = @sqrt(floatMin(T));
diff --git a/lib/std/math/ilogb.zig b/lib/std/math/ilogb.zig
index 6f4bb131892e..ba6075208dce 100644
--- a/lib/std/math/ilogb.zig
+++ b/lib/std/math/ilogb.zig
@@ -26,7 +26,7 @@ pub const fp_ilogbnan = minInt(i32);
pub const fp_ilogb0 = minInt(i32);
fn ilogbX(comptime T: type, x: T) i32 {
- const typeWidth = @typeInfo(T).Float.bits;
+ const typeWidth = @typeInfo(T).float.bits;
const significandBits = math.floatMantissaBits(T);
const exponentBits = math.floatExponentBits(T);
diff --git a/lib/std/math/isfinite.zig b/lib/std/math/isfinite.zig
index 5d5bfd2a412d..8f4e170989e5 100644
--- a/lib/std/math/isfinite.zig
+++ b/lib/std/math/isfinite.zig
@@ -5,7 +5,7 @@ const expect = std.testing.expect;
/// Returns whether x is a finite value.
pub fn isFinite(x: anytype) bool {
const T = @TypeOf(x);
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const remove_sign = ~@as(TBits, 0) >> 1;
return @as(TBits, @bitCast(x)) & remove_sign < @as(TBits, @bitCast(math.inf(T)));
}
diff --git a/lib/std/math/isinf.zig b/lib/std/math/isinf.zig
index 7a2e3943d6c6..220f43209d89 100644
--- a/lib/std/math/isinf.zig
+++ b/lib/std/math/isinf.zig
@@ -5,7 +5,7 @@ const expect = std.testing.expect;
/// Returns whether x is an infinity, ignoring sign.
pub inline fn isInf(x: anytype) bool {
const T = @TypeOf(x);
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const remove_sign = ~@as(TBits, 0) >> 1;
return @as(TBits, @bitCast(x)) & remove_sign == @as(TBits, @bitCast(math.inf(T)));
}
diff --git a/lib/std/math/isnormal.zig b/lib/std/math/isnormal.zig
index 1ecaf39330fa..f3d09441e752 100644
--- a/lib/std/math/isnormal.zig
+++ b/lib/std/math/isnormal.zig
@@ -5,7 +5,7 @@ const expect = std.testing.expect;
/// Returns whether x is neither zero, subnormal, infinity, or NaN.
pub fn isNormal(x: anytype) bool {
const T = @TypeOf(x);
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const increment_exp = 1 << math.floatMantissaBits(T);
const remove_sign = ~@as(TBits, 0) >> 1;
diff --git a/lib/std/math/iszero.zig b/lib/std/math/iszero.zig
index 2d288d01e887..57d8250afd30 100644
--- a/lib/std/math/iszero.zig
+++ b/lib/std/math/iszero.zig
@@ -5,7 +5,7 @@ const expect = std.testing.expect;
/// Returns whether x is positive zero.
pub inline fn isPositiveZero(x: anytype) bool {
const T = @TypeOf(x);
- const bit_count = @typeInfo(T).Float.bits;
+ const bit_count = @typeInfo(T).float.bits;
const TBits = std.meta.Int(.unsigned, bit_count);
return @as(TBits, @bitCast(x)) == @as(TBits, 0);
}
@@ -13,7 +13,7 @@ pub inline fn isPositiveZero(x: anytype) bool {
/// Returns whether x is negative zero.
pub inline fn isNegativeZero(x: anytype) bool {
const T = @TypeOf(x);
- const bit_count = @typeInfo(T).Float.bits;
+ const bit_count = @typeInfo(T).float.bits;
const TBits = std.meta.Int(.unsigned, bit_count);
return @as(TBits, @bitCast(x)) == @as(TBits, 1) << (bit_count - 1);
}
diff --git a/lib/std/math/ldexp.zig b/lib/std/math/ldexp.zig
index c785f719f0cb..3b982a9bc200 100644
--- a/lib/std/math/ldexp.zig
+++ b/lib/std/math/ldexp.zig
@@ -7,7 +7,7 @@ const expect = std.testing.expect;
/// Returns x * 2^n.
pub fn ldexp(x: anytype, n: i32) @TypeOf(x) {
const T = @TypeOf(x);
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
const exponent_bits = math.floatExponentBits(T);
const mantissa_bits = math.floatMantissaBits(T);
diff --git a/lib/std/math/log.zig b/lib/std/math/log.zig
index 3ff13a7f197c..47846fa688df 100644
--- a/lib/std/math/log.zig
+++ b/lib/std/math/log.zig
@@ -14,26 +14,26 @@ pub fn log(comptime T: type, base: T, x: T) T {
return math.log2(x);
} else if (base == 10) {
return math.log10(x);
- } else if ((@typeInfo(T) == .Float or @typeInfo(T) == .ComptimeFloat) and base == math.e) {
+ } else if ((@typeInfo(T) == .float or @typeInfo(T) == .comptime_float) and base == math.e) {
return @log(x);
}
const float_base = math.lossyCast(f64, base);
switch (@typeInfo(T)) {
- .ComptimeFloat => {
+ .comptime_float => {
return @as(comptime_float, @log(@as(f64, x)) / @log(float_base));
},
- .ComptimeInt => {
+ .comptime_int => {
return @as(comptime_int, math.log_int(comptime_int, base, x));
},
- .Int => |IntType| switch (IntType.signedness) {
+ .int => |IntType| switch (IntType.signedness) {
.signed => @compileError("log not implemented for signed integers"),
.unsigned => return @as(T, math.log_int(T, base, x)),
},
- .Float => {
+ .float => {
switch (T) {
f32 => return @as(f32, @floatCast(@log(@as(f64, x)) / @log(float_base))),
f64 => return @log(x) / @log(float_base),
diff --git a/lib/std/math/log10.zig b/lib/std/math/log10.zig
index 5b3ee8a8400a..6f3d9a47f6d4 100644
--- a/lib/std/math/log10.zig
+++ b/lib/std/math/log10.zig
@@ -12,14 +12,14 @@ const testing = std.testing;
pub fn log10(x: anytype) @TypeOf(x) {
const T = @TypeOf(x);
switch (@typeInfo(T)) {
- .ComptimeFloat => {
+ .comptime_float => {
return @as(comptime_float, @log10(x));
},
- .Float => return @log10(x),
- .ComptimeInt => {
+ .float => return @log10(x),
+ .comptime_int => {
return @as(comptime_int, @floor(@log10(@as(f64, x))));
},
- .Int => |IntType| switch (IntType.signedness) {
+ .int => |IntType| switch (IntType.signedness) {
.signed => @compileError("log10 not implemented for signed integers"),
.unsigned => return log10_int(x),
},
@@ -37,12 +37,12 @@ pub fn log10(x: anytype) @TypeOf(x) {
pub fn log10_int(x: anytype) std.math.Log2Int(@TypeOf(x)) {
const T = @TypeOf(x);
const OutT = std.math.Log2Int(T);
- if (@typeInfo(T) != .Int or @typeInfo(T).Int.signedness != .unsigned)
+ if (@typeInfo(T) != .int or @typeInfo(T).int.signedness != .unsigned)
@compileError("log10_int requires an unsigned integer, found " ++ @typeName(T));
std.debug.assert(x != 0);
- const bit_size = @typeInfo(T).Int.bits;
+ const bit_size = @typeInfo(T).int.bits;
if (bit_size <= 8) {
return @as(OutT, @intCast(log10_int_u8(x)));
diff --git a/lib/std/math/log2.zig b/lib/std/math/log2.zig
index 0902f3e10c7c..01a1bd3856a4 100644
--- a/lib/std/math/log2.zig
+++ b/lib/std/math/log2.zig
@@ -13,11 +13,11 @@ const expect = std.testing.expect;
pub fn log2(x: anytype) @TypeOf(x) {
const T = @TypeOf(x);
switch (@typeInfo(T)) {
- .ComptimeFloat => {
+ .comptime_float => {
return @as(comptime_float, @log2(x));
},
- .Float => return @log2(x),
- .ComptimeInt => comptime {
+ .float => return @log2(x),
+ .comptime_int => comptime {
var x_shifted = x;
// First, calculate floorPowerOfTwo(x)
var shift_amt = 1;
@@ -34,7 +34,7 @@ pub fn log2(x: anytype) @TypeOf(x) {
}
return result;
},
- .Int => |IntType| switch (IntType.signedness) {
+ .int => |IntType| switch (IntType.signedness) {
.signed => @compileError("log2 not implemented for signed integers"),
.unsigned => return math.log2_int(T, x),
},
diff --git a/lib/std/math/log_int.zig b/lib/std/math/log_int.zig
index edf5c31782c6..376aa69a4d66 100644
--- a/lib/std/math/log_int.zig
+++ b/lib/std/math/log_int.zig
@@ -8,8 +8,8 @@ const Log2Int = math.Log2Int;
/// Asserts that `base > 1` and `x > 0`.
pub fn log_int(comptime T: type, base: T, x: T) Log2Int(T) {
const valid = switch (@typeInfo(T)) {
- .ComptimeInt => true,
- .Int => |IntType| IntType.signedness == .unsigned,
+ .comptime_int => true,
+ .int => |IntType| IntType.signedness == .unsigned,
else => false,
};
if (!valid) @compileError("log_int requires an unsigned integer, found " ++ @typeName(T));
@@ -64,9 +64,7 @@ test "log_int" {
// Test all unsigned integers with 2, 3, ..., 64 bits.
// We cannot test 0 or 1 bits since base must be > 1.
inline for (2..64 + 1) |bits| {
- const T = @Type(std.builtin.Type{
- .Int = std.builtin.Type.Int{ .signedness = .unsigned, .bits = @intCast(bits) },
- });
+ const T = @Type(.{ .int = .{ .signedness = .unsigned, .bits = @intCast(bits) } });
// for base = 2, 3, ..., min(maxInt(T),1024)
var base: T = 1;
diff --git a/lib/std/math/nextafter.zig b/lib/std/math/nextafter.zig
index b88648229b3c..12418b5a1a26 100644
--- a/lib/std/math/nextafter.zig
+++ b/lib/std/math/nextafter.zig
@@ -14,15 +14,15 @@ const expect = std.testing.expect;
///
pub fn nextAfter(comptime T: type, x: T, y: T) T {
return switch (@typeInfo(T)) {
- .Int, .ComptimeInt => nextAfterInt(T, x, y),
- .Float => nextAfterFloat(T, x, y),
+ .int, .comptime_int => nextAfterInt(T, x, y),
+ .float => nextAfterFloat(T, x, y),
else => @compileError("expected int or non-comptime float, found '" ++ @typeName(T) ++ "'"),
};
}
fn nextAfterInt(comptime T: type, x: T, y: T) T {
- comptime assert(@typeInfo(T) == .Int or @typeInfo(T) == .ComptimeInt);
- return if (@typeInfo(T) == .Int and @bitSizeOf(T) < 2)
+ comptime assert(@typeInfo(T) == .int or @typeInfo(T) == .comptime_int);
+ return if (@typeInfo(T) == .int and @bitSizeOf(T) < 2)
// Special case for `i0`, `u0`, `i1`, and `u1`.
y
else if (y > x)
@@ -38,7 +38,7 @@ fn nextAfterInt(comptime T: type, x: T, y: T) T {
//
fn nextAfterFloat(comptime T: type, x: T, y: T) T {
- comptime assert(@typeInfo(T) == .Float);
+ comptime assert(@typeInfo(T) == .float);
if (x == y) {
// Returning `y` ensures that (0.0, -0.0) returns -0.0 and that (-0.0, 0.0) returns 0.0.
return y;
@@ -320,7 +320,7 @@ test "float" {
/// Helps ensure that 0.0 doesn't compare equal to -0.0.
fn bitwiseEqual(comptime T: type, x: T, y: T) bool {
- comptime assert(@typeInfo(T) == .Float);
+ comptime assert(@typeInfo(T) == .float);
const Bits = std.meta.Int(.unsigned, @bitSizeOf(T));
return @as(Bits, @bitCast(x)) == @as(Bits, @bitCast(y));
}
diff --git a/lib/std/math/pow.zig b/lib/std/math/pow.zig
index 2e50cc16dd8b..7409561e1f6a 100644
--- a/lib/std/math/pow.zig
+++ b/lib/std/math/pow.zig
@@ -31,7 +31,7 @@ const expect = std.testing.expect;
/// - pow(-inf, y) = pow(-0, -y)
/// - pow(x, y) = nan for finite x < 0 and finite non-integer y
pub fn pow(comptime T: type, x: T, y: T) T {
- if (@typeInfo(T) == .Int) {
+ if (@typeInfo(T) == .int) {
return math.powi(T, x, y) catch unreachable;
}
@@ -122,7 +122,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
if (yf != 0 and x < 0) {
return math.nan(T);
}
- if (yi >= 1 << (@typeInfo(T).Float.bits - 1)) {
+ if (yi >= 1 << (@typeInfo(T).float.bits - 1)) {
return @exp(y * @log(x));
}
@@ -144,7 +144,7 @@ pub fn pow(comptime T: type, x: T, y: T) T {
var xe = r2.exponent;
var x1 = r2.significand;
- var i = @as(std.meta.Int(.signed, @typeInfo(T).Float.bits), @intFromFloat(yi));
+ var i = @as(std.meta.Int(.signed, @typeInfo(T).float.bits), @intFromFloat(yi));
while (i != 0) : (i >>= 1) {
const overflow_shift = math.floatExponentBits(T) + 1;
if (xe < -(1 << overflow_shift) or (1 << overflow_shift) < xe) {
diff --git a/lib/std/math/powi.zig b/lib/std/math/powi.zig
index 271d24352ad7..aed79e097c8d 100644
--- a/lib/std/math/powi.zig
+++ b/lib/std/math/powi.zig
@@ -27,7 +27,7 @@ pub fn powi(comptime T: type, x: T, y: T) (error{
Overflow,
Underflow,
}!T) {
- const bit_size = @typeInfo(T).Int.bits;
+ const bit_size = @typeInfo(T).int.bits;
// `y & 1 == 0` won't compile when `does_one_overflow`.
const does_one_overflow = math.maxInt(T) < 1;
diff --git a/lib/std/math/signbit.zig b/lib/std/math/signbit.zig
index eeb729ceb7ee..97dd03613aed 100644
--- a/lib/std/math/signbit.zig
+++ b/lib/std/math/signbit.zig
@@ -5,7 +5,7 @@ const expect = std.testing.expect;
/// Returns whether x is negative or negative 0.
pub fn signbit(x: anytype) bool {
const T = @TypeOf(x);
- const TBits = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const TBits = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
return @as(TBits, @bitCast(x)) >> (@bitSizeOf(T) - 1) != 0;
}
diff --git a/lib/std/math/sqrt.zig b/lib/std/math/sqrt.zig
index a00091189736..0753277bb75d 100644
--- a/lib/std/math/sqrt.zig
+++ b/lib/std/math/sqrt.zig
@@ -15,8 +15,8 @@ const maxInt = std.math.maxInt;
pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) {
const T = @TypeOf(x);
switch (@typeInfo(T)) {
- .Float, .ComptimeFloat => return @sqrt(x),
- .ComptimeInt => comptime {
+ .float, .comptime_float => return @sqrt(x),
+ .comptime_int => comptime {
if (x > maxInt(u128)) {
@compileError("sqrt not implemented for comptime_int greater than 128 bits");
}
@@ -25,7 +25,7 @@ pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) {
}
return @as(T, sqrt_int(u128, x));
},
- .Int => |IntType| switch (IntType.signedness) {
+ .int => |IntType| switch (IntType.signedness) {
.signed => @compileError("sqrt not implemented for signed integers"),
.unsigned => return sqrt_int(T, x),
},
@@ -34,10 +34,10 @@ pub fn sqrt(x: anytype) Sqrt(@TypeOf(x)) {
}
fn sqrt_int(comptime T: type, value: T) Sqrt(T) {
- if (@typeInfo(T).Int.bits <= 2) {
+ if (@typeInfo(T).int.bits <= 2) {
return if (value == 0) 0 else 1; // shortcut for small number of bits to simplify general case
} else {
- const bits = @typeInfo(T).Int.bits;
+ const bits = @typeInfo(T).int.bits;
const max = math.maxInt(T);
const minustwo = (@as(T, 2) ^ max) + 1; // unsigned int cannot represent -2
var op = value;
@@ -80,7 +80,7 @@ test sqrt_int {
/// Returns the return type `sqrt` will return given an operand of type `T`.
pub fn Sqrt(comptime T: type) type {
return switch (@typeInfo(T)) {
- .Int => |int| std.meta.Int(.unsigned, (int.bits + 1) / 2),
+ .int => |int| @Type(.{ .int = .{ .signedness = .unsigned, .bits = (int.bits + 1) / 2 } }),
else => T,
};
}
diff --git a/lib/std/mem.zig b/lib/std/mem.zig
index c2c168a2aea3..b4580b1aa4c1 100644
--- a/lib/std/mem.zig
+++ b/lib/std/mem.zig
@@ -229,22 +229,22 @@ pub fn copyBackwards(comptime T: type, dest: []T, source: []const T) void {
/// This can be used to zero-initialize any type for which it makes sense. Structs will be initialized recursively.
pub fn zeroes(comptime T: type) T {
switch (@typeInfo(T)) {
- .ComptimeInt, .Int, .ComptimeFloat, .Float => {
+ .comptime_int, .int, .comptime_float, .float => {
return @as(T, 0);
},
- .Enum => {
+ .@"enum" => {
return @as(T, @enumFromInt(0));
},
- .Void => {
+ .void => {
return {};
},
- .Bool => {
+ .bool => {
return false;
},
- .Optional, .Null => {
+ .optional, .null => {
return null;
},
- .Struct => |struct_info| {
+ .@"struct" => |struct_info| {
if (@sizeOf(T) == 0) return undefined;
if (struct_info.layout == .@"extern") {
var item: T = undefined;
@@ -260,7 +260,7 @@ pub fn zeroes(comptime T: type) T {
return structure;
}
},
- .Pointer => |ptr_info| {
+ .pointer => |ptr_info| {
switch (ptr_info.size) {
.Slice => {
if (ptr_info.sentinel) |sentinel| {
@@ -281,17 +281,17 @@ pub fn zeroes(comptime T: type) T {
},
}
},
- .Array => |info| {
+ .array => |info| {
if (info.sentinel) |sentinel_ptr| {
const sentinel = @as(*align(1) const info.child, @ptrCast(sentinel_ptr)).*;
return [_:sentinel]info.child{zeroes(info.child)} ** info.len;
}
return [_]info.child{zeroes(info.child)} ** info.len;
},
- .Vector => |info| {
+ .vector => |info| {
return @splat(zeroes(info.child));
},
- .Union => |info| {
+ .@"union" => |info| {
if (info.layout == .@"extern") {
var item: T = undefined;
@memset(asBytes(&item), 0);
@@ -299,16 +299,16 @@ pub fn zeroes(comptime T: type) T {
}
@compileError("Can't set a " ++ @typeName(T) ++ " to zero.");
},
- .EnumLiteral,
- .ErrorUnion,
- .ErrorSet,
- .Fn,
- .Type,
- .NoReturn,
- .Undefined,
- .Opaque,
- .Frame,
- .AnyFrame,
+ .enum_literal,
+ .error_union,
+ .error_set,
+ .@"fn",
+ .type,
+ .noreturn,
+ .undefined,
+ .@"opaque",
+ .frame,
+ .@"anyframe",
=> {
@compileError("Can't set a " ++ @typeName(T) ++ " to zero.");
},
@@ -423,9 +423,9 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
const Init = @TypeOf(init);
switch (@typeInfo(T)) {
- .Struct => |struct_info| {
+ .@"struct" => |struct_info| {
switch (@typeInfo(Init)) {
- .Struct => |init_info| {
+ .@"struct" => |init_info| {
if (init_info.is_tuple) {
if (init_info.fields.len > struct_info.fields.len) {
@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 {
@field(value, field.name) = @field(init, init_info.fields[i].name);
} else if (@hasField(@TypeOf(init), field.name)) {
switch (@typeInfo(field.type)) {
- .Struct => {
+ .@"struct" => {
@field(value, field.name) = zeroInit(field.type, @field(init, field.name));
},
else => {
@@ -461,7 +461,7 @@ pub fn zeroInit(comptime T: type, init: anytype) T {
@field(value, field.name) = default_value;
} else {
switch (@typeInfo(field.type)) {
- .Struct => {
+ .@"struct" => {
@field(value, field.name) = std.mem.zeroInit(field.type, .{});
},
else => {
@@ -752,10 +752,10 @@ test indexOfDiff {
/// `[*c]` pointers are assumed to be 0-terminated and assumed to not be allowzero.
fn Span(comptime T: type) type {
switch (@typeInfo(T)) {
- .Optional => |optional_info| {
+ .optional => |optional_info| {
return ?Span(optional_info.child);
},
- .Pointer => |ptr_info| {
+ .pointer => |ptr_info| {
var new_ptr_info = ptr_info;
switch (ptr_info.size) {
.C => {
@@ -766,7 +766,7 @@ fn Span(comptime T: type) type {
.One, .Slice => @compileError("invalid type given to std.mem.span: " ++ @typeName(T)),
}
new_ptr_info.size = .Slice;
- return @Type(.{ .Pointer = new_ptr_info });
+ return @Type(.{ .pointer = new_ptr_info });
},
else => {},
}
@@ -789,7 +789,7 @@ test Span {
/// Pointer attributes such as const are preserved.
/// `[*c]` pointers are assumed to be non-null and 0-terminated.
pub fn span(ptr: anytype) Span(@TypeOf(ptr)) {
- if (@typeInfo(@TypeOf(ptr)) == .Optional) {
+ if (@typeInfo(@TypeOf(ptr)) == .optional) {
if (ptr) |non_null| {
return span(non_null);
} else {
@@ -798,7 +798,7 @@ pub fn span(ptr: anytype) Span(@TypeOf(ptr)) {
}
const Result = Span(@TypeOf(ptr));
const l = len(ptr);
- const ptr_info = @typeInfo(Result).Pointer;
+ const ptr_info = @typeInfo(Result).pointer;
if (ptr_info.sentinel) |s_ptr| {
const s = @as(*align(1) const ptr_info.child, @ptrCast(s_ptr)).*;
return ptr[0..l :s];
@@ -817,15 +817,15 @@ test span {
/// Helper for the return type of sliceTo()
fn SliceTo(comptime T: type, comptime end: std.meta.Elem(T)) type {
switch (@typeInfo(T)) {
- .Optional => |optional_info| {
+ .optional => |optional_info| {
return ?SliceTo(optional_info.child, end);
},
- .Pointer => |ptr_info| {
+ .pointer => |ptr_info| {
var new_ptr_info = ptr_info;
new_ptr_info.size = .Slice;
switch (ptr_info.size) {
.One => switch (@typeInfo(ptr_info.child)) {
- .Array => |array_info| {
+ .array => |array_info| {
new_ptr_info.child = array_info.child;
// The return type must only be sentinel terminated if we are guaranteed
// 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 {
new_ptr_info.is_allowzero = false;
},
}
- return @Type(.{ .Pointer = new_ptr_info });
+ return @Type(.{ .pointer = new_ptr_info });
},
else => {},
}
@@ -876,13 +876,13 @@ fn SliceTo(comptime T: type, comptime end: std.meta.Elem(T)) type {
/// Pointer properties such as mutability and alignment are preserved.
/// C pointers are assumed to be non-null.
pub fn sliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) SliceTo(@TypeOf(ptr), end) {
- if (@typeInfo(@TypeOf(ptr)) == .Optional) {
+ if (@typeInfo(@TypeOf(ptr)) == .optional) {
const non_null = ptr orelse return null;
return sliceTo(non_null, end);
}
const Result = SliceTo(@TypeOf(ptr), end);
const length = lenSliceTo(ptr, end);
- const ptr_info = @typeInfo(Result).Pointer;
+ const ptr_info = @typeInfo(Result).pointer;
if (ptr_info.sentinel) |s_ptr| {
const s = @as(*align(1) const ptr_info.child, @ptrCast(s_ptr)).*;
return ptr[0..length :s];
@@ -933,9 +933,9 @@ test sliceTo {
/// Private helper for sliceTo(). If you want the length, use sliceTo(foo, x).len
fn lenSliceTo(ptr: anytype, comptime end: std.meta.Elem(@TypeOf(ptr))) usize {
switch (@typeInfo(@TypeOf(ptr))) {
- .Pointer => |ptr_info| switch (ptr_info.size) {
+ .pointer => |ptr_info| switch (ptr_info.size) {
.One => switch (@typeInfo(ptr_info.child)) {
- .Array => |array_info| {
+ .array => |array_info| {
if (array_info.sentinel) |sentinel_ptr| {
const sentinel = @as(*align(1) const array_info.child, @ptrCast(sentinel_ptr)).*;
if (sentinel == end) {
@@ -1015,7 +1015,7 @@ test lenSliceTo {
/// `[*c]` pointers are assumed to be non-null and 0-terminated.
pub fn len(value: anytype) usize {
switch (@typeInfo(@TypeOf(value))) {
- .Pointer => |info| switch (info.size) {
+ .pointer => |info| switch (info.size) {
.Many => {
const sentinel_ptr = info.sentinel orelse
@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
if (backend_supports_vectors and
!std.debug.inValgrind() and // https://github.com/ziglang/zig/issues/17717
!@inComptime() and
- (@typeInfo(T) == .Int or @typeInfo(T) == .Float) and std.math.isPowerOfTwo(@bitSizeOf(T)))
+ (@typeInfo(T) == .int or @typeInfo(T) == .float) and std.math.isPowerOfTwo(@bitSizeOf(T)))
{
switch (@import("builtin").cpu.arch) {
// 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,
if (backend_supports_vectors and
!std.debug.inValgrind() and // https://github.com/ziglang/zig/issues/17717
!@inComptime() and
- (@typeInfo(T) == .Int or @typeInfo(T) == .Float) and std.math.isPowerOfTwo(@bitSizeOf(T)))
+ (@typeInfo(T) == .int or @typeInfo(T) == .float) and std.math.isPowerOfTwo(@bitSizeOf(T)))
{
if (std.simd.suggestVectorLength(T)) |block_len| {
// For Intel Nehalem (2009) and AMD Bulldozer (2012) or later, unaligned loads on aligned data result
@@ -1602,8 +1602,8 @@ test containsAtLeast {
/// T specifies the return type, which must be large enough to store
/// the result.
pub fn readVarInt(comptime ReturnType: type, bytes: []const u8, endian: Endian) ReturnType {
- const bits = @typeInfo(ReturnType).Int.bits;
- const signedness = @typeInfo(ReturnType).Int.signedness;
+ const bits = @typeInfo(ReturnType).int.bits;
+ const signedness = @typeInfo(ReturnType).int.signedness;
const WorkType = std.meta.Int(signedness, @max(16, bits));
var result: WorkType = 0;
switch (endian) {
@@ -1635,7 +1635,7 @@ test readVarInt {
try testing.expect(readVarInt(i16, &[_]u8{ 0xff, 0xfd }, .big) == -3);
try testing.expect(readVarInt(i16, &[_]u8{ 0xfc, 0xff }, .little) == -4);
- // Return type can be oversized (bytes.len * 8 < @typeInfo(ReturnType).Int.bits)
+ // Return type can be oversized (bytes.len * 8 < @typeInfo(ReturnType).int.bits)
try testing.expect(readVarInt(u9, &[_]u8{0x12}, .little) == 0x12);
try testing.expect(readVarInt(u9, &[_]u8{0xde}, .big) == 0xde);
try testing.expect(readVarInt(u80, &[_]u8{ 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0, 0x24 }, .big) == 0x123456789abcdef024);
@@ -1719,7 +1719,7 @@ test readVarPackedInt {
/// Reads an integer from memory with bit count specified by T.
/// The bit count of T must be evenly divisible by 8.
/// This function cannot fail and cannot cause undefined behavior.
-pub inline fn readInt(comptime T: type, buffer: *const [@divExact(@typeInfo(T).Int.bits, 8)]u8, endian: Endian) T {
+pub inline fn readInt(comptime T: type, buffer: *const [@divExact(@typeInfo(T).int.bits, 8)]u8, endian: Endian) T {
const value: T = @bitCast(buffer.*);
return if (endian == native_endian) value else @byteSwap(value);
}
@@ -1844,7 +1844,7 @@ test "comptime read/write int" {
/// Writes an integer to memory, storing it in twos-complement.
/// This function always succeeds, has defined behavior for all inputs, but
/// the integer bit width must be divisible by 8.
-pub inline fn writeInt(comptime T: type, buffer: *[@divExact(@typeInfo(T).Int.bits, 8)]u8, value: T, endian: Endian) void {
+pub inline fn writeInt(comptime T: type, buffer: *[@divExact(@typeInfo(T).int.bits, 8)]u8, value: T, endian: Endian) void {
buffer.* = @bitCast(if (endian == native_endian) value else @byteSwap(value));
}
@@ -2047,20 +2047,20 @@ test writeVarPackedInt {
/// (Changing their endianness)
pub fn byteSwapAllFields(comptime S: type, ptr: *S) void {
switch (@typeInfo(S)) {
- .Struct => {
+ .@"struct" => {
inline for (std.meta.fields(S)) |f| {
switch (@typeInfo(f.type)) {
- .Struct => |struct_info| if (struct_info.backing_integer) |Int| {
+ .@"struct" => |struct_info| if (struct_info.backing_integer) |Int| {
@field(ptr, f.name) = @bitCast(@byteSwap(@as(Int, @bitCast(@field(ptr, f.name)))));
} else {
byteSwapAllFields(f.type, &@field(ptr, f.name));
},
- .Array => byteSwapAllFields(f.type, &@field(ptr, f.name)),
- .Enum => {
+ .array => byteSwapAllFields(f.type, &@field(ptr, f.name)),
+ .@"enum" => {
@field(ptr, f.name) = @enumFromInt(@byteSwap(@intFromEnum(@field(ptr, f.name))));
},
- .Bool => {},
- .Float => |float_info| {
+ .bool => {},
+ .float => |float_info| {
@field(ptr, f.name) = @bitCast(@byteSwap(@as(std.meta.Int(.unsigned, float_info.bits), @bitCast(@field(ptr, f.name)))));
},
else => {
@@ -2069,15 +2069,15 @@ pub fn byteSwapAllFields(comptime S: type, ptr: *S) void {
}
}
},
- .Array => {
+ .array => {
for (ptr) |*item| {
switch (@typeInfo(@TypeOf(item.*))) {
- .Struct, .Array => byteSwapAllFields(@TypeOf(item.*), item),
- .Enum => {
+ .@"struct", .array => byteSwapAllFields(@TypeOf(item.*), item),
+ .@"enum" => {
item.* = @enumFromInt(@byteSwap(@intFromEnum(item.*)));
},
- .Bool => {},
- .Float => |float_info| {
+ .bool => {},
+ .float => |float_info| {
item.* = @bitCast(@byteSwap(@as(std.meta.Int(.unsigned, float_info.bits), @bitCast(item.*))));
},
else => {
@@ -3560,21 +3560,21 @@ test reverse {
fn ReverseIterator(comptime T: type) type {
const Pointer = blk: {
switch (@typeInfo(T)) {
- .Pointer => |ptr_info| switch (ptr_info.size) {
+ .pointer => |ptr_info| switch (ptr_info.size) {
.One => switch (@typeInfo(ptr_info.child)) {
- .Array => |array_info| {
+ .array => |array_info| {
var new_ptr_info = ptr_info;
new_ptr_info.size = .Many;
new_ptr_info.child = array_info.child;
new_ptr_info.sentinel = array_info.sentinel;
- break :blk @Type(.{ .Pointer = new_ptr_info });
+ break :blk @Type(.{ .pointer = new_ptr_info });
},
else => {},
},
.Slice => {
var new_ptr_info = ptr_info;
new_ptr_info.size = .Many;
- break :blk @Type(.{ .Pointer = new_ptr_info });
+ break :blk @Type(.{ .pointer = new_ptr_info });
},
else => {},
},
@@ -3583,8 +3583,8 @@ fn ReverseIterator(comptime T: type) type {
@compileError("expected slice or pointer to array, found '" ++ @typeName(T) ++ "'");
};
const Element = std.meta.Elem(Pointer);
- const ElementPointer = @Type(.{ .Pointer = ptr: {
- var ptr = @typeInfo(Pointer).Pointer;
+ const ElementPointer = @Type(.{ .pointer = ptr: {
+ var ptr = @typeInfo(Pointer).pointer;
ptr.size = .One;
ptr.child = Element;
ptr.sentinel = null;
@@ -3891,11 +3891,11 @@ pub fn alignPointerOffset(ptr: anytype, align_to: usize) ?usize {
const T = @TypeOf(ptr);
const info = @typeInfo(T);
- if (info != .Pointer or info.Pointer.size != .Many)
+ if (info != .pointer or info.pointer.size != .Many)
@compileError("expected many item pointer, got " ++ @typeName(T));
// Do nothing if the pointer is already well-aligned.
- if (align_to <= info.Pointer.alignment)
+ if (align_to <= info.pointer.alignment)
return 0;
// Calculate the aligned base address with an eye out for overflow.
@@ -3907,7 +3907,7 @@ pub fn alignPointerOffset(ptr: anytype, align_to: usize) ?usize {
// The delta is expressed in terms of bytes, turn it into a number of child
// type elements.
const delta = ov[0] - addr;
- const pointee_size = @sizeOf(info.Pointer.child);
+ const pointee_size = @sizeOf(info.pointer.child);
if (delta % pointee_size != 0) return null;
return delta / pointee_size;
}
@@ -3948,9 +3948,9 @@ fn CopyPtrAttrs(
comptime size: std.builtin.Type.Pointer.Size,
comptime child: type,
) type {
- const info = @typeInfo(source).Pointer;
+ const info = @typeInfo(source).pointer;
return @Type(.{
- .Pointer = .{
+ .pointer = .{
.size = size,
.is_const = info.is_const,
.is_volatile = info.is_volatile,
@@ -4019,8 +4019,8 @@ test "asBytes preserves pointer attributes" {
const inPtr = @as(*align(16) const volatile u32, @ptrCast(&inArr));
const outSlice = asBytes(inPtr);
- const in = @typeInfo(@TypeOf(inPtr)).Pointer;
- const out = @typeInfo(@TypeOf(outSlice)).Pointer;
+ const in = @typeInfo(@TypeOf(inPtr)).pointer;
+ const out = @typeInfo(@TypeOf(outSlice)).pointer;
try testing.expectEqual(in.is_const, out.is_const);
try testing.expectEqual(in.is_volatile, out.is_volatile);
@@ -4102,8 +4102,8 @@ test "bytesAsValue preserves pointer attributes" {
const inSlice = @as(*align(16) const volatile [4]u8, @ptrCast(&inArr))[0..];
const outPtr = bytesAsValue(u32, inSlice);
- const in = @typeInfo(@TypeOf(inSlice)).Pointer;
- const out = @typeInfo(@TypeOf(outPtr)).Pointer;
+ const in = @typeInfo(@TypeOf(inSlice)).pointer;
+ const out = @typeInfo(@TypeOf(outPtr)).pointer;
try testing.expectEqual(in.is_const, out.is_const);
try testing.expectEqual(in.is_volatile, out.is_volatile);
@@ -4204,8 +4204,8 @@ test "bytesAsSlice preserves pointer attributes" {
const inSlice = @as(*align(16) const volatile [4]u8, @ptrCast(&inArr))[0..];
const outSlice = bytesAsSlice(u16, inSlice);
- const in = @typeInfo(@TypeOf(inSlice)).Pointer;
- const out = @typeInfo(@TypeOf(outSlice)).Pointer;
+ const in = @typeInfo(@TypeOf(inSlice)).pointer;
+ const out = @typeInfo(@TypeOf(outSlice)).pointer;
try testing.expectEqual(in.is_const, out.is_const);
try testing.expectEqual(in.is_volatile, out.is_volatile);
@@ -4303,8 +4303,8 @@ test "sliceAsBytes preserves pointer attributes" {
const inSlice = @as(*align(16) const volatile [2]u16, @ptrCast(&inArr))[0..];
const outSlice = sliceAsBytes(inSlice);
- const in = @typeInfo(@TypeOf(inSlice)).Pointer;
- const out = @typeInfo(@TypeOf(outSlice)).Pointer;
+ const in = @typeInfo(@TypeOf(inSlice)).pointer;
+ const out = @typeInfo(@TypeOf(outSlice)).pointer;
try testing.expectEqual(in.is_const, out.is_const);
try testing.expectEqual(in.is_volatile, out.is_volatile);
@@ -4346,14 +4346,14 @@ pub fn doNotOptimizeAway(val: anytype) void {
const max_gp_register_bits = @bitSizeOf(c_long);
const t = @typeInfo(@TypeOf(val));
switch (t) {
- .Void, .Null, .ComptimeInt, .ComptimeFloat => return,
- .Enum => doNotOptimizeAway(@intFromEnum(val)),
- .Bool => doNotOptimizeAway(@intFromBool(val)),
- .Int => {
- const bits = t.Int.bits;
+ .void, .null, .comptime_int, .comptime_float => return,
+ .@"enum" => doNotOptimizeAway(@intFromEnum(val)),
+ .bool => doNotOptimizeAway(@intFromBool(val)),
+ .int => {
+ const bits = t.int.bits;
if (bits <= max_gp_register_bits and builtin.zig_backend != .stage2_c) {
const val2 = @as(
- std.meta.Int(t.Int.signedness, @max(8, std.math.ceilPowerOfTwoAssert(u16, bits))),
+ std.meta.Int(t.int.signedness, @max(8, std.math.ceilPowerOfTwoAssert(u16, bits))),
val,
);
asm volatile (""
@@ -4362,15 +4362,15 @@ pub fn doNotOptimizeAway(val: anytype) void {
);
} else doNotOptimizeAway(&val);
},
- .Float => {
- if ((t.Float.bits == 32 or t.Float.bits == 64) and builtin.zig_backend != .stage2_c) {
+ .float => {
+ if ((t.float.bits == 32 or t.float.bits == 64) and builtin.zig_backend != .stage2_c) {
asm volatile (""
:
: [val] "rm" (val),
);
} else doNotOptimizeAway(&val);
},
- .Pointer => {
+ .pointer => {
if (builtin.zig_backend == .stage2_c) {
doNotOptimizeAwayC(val);
} else {
@@ -4381,8 +4381,8 @@ pub fn doNotOptimizeAway(val: anytype) void {
);
}
},
- .Array => {
- if (t.Array.len * @sizeOf(t.Array.child) <= 64) {
+ .array => {
+ if (t.array.len * @sizeOf(t.array.child) <= 64) {
for (val) |v| doNotOptimizeAway(v);
} else doNotOptimizeAway(&val);
},
@@ -4518,9 +4518,9 @@ test "freeing empty string with null-terminated sentinel" {
/// Returns a slice with the given new alignment,
/// all other pointer attributes copied from `AttributeSource`.
fn AlignedSlice(comptime AttributeSource: type, comptime new_alignment: usize) type {
- const info = @typeInfo(AttributeSource).Pointer;
+ const info = @typeInfo(AttributeSource).pointer;
return @Type(.{
- .Pointer = .{
+ .pointer = .{
.size = .Slice,
.is_const = info.is_const,
.is_volatile = info.is_volatile,
@@ -4659,7 +4659,7 @@ test "read/write(Var)PackedInt" {
try expect(diff_bits << @as(Log2T, @intCast(@bitSizeOf(BackingType) - offset)) == 0);
}
- const signedness = @typeInfo(PackedType).Int.signedness;
+ const signedness = @typeInfo(PackedType).int.signedness;
const NextPowerOfTwoInt = std.meta.Int(signedness, try comptime std.math.ceilPowerOfTwo(u16, @bitSizeOf(PackedType)));
const ui64 = std.meta.Int(signedness, 64);
inline for ([_]type{ PackedType, NextPowerOfTwoInt, ui64 }) |U| {
diff --git a/lib/std/mem/Allocator.zig b/lib/std/mem/Allocator.zig
index 1cd628535575..0d4ab9141f3a 100644
--- a/lib/std/mem/Allocator.zig
+++ b/lib/std/mem/Allocator.zig
@@ -109,7 +109,7 @@ pub fn create(self: Allocator, comptime T: type) Error!*T {
/// `ptr` should be the return value of `create`, or otherwise
/// have the same address and alignment property.
pub fn destroy(self: Allocator, ptr: anytype) void {
- const info = @typeInfo(@TypeOf(ptr)).Pointer;
+ const info = @typeInfo(@TypeOf(ptr)).pointer;
if (info.size != .One) @compileError("ptr must be a single item pointer");
const T = info.child;
if (@sizeOf(T) == 0) return;
@@ -232,7 +232,7 @@ fn allocBytesWithAlignment(self: Allocator, comptime alignment: u29, byte_count:
/// the pointer, however the allocator implementation may refuse the resize
/// request by returning `false`.
pub fn resize(self: Allocator, old_mem: anytype, new_n: usize) bool {
- const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
+ const Slice = @typeInfo(@TypeOf(old_mem)).pointer;
const T = Slice.child;
if (new_n == 0) {
self.free(old_mem);
@@ -253,7 +253,7 @@ pub fn resize(self: Allocator, old_mem: anytype, new_n: usize) bool {
/// can be larger, smaller, or the same size as the old memory allocation.
/// If `new_n` is 0, this is the same as `free` and it always succeeds.
pub fn realloc(self: Allocator, old_mem: anytype, new_n: usize) t: {
- const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
+ const Slice = @typeInfo(@TypeOf(old_mem)).pointer;
break :t Error![]align(Slice.alignment) Slice.child;
} {
return self.reallocAdvanced(old_mem, new_n, @returnAddress());
@@ -265,10 +265,10 @@ pub fn reallocAdvanced(
new_n: usize,
return_address: usize,
) t: {
- const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
+ const Slice = @typeInfo(@TypeOf(old_mem)).pointer;
break :t Error![]align(Slice.alignment) Slice.child;
} {
- const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
+ const Slice = @typeInfo(@TypeOf(old_mem)).pointer;
const T = Slice.child;
if (old_mem.len == 0) {
return self.allocAdvancedWithRetAddr(T, Slice.alignment, new_n, return_address);
@@ -304,7 +304,7 @@ pub fn reallocAdvanced(
/// Free an array allocated with `alloc`. To free a single item,
/// see `destroy`.
pub fn free(self: Allocator, memory: anytype) void {
- const Slice = @typeInfo(@TypeOf(memory)).Pointer;
+ const Slice = @typeInfo(@TypeOf(memory)).pointer;
const bytes = mem.sliceAsBytes(memory);
const bytes_len = bytes.len + if (Slice.sentinel != null) @sizeOf(Slice.child) else 0;
if (bytes_len == 0) return;
@@ -332,13 +332,13 @@ pub fn dupeZ(allocator: Allocator, comptime T: type, m: []const T) Error![:0]T {
/// TODO replace callsites with `@log2` after this proposal is implemented:
/// https://github.com/ziglang/zig/issues/13642
inline fn log2a(x: anytype) switch (@typeInfo(@TypeOf(x))) {
- .Int => math.Log2Int(@TypeOf(x)),
- .ComptimeInt => comptime_int,
+ .int => math.Log2Int(@TypeOf(x)),
+ .comptime_int => comptime_int,
else => @compileError("int please"),
} {
switch (@typeInfo(@TypeOf(x))) {
- .Int => return math.log2_int(@TypeOf(x), x),
- .ComptimeInt => return math.log2(x),
+ .int => return math.log2_int(@TypeOf(x), x),
+ .comptime_int => return math.log2(x),
else => @compileError("bad"),
}
}
diff --git a/lib/std/meta.zig b/lib/std/meta.zig
index a06674f0862e..3d3bfca1f9ea 100644
--- a/lib/std/meta.zig
+++ b/lib/std/meta.zig
@@ -21,11 +21,11 @@ pub fn stringToEnum(comptime T: type, str: []const u8) ?T {
// TODO The '100' here is arbitrary and should be increased when possible:
// - https://github.com/ziglang/zig/issues/4055
// - https://github.com/ziglang/zig/issues/3863
- if (@typeInfo(T).Enum.fields.len <= 100) {
+ if (@typeInfo(T).@"enum".fields.len <= 100) {
const kvs = comptime build_kvs: {
const EnumKV = struct { []const u8, T };
- var kvs_array: [@typeInfo(T).Enum.fields.len]EnumKV = undefined;
- for (@typeInfo(T).Enum.fields, 0..) |enumField, i| {
+ var kvs_array: [@typeInfo(T).@"enum".fields.len]EnumKV = undefined;
+ for (@typeInfo(T).@"enum".fields, 0..) |enumField, i| {
kvs_array[i] = .{ enumField.name, @field(T, enumField.name) };
}
break :build_kvs kvs_array[0..];
@@ -33,7 +33,7 @@ pub fn stringToEnum(comptime T: type, str: []const u8) ?T {
const map = std.StaticStringMap(T).initComptime(kvs);
return map.get(str);
} else {
- inline for (@typeInfo(T).Enum.fields) |enumField| {
+ inline for (@typeInfo(T).@"enum".fields) |enumField| {
if (mem.eql(u8, str, enumField.name)) {
return @field(T, enumField.name);
}
@@ -58,11 +58,11 @@ test stringToEnum {
/// If T is a pointer type the alignment of the type it points to is returned.
pub fn alignment(comptime T: type) comptime_int {
return switch (@typeInfo(T)) {
- .Optional => |info| switch (@typeInfo(info.child)) {
- .Pointer, .Fn => alignment(info.child),
+ .optional => |info| switch (@typeInfo(info.child)) {
+ .pointer, .@"fn" => alignment(info.child),
else => @alignOf(T),
},
- .Pointer => |info| info.alignment,
+ .pointer => |info| info.alignment,
else => @alignOf(T),
};
}
@@ -81,10 +81,10 @@ test alignment {
/// Given a parameterized type (array, vector, pointer, optional), returns the "child type".
pub fn Child(comptime T: type) type {
return switch (@typeInfo(T)) {
- .Array => |info| info.child,
- .Vector => |info| info.child,
- .Pointer => |info| info.child,
- .Optional => |info| info.child,
+ .array => |info| info.child,
+ .vector => |info| info.child,
+ .pointer => |info| info.child,
+ .optional => |info| info.child,
else => @compileError("Expected pointer, optional, array or vector type, found '" ++ @typeName(T) ++ "'"),
};
}
@@ -100,17 +100,17 @@ test Child {
/// Given a "memory span" type (array, slice, vector, or pointer to such), returns the "element type".
pub fn Elem(comptime T: type) type {
switch (@typeInfo(T)) {
- .Array => |info| return info.child,
- .Vector => |info| return info.child,
- .Pointer => |info| switch (info.size) {
+ .array => |info| return info.child,
+ .vector => |info| return info.child,
+ .pointer => |info| switch (info.size) {
.One => switch (@typeInfo(info.child)) {
- .Array => |array_info| return array_info.child,
- .Vector => |vector_info| return vector_info.child,
+ .array => |array_info| return array_info.child,
+ .vector => |vector_info| return vector_info.child,
else => {},
},
.Many, .C, .Slice => return info.child,
},
- .Optional => |info| return Elem(info.child),
+ .optional => |info| return Elem(info.child),
else => {},
}
@compileError("Expected pointer, slice, array or vector type, found '" ++ @typeName(T) ++ "'");
@@ -132,18 +132,18 @@ test Elem {
/// Result is always comptime-known.
pub inline fn sentinel(comptime T: type) ?Elem(T) {
switch (@typeInfo(T)) {
- .Array => |info| {
+ .array => |info| {
const sentinel_ptr = info.sentinel orelse return null;
return @as(*const info.child, @ptrCast(sentinel_ptr)).*;
},
- .Pointer => |info| {
+ .pointer => |info| {
switch (info.size) {
.Many, .Slice => {
const sentinel_ptr = info.sentinel orelse return null;
return @as(*align(1) const info.child, @ptrCast(sentinel_ptr)).*;
},
.One => switch (@typeInfo(info.child)) {
- .Array => |array_info| {
+ .array => |array_info| {
const sentinel_ptr = array_info.sentinel orelse return null;
return @as(*align(1) const array_info.child, @ptrCast(sentinel_ptr)).*;
},
@@ -177,17 +177,17 @@ fn testSentinel() !void {
/// Given a "memory span" type, returns the same type except with the given sentinel value.
pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
switch (@typeInfo(T)) {
- .Pointer => |info| switch (info.size) {
+ .pointer => |info| switch (info.size) {
.One => switch (@typeInfo(info.child)) {
- .Array => |array_info| return @Type(.{
- .Pointer = .{
+ .array => |array_info| return @Type(.{
+ .pointer = .{
.size = info.size,
.is_const = info.is_const,
.is_volatile = info.is_volatile,
.alignment = info.alignment,
.address_space = info.address_space,
.child = @Type(.{
- .Array = .{
+ .array = .{
.len = array_info.len,
.child = array_info.child,
.sentinel = @as(?*const anyopaque, @ptrCast(&sentinel_val)),
@@ -200,7 +200,7 @@ pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
else => {},
},
.Many, .Slice => return @Type(.{
- .Pointer = .{
+ .pointer = .{
.size = info.size,
.is_const = info.is_const,
.is_volatile = info.is_volatile,
@@ -213,12 +213,12 @@ pub fn Sentinel(comptime T: type, comptime sentinel_val: Elem(T)) type {
}),
else => {},
},
- .Optional => |info| switch (@typeInfo(info.child)) {
- .Pointer => |ptr_info| switch (ptr_info.size) {
+ .optional => |info| switch (@typeInfo(info.child)) {
+ .pointer => |ptr_info| switch (ptr_info.size) {
.Many => return @Type(.{
- .Optional = .{
+ .optional = .{
.child = @Type(.{
- .Pointer = .{
+ .pointer = .{
.size = ptr_info.size,
.is_const = ptr_info.is_const,
.is_volatile = ptr_info.is_volatile,
@@ -244,8 +244,8 @@ pub const assumeSentinel = @compileError("This function has been removed, consid
pub fn containerLayout(comptime T: type) Type.ContainerLayout {
return switch (@typeInfo(T)) {
- .Struct => |info| info.layout,
- .Union => |info| info.layout,
+ .@"struct" => |info| info.layout,
+ .@"union" => |info| info.layout,
else => @compileError("expected struct or union type, found '" ++ @typeName(T) ++ "'"),
};
}
@@ -276,10 +276,10 @@ test containerLayout {
/// directly when you know what kind of type it is.
pub fn declarations(comptime T: type) []const Type.Declaration {
return switch (@typeInfo(T)) {
- .Struct => |info| info.decls,
- .Enum => |info| info.decls,
- .Union => |info| info.decls,
- .Opaque => |info| info.decls,
+ .@"struct" => |info| info.decls,
+ .@"enum" => |info| info.decls,
+ .@"union" => |info| info.decls,
+ .@"opaque" => |info| info.decls,
else => @compileError("Expected struct, enum, union, or opaque type, found '" ++ @typeName(T) ++ "'"),
};
}
@@ -350,17 +350,17 @@ test declarationInfo {
}
}
pub fn fields(comptime T: type) switch (@typeInfo(T)) {
- .Struct => []const Type.StructField,
- .Union => []const Type.UnionField,
- .ErrorSet => []const Type.Error,
- .Enum => []const Type.EnumField,
+ .@"struct" => []const Type.StructField,
+ .@"union" => []const Type.UnionField,
+ .@"enum" => []const Type.EnumField,
+ .error_set => []const Type.Error,
else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"),
} {
return switch (@typeInfo(T)) {
- .Struct => |info| info.fields,
- .Union => |info| info.fields,
- .Enum => |info| info.fields,
- .ErrorSet => |errors| errors.?, // must be non global error set
+ .@"struct" => |info| info.fields,
+ .@"union" => |info| info.fields,
+ .@"enum" => |info| info.fields,
+ .error_set => |errors| errors.?, // must be non global error set
else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"),
};
}
@@ -395,10 +395,10 @@ test fields {
}
pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeInfo(T)) {
- .Struct => Type.StructField,
- .Union => Type.UnionField,
- .ErrorSet => Type.Error,
- .Enum => Type.EnumField,
+ .@"struct" => Type.StructField,
+ .@"union" => Type.UnionField,
+ .@"enum" => Type.EnumField,
+ .error_set => Type.Error,
else => @compileError("Expected struct, union, error set or enum type, found '" ++ @typeName(T) ++ "'"),
} {
return fields(T)[@intFromEnum(field)];
@@ -430,7 +430,7 @@ test fieldInfo {
}
pub fn FieldType(comptime T: type, comptime field: FieldEnum(T)) type {
- if (@typeInfo(T) != .Struct and @typeInfo(T) != .Union) {
+ if (@typeInfo(T) != .@"struct" and @typeInfo(T) != .@"union") {
@compileError("Expected struct or union, found '" ++ @typeName(T) ++ "'");
}
@@ -528,7 +528,7 @@ pub fn FieldEnum(comptime T: type) type {
if (field_infos.len == 0) {
return @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u0,
.fields = &.{},
.decls = &.{},
@@ -537,8 +537,8 @@ pub fn FieldEnum(comptime T: type) type {
});
}
- if (@typeInfo(T) == .Union) {
- if (@typeInfo(T).Union.tag_type) |tag_type| {
+ if (@typeInfo(T) == .@"union") {
+ if (@typeInfo(T).@"union".tag_type) |tag_type| {
for (std.enums.values(tag_type), 0..) |v, i| {
if (@intFromEnum(v) != i) break; // enum values not consecutive
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 {
};
}
return @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = std.math.IntFittingRange(0, field_infos.len - 1),
.fields = &enumFields,
.decls = &decls,
@@ -568,17 +568,17 @@ pub fn FieldEnum(comptime T: type) type {
fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
// TODO: https://github.com/ziglang/zig/issues/7419
- // testing.expectEqual(@typeInfo(expected).Enum, @typeInfo(actual).Enum);
+ // testing.expectEqual(@typeInfo(expected).@"enum", @typeInfo(actual).@"enum");
try testing.expectEqual(
- @typeInfo(expected).Enum.tag_type,
- @typeInfo(actual).Enum.tag_type,
+ @typeInfo(expected).@"enum".tag_type,
+ @typeInfo(actual).@"enum".tag_type,
);
// For comparing decls and fields, we cannot use the meta eql function here
// because the language does not guarantee that the slice pointers for field names
// and decl names will be the same.
comptime {
- const expected_fields = @typeInfo(expected).Enum.fields;
- const actual_fields = @typeInfo(actual).Enum.fields;
+ const expected_fields = @typeInfo(expected).@"enum".fields;
+ const actual_fields = @typeInfo(actual).@"enum".fields;
if (expected_fields.len != actual_fields.len) return error.FailedTest;
for (expected_fields, 0..) |expected_field, i| {
const actual_field = actual_fields[i];
@@ -587,8 +587,8 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
}
}
comptime {
- const expected_decls = @typeInfo(expected).Enum.decls;
- const actual_decls = @typeInfo(actual).Enum.decls;
+ const expected_decls = @typeInfo(expected).@"enum".decls;
+ const actual_decls = @typeInfo(actual).@"enum".decls;
if (expected_decls.len != actual_decls.len) return error.FailedTest;
for (expected_decls, 0..) |expected_decl, i| {
const actual_decl = actual_decls[i];
@@ -596,8 +596,8 @@ fn expectEqualEnum(expected: anytype, actual: @TypeOf(expected)) !void {
}
}
try testing.expectEqual(
- @typeInfo(expected).Enum.is_exhaustive,
- @typeInfo(actual).Enum.is_exhaustive,
+ @typeInfo(expected).@"enum".is_exhaustive,
+ @typeInfo(actual).@"enum".is_exhaustive,
);
}
@@ -627,7 +627,7 @@ pub fn DeclEnum(comptime T: type) type {
enumDecls[i] = .{ .name = field.name ++ "", .value = i };
}
return @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = std.math.IntFittingRange(0, fieldInfos.len - 1),
.fields = &enumDecls,
.decls = &decls,
@@ -661,8 +661,8 @@ test DeclEnum {
pub fn Tag(comptime T: type) type {
return switch (@typeInfo(T)) {
- .Enum => |info| info.tag_type,
- .Union => |info| info.tag_type orelse @compileError(@typeName(T) ++ " has no tag type"),
+ .@"enum" => |info| info.tag_type,
+ .@"union" => |info| info.tag_type orelse @compileError(@typeName(T) ++ " has no tag type"),
else => @compileError("expected enum or union type, found '" ++ @typeName(T) ++ "'"),
};
}
@@ -708,7 +708,7 @@ test activeTag {
const TagPayloadType = TagPayload;
pub fn TagPayloadByName(comptime U: type, comptime tag_name: []const u8) type {
- const info = @typeInfo(U).Union;
+ const info = @typeInfo(U).@"union";
inline for (info.fields) |field_info| {
if (comptime mem.eql(u8, field_info.name, tag_name))
@@ -742,20 +742,20 @@ pub fn eql(a: anytype, b: @TypeOf(a)) bool {
const T = @TypeOf(a);
switch (@typeInfo(T)) {
- .Struct => |info| {
+ .@"struct" => |info| {
inline for (info.fields) |field_info| {
if (!eql(@field(a, field_info.name), @field(b, field_info.name))) return false;
}
return true;
},
- .ErrorUnion => {
+ .error_union => {
if (a) |a_p| {
if (b) |b_p| return eql(a_p, b_p) else |_| return false;
} else |a_e| {
if (b) |_| return false else |b_e| return a_e == b_e;
}
},
- .Union => |info| {
+ .@"union" => |info| {
if (info.tag_type) |UnionTag| {
const tag_a: UnionTag = a;
const tag_b: UnionTag = b;
@@ -768,26 +768,26 @@ pub fn eql(a: anytype, b: @TypeOf(a)) bool {
@compileError("cannot compare untagged union type " ++ @typeName(T));
},
- .Array => {
+ .array => {
if (a.len != b.len) return false;
for (a, 0..) |e, i|
if (!eql(e, b[i])) return false;
return true;
},
- .Vector => |info| {
+ .vector => |info| {
var i: usize = 0;
while (i < info.len) : (i += 1) {
if (!eql(a[i], b[i])) return false;
}
return true;
},
- .Pointer => |info| {
+ .pointer => |info| {
return switch (info.size) {
.One, .Many, .C => a == b,
.Slice => a.ptr == b.ptr and a.len == b.len,
};
},
- .Optional => {
+ .optional => {
if (a == null and b == null) return true;
if (a == null or b == null) return false;
return eql(a.?, b.?);
@@ -893,7 +893,7 @@ test intToEnum {
pub const IntToEnumError = error{InvalidEnumTag};
pub fn intToEnum(comptime EnumTag: type, tag_int: anytype) IntToEnumError!EnumTag {
- const enum_info = @typeInfo(EnumTag).Enum;
+ const enum_info = @typeInfo(EnumTag).@"enum";
if (!enum_info.is_exhaustive) {
if (std.math.cast(enum_info.tag_type, tag_int)) |tag| {
@@ -955,7 +955,7 @@ pub const IntType = @compileError("replaced by std.meta.Int");
pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16) type {
return @Type(.{
- .Int = .{
+ .int = .{
.signedness = signedness,
.bits = bit_count,
},
@@ -964,7 +964,7 @@ pub fn Int(comptime signedness: std.builtin.Signedness, comptime bit_count: u16)
pub fn Float(comptime bit_count: u8) type {
return @Type(.{
- .Float = .{ .bits = bit_count },
+ .float = .{ .bits = bit_count },
});
}
@@ -984,10 +984,10 @@ test Float {
/// - `ArgsTuple(fn (a: u32, b: f16) noreturn)` ⇒ `tuple { u32, f16 }`
pub fn ArgsTuple(comptime Function: type) type {
const info = @typeInfo(Function);
- if (info != .Fn)
+ if (info != .@"fn")
@compileError("ArgsTuple expects a function type");
- const function_info = info.Fn;
+ const function_info = info.@"fn";
if (function_info.is_var_args)
@compileError("Cannot create ArgsTuple for variadic function");
@@ -1026,7 +1026,7 @@ fn CreateUniqueTuple(comptime N: comptime_int, comptime types: [N]type) type {
}
return @Type(.{
- .Struct = .{
+ .@"struct" = .{
.is_tuple = true,
.layout = .auto,
.decls = &.{},
@@ -1043,9 +1043,9 @@ const TupleTester = struct {
fn assertTuple(comptime expected: anytype, comptime Actual: type) void {
const info = @typeInfo(Actual);
- if (info != .Struct)
+ if (info != .@"struct")
@compileError("Expected struct type");
- if (!info.Struct.is_tuple)
+ if (!info.@"struct".is_tuple)
@compileError("Struct type must be a tuple type");
const fields_list = std.meta.fields(Actual);
@@ -1115,13 +1115,13 @@ test isError {
/// `false` otherwise. Result is always comptime-known.
pub inline fn hasFn(comptime T: type, comptime name: []const u8) bool {
switch (@typeInfo(T)) {
- .Struct, .Union, .Enum, .Opaque => {},
+ .@"struct", .@"union", .@"enum", .@"opaque" => {},
else => return false,
}
if (!@hasDecl(T, name))
return false;
- return @typeInfo(@TypeOf(@field(T, name))) == .Fn;
+ return @typeInfo(@TypeOf(@field(T, name))) == .@"fn";
}
test hasFn {
@@ -1144,7 +1144,7 @@ test hasFn {
/// Result is always comptime-known.
pub inline fn hasMethod(comptime T: type, comptime name: []const u8) bool {
return switch (@typeInfo(T)) {
- .Pointer => |P| switch (P.size) {
+ .pointer => |P| switch (P.size) {
.One => hasFn(P.child, name),
.Many, .Slice, .C => false,
},
@@ -1191,29 +1191,29 @@ pub inline fn hasUniqueRepresentation(comptime T: type) bool {
return switch (@typeInfo(T)) {
else => false, // TODO can we know if it's true for some of these types ?
- .AnyFrame,
- .Enum,
- .ErrorSet,
- .Fn,
+ .@"anyframe",
+ .@"enum",
+ .error_set,
+ .@"fn",
=> true,
- .Bool => false,
+ .bool => false,
- .Int => |info| @sizeOf(T) * 8 == info.bits,
+ .int => |info| @sizeOf(T) * 8 == info.bits,
- .Pointer => |info| info.size != .Slice,
+ .pointer => |info| info.size != .Slice,
- .Optional => |info| switch (@typeInfo(info.child)) {
- .Pointer => |ptr| !ptr.is_allowzero and switch (ptr.size) {
+ .optional => |info| switch (@typeInfo(info.child)) {
+ .pointer => |ptr| !ptr.is_allowzero and switch (ptr.size) {
.Slice, .C => false,
.One, .Many => true,
},
else => false,
},
- .Array => |info| hasUniqueRepresentation(info.child),
+ .array => |info| hasUniqueRepresentation(info.child),
- .Struct => |info| {
+ .@"struct" => |info| {
if (info.layout == .@"packed") return @sizeOf(T) * 8 == @bitSizeOf(T);
var sum_size = @as(usize, 0);
@@ -1226,7 +1226,7 @@ pub inline fn hasUniqueRepresentation(comptime T: type) bool {
return @sizeOf(T) == sum_size;
},
- .Vector => |info| hasUniqueRepresentation(info.child) and
+ .vector => |info| hasUniqueRepresentation(info.child) and
@sizeOf(T) == @sizeOf(info.child) * info.len,
};
}
diff --git a/lib/std/meta/trailer_flags.zig b/lib/std/meta/trailer_flags.zig
index 9e223768a76b..e00d32c78919 100644
--- a/lib/std/meta/trailer_flags.zig
+++ b/lib/std/meta/trailer_flags.zig
@@ -14,14 +14,14 @@ pub fn TrailerFlags(comptime Fields: type) type {
bits: Int,
pub const Int = meta.Int(.unsigned, bit_count);
- pub const bit_count = @typeInfo(Fields).Struct.fields.len;
+ pub const bit_count = @typeInfo(Fields).@"struct".fields.len;
pub const FieldEnum = std.meta.FieldEnum(Fields);
pub const ActiveFields = std.enums.EnumFieldStruct(FieldEnum, bool, false);
pub const FieldValues = blk: {
var fields: [bit_count]Type.StructField = undefined;
- for (@typeInfo(Fields).Struct.fields, 0..) |struct_field, i| {
+ for (@typeInfo(Fields).@"struct".fields, 0..) |struct_field, i| {
fields[i] = Type.StructField{
.name = struct_field.name,
.type = ?struct_field.type,
@@ -31,7 +31,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
};
}
break :blk @Type(.{
- .Struct = .{
+ .@"struct" = .{
.layout = .auto,
.fields = &fields,
.decls = &.{},
@@ -61,7 +61,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
/// `fields` is a boolean struct where each active field is set to `true`
pub fn init(fields: ActiveFields) Self {
var self: Self = .{ .bits = 0 };
- inline for (@typeInfo(Fields).Struct.fields, 0..) |field, i| {
+ inline for (@typeInfo(Fields).@"struct".fields, 0..) |field, i| {
if (@field(fields, field.name))
self.bits |= 1 << i;
}
@@ -70,7 +70,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
/// `fields` is a struct with each field set to an optional value
pub fn setMany(self: Self, p: [*]align(@alignOf(Fields)) u8, fields: FieldValues) void {
- inline for (@typeInfo(Fields).Struct.fields, 0..) |field, i| {
+ inline for (@typeInfo(Fields).@"struct".fields, 0..) |field, i| {
if (@field(fields, field.name)) |value|
self.set(p, @as(FieldEnum, @enumFromInt(i)), value);
}
@@ -101,7 +101,7 @@ pub fn TrailerFlags(comptime Fields: type) type {
pub fn offset(self: Self, comptime field: FieldEnum) usize {
var off: usize = 0;
- inline for (@typeInfo(Fields).Struct.fields, 0..) |field_info, i| {
+ inline for (@typeInfo(Fields).@"struct".fields, 0..) |field_info, i| {
const active = (self.bits & (1 << i)) != 0;
if (i == @intFromEnum(field)) {
assert(active);
@@ -114,12 +114,12 @@ pub fn TrailerFlags(comptime Fields: type) type {
}
pub fn Field(comptime field: FieldEnum) type {
- return @typeInfo(Fields).Struct.fields[@intFromEnum(field)].type;
+ return @typeInfo(Fields).@"struct".fields[@intFromEnum(field)].type;
}
pub fn sizeInBytes(self: Self) usize {
var off: usize = 0;
- inline for (@typeInfo(Fields).Struct.fields, 0..) |field, i| {
+ inline for (@typeInfo(Fields).@"struct".fields, 0..) |field, i| {
if (@sizeOf(field.type) == 0)
continue;
if ((self.bits & (1 << i)) != 0) {
diff --git a/lib/std/multi_array_list.zig b/lib/std/multi_array_list.zig
index cfe77f11b5b8..0d9272d4929d 100644
--- a/lib/std/multi_array_list.zig
+++ b/lib/std/multi_array_list.zig
@@ -24,10 +24,9 @@ pub fn MultiArrayList(comptime T: type) type {
capacity: usize = 0,
const Elem = switch (@typeInfo(T)) {
- .Struct => T,
- .Union => |u| struct {
- pub const Bare =
- @Type(.{ .Union = .{
+ .@"struct" => T,
+ .@"union" => |u| struct {
+ pub const Bare = @Type(.{ .@"union" = .{
.layout = u.layout,
.tag_type = null,
.fields = u.fields,
@@ -84,8 +83,8 @@ pub fn MultiArrayList(comptime T: type) type {
pub fn set(self: *Slice, index: usize, elem: T) void {
const e = switch (@typeInfo(T)) {
- .Struct => elem,
- .Union => Elem.fromT(elem),
+ .@"struct" => elem,
+ .@"union" => Elem.fromT(elem),
else => unreachable,
};
inline for (fields, 0..) |field_info, i| {
@@ -99,8 +98,8 @@ pub fn MultiArrayList(comptime T: type) type {
@field(result, field_info.name) = self.items(@as(Field, @enumFromInt(i)))[index];
}
return switch (@typeInfo(T)) {
- .Struct => result,
- .Union => Elem.toT(result.tags, result.data),
+ .@"struct" => result,
+ .@"union" => Elem.toT(result.tags, result.data),
else => unreachable,
};
}
@@ -287,8 +286,8 @@ pub fn MultiArrayList(comptime T: type) type {
assert(index <= self.len);
self.len += 1;
const entry = switch (@typeInfo(T)) {
- .Struct => elem,
- .Union => Elem.fromT(elem),
+ .@"struct" => elem,
+ .@"union" => Elem.fromT(elem),
else => unreachable,
};
const slices = self.slice();
@@ -557,7 +556,7 @@ pub fn MultiArrayList(comptime T: type) type {
.is_comptime = fields[i].is_comptime,
.alignment = fields[i].alignment,
};
- break :entry @Type(.{ .Struct = .{
+ break :entry @Type(.{ .@"struct" = .{
.layout = .@"extern",
.fields = &entry_fields,
.decls = &.{},
diff --git a/lib/std/os/emscripten.zig b/lib/std/os/emscripten.zig
index 6792728390ad..6c6a34ac47ef 100644
--- a/lib/std/os/emscripten.zig
+++ b/lib/std/os/emscripten.zig
@@ -560,7 +560,7 @@ pub const Sigaction = extern struct {
};
pub const sigset_t = [1024 / 32]u32;
-pub const empty_sigset = [_]u32{0} ** @typeInfo(sigset_t).Array.len;
+pub const empty_sigset = [_]u32{0} ** @typeInfo(sigset_t).array.len;
pub const siginfo_t = extern struct {
signo: i32,
errno: i32,
diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig
index 60b5decdd343..df9d491a5e04 100644
--- a/lib/std/os/linux.zig
+++ b/lib/std/os/linux.zig
@@ -1547,7 +1547,7 @@ pub fn seteuid(euid: uid_t) usize {
// The setresuid(2) man page says that if -1 is passed the corresponding
// id will not be changed. Since uid_t is unsigned, this wraps around to the
// max value in C.
- comptime assert(@typeInfo(uid_t) == .Int and @typeInfo(uid_t).Int.signedness == .unsigned);
+ comptime assert(@typeInfo(uid_t) == .int and @typeInfo(uid_t).int.signedness == .unsigned);
return setresuid(std.math.maxInt(uid_t), euid, std.math.maxInt(uid_t));
}
@@ -1558,7 +1558,7 @@ pub fn setegid(egid: gid_t) usize {
// The setresgid(2) man page says that if -1 is passed the corresponding
// id will not be changed. Since gid_t is unsigned, this wraps around to the
// max value in C.
- comptime assert(@typeInfo(uid_t) == .Int and @typeInfo(uid_t).Int.signedness == .unsigned);
+ comptime assert(@typeInfo(uid_t) == .int and @typeInfo(uid_t).int.signedness == .unsigned);
return setresgid(std.math.maxInt(gid_t), egid, std.math.maxInt(gid_t));
}
@@ -1673,7 +1673,7 @@ pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigact
return 0;
}
-const usize_bits = @typeInfo(usize).Int.bits;
+const usize_bits = @typeInfo(usize).int.bits;
pub fn sigaddset(set: *sigset_t, sig: u6) void {
const s = sig - 1;
@@ -1734,7 +1734,7 @@ pub fn sendmsg(fd: i32, msg: *const msghdr_const, flags: u32) usize {
}
pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize {
- if (@typeInfo(usize).Int.bits > @typeInfo(@typeInfo(mmsghdr).Struct.fields[1].type).Int.bits) {
+ if (@typeInfo(usize).int.bits > @typeInfo(@typeInfo(mmsghdr).@"struct".fields[1].type).int.bits) {
// workaround kernel brokenness:
// if adding up all iov_len overflows a i32 then split into multiple calls
// see https://www.openwall.com/lists/musl/2014/06/07/5
@@ -4904,7 +4904,7 @@ pub const NSIG = if (is_mips) 128 else 65;
pub const sigset_t = [1024 / 32]u32;
-pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).Array.len;
+pub const all_mask: sigset_t = [_]u32{0xffffffff} ** @typeInfo(sigset_t).array.len;
pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30;
const k_sigaction_funcs = struct {
@@ -4947,7 +4947,7 @@ pub const Sigaction = extern struct {
restorer: ?*const fn () callconv(.C) void = null,
};
-const sigset_len = @typeInfo(sigset_t).Array.len;
+const sigset_len = @typeInfo(sigset_t).array.len;
pub const empty_sigset = [_]u32{0} ** sigset_len;
pub const filled_sigset = [_]u32{(1 << (31 & (usize_bits - 1))) - 1} ++ [_]u32{0} ** (sigset_len - 1);
@@ -7420,7 +7420,7 @@ pub const MADV = struct {
};
pub const POSIX_FADV = switch (native_arch) {
- .s390x => if (@typeInfo(usize).Int.bits == 64) struct {
+ .s390x => if (@typeInfo(usize).int.bits == 64) struct {
pub const NORMAL = 0;
pub const RANDOM = 1;
pub const SEQUENTIAL = 2;
diff --git a/lib/std/os/linux/bpf.zig b/lib/std/os/linux/bpf.zig
index 7661ba9d7caa..f35ccf4f1a74 100644
--- a/lib/std/os/linux/bpf.zig
+++ b/lib/std/os/linux/bpf.zig
@@ -459,7 +459,7 @@ pub const Insn = packed struct {
};
fn imm_reg(code: u8, dst: Reg, src: anytype, off: i16) Insn {
- const imm_or_reg = if (@TypeOf(src) == Reg or @typeInfo(@TypeOf(src)) == .EnumLiteral)
+ const imm_or_reg = if (@TypeOf(src) == Reg or @typeInfo(@TypeOf(src)) == .enum_literal)
ImmOrReg{ .reg = @as(Reg, src) }
else
ImmOrReg{ .imm = src };
diff --git a/lib/std/os/uefi/protocol/device_path.zig b/lib/std/os/uefi/protocol/device_path.zig
index a08eee193cb6..b59ebb7be091 100644
--- a/lib/std/os/uefi/protocol/device_path.zig
+++ b/lib/std/os/uefi/protocol/device_path.zig
@@ -76,7 +76,7 @@ pub const DevicePath = extern struct {
}
pub fn getDevicePath(self: *const DevicePath) ?uefi.DevicePath {
- inline for (@typeInfo(uefi.DevicePath).Union.fields) |ufield| {
+ inline for (@typeInfo(uefi.DevicePath).@"union".fields) |ufield| {
const enum_value = std.meta.stringToEnum(uefi.DevicePath.Type, ufield.name);
// Got the associated union type for self.type, now
@@ -94,7 +94,7 @@ pub const DevicePath = extern struct {
}
pub fn initSubtype(self: *const DevicePath, comptime TUnion: type) ?TUnion {
- const type_info = @typeInfo(TUnion).Union;
+ const type_info = @typeInfo(TUnion).@"union";
const TTag = type_info.tag_type.?;
inline for (type_info.fields) |subtype| {
diff --git a/lib/std/os/uefi/status.zig b/lib/std/os/uefi/status.zig
index e975b92a150d..79a939e6b96d 100644
--- a/lib/std/os/uefi/status.zig
+++ b/lib/std/os/uefi/status.zig
@@ -1,6 +1,6 @@
const testing = @import("std").testing;
-const high_bit = 1 << @typeInfo(usize).Int.bits - 1;
+const high_bit = 1 << @typeInfo(usize).int.bits - 1;
pub const Status = enum(usize) {
/// The operation completed successfully.
@@ -186,7 +186,7 @@ pub const Status = enum(usize) {
};
pub fn err(self: Status) EfiError!void {
- inline for (@typeInfo(EfiError).ErrorSet.?) |efi_err| {
+ inline for (@typeInfo(EfiError).error_set.?) |efi_err| {
if (self == @field(Status, efi_err.name)) {
return @field(EfiError, efi_err.name);
}
diff --git a/lib/std/posix.zig b/lib/std/posix.zig
index fcd923ad9c1b..9e1631dd20b8 100644
--- a/lib/std/posix.zig
+++ b/lib/std/posix.zig
@@ -6181,7 +6181,7 @@ pub fn sendfile(
var total_written: usize = 0;
// Prevents EOVERFLOW.
- const size_t = std.meta.Int(.unsigned, @typeInfo(usize).Int.bits - 1);
+ const size_t = std.meta.Int(.unsigned, @typeInfo(usize).int.bits - 1);
const max_count = switch (native_os) {
.linux => 0x7ffff000,
.macos, .ios, .watchos, .tvos, .visionos => maxInt(i32),
@@ -6988,7 +6988,7 @@ pub const PrctlError = error{
} || UnexpectedError;
pub fn prctl(option: PR, args: anytype) PrctlError!u31 {
- if (@typeInfo(@TypeOf(args)) != .Struct)
+ if (@typeInfo(@TypeOf(args)) != .@"struct")
@compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(args)));
if (args.len > 4)
@compileError("prctl takes a maximum of 4 optional arguments");
diff --git a/lib/std/posix/test.zig b/lib/std/posix/test.zig
index 7ba9a7701eba..474de28f6dec 100644
--- a/lib/std/posix/test.zig
+++ b/lib/std/posix/test.zig
@@ -782,7 +782,7 @@ test "fsync" {
test "getrlimit and setrlimit" {
if (posix.system.rlimit_resource == void) return error.SkipZigTest;
- inline for (@typeInfo(posix.rlimit_resource).Enum.fields) |field| {
+ inline for (@typeInfo(posix.rlimit_resource).@"enum".fields) |field| {
const resource: posix.rlimit_resource = @enumFromInt(field.value);
const limit = try posix.getrlimit(resource);
diff --git a/lib/std/process/Child.zig b/lib/std/process/Child.zig
index dfe0c6578eb5..2002bad20e99 100644
--- a/lib/std/process/Child.zig
+++ b/lib/std/process/Child.zig
@@ -1112,7 +1112,7 @@ fn windowsCreateProcessPathExt(
}
var io_status: windows.IO_STATUS_BLOCK = undefined;
- const num_supported_pathext = @typeInfo(WindowsExtension).Enum.fields.len;
+ const num_supported_pathext = @typeInfo(WindowsExtension).@"enum".fields.len;
var pathext_seen = [_]bool{false} ** num_supported_pathext;
var any_pathext_seen = false;
var unappended_exists = false;
diff --git a/lib/std/segmented_list.zig b/lib/std/segmented_list.zig
index a729c368edf2..72397dc1ab1d 100644
--- a/lib/std/segmented_list.zig
+++ b/lib/std/segmented_list.zig
@@ -99,7 +99,7 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type
pub const prealloc_count = prealloc_item_count;
fn AtType(comptime SelfType: type) type {
- if (@typeInfo(SelfType).Pointer.is_const) {
+ if (@typeInfo(SelfType).pointer.is_const) {
return *const T;
} else {
return *T;
diff --git a/lib/std/simd.zig b/lib/std/simd.zig
index 236b9fbab8ef..6817c7e082e6 100644
--- a/lib/std/simd.zig
+++ b/lib/std/simd.zig
@@ -105,8 +105,8 @@ test "suggestVectorLengthForCpu works with signed and unsigned values" {
fn vectorLength(comptime VectorType: type) comptime_int {
return switch (@typeInfo(VectorType)) {
- .Vector => |info| info.len,
- .Array => |info| info.len,
+ .vector => |info| info.len,
+ .array => |info| info.len,
else => @compileError("Invalid type " ++ @typeName(VectorType)),
};
}
@@ -128,8 +128,8 @@ pub inline fn iota(comptime T: type, comptime len: usize) @Vector(len, T) {
var out: [len]T = undefined;
for (&out, 0..) |*element, i| {
element.* = switch (@typeInfo(T)) {
- .Int => @as(T, @intCast(i)),
- .Float => @as(T, @floatFromInt(i)),
+ .int => @as(T, @intCast(i)),
+ .float => @as(T, @floatFromInt(i)),
else => @compileError("Can't use type " ++ @typeName(T) ++ " in iota."),
};
}
@@ -417,18 +417,18 @@ pub fn prefixScan(comptime op: std.builtin.ReduceOp, comptime hop: isize, vec: a
const Child = std.meta.Child(VecType);
const identity = comptime switch (@typeInfo(Child)) {
- .Bool => switch (op) {
+ .bool => switch (op) {
.Or, .Xor => false,
.And => true,
else => @compileError("Invalid prefixScan operation " ++ @tagName(op) ++ " for vector of booleans."),
},
- .Int => switch (op) {
+ .int => switch (op) {
.Max => std.math.minInt(Child),
.Add, .Or, .Xor => 0,
.Mul => 1,
.And, .Min => std.math.maxInt(Child),
},
- .Float => switch (op) {
+ .float => switch (op) {
.Max => -std.math.inf(Child),
.Add => 0,
.Mul => 1,
diff --git a/lib/std/start.zig b/lib/std/start.zig
index 5872e46be706..ea6f347bd665 100644
--- a/lib/std/start.zig
+++ b/lib/std/start.zig
@@ -30,7 +30,7 @@ comptime {
if (simplified_logic) {
if (builtin.output_mode == .Exe) {
if ((builtin.link_libc or builtin.object_format == .c) and @hasDecl(root, "main")) {
- if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) {
+ if (@typeInfo(@TypeOf(root.main)).@"fn".calling_convention != .C) {
@export(&main2, .{ .name = "main" });
}
} else if (builtin.os.tag == .windows) {
@@ -55,7 +55,7 @@ comptime {
if (builtin.link_libc and @hasDecl(root, "main")) {
if (native_arch.isWasm()) {
@export(&mainWithoutEnv, .{ .name = "main" });
- } else if (@typeInfo(@TypeOf(root.main)).Fn.calling_convention != .C) {
+ } else if (@typeInfo(@TypeOf(root.main)).@"fn".calling_convention != .C) {
@export(&main, .{ .name = "main" });
}
} else if (native_os == .windows) {
@@ -205,7 +205,7 @@ fn EfiMain(handle: uefi.Handle, system_table: *uefi.tables.SystemTable) callconv
uefi.handle = handle;
uefi.system_table = system_table;
- switch (@typeInfo(@TypeOf(root.main)).Fn.return_type.?) {
+ switch (@typeInfo(@TypeOf(root.main)).@"fn".return_type.?) {
noreturn => {
root.main();
},
@@ -599,7 +599,7 @@ fn mainWithoutEnv(c_argc: c_int, c_argv: [*][*:0]c_char) callconv(.C) c_int {
const bad_main_ret = "expected return type of main to be 'void', '!void', 'noreturn', 'u8', or '!u8'";
pub inline fn callMain() u8 {
- const ReturnType = @typeInfo(@TypeOf(root.main)).Fn.return_type.?;
+ const ReturnType = @typeInfo(@TypeOf(root.main)).@"fn".return_type.?;
switch (ReturnType) {
void => {
@@ -610,7 +610,7 @@ pub inline fn callMain() u8 {
return root.main();
},
else => {
- if (@typeInfo(ReturnType) != .ErrorUnion) @compileError(bad_main_ret);
+ if (@typeInfo(ReturnType) != .error_union) @compileError(bad_main_ret);
const result = root.main() catch |err| {
if (builtin.zig_backend == .stage2_riscv64) {
@@ -635,7 +635,7 @@ pub inline fn callMain() u8 {
pub fn call_wWinMain() std.os.windows.INT {
const peb = std.os.windows.peb();
- const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).Fn.params[0].type.?;
+ const MAIN_HINSTANCE = @typeInfo(@TypeOf(root.wWinMain)).@"fn".params[0].type.?;
const hInstance = @as(MAIN_HINSTANCE, @ptrCast(peb.ImageBaseAddress));
const lpCmdLine: [*:0]u16 = @ptrCast(peb.ProcessParameters.CommandLine.Buffer);
diff --git a/lib/std/testing.zig b/lib/std/testing.zig
index 80e8ab13bbff..35bb13bf0d9a 100644
--- a/lib/std/testing.zig
+++ b/lib/std/testing.zig
@@ -64,33 +64,33 @@ pub inline fn expectEqual(expected: anytype, actual: anytype) !void {
fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
switch (@typeInfo(@TypeOf(actual))) {
- .NoReturn,
- .Opaque,
- .Frame,
- .AnyFrame,
+ .noreturn,
+ .@"opaque",
+ .frame,
+ .@"anyframe",
=> @compileError("value of type " ++ @typeName(@TypeOf(actual)) ++ " encountered"),
- .Undefined,
- .Null,
- .Void,
+ .undefined,
+ .null,
+ .void,
=> return,
- .Type => {
+ .type => {
if (actual != expected) {
print("expected type {s}, found type {s}\n", .{ @typeName(expected), @typeName(actual) });
return error.TestExpectedEqual;
}
},
- .Bool,
- .Int,
- .Float,
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .Enum,
- .Fn,
- .ErrorSet,
+ .bool,
+ .int,
+ .float,
+ .comptime_float,
+ .comptime_int,
+ .enum_literal,
+ .@"enum",
+ .@"fn",
+ .error_set,
=> {
if (actual != expected) {
print("expected {}, found {}\n", .{ expected, actual });
@@ -98,7 +98,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
}
},
- .Pointer => |pointer| {
+ .pointer => |pointer| {
switch (pointer.size) {
.One, .Many, .C => {
if (actual != expected) {
@@ -119,9 +119,9 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
}
},
- .Array => |array| try expectEqualSlices(array.child, &expected, &actual),
+ .array => |array| try expectEqualSlices(array.child, &expected, &actual),
- .Vector => |info| {
+ .vector => |info| {
var i: usize = 0;
while (i < info.len) : (i += 1) {
if (!std.meta.eql(expected[i], actual[i])) {
@@ -133,13 +133,13 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
}
},
- .Struct => |structType| {
+ .@"struct" => |structType| {
inline for (structType.fields) |field| {
try expectEqual(@field(expected, field.name), @field(actual, field.name));
}
},
- .Union => |union_info| {
+ .@"union" => |union_info| {
if (union_info.tag_type == null) {
@compileError("Unable to compare untagged union values");
}
@@ -157,7 +157,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
}
},
- .Optional => {
+ .optional => {
if (expected) |expected_payload| {
if (actual) |actual_payload| {
try expectEqual(expected_payload, actual_payload);
@@ -173,7 +173,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void {
}
},
- .ErrorUnion => {
+ .error_union => {
if (expected) |expected_payload| {
if (actual) |actual_payload| {
try expectEqual(expected_payload, actual_payload);
@@ -237,12 +237,12 @@ pub inline fn expectApproxEqAbs(expected: anytype, actual: anytype, tolerance: a
fn expectApproxEqAbsInner(comptime T: type, expected: T, actual: T, tolerance: T) !void {
switch (@typeInfo(T)) {
- .Float => if (!math.approxEqAbs(T, expected, actual, tolerance)) {
+ .float => if (!math.approxEqAbs(T, expected, actual, tolerance)) {
print("actual {}, not within absolute tolerance {} of expected {}\n", .{ actual, tolerance, expected });
return error.TestExpectedApproxEqAbs;
},
- .ComptimeFloat => @compileError("Cannot approximately compare two comptime_float values"),
+ .comptime_float => @compileError("Cannot approximately compare two comptime_float values"),
else => @compileError("Unable to compare non floating point values"),
}
@@ -273,12 +273,12 @@ pub inline fn expectApproxEqRel(expected: anytype, actual: anytype, tolerance: a
fn expectApproxEqRelInner(comptime T: type, expected: T, actual: T, tolerance: T) !void {
switch (@typeInfo(T)) {
- .Float => if (!math.approxEqRel(T, expected, actual, tolerance)) {
+ .float => if (!math.approxEqRel(T, expected, actual, tolerance)) {
print("actual {}, not within relative tolerance {} of expected {}\n", .{ actual, tolerance, expected });
return error.TestExpectedApproxEqRel;
},
- .ComptimeFloat => @compileError("Cannot approximately compare two comptime_float values"),
+ .comptime_float => @compileError("Cannot approximately compare two comptime_float values"),
else => @compileError("Unable to compare non floating point values"),
}
@@ -415,7 +415,7 @@ fn SliceDiffer(comptime T: type) type {
const full_index = self.start_index + i;
const diff = if (i < self.actual.len) !std.meta.eql(self.actual[i], value) else true;
if (diff) try self.ttyconf.setColor(writer, .red);
- if (@typeInfo(T) == .Pointer) {
+ if (@typeInfo(T) == .pointer) {
try writer.print("[{}]{*}: {any}\n", .{ full_index, value, value });
} else {
try writer.print("[{}]: {any}\n", .{ full_index, value });
@@ -505,10 +505,10 @@ pub fn expectEqualSentinel(comptime T: type, comptime sentinel: T, expected: [:s
const expected_value_sentinel = blk: {
switch (@typeInfo(@TypeOf(expected))) {
- .Pointer => {
+ .pointer => {
break :blk expected[expected.len];
},
- .Array => |array_info| {
+ .array => |array_info| {
const indexable_outside_of_bounds = @as([]const array_info.child, &expected);
break :blk indexable_outside_of_bounds[indexable_outside_of_bounds.len];
},
@@ -518,10 +518,10 @@ pub fn expectEqualSentinel(comptime T: type, comptime sentinel: T, expected: [:s
const actual_value_sentinel = blk: {
switch (@typeInfo(@TypeOf(actual))) {
- .Pointer => {
+ .pointer => {
break :blk actual[actual.len];
},
- .Array => |array_info| {
+ .array => |array_info| {
const indexable_outside_of_bounds = @as([]const array_info.child, &actual);
break :blk indexable_outside_of_bounds[indexable_outside_of_bounds.len];
},
@@ -689,33 +689,33 @@ pub inline fn expectEqualDeep(expected: anytype, actual: anytype) error{TestExpe
fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpectedEqual}!void {
switch (@typeInfo(@TypeOf(actual))) {
- .NoReturn,
- .Opaque,
- .Frame,
- .AnyFrame,
+ .noreturn,
+ .@"opaque",
+ .frame,
+ .@"anyframe",
=> @compileError("value of type " ++ @typeName(@TypeOf(actual)) ++ " encountered"),
- .Undefined,
- .Null,
- .Void,
+ .undefined,
+ .null,
+ .void,
=> return,
- .Type => {
+ .type => {
if (actual != expected) {
print("expected type {s}, found type {s}\n", .{ @typeName(expected), @typeName(actual) });
return error.TestExpectedEqual;
}
},
- .Bool,
- .Int,
- .Float,
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .Enum,
- .Fn,
- .ErrorSet,
+ .bool,
+ .int,
+ .float,
+ .comptime_float,
+ .comptime_int,
+ .enum_literal,
+ .@"enum",
+ .@"fn",
+ .error_set,
=> {
if (actual != expected) {
print("expected {}, found {}\n", .{ expected, actual });
@@ -723,7 +723,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
}
},
- .Pointer => |pointer| {
+ .pointer => |pointer| {
switch (pointer.size) {
// We have no idea what is behind those pointers, so the best we can do is `==` check.
.C, .Many => {
@@ -735,7 +735,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
.One => {
// Length of those pointers are runtime value, so the best we can do is `==` check.
switch (@typeInfo(pointer.child)) {
- .Fn, .Opaque => {
+ .@"fn", .@"opaque" => {
if (actual != expected) {
print("expected {*}, found {*}\n", .{ expected, actual });
return error.TestExpectedEqual;
@@ -762,7 +762,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
}
},
- .Array => |_| {
+ .array => |_| {
if (expected.len != actual.len) {
print("Array len not the same, expected {d}, found {d}\n", .{ expected.len, actual.len });
return error.TestExpectedEqual;
@@ -778,9 +778,9 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
}
},
- .Vector => |info| {
- if (info.len != @typeInfo(@TypeOf(actual)).Vector.len) {
- print("Vector len not the same, expected {d}, found {d}\n", .{ info.len, @typeInfo(@TypeOf(actual)).Vector.len });
+ .vector => |info| {
+ if (info.len != @typeInfo(@TypeOf(actual)).vector.len) {
+ print("Vector len not the same, expected {d}, found {d}\n", .{ info.len, @typeInfo(@TypeOf(actual)).vector.len });
return error.TestExpectedEqual;
}
var i: usize = 0;
@@ -794,7 +794,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
}
},
- .Struct => |structType| {
+ .@"struct" => |structType| {
inline for (structType.fields) |field| {
expectEqualDeep(@field(expected, field.name), @field(actual, field.name)) catch |e| {
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
}
},
- .Union => |union_info| {
+ .@"union" => |union_info| {
if (union_info.tag_type == null) {
@compileError("Unable to compare untagged union values");
}
@@ -823,7 +823,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
}
},
- .Optional => {
+ .optional => {
if (expected) |expected_payload| {
if (actual) |actual_payload| {
try expectEqualDeep(expected_payload, actual_payload);
@@ -839,7 +839,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe
}
},
- .ErrorUnion => {
+ .error_union => {
if (expected) |expected_payload| {
if (actual) |actual_payload| {
try expectEqualDeep(expected_payload, actual_payload);
@@ -1036,20 +1036,20 @@ test {
/// }
/// ```
pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime test_fn: anytype, extra_args: anytype) !void {
- switch (@typeInfo(@typeInfo(@TypeOf(test_fn)).Fn.return_type.?)) {
- .ErrorUnion => |info| {
+ switch (@typeInfo(@typeInfo(@TypeOf(test_fn)).@"fn".return_type.?)) {
+ .error_union => |info| {
if (info.payload != void) {
@compileError("Return type must be !void");
}
},
else => @compileError("Return type must be !void"),
}
- if (@typeInfo(@TypeOf(extra_args)) != .Struct) {
+ if (@typeInfo(@TypeOf(extra_args)) != .@"struct") {
@compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(extra_args)));
}
const ArgsTuple = std.meta.ArgsTuple(@TypeOf(test_fn));
- const fn_args_fields = @typeInfo(ArgsTuple).Struct.fields;
+ const fn_args_fields = @typeInfo(ArgsTuple).@"struct".fields;
if (fn_args_fields.len == 0 or fn_args_fields[0].type != std.mem.Allocator) {
@compileError("The provided function must have an " ++ @typeName(std.mem.Allocator) ++ " as its first argument");
}
@@ -1061,7 +1061,7 @@ pub fn checkAllAllocationFailures(backing_allocator: std.mem.Allocator, comptime
// Setup the tuple that will actually be used with @call (we'll need to insert
// the failing allocator in field @"0" before each @call)
var args: ArgsTuple = undefined;
- inline for (@typeInfo(@TypeOf(extra_args)).Struct.fields, 0..) |field, i| {
+ inline for (@typeInfo(@TypeOf(extra_args)).@"struct".fields, 0..) |field, i| {
const arg_i_str = comptime str: {
var str_buf: [100]u8 = undefined;
const args_i = i + 1;
@@ -1129,7 +1129,7 @@ pub fn refAllDeclsRecursive(comptime T: type) void {
inline for (comptime std.meta.declarations(T)) |decl| {
if (@TypeOf(@field(T, decl.name)) == type) {
switch (@typeInfo(@field(T, decl.name))) {
- .Struct, .Enum, .Union, .Opaque => refAllDeclsRecursive(@field(T, decl.name)),
+ .@"struct", .@"enum", .@"union", .@"opaque" => refAllDeclsRecursive(@field(T, decl.name)),
else => {},
}
}
diff --git a/lib/std/zig.zig b/lib/std/zig.zig
index c11b5319c558..325b7bea90f5 100644
--- a/lib/std/zig.zig
+++ b/lib/std/zig.zig
@@ -246,7 +246,7 @@ pub const BuildId = union(enum) {
hexstring: HexString,
pub fn eql(a: BuildId, b: BuildId) bool {
- const Tag = @typeInfo(BuildId).Union.tag_type.?;
+ const Tag = @typeInfo(BuildId).@"union".tag_type.?;
const a_tag: Tag = a;
const b_tag: Tag = b;
if (a_tag != b_tag) return false;
@@ -654,7 +654,7 @@ pub fn parseTargetQueryOrReportFatalError(
help: {
var help_text = std.ArrayList(u8).init(allocator);
defer help_text.deinit();
- inline for (@typeInfo(std.Target.ObjectFormat).Enum.fields) |field| {
+ inline for (@typeInfo(std.Target.ObjectFormat).@"enum".fields) |field| {
help_text.writer().print(" {s}\n", .{field.name}) catch break :help;
}
std.log.info("available object formats:\n{s}", .{help_text.items});
diff --git a/lib/std/zig/AstGen.zig b/lib/std/zig/AstGen.zig
index 4e36e3e36557..309472f9ea69 100644
--- a/lib/std/zig/AstGen.zig
+++ b/lib/std/zig/AstGen.zig
@@ -153,7 +153,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir {
try astgen.instructions.ensureTotalCapacity(gpa, tree.nodes.len);
// First few indexes of extra are reserved and set at the end.
- const reserved_count = @typeInfo(Zir.ExtraIndex).Enum.fields.len;
+ const reserved_count = @typeInfo(Zir.ExtraIndex).@"enum".fields.len;
try astgen.extra.ensureTotalCapacity(gpa, tree.nodes.len + reserved_count);
astgen.extra.items.len += reserved_count;
@@ -197,7 +197,7 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir {
astgen.extra.items[err_index] = 0;
} else {
try astgen.extra.ensureUnusedCapacity(gpa, 1 + astgen.compile_errors.items.len *
- @typeInfo(Zir.Inst.CompileErrors.Item).Struct.fields.len);
+ @typeInfo(Zir.Inst.CompileErrors.Item).@"struct".fields.len);
astgen.extra.items[err_index] = astgen.addExtraAssumeCapacity(Zir.Inst.CompileErrors{
.items_len = @intCast(astgen.compile_errors.items.len),
@@ -212,8 +212,8 @@ pub fn generate(gpa: Allocator, tree: Ast) Allocator.Error!Zir {
if (astgen.imports.count() == 0) {
astgen.extra.items[imports_index] = 0;
} else {
- try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Imports).Struct.fields.len +
- astgen.imports.count() * @typeInfo(Zir.Inst.Imports.Item).Struct.fields.len);
+ try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Imports).@"struct".fields.len +
+ astgen.imports.count() * @typeInfo(Zir.Inst.Imports.Item).@"struct".fields.len);
astgen.extra.items[imports_index] = astgen.addExtraAssumeCapacity(Zir.Inst.Imports{
.imports_len = @intCast(astgen.imports.count()),
@@ -1885,7 +1885,7 @@ fn structInitExprAnon(
const payload_index = try addExtra(astgen, Zir.Inst.StructInitAnon{
.fields_len = @intCast(struct_init.ast.fields.len),
});
- const field_size = @typeInfo(Zir.Inst.StructInitAnon.Item).Struct.fields.len;
+ const field_size = @typeInfo(Zir.Inst.StructInitAnon.Item).@"struct".fields.len;
var extra_index: usize = try reserveExtra(astgen, struct_init.ast.fields.len * field_size);
for (struct_init.ast.fields) |field_init| {
@@ -1916,7 +1916,7 @@ fn structInitExprTyped(
const payload_index = try addExtra(astgen, Zir.Inst.StructInit{
.fields_len = @intCast(struct_init.ast.fields.len),
});
- const field_size = @typeInfo(Zir.Inst.StructInit.Item).Struct.fields.len;
+ const field_size = @typeInfo(Zir.Inst.StructInit.Item).@"struct".fields.len;
var extra_index: usize = try reserveExtra(astgen, struct_init.ast.fields.len * field_size);
for (struct_init.ast.fields) |field_init| {
@@ -2464,7 +2464,7 @@ fn labeledBlockExpr(
};
// We need to call `rvalue` to write through to the pointer only if we had a
// result pointer and aren't forwarding it.
- const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
+ const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
// Reserve the Block ZIR instruction index so that we can put it into the GenZir struct
@@ -3864,7 +3864,7 @@ fn ptrType(
const gpa = gz.astgen.gpa;
try gz.instructions.ensureUnusedCapacity(gpa, 1);
try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1);
- try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.PtrType).Struct.fields.len +
+ try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.PtrType).@"struct".fields.len +
trailing_count);
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
const main_tokens = tree.nodes.items(.main_token);
const token_tags = tree.tokens.items(.tag);
- const payload_index = try reserveExtra(astgen, @typeInfo(Zir.Inst.ErrorSetDecl).Struct.fields.len);
+ const payload_index = try reserveExtra(astgen, @typeInfo(Zir.Inst.ErrorSetDecl).@"struct".fields.len);
var fields_len: usize = 0;
{
var idents: std.AutoHashMapUnmanaged(Zir.NullTerminatedString, Ast.TokenIndex) = .{};
@@ -6078,7 +6078,7 @@ fn orelseCatchExpr(
};
// We need to call `rvalue` to write through to the pointer only if we had a
// result pointer and aren't forwarding it.
- const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
+ const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
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(
};
// We need to call `rvalue` to write through to the pointer only if we had a
// result pointer and aren't forwarding it.
- const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
+ const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
var block_scope = parent_gz.makeSubBlock(scope);
@@ -6537,7 +6537,7 @@ fn setCondBrPayload(
const else_body_len = astgen.countBodyLenAfterFixups(else_body);
try astgen.extra.ensureUnusedCapacity(
astgen.gpa,
- @typeInfo(Zir.Inst.CondBr).Struct.fields.len + then_body_len + else_body_len,
+ @typeInfo(Zir.Inst.CondBr).@"struct".fields.len + then_body_len + else_body_len,
);
const zir_datas = astgen.instructions.items(.data);
@@ -6573,7 +6573,7 @@ fn whileExpr(
};
// We need to call `rvalue` to write through to the pointer only if we had a
// result pointer and aren't forwarding it.
- const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
+ const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
if (while_full.label_token) |label_token| {
@@ -6853,7 +6853,7 @@ fn forExpr(
};
// We need to call `rvalue` to write through to the pointer only if we had a
// result pointer and aren't forwarding it.
- const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
+ const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
const is_inline = for_full.inline_token != null;
@@ -6951,7 +6951,7 @@ fn forExpr(
// nicer error reporting as well as fewer ZIR bytes emitted.
const len: Zir.Inst.Ref = len: {
const lens_len: u32 = @intCast(lens.len);
- try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.MultiOp).Struct.fields.len + lens_len);
+ try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.MultiOp).@"struct".fields.len + lens_len);
const len = try parent_gz.addPlNode(.for_len, node, Zir.Inst.MultiOp{
.operands_len = lens_len,
});
@@ -7188,7 +7188,7 @@ fn switchExprErrUnion(
// We need to call `rvalue` to write through to the pointer only if we had a
// result pointer and aren't forwarding it.
- const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
+ const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
var scalar_cases_len: u32 = 0;
var multi_cases_len: u32 = 0;
@@ -7622,10 +7622,10 @@ fn switchExprErrUnion(
// Now that the item expressions are generated we can add this.
try parent_gz.instructions.append(gpa, switch_block);
- try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.SwitchBlockErrUnion).Struct.fields.len +
+ try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.SwitchBlockErrUnion).@"struct".fields.len +
@intFromBool(multi_cases_len != 0) +
payloads.items.len - case_table_end +
- (case_table_end - case_table_start) * @typeInfo(Zir.Inst.As).Struct.fields.len);
+ (case_table_end - case_table_start) * @typeInfo(Zir.Inst.As).@"struct".fields.len);
const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.SwitchBlockErrUnion{
.operand = raw_operand,
@@ -7705,7 +7705,7 @@ fn switchExpr(
};
// We need to call `rvalue` to write through to the pointer only if we had a
// result pointer and aren't forwarding it.
- const LocTag = @typeInfo(ResultInfo.Loc).Union.tag_type.?;
+ const LocTag = @typeInfo(ResultInfo.Loc).@"union".tag_type.?;
const need_result_rvalue = @as(LocTag, block_ri.rl) != @as(LocTag, ri.rl);
// We perform two passes over the AST. This first pass is to collect information
@@ -8068,11 +8068,11 @@ fn switchExpr(
// Now that the item expressions are generated we can add this.
try parent_gz.instructions.append(gpa, switch_block);
- try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.SwitchBlock).Struct.fields.len +
+ try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.SwitchBlock).@"struct".fields.len +
@intFromBool(multi_cases_len != 0) +
@intFromBool(any_has_tag_capture) +
payloads.items.len - case_table_end +
- (case_table_end - case_table_start) * @typeInfo(Zir.Inst.As).Struct.fields.len);
+ (case_table_end - case_table_start) * @typeInfo(Zir.Inst.As).@"struct".fields.len);
const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.SwitchBlock{
.operand = raw_operand,
@@ -8971,7 +8971,7 @@ fn ptrCast(
const node_datas = tree.nodes.items(.data);
const node_tags = tree.nodes.items(.tag);
- const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
+ const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
var flags: Zir.Inst.FullPtrCastFlags = .{};
// Note that all pointer cast builtins have one parameter, so we only need
@@ -12080,7 +12080,7 @@ const GenZir = struct {
const body_len = astgen.countBodyLenAfterFixups(body);
try astgen.extra.ensureUnusedCapacity(
gpa,
- @typeInfo(Zir.Inst.BoolBr).Struct.fields.len + body_len,
+ @typeInfo(Zir.Inst.BoolBr).@"struct".fields.len + body_len,
);
const zir_datas = astgen.instructions.items(.data);
zir_datas[@intFromEnum(bool_br)].pl_node.payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.BoolBr{
@@ -12099,7 +12099,7 @@ const GenZir = struct {
const body_len = astgen.countBodyLenAfterFixups(body);
try astgen.extra.ensureUnusedCapacity(
gpa,
- @typeInfo(Zir.Inst.Block).Struct.fields.len + body_len,
+ @typeInfo(Zir.Inst.Block).@"struct".fields.len + body_len,
);
const zir_datas = astgen.instructions.items(.data);
zir_datas[@intFromEnum(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity(
@@ -12117,7 +12117,7 @@ const GenZir = struct {
const body_len = astgen.countBodyLenAfterFixups(body);
try astgen.extra.ensureUnusedCapacity(
gpa,
- @typeInfo(Zir.Inst.Try).Struct.fields.len + body_len,
+ @typeInfo(Zir.Inst.Try).@"struct".fields.len + body_len,
);
const zir_datas = astgen.instructions.items(.data);
zir_datas[@intFromEnum(inst)].pl_node.payload_index = astgen.addExtraAssumeCapacity(
@@ -12235,7 +12235,7 @@ const GenZir = struct {
try astgen.extra.ensureUnusedCapacity(
gpa,
- @typeInfo(Zir.Inst.FuncFancy).Struct.fields.len +
+ @typeInfo(Zir.Inst.FuncFancy).@"struct".fields.len +
fancyFnExprExtraLen(astgen, align_body, args.align_ref) +
fancyFnExprExtraLen(astgen, addrspace_body, args.addrspace_ref) +
fancyFnExprExtraLen(astgen, section_body, args.section_ref) +
@@ -12354,7 +12354,7 @@ const GenZir = struct {
} else {
try astgen.extra.ensureUnusedCapacity(
gpa,
- @typeInfo(Zir.Inst.Func).Struct.fields.len + 1 +
+ @typeInfo(Zir.Inst.Func).@"struct".fields.len + 1 +
fancyFnExprExtraLen(astgen, ret_body, ret_ref) +
body_len + src_locs_and_hash.len,
);
@@ -12428,7 +12428,7 @@ const GenZir = struct {
try astgen.extra.ensureUnusedCapacity(
gpa,
- @typeInfo(Zir.Inst.ExtendedVar).Struct.fields.len +
+ @typeInfo(Zir.Inst.ExtendedVar).@"struct".fields.len +
@intFromBool(args.lib_name != .empty) +
@intFromBool(args.align_inst != .none) +
@intFromBool(args.init != .none),
@@ -12590,7 +12590,7 @@ const GenZir = struct {
const param_body = param_gz.instructionsSlice();
const body_len = gz.astgen.countBodyLenAfterFixups(param_body);
try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1);
- try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Param).Struct.fields.len + body_len);
+ try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Param).@"struct".fields.len + body_len);
const doc_comment_index = if (first_doc_comment) |first|
try gz.astgen.docCommentAsStringFromFirst(abs_tok_index, first)
@@ -12663,7 +12663,7 @@ const GenZir = struct {
try astgen.instructions.ensureUnusedCapacity(gpa, 1);
try astgen.extra.ensureUnusedCapacity(
gpa,
- @typeInfo(Zir.Inst.NodeMultiOp).Struct.fields.len + operands.len,
+ @typeInfo(Zir.Inst.NodeMultiOp).@"struct".fields.len + operands.len,
);
const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.NodeMultiOp{
@@ -12904,7 +12904,7 @@ const GenZir = struct {
) !Zir.Inst.Index {
const gpa = gz.astgen.gpa;
try gz.astgen.instructions.ensureUnusedCapacity(gpa, 1);
- try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Break).Struct.fields.len);
+ try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Break).@"struct".fields.len);
const new_index: Zir.Inst.Index = @enumFromInt(gz.astgen.instructions.len);
gz.astgen.instructions.appendAssumeCapacity(.{
@@ -13027,7 +13027,7 @@ const GenZir = struct {
try astgen.instructions.ensureUnusedCapacity(gpa, 1);
try astgen.extra.ensureUnusedCapacity(
gpa,
- @typeInfo(Zir.Inst.AllocExtended).Struct.fields.len +
+ @typeInfo(Zir.Inst.AllocExtended).@"struct".fields.len +
@intFromBool(args.type_inst != .none) +
@intFromBool(args.align_inst != .none),
);
@@ -13079,9 +13079,9 @@ const GenZir = struct {
try gz.instructions.ensureUnusedCapacity(gpa, 1);
try astgen.instructions.ensureUnusedCapacity(gpa, 1);
- try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Asm).Struct.fields.len +
- args.outputs.len * @typeInfo(Zir.Inst.Asm.Output).Struct.fields.len +
- args.inputs.len * @typeInfo(Zir.Inst.Asm.Input).Struct.fields.len +
+ try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Asm).@"struct".fields.len +
+ args.outputs.len * @typeInfo(Zir.Inst.Asm.Output).@"struct".fields.len +
+ args.inputs.len * @typeInfo(Zir.Inst.Asm.Input).@"struct".fields.len +
args.clobbers.len);
const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.Asm{
@@ -13190,7 +13190,7 @@ const GenZir = struct {
const fields_hash_arr: [4]u32 = @bitCast(args.fields_hash);
- try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.StructDecl).Struct.fields.len + 3);
+ try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.StructDecl).@"struct".fields.len + 3);
const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.StructDecl{
.fields_hash_0 = fields_hash_arr[0],
.fields_hash_1 = fields_hash_arr[1],
@@ -13251,7 +13251,7 @@ const GenZir = struct {
const fields_hash_arr: [4]u32 = @bitCast(args.fields_hash);
- try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.UnionDecl).Struct.fields.len + 5);
+ try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.UnionDecl).@"struct".fields.len + 5);
const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.UnionDecl{
.fields_hash_0 = fields_hash_arr[0],
.fields_hash_1 = fields_hash_arr[1],
@@ -13313,7 +13313,7 @@ const GenZir = struct {
const fields_hash_arr: [4]u32 = @bitCast(args.fields_hash);
- try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.EnumDecl).Struct.fields.len + 5);
+ try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.EnumDecl).@"struct".fields.len + 5);
const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.EnumDecl{
.fields_hash_0 = fields_hash_arr[0],
.fields_hash_1 = fields_hash_arr[1],
@@ -13366,7 +13366,7 @@ const GenZir = struct {
assert(args.src_node != 0);
- try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.OpaqueDecl).Struct.fields.len + 2);
+ try astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.OpaqueDecl).@"struct".fields.len + 2);
const payload_index = astgen.addExtraAssumeCapacity(Zir.Inst.OpaqueDecl{
.src_line = astgen.source_line,
.src_node = args.src_node,
diff --git a/lib/std/zig/ErrorBundle.zig b/lib/std/zig/ErrorBundle.zig
index 2d69ff901dbb..63e0748d8d1e 100644
--- a/lib/std/zig/ErrorBundle.zig
+++ b/lib/std/zig/ErrorBundle.zig
@@ -108,7 +108,7 @@ pub fn getSourceLocation(eb: ErrorBundle, index: SourceLocationIndex) SourceLoca
pub fn getNotes(eb: ErrorBundle, index: MessageIndex) []const MessageIndex {
const notes_len = eb.getErrorMessage(index).notes_len;
- const start = @intFromEnum(index) + @typeInfo(ErrorMessage).Struct.fields.len;
+ const start = @intFromEnum(index) + @typeInfo(ErrorMessage).@"struct".fields.len;
return @as([]const MessageIndex, @ptrCast(eb.extra[start..][0..notes_len]));
}
@@ -119,7 +119,7 @@ pub fn getCompileLogOutput(eb: ErrorBundle) [:0]const u8 {
/// Returns the requested data, as well as the new index which is at the start of the
/// trailers for the object.
fn extraData(eb: ErrorBundle, comptime T: type, index: usize) struct { data: T, end: usize } {
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
@@ -456,7 +456,7 @@ pub const Wip = struct {
pub fn reserveNotes(wip: *Wip, notes_len: u32) !u32 {
try wip.extra.ensureUnusedCapacity(wip.gpa, notes_len +
- notes_len * @typeInfo(ErrorBundle.ErrorMessage).Struct.fields.len);
+ notes_len * @typeInfo(ErrorBundle.ErrorMessage).@"struct".fields.len);
wip.extra.items.len += notes_len;
return @intCast(wip.extra.items.len - notes_len);
}
@@ -616,13 +616,13 @@ pub const Wip = struct {
fn addExtra(wip: *Wip, extra: anytype) Allocator.Error!u32 {
const gpa = wip.gpa;
- const fields = @typeInfo(@TypeOf(extra)).Struct.fields;
+ const fields = @typeInfo(@TypeOf(extra)).@"struct".fields;
try wip.extra.ensureUnusedCapacity(gpa, fields.len);
return addExtraAssumeCapacity(wip, extra);
}
fn addExtraAssumeCapacity(wip: *Wip, extra: anytype) u32 {
- const fields = @typeInfo(@TypeOf(extra)).Struct.fields;
+ const fields = @typeInfo(@TypeOf(extra)).@"struct".fields;
const result: u32 = @intCast(wip.extra.items.len);
wip.extra.items.len += fields.len;
setExtra(wip, result, extra);
@@ -630,7 +630,7 @@ pub const Wip = struct {
}
fn setExtra(wip: *Wip, index: usize, extra: anytype) void {
- const fields = @typeInfo(@TypeOf(extra)).Struct.fields;
+ const fields = @typeInfo(@TypeOf(extra)).@"struct".fields;
var i = index;
inline for (fields) |field| {
wip.extra.items[i] = switch (field.type) {
diff --git a/lib/std/zig/Server.zig b/lib/std/zig/Server.zig
index 0ed9cfcd0b12..6400c30965a5 100644
--- a/lib/std/zig/Server.zig
+++ b/lib/std/zig/Server.zig
@@ -282,9 +282,9 @@ fn bswap(x: anytype) @TypeOf(x) {
const T = @TypeOf(x);
switch (@typeInfo(T)) {
- .Enum => return @as(T, @enumFromInt(@byteSwap(@intFromEnum(x)))),
- .Int => return @byteSwap(x),
- .Struct => |info| switch (info.layout) {
+ .@"enum" => return @as(T, @enumFromInt(@byteSwap(@intFromEnum(x)))),
+ .int => return @byteSwap(x),
+ .@"struct" => |info| switch (info.layout) {
.@"extern" => {
var result: T = undefined;
inline for (info.fields) |field| {
diff --git a/lib/std/zig/Zir.zig b/lib/std/zig/Zir.zig
index 02eb38f9c449..af4ddaad6afc 100644
--- a/lib/std/zig/Zir.zig
+++ b/lib/std/zig/Zir.zig
@@ -68,7 +68,7 @@ fn ExtraData(comptime T: type) type {
/// Returns the requested data, as well as the new index which is at the start of the
/// trailers for the object.
pub fn extraData(code: Zir, comptime T: type, index: usize) ExtraData(T) {
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
var i: usize = index;
var result: T = undefined;
inline for (fields) |field| {
@@ -1823,7 +1823,7 @@ pub const Inst = struct {
// Uncomment to view how many tag slots are available.
//comptime {
- // @compileLog("ZIR tags left: ", 256 - @typeInfo(Tag).Enum.fields.len);
+ // @compileLog("ZIR tags left: ", 256 - @typeInfo(Tag).@"enum".fields.len);
//}
};
@@ -3551,7 +3551,7 @@ pub fn declIterator(zir: Zir, decl_inst: Zir.Inst.Index) DeclIterator {
},
.struct_decl => {
const small: Inst.StructDecl.Small = @bitCast(extended.small);
- var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.StructDecl).Struct.fields.len);
+ var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.StructDecl).@"struct".fields.len);
const captures_len = if (small.has_captures_len) captures_len: {
const captures_len = zir.extra[extra_index];
extra_index += 1;
@@ -3584,7 +3584,7 @@ pub fn declIterator(zir: Zir, decl_inst: Zir.Inst.Index) DeclIterator {
},
.enum_decl => {
const small: Inst.EnumDecl.Small = @bitCast(extended.small);
- var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.EnumDecl).Struct.fields.len);
+ var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.EnumDecl).@"struct".fields.len);
extra_index += @intFromBool(small.has_tag_type);
const captures_len = if (small.has_captures_len) captures_len: {
const captures_len = zir.extra[extra_index];
@@ -3609,7 +3609,7 @@ pub fn declIterator(zir: Zir, decl_inst: Zir.Inst.Index) DeclIterator {
},
.union_decl => {
const small: Inst.UnionDecl.Small = @bitCast(extended.small);
- var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.UnionDecl).Struct.fields.len);
+ var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.UnionDecl).@"struct".fields.len);
extra_index += @intFromBool(small.has_tag_type);
const captures_len = if (small.has_captures_len) captures_len: {
const captures_len = zir.extra[extra_index];
@@ -3634,7 +3634,7 @@ pub fn declIterator(zir: Zir, decl_inst: Zir.Inst.Index) DeclIterator {
},
.opaque_decl => {
const small: Inst.OpaqueDecl.Small = @bitCast(extended.small);
- var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.OpaqueDecl).Struct.fields.len);
+ var extra_index: u32 = @intCast(extended.operand + @typeInfo(Inst.OpaqueDecl).@"struct".fields.len);
const decls_len = if (small.has_decls_len) decls_len: {
const decls_len = zir.extra[extra_index];
extra_index += 1;
@@ -4607,7 +4607,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash {
const extra_index = extra.end +
extra.data.ret_body_len +
extra.data.body_len +
- @typeInfo(Inst.Func.SrcLocs).Struct.fields.len;
+ @typeInfo(Inst.Func.SrcLocs).@"struct".fields.len;
return @bitCast([4]u32{
zir.extra[extra_index + 0],
zir.extra[extra_index + 1],
@@ -4647,7 +4647,7 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash {
} else extra_index += @intFromBool(bits.has_ret_ty_ref);
extra_index += @intFromBool(bits.has_any_noalias);
extra_index += extra.data.body_len;
- extra_index += @typeInfo(Zir.Inst.Func.SrcLocs).Struct.fields.len;
+ extra_index += @typeInfo(Zir.Inst.Func.SrcLocs).@"struct".fields.len;
return @bitCast([4]u32{
zir.extra[extra_index + 0],
zir.extra[extra_index + 1],
diff --git a/lib/std/zig/c_translation.zig b/lib/std/zig/c_translation.zig
index 504f134b4158..39f7fa9a113f 100644
--- a/lib/std/zig/c_translation.zig
+++ b/lib/std/zig/c_translation.zig
@@ -9,60 +9,60 @@ pub fn cast(comptime DestType: type, target: anytype) DestType {
// this function should behave like transCCast in translate-c, except it's for macros
const SourceType = @TypeOf(target);
switch (@typeInfo(DestType)) {
- .Fn => return castToPtr(*const DestType, SourceType, target),
- .Pointer => return castToPtr(DestType, SourceType, target),
- .Optional => |dest_opt| {
- if (@typeInfo(dest_opt.child) == .Pointer) {
+ .@"fn" => return castToPtr(*const DestType, SourceType, target),
+ .pointer => return castToPtr(DestType, SourceType, target),
+ .optional => |dest_opt| {
+ if (@typeInfo(dest_opt.child) == .pointer) {
return castToPtr(DestType, SourceType, target);
- } else if (@typeInfo(dest_opt.child) == .Fn) {
+ } else if (@typeInfo(dest_opt.child) == .@"fn") {
return castToPtr(?*const dest_opt.child, SourceType, target);
}
},
- .Int => {
+ .int => {
switch (@typeInfo(SourceType)) {
- .Pointer => {
+ .pointer => {
return castInt(DestType, @intFromPtr(target));
},
- .Optional => |opt| {
- if (@typeInfo(opt.child) == .Pointer) {
+ .optional => |opt| {
+ if (@typeInfo(opt.child) == .pointer) {
return castInt(DestType, @intFromPtr(target));
}
},
- .Int => {
+ .int => {
return castInt(DestType, target);
},
- .Fn => {
+ .@"fn" => {
return castInt(DestType, @intFromPtr(&target));
},
- .Bool => {
+ .bool => {
return @intFromBool(target);
},
else => {},
}
},
- .Float => {
+ .float => {
switch (@typeInfo(SourceType)) {
- .Int => return @as(DestType, @floatFromInt(target)),
- .Float => return @as(DestType, @floatCast(target)),
- .Bool => return @as(DestType, @floatFromInt(@intFromBool(target))),
+ .int => return @as(DestType, @floatFromInt(target)),
+ .float => return @as(DestType, @floatCast(target)),
+ .bool => return @as(DestType, @floatFromInt(@intFromBool(target))),
else => {},
}
},
- .Union => |info| {
+ .@"union" => |info| {
inline for (info.fields) |field| {
if (field.type == SourceType) return @unionInit(DestType, field.name, target);
}
@compileError("cast to union type '" ++ @typeName(DestType) ++ "' from type '" ++ @typeName(SourceType) ++ "' which is not present in union");
},
- .Bool => return cast(usize, target) != 0,
+ .bool => return cast(usize, target) != 0,
else => {},
}
return @as(DestType, target);
}
fn castInt(comptime DestType: type, target: anytype) DestType {
- const dest = @typeInfo(DestType).Int;
- const source = @typeInfo(@TypeOf(target)).Int;
+ const dest = @typeInfo(DestType).int;
+ const source = @typeInfo(@TypeOf(target)).int;
if (dest.bits < source.bits)
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 {
fn castToPtr(comptime DestType: type, comptime SourceType: type, target: anytype) DestType {
switch (@typeInfo(SourceType)) {
- .Int => {
+ .int => {
return @as(DestType, @ptrFromInt(castInt(usize, target)));
},
- .ComptimeInt => {
+ .comptime_int => {
if (target < 0)
return @as(DestType, @ptrFromInt(@as(usize, @bitCast(@as(isize, @intCast(target))))))
else
return @as(DestType, @ptrFromInt(@as(usize, @intCast(target))));
},
- .Pointer => {
+ .pointer => {
return castPtr(DestType, target);
},
- .Optional => |target_opt| {
- if (@typeInfo(target_opt.child) == .Pointer) {
+ .optional => |target_opt| {
+ if (@typeInfo(target_opt.child) == .pointer) {
return castPtr(DestType, target);
}
},
@@ -100,8 +100,8 @@ fn castToPtr(comptime DestType: type, comptime SourceType: type, target: anytype
fn ptrInfo(comptime PtrType: type) std.builtin.Type.Pointer {
return switch (@typeInfo(PtrType)) {
- .Optional => |opt_info| @typeInfo(opt_info.child).Pointer,
- .Pointer => |ptr_info| ptr_info,
+ .optional => |opt_info| @typeInfo(opt_info.child).pointer,
+ .pointer => |ptr_info| ptr_info,
else => unreachable,
};
}
@@ -144,17 +144,17 @@ test "cast" {
pub fn sizeof(target: anytype) usize {
const T: type = if (@TypeOf(target) == type) target else @TypeOf(target);
switch (@typeInfo(T)) {
- .Float, .Int, .Struct, .Union, .Array, .Bool, .Vector => return @sizeOf(T),
- .Fn => {
+ .float, .int, .@"struct", .@"union", .array, .bool, .vector => return @sizeOf(T),
+ .@"fn" => {
// sizeof(main) in C returns 1
return 1;
},
- .Null => return @sizeOf(*anyopaque),
- .Void => {
+ .null => return @sizeOf(*anyopaque),
+ .void => {
// Note: sizeof(void) is 1 on clang/gcc and 0 on MSVC.
return 1;
},
- .Opaque => {
+ .@"opaque" => {
if (T == anyopaque) {
// Note: sizeof(void) is 1 on clang/gcc and 0 on MSVC.
return 1;
@@ -162,24 +162,24 @@ pub fn sizeof(target: anytype) usize {
@compileError("Cannot use C sizeof on opaque type " ++ @typeName(T));
}
},
- .Optional => |opt| {
- if (@typeInfo(opt.child) == .Pointer) {
+ .optional => |opt| {
+ if (@typeInfo(opt.child) == .pointer) {
return sizeof(opt.child);
} else {
@compileError("Cannot use C sizeof on non-pointer optional " ++ @typeName(T));
}
},
- .Pointer => |ptr| {
+ .pointer => |ptr| {
if (ptr.size == .Slice) {
@compileError("Cannot use C sizeof on slice type " ++ @typeName(T));
}
// for strings, sizeof("a") returns 2.
// normal pointer decay scenarios from C are handled
- // in the .Array case above, but strings remain literals
+ // in the .array case above, but strings remain literals
// and are therefore always pointers, so they need to be
// specially handled here.
- if (ptr.size == .One and ptr.is_const and @typeInfo(ptr.child) == .Array) {
- const array_info = @typeInfo(ptr.child).Array;
+ if (ptr.size == .One and ptr.is_const and @typeInfo(ptr.child) == .array) {
+ const array_info = @typeInfo(ptr.child).array;
if ((array_info.child == u8 or array_info.child == u16) and
array_info.sentinel != null and
@as(*align(1) const array_info.child, @ptrCast(array_info.sentinel.?)).* == 0)
@@ -195,8 +195,8 @@ pub fn sizeof(target: anytype) usize {
}
return @sizeOf(T);
},
- .ComptimeFloat => return @sizeOf(f64), // TODO c_double #3999
- .ComptimeInt => {
+ .comptime_float => return @sizeOf(f64), // TODO c_double #3999
+ .comptime_int => {
// TODO to get the correct result we have to translate
// `1073741824 * 4` as `int(1073741824) *% int(4)` since
// sizeof(1073741824 * 4) != sizeof(4294967296).
@@ -262,7 +262,7 @@ fn PromoteIntLiteralReturnType(comptime SuffixType: type, comptime number: compt
const signed_oct_hex = [_]type{ c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong };
const unsigned = [_]type{ c_uint, c_ulong, c_ulonglong };
- const list: []const type = if (@typeInfo(SuffixType).Int.signedness == .unsigned)
+ const list: []const type = if (@typeInfo(SuffixType).int.signedness == .unsigned)
&unsigned
else if (base == .decimal)
&signed_decimal
@@ -339,8 +339,8 @@ test "shuffleVectorIndex" {
/// from SelfType for pointing to a C flexible array of ElementType.
pub fn FlexibleArrayType(comptime SelfType: type, comptime ElementType: type) type {
switch (@typeInfo(SelfType)) {
- .Pointer => |ptr| {
- return @Type(.{ .Pointer = .{
+ .pointer => |ptr| {
+ return @Type(.{ .pointer = .{
.size = .C,
.is_const = ptr.is_const,
.is_volatile = ptr.is_volatile,
@@ -372,7 +372,7 @@ test "Flexible Array Type" {
/// the type and denominator is -1. C has undefined behavior for those two cases; this function has safety
/// checked undefined behavior
pub fn signedRemainder(numerator: anytype, denominator: anytype) @TypeOf(numerator, denominator) {
- std.debug.assert(@typeInfo(@TypeOf(numerator, denominator)).Int.signedness == .signed);
+ std.debug.assert(@typeInfo(@TypeOf(numerator, denominator)).int.signedness == .signed);
if (denominator > 0) return @rem(numerator, denominator);
return numerator - @divTrunc(numerator, denominator) * denominator;
}
@@ -384,15 +384,15 @@ pub const Macros = struct {
fn L_SUFFIX_ReturnType(comptime number: anytype) type {
switch (@typeInfo(@TypeOf(number))) {
- .Int, .ComptimeInt => return @TypeOf(promoteIntLiteral(c_long, number, .decimal)),
- .Float, .ComptimeFloat => return c_longdouble,
+ .int, .comptime_int => return @TypeOf(promoteIntLiteral(c_long, number, .decimal)),
+ .float, .comptime_float => return c_longdouble,
else => @compileError("Invalid value for L suffix"),
}
}
pub fn L_SUFFIX(comptime number: anytype) L_SUFFIX_ReturnType(number) {
switch (@typeInfo(@TypeOf(number))) {
- .Int, .ComptimeInt => return promoteIntLiteral(c_long, number, .decimal),
- .Float, .ComptimeFloat => @compileError("TODO: c_longdouble initialization from comptime_float not supported"),
+ .int, .comptime_int => return promoteIntLiteral(c_long, number, .decimal),
+ .float, .comptime_float => @compileError("TODO: c_longdouble initialization from comptime_float not supported"),
else => @compileError("Invalid value for L suffix"),
}
}
@@ -420,13 +420,13 @@ pub const Macros = struct {
/// A 2-argument function-like macro defined as #define FOO(A, B) (A)(B)
/// could be either: cast B to A, or call A with the value B.
pub fn CAST_OR_CALL(a: anytype, b: anytype) switch (@typeInfo(@TypeOf(a))) {
- .Type => a,
- .Fn => |fn_info| fn_info.return_type orelse void,
+ .type => a,
+ .@"fn" => |fn_info| fn_info.return_type orelse void,
else => |info| @compileError("Unexpected argument type: " ++ @tagName(info)),
} {
switch (@typeInfo(@TypeOf(a))) {
- .Type => return cast(a, b),
- .Fn => return a(b),
+ .type => return cast(a, b),
+ .@"fn" => return a(b),
else => unreachable, // return type will be a compile error otherwise
}
}
@@ -444,7 +444,7 @@ fn PromotedIntType(comptime T: type) type {
c_int, c_uint, c_long, c_ulong, c_longlong, c_ulonglong => T,
else => if (T == comptime_int) {
@compileError("Cannot promote `" ++ @typeName(T) ++ "`; a fixed-size number type is required");
- } else if (@typeInfo(T) == .Int) {
+ } else if (@typeInfo(T) == .int) {
@compileError("Cannot promote `" ++ @typeName(T) ++ "`; a C ABI type is required");
} else {
@compileError("Attempted to promote invalid type `" ++ @typeName(T) ++ "`");
@@ -490,8 +490,8 @@ fn ArithmeticConversion(comptime A: type, comptime B: type) type {
if (A_Promoted == B_Promoted) return A_Promoted;
- const a_signed = @typeInfo(A_Promoted).Int.signedness == .signed;
- const b_signed = @typeInfo(B_Promoted).Int.signedness == .signed;
+ const a_signed = @typeInfo(A_Promoted).int.signedness == .signed;
+ const b_signed = @typeInfo(B_Promoted).int.signedness == .signed;
if (a_signed == b_signed) {
return if (integerRank(A_Promoted) > integerRank(B_Promoted)) A_Promoted else B_Promoted;
@@ -544,8 +544,8 @@ pub const MacroArithmetic = struct {
const a_casted = cast(ResType, a);
const b_casted = cast(ResType, b);
switch (@typeInfo(ResType)) {
- .Float => return a_casted / b_casted,
- .Int => return @divTrunc(a_casted, b_casted),
+ .float => return a_casted / b_casted,
+ .int => return @divTrunc(a_casted, b_casted),
else => unreachable,
}
}
@@ -555,8 +555,8 @@ pub const MacroArithmetic = struct {
const a_casted = cast(ResType, a);
const b_casted = cast(ResType, b);
switch (@typeInfo(ResType)) {
- .Int => {
- if (@typeInfo(ResType).Int.signedness == .signed) {
+ .int => {
+ if (@typeInfo(ResType).int.signedness == .signed) {
return signedRemainder(a_casted, b_casted);
} else {
return a_casted % b_casted;
diff --git a/lib/std/zig/parser_test.zig b/lib/std/zig/parser_test.zig
index 530aa924d08c..d399c58c9cd6 100644
--- a/lib/std/zig/parser_test.zig
+++ b/lib/std/zig/parser_test.zig
@@ -2548,7 +2548,7 @@ test "zig fmt: same-line comment after non-block if expression" {
test "zig fmt: same-line comment on comptime expression" {
try testCanonical(
\\test "" {
- \\ comptime assert(@typeInfo(T) == .Int); // must pass an integer to absInt
+ \\ comptime assert(@typeInfo(T) == .int); // must pass an integer to absInt
\\}
\\
);
diff --git a/lib/std/zig/system/windows.zig b/lib/std/zig/system/windows.zig
index 4c8e911a9fe7..43d407c3a0a0 100644
--- a/lib/std/zig/system/windows.zig
+++ b/lib/std/zig/system/windows.zig
@@ -56,11 +56,11 @@ fn getCpuInfoFromRegistry(core: usize, args: anytype) !void {
const ArgsType = @TypeOf(args);
const args_type_info = @typeInfo(ArgsType);
- if (args_type_info != .Struct) {
+ if (args_type_info != .@"struct") {
@compileError("expected tuple or struct argument, found " ++ @typeName(ArgsType));
}
- const fields_info = args_type_info.Struct.fields;
+ const fields_info = args_type_info.@"struct".fields;
// Originally, I wanted to issue a single call with a more complex table structure such that we
// would sequentially visit each CPU#d subkey in the registry and pull the value of interest into
diff --git a/src/Air/types_resolved.zig b/src/Air/types_resolved.zig
index 06258f9130d3..e60f5ef3110e 100644
--- a/src/Air/types_resolved.zig
+++ b/src/Air/types_resolved.zig
@@ -272,7 +272,7 @@ fn checkBody(air: Air, body: []const Air.Inst.Index, zcu: *Zcu) bool {
const elems_len: usize = @intCast(ty.arrayLen(zcu));
const elems: []const Air.Inst.Ref = @ptrCast(air.extra[data.ty_pl.payload..][0..elems_len]);
if (!checkType(ty, zcu)) return false;
- if (ty.zigTypeTag(zcu) == .Struct) {
+ if (ty.zigTypeTag(zcu) == .@"struct") {
for (elems, 0..) |elem, elem_idx| {
if (ty.structFieldIsComptime(elem_idx, zcu)) continue;
if (!checkRef(elem, zcu)) return false;
@@ -453,35 +453,35 @@ pub fn checkType(ty: Type, zcu: *Zcu) bool {
return switch (ty.zigTypeTagOrPoison(zcu) catch |err| switch (err) {
error.GenericPoison => return true,
}) {
- .Type,
- .Void,
- .Bool,
- .NoReturn,
- .Int,
- .Float,
- .ErrorSet,
- .Enum,
- .Opaque,
- .Vector,
+ .type,
+ .void,
+ .bool,
+ .noreturn,
+ .int,
+ .float,
+ .error_set,
+ .@"enum",
+ .@"opaque",
+ .vector,
// These types can appear due to some dummy instructions Sema introduces and expects to be omitted by Liveness.
// It's a little silly -- but fine, we'll return `true`.
- .ComptimeFloat,
- .ComptimeInt,
- .Undefined,
- .Null,
- .EnumLiteral,
+ .comptime_float,
+ .comptime_int,
+ .undefined,
+ .null,
+ .enum_literal,
=> true,
- .Frame,
- .AnyFrame,
+ .frame,
+ .@"anyframe",
=> @panic("TODO Air.types_resolved.checkType async frames"),
- .Optional => checkType(ty.childType(zcu), zcu),
- .ErrorUnion => checkType(ty.errorUnionPayload(zcu), zcu),
- .Pointer => checkType(ty.childType(zcu), zcu),
- .Array => checkType(ty.childType(zcu), zcu),
+ .optional => checkType(ty.childType(zcu), zcu),
+ .error_union => checkType(ty.errorUnionPayload(zcu), zcu),
+ .pointer => checkType(ty.childType(zcu), zcu),
+ .array => checkType(ty.childType(zcu), zcu),
- .Fn => {
+ .@"fn" => {
const info = zcu.typeToFunc(ty).?;
for (0..info.param_types.len) |i| {
const param_ty = info.param_types.get(ip)[i];
@@ -489,7 +489,7 @@ pub fn checkType(ty: Type, zcu: *Zcu) bool {
}
return checkType(Type.fromInterned(info.return_type), zcu);
},
- .Struct => switch (ip.indexToKey(ty.toIntern())) {
+ .@"struct" => switch (ip.indexToKey(ty.toIntern())) {
.struct_type => {
const struct_obj = zcu.typeToStruct(ty).?;
return switch (struct_obj.layout) {
@@ -508,6 +508,6 @@ pub fn checkType(ty: Type, zcu: *Zcu) bool {
},
else => unreachable,
},
- .Union => return zcu.typeToUnion(ty).?.flagsUnordered(ip).status == .fully_resolved,
+ .@"union" => return zcu.typeToUnion(ty).?.flagsUnordered(ip).status == .fully_resolved,
};
}
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 3ba53083ea74..3d40957a72f8 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -384,7 +384,7 @@ const Job = union(enum) {
/// The value is the index into `system_libs`.
windows_import_lib: usize,
- const Tag = @typeInfo(Job).Union.tag_type.?;
+ const Tag = @typeInfo(Job).@"union".tag_type.?;
fn stage(tag: Tag) usize {
return switch (tag) {
// Prioritize functions so that codegen can get to work on them on a
@@ -911,7 +911,7 @@ pub const cache_helpers = struct {
}
pub fn addDebugFormat(hh: *Cache.HashHelper, x: Config.DebugFormat) void {
- const tag: @typeInfo(Config.DebugFormat).Union.tag_type.? = x;
+ const tag: @typeInfo(Config.DebugFormat).@"union".tag_type.? = x;
hh.add(tag);
switch (x) {
.strip, .code_view => {},
@@ -1486,7 +1486,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
.emit_asm = options.emit_asm,
.emit_llvm_ir = options.emit_llvm_ir,
.emit_llvm_bc = options.emit_llvm_bc,
- .work_queues = .{std.fifo.LinearFifo(Job, .Dynamic).init(gpa)} ** @typeInfo(std.meta.FieldType(Compilation, .work_queues)).Array.len,
+ .work_queues = .{std.fifo.LinearFifo(Job, .Dynamic).init(gpa)} ** @typeInfo(std.meta.FieldType(Compilation, .work_queues)).array.len,
.codegen_work = if (InternPool.single_threaded) {} else .{
.mutex = .{},
.cond = .{},
@@ -3113,8 +3113,8 @@ pub fn getAllErrorsAlloc(comp: *Compilation) !ErrorBundle {
err: *?Error,
const Error = @typeInfo(
- @typeInfo(@TypeOf(Zcu.SrcLoc.span)).Fn.return_type.?,
- ).ErrorUnion.error_set;
+ @typeInfo(@TypeOf(Zcu.SrcLoc.span)).@"fn".return_type.?,
+ ).error_union.error_set;
pub fn lessThan(ctx: @This(), lhs_index: usize, rhs_index: usize) bool {
if (ctx.err.*) |_| return lhs_index < rhs_index;
diff --git a/src/InternPool.zig b/src/InternPool.zig
index d0ade7026cb4..e09576c5aaa4 100644
--- a/src/InternPool.zig
+++ b/src/InternPool.zig
@@ -893,7 +893,7 @@ const Local = struct {
};
fn List(comptime Elem: type) type {
- assert(@typeInfo(Elem) == .Struct);
+ assert(@typeInfo(Elem) == .@"struct");
return struct {
bytes: [*]align(@alignOf(Elem)) u8,
@@ -907,7 +907,7 @@ const Local = struct {
const fields = std.enums.values(std.meta.FieldEnum(Elem));
fn PtrArrayElem(comptime len: usize) type {
- const elem_info = @typeInfo(Elem).Struct;
+ const elem_info = @typeInfo(Elem).@"struct";
const elem_fields = elem_info.fields;
var new_fields: [elem_fields.len]std.builtin.Type.StructField = undefined;
for (&new_fields, elem_fields) |*new_field, elem_field| new_field.* = .{
@@ -917,7 +917,7 @@ const Local = struct {
.is_comptime = false,
.alignment = 0,
};
- return @Type(.{ .Struct = .{
+ return @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &new_fields,
.decls = &.{},
@@ -928,12 +928,12 @@ const Local = struct {
size: std.builtin.Type.Pointer.Size,
is_const: bool = false,
}) type {
- const elem_info = @typeInfo(Elem).Struct;
+ const elem_info = @typeInfo(Elem).@"struct";
const elem_fields = elem_info.fields;
var new_fields: [elem_fields.len]std.builtin.Type.StructField = undefined;
for (&new_fields, elem_fields) |*new_field, elem_field| new_field.* = .{
.name = elem_field.name,
- .type = @Type(.{ .Pointer = .{
+ .type = @Type(.{ .pointer = .{
.size = opts.size,
.is_const = opts.is_const,
.is_volatile = false,
@@ -947,7 +947,7 @@ const Local = struct {
.is_comptime = false,
.alignment = 0,
};
- return @Type(.{ .Struct = .{
+ return @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &new_fields,
.decls = &.{},
@@ -1306,7 +1306,7 @@ const Shard = struct {
};
fn Map(comptime Value: type) type {
- comptime assert(@typeInfo(Value).Enum.tag_type == u32);
+ comptime assert(@typeInfo(Value).@"enum".tag_type == u32);
_ = @as(Value, .none); // expected .none key
return struct {
/// header: Header,
@@ -2254,7 +2254,7 @@ pub const Key = union(enum) {
byte_offset: u64,
pub const BaseAddr = union(enum) {
- const Tag = @typeInfo(BaseAddr).Union.tag_type.?;
+ const Tag = @typeInfo(BaseAddr).@"union".tag_type.?;
/// Points to the value of a single `Nav`, which may be constant or a `variable`.
nav: Nav.Index,
@@ -2411,7 +2411,7 @@ pub const Key = union(enum) {
pub fn hash64(key: Key, ip: *const InternPool) u64 {
const asBytes = std.mem.asBytes;
- const KeyTag = @typeInfo(Key).Union.tag_type.?;
+ const KeyTag = @typeInfo(Key).@"union".tag_type.?;
const seed = @intFromEnum(@as(KeyTag, key));
return switch (key) {
// TODO: assert no padding in these types
@@ -2487,7 +2487,7 @@ pub const Key = union(enum) {
.lazy_align, .lazy_size => |lazy_ty| {
std.hash.autoHash(
&hasher,
- @as(@typeInfo(Key.Int.Storage).Union.tag_type.?, int.storage),
+ @as(@typeInfo(Key.Int.Storage).@"union".tag_type.?, int.storage),
);
std.hash.autoHash(&hasher, lazy_ty);
},
@@ -2651,7 +2651,7 @@ pub const Key = union(enum) {
}
pub fn eql(a: Key, b: Key, ip: *const InternPool) bool {
- const KeyTag = @typeInfo(Key).Union.tag_type.?;
+ const KeyTag = @typeInfo(Key).@"union".tag_type.?;
const a_tag: KeyTag = a;
const b_tag: KeyTag = b;
if (a_tag != b_tag) return false;
@@ -2861,7 +2861,7 @@ pub const Key = union(enum) {
return a_val == b_val;
}
- const StorageTag = @typeInfo(Key.Float.Storage).Union.tag_type.?;
+ const StorageTag = @typeInfo(Key.Float.Storage).@"union".tag_type.?;
assert(@as(StorageTag, a_info.storage) == @as(StorageTag, b_info.storage));
switch (a_info.storage) {
@@ -2905,7 +2905,7 @@ pub const Key = union(enum) {
if (a_info.ty != b_info.ty) return false;
const len = ip.aggregateTypeLen(a_info.ty);
- const StorageTag = @typeInfo(Key.Aggregate.Storage).Union.tag_type.?;
+ const StorageTag = @typeInfo(Key.Aggregate.Storage).@"union".tag_type.?;
if (@as(StorageTag, a_info.storage) != @as(StorageTag, b_info.storage)) {
for (0..@intCast(len)) |elem_index| {
const a_elem = switch (a_info.storage) {
@@ -4000,7 +4000,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
const zir_index: TrackedInst.Index = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "zir_index").?]);
const fields_len = extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "fields_len").?];
const flags: Tag.TypeStruct.Flags = @bitCast(@atomicLoad(u32, &extra_items[item.data + std.meta.fieldIndex(Tag.TypeStruct, "flags").?], .unordered));
- var extra_index = item.data + @as(u32, @typeInfo(Tag.TypeStruct).Struct.fields.len);
+ var extra_index = item.data + @as(u32, @typeInfo(Tag.TypeStruct).@"struct".fields.len);
const captures_len = if (flags.any_captures) c: {
const len = extra_list.view().items(.@"0")[extra_index];
extra_index += 1;
@@ -4105,7 +4105,7 @@ pub fn loadStructType(ip: *const InternPool, index: Index) LoadedStructType {
const namespace: NamespaceIndex = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "namespace").?]);
const names_map: MapIndex = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "names_map").?]);
const flags: Tag.TypeStructPacked.Flags = @bitCast(@atomicLoad(u32, &extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "flags").?], .unordered));
- var extra_index = item.data + @as(u32, @typeInfo(Tag.TypeStructPacked).Struct.fields.len);
+ var extra_index = item.data + @as(u32, @typeInfo(Tag.TypeStructPacked).@"struct".fields.len);
const has_inits = item.tag == .type_struct_packed_inits;
const captures_len = if (flags.any_captures) c: {
const len = extra_list.view().items(.@"0")[extra_index];
@@ -4711,9 +4711,9 @@ pub const Index = enum(u32) {
},
}) void {
_ = self;
- const map_fields = @typeInfo(@typeInfo(@TypeOf(tag_to_encoding_map)).Pointer.child).Struct.fields;
+ const map_fields = @typeInfo(@typeInfo(@TypeOf(tag_to_encoding_map)).pointer.child).@"struct".fields;
@setEvalBranchQuota(2_000);
- inline for (@typeInfo(Tag).Enum.fields, 0..) |tag, start| {
+ inline for (@typeInfo(Tag).@"enum".fields, 0..) |tag, start| {
inline for (0..map_fields.len) |offset| {
if (comptime std.mem.eql(u8, tag.name, map_fields[(start + offset) % map_fields.len].name)) break;
} else {
@@ -6384,7 +6384,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key {
const extra_items = extra_list.view().items(.@"0");
const zir_index: TrackedInst.Index = @enumFromInt(extra_items[data + std.meta.fieldIndex(Tag.TypeStruct, "zir_index").?]);
const flags: Tag.TypeStruct.Flags = @bitCast(@atomicLoad(u32, &extra_items[data + std.meta.fieldIndex(Tag.TypeStruct, "flags").?], .unordered));
- const end_extra_index = data + @as(u32, @typeInfo(Tag.TypeStruct).Struct.fields.len);
+ const end_extra_index = data + @as(u32, @typeInfo(Tag.TypeStruct).@"struct".fields.len);
if (flags.is_reified) {
assert(!flags.any_captures);
break :ns .{ .reified = .{
@@ -6407,7 +6407,7 @@ pub fn indexToKey(ip: *const InternPool, index: Index) Key {
const extra_items = extra_list.view().items(.@"0");
const zir_index: TrackedInst.Index = @enumFromInt(extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "zir_index").?]);
const flags: Tag.TypeStructPacked.Flags = @bitCast(@atomicLoad(u32, &extra_items[item.data + std.meta.fieldIndex(Tag.TypeStructPacked, "flags").?], .unordered));
- const end_extra_index = data + @as(u32, @typeInfo(Tag.TypeStructPacked).Struct.fields.len);
+ const end_extra_index = data + @as(u32, @typeInfo(Tag.TypeStructPacked).@"struct".fields.len);
if (flags.is_reified) {
assert(!flags.any_captures);
break :ns .{ .reified = .{
@@ -6922,7 +6922,7 @@ fn extraFuncInstance(ip: *const InternPool, tid: Zcu.PerThread.Id, extra: Local.
const ty: Index = @enumFromInt(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "ty").?]);
const generic_owner: Index = @enumFromInt(extra_items[extra_index + std.meta.fieldIndex(Tag.FuncInstance, "generic_owner").?]);
const func_decl = ip.funcDeclInfo(generic_owner);
- const end_extra_index = extra_index + @as(u32, @typeInfo(Tag.FuncInstance).Struct.fields.len);
+ const end_extra_index = extra_index + @as(u32, @typeInfo(Tag.FuncInstance).@"struct".fields.len);
return .{
.tid = tid,
.ty = ty,
@@ -7288,7 +7288,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
const names_map = try ip.addMap(gpa, tid, names.len);
ip.addStringsToMap(names_map, names);
const names_len = error_set_type.names.len;
- try extra.ensureUnusedCapacity(@typeInfo(Tag.ErrorSet).Struct.fields.len + names_len);
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.ErrorSet).@"struct".fields.len + names_len);
items.appendAssumeCapacity(.{
.tag = .type_error_set,
.data = addExtraAssumeCapacity(extra, Tag.ErrorSet{
@@ -7883,7 +7883,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
.repeated_elem => |elem| elem,
};
- try extra.ensureUnusedCapacity(@typeInfo(Repeated).Struct.fields.len);
+ try extra.ensureUnusedCapacity(@typeInfo(Repeated).@"struct".fields.len);
items.appendAssumeCapacity(.{
.tag = .repeated,
.data = addExtraAssumeCapacity(extra, Repeated{
@@ -7898,7 +7898,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
const strings = ip.getLocal(tid).getMutableStrings(gpa);
const start = strings.mutate.len;
try strings.ensureUnusedCapacity(@intCast(len_including_sentinel + 1));
- try extra.ensureUnusedCapacity(@typeInfo(Bytes).Struct.fields.len);
+ try extra.ensureUnusedCapacity(@typeInfo(Bytes).@"struct".fields.len);
switch (aggregate.storage) {
.bytes => |bytes| strings.appendSliceAssumeCapacity(.{bytes.toSlice(len, ip)}),
.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
}
try extra.ensureUnusedCapacity(
- @typeInfo(Tag.Aggregate).Struct.fields.len + @as(usize, @intCast(len_including_sentinel + 1)),
+ @typeInfo(Tag.Aggregate).@"struct".fields.len + @as(usize, @intCast(len_including_sentinel + 1)),
);
items.appendAssumeCapacity(.{
.tag = .aggregate,
@@ -7961,7 +7961,7 @@ pub fn get(ip: *InternPool, gpa: Allocator, tid: Zcu.PerThread.Id, key: Key) All
.memoized_call => |memoized_call| {
for (memoized_call.arg_values) |arg| assert(arg != .none);
- try extra.ensureUnusedCapacity(@typeInfo(MemoizedCall).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(MemoizedCall).@"struct".fields.len +
memoized_call.arg_values.len);
items.appendAssumeCapacity(.{
.tag = .memoized_call,
@@ -8050,7 +8050,7 @@ pub fn getUnionType(
const align_elements_len = if (ini.flags.any_aligned_fields) (ini.fields_len + 3) / 4 else 0;
const align_element: u32 = @bitCast([1]u8{@intFromEnum(Alignment.none)} ** 4);
- try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeUnion).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeUnion).@"struct".fields.len +
// TODO: fmt bug
// zig fmt: off
switch (ini.key) {
@@ -8259,7 +8259,7 @@ pub fn getStructType(
.auto => false,
.@"extern" => true,
.@"packed" => {
- try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeStructPacked).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeStructPacked).@"struct".fields.len +
// TODO: fmt bug
// zig fmt: off
switch (ini.key) {
@@ -8327,7 +8327,7 @@ pub fn getStructType(
const align_element: u32 = @bitCast([1]u8{@intFromEnum(Alignment.none)} ** 4);
const comptime_elements_len = if (ini.any_comptime_fields) (ini.fields_len + 31) / 32 else 0;
- try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeStruct).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeStruct).@"struct".fields.len +
// TODO: fmt bug
// zig fmt: off
switch (ini.key) {
@@ -8443,7 +8443,7 @@ pub fn getAnonStructType(
try items.ensureUnusedCapacity(1);
try extra.ensureUnusedCapacity(
- @typeInfo(TypeStructAnon).Struct.fields.len + (fields_len * 3),
+ @typeInfo(TypeStructAnon).@"struct".fields.len + (fields_len * 3),
);
const extra_index = addExtraAssumeCapacity(extra, TypeStructAnon{
@@ -8509,7 +8509,7 @@ pub fn getFuncType(
const prev_extra_len = extra.mutate.len;
const params_len: u32 = @intCast(key.param_types.len);
- try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeFunction).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeFunction).@"struct".fields.len +
@intFromBool(key.comptime_bits != 0) +
@intFromBool(key.noalias_bits != 0) +
params_len);
@@ -8575,7 +8575,7 @@ pub fn getExtern(
const items = local.getMutableItems(gpa);
const extra = local.getMutableExtra(gpa);
try items.ensureUnusedCapacity(1);
- try extra.ensureUnusedCapacity(@typeInfo(Tag.Extern).Struct.fields.len);
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.Extern).@"struct".fields.len);
try local.getMutableNavs(gpa).ensureUnusedCapacity(1);
// 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(
// arrays. This is similar to what `getOrPutTrailingString` does.
const prev_extra_len = extra.mutate.len;
- try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncDecl).Struct.fields.len);
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncDecl).@"struct".fields.len);
const func_decl_extra_index = addExtraAssumeCapacity(extra, Tag.FuncDecl{
.analysis = .{
@@ -8723,10 +8723,10 @@ pub fn getFuncDeclIes(
const prev_extra_len = extra.mutate.len;
const params_len: u32 = @intCast(key.param_types.len);
- try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncDecl).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncDecl).@"struct".fields.len +
1 + // inferred_error_set
- @typeInfo(Tag.ErrorUnionType).Struct.fields.len +
- @typeInfo(Tag.TypeFunction).Struct.fields.len +
+ @typeInfo(Tag.ErrorUnionType).@"struct".fields.len +
+ @typeInfo(Tag.TypeFunction).@"struct".fields.len +
@intFromBool(key.comptime_bits != 0) +
@intFromBool(key.noalias_bits != 0) +
params_len);
@@ -8855,7 +8855,7 @@ pub fn getErrorSetType(
const local = ip.getLocal(tid);
const items = local.getMutableItems(gpa);
const extra = local.getMutableExtra(gpa);
- try extra.ensureUnusedCapacity(@typeInfo(Tag.ErrorSet).Struct.fields.len + names.len);
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.ErrorSet).@"struct".fields.len + names.len);
const names_map = try ip.addMap(gpa, tid, names.len);
errdefer local.mutate.maps.len -= 1;
@@ -8930,7 +8930,7 @@ pub fn getFuncInstance(
const local = ip.getLocal(tid);
const items = local.getMutableItems(gpa);
const extra = local.getMutableExtra(gpa);
- try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncInstance).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncInstance).@"struct".fields.len +
arg.comptime_args.len);
const generic_owner = unwrapCoercedFunc(ip, arg.generic_owner);
@@ -9015,11 +9015,11 @@ pub fn getFuncInstanceIes(
const prev_extra_len = extra.mutate.len;
const params_len: u32 = @intCast(arg.param_types.len);
- try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncInstance).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncInstance).@"struct".fields.len +
1 + // inferred_error_set
arg.comptime_args.len +
- @typeInfo(Tag.ErrorUnionType).Struct.fields.len +
- @typeInfo(Tag.TypeFunction).Struct.fields.len +
+ @typeInfo(Tag.ErrorUnionType).@"struct".fields.len +
+ @typeInfo(Tag.TypeFunction).@"struct".fields.len +
@intFromBool(arg.noalias_bits != 0) +
params_len);
@@ -9324,7 +9324,7 @@ pub fn getEnumType(
switch (ini.tag_mode) {
.auto => {
assert(!ini.has_values);
- try extra.ensureUnusedCapacity(@typeInfo(EnumAuto).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(EnumAuto).@"struct".fields.len +
// TODO: fmt bug
// zig fmt: off
switch (ini.key) {
@@ -9384,7 +9384,7 @@ pub fn getEnumType(
local.mutate.maps.len -= 1;
};
- try extra.ensureUnusedCapacity(@typeInfo(EnumExplicit).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(EnumExplicit).@"struct".fields.len +
// TODO: fmt bug
// zig fmt: off
switch (ini.key) {
@@ -9499,7 +9499,7 @@ pub fn getGeneratedTagEnumType(
const prev_extra_len = extra.mutate.len;
switch (ini.tag_mode) {
.auto => {
- try extra.ensureUnusedCapacity(@typeInfo(EnumAuto).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(EnumAuto).@"struct".fields.len +
1 + // owner_union
fields_len); // field names
items.appendAssumeCapacity(.{
@@ -9518,7 +9518,7 @@ pub fn getGeneratedTagEnumType(
extra.appendSliceAssumeCapacity(.{@ptrCast(ini.names)});
},
.explicit, .nonexhaustive => {
- try extra.ensureUnusedCapacity(@typeInfo(EnumExplicit).Struct.fields.len +
+ try extra.ensureUnusedCapacity(@typeInfo(EnumExplicit).@"struct".fields.len +
1 + // owner_union
fields_len + // field names
ini.values.len); // field values
@@ -9606,7 +9606,7 @@ pub fn getOpaqueType(
const extra = local.getMutableExtra(gpa);
try items.ensureUnusedCapacity(1);
- try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeOpaque).Struct.fields.len + switch (ini.key) {
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.TypeOpaque).@"struct".fields.len + switch (ini.key) {
.declared => |d| d.captures.len,
.reified => 0,
});
@@ -9740,14 +9740,14 @@ fn addInt(
}
fn addExtra(extra: Local.Extra.Mutable, item: anytype) Allocator.Error!u32 {
- const fields = @typeInfo(@TypeOf(item)).Struct.fields;
+ const fields = @typeInfo(@TypeOf(item)).@"struct".fields;
try extra.ensureUnusedCapacity(fields.len);
return addExtraAssumeCapacity(extra, item);
}
fn addExtraAssumeCapacity(extra: Local.Extra.Mutable, item: anytype) u32 {
const result: u32 = extra.mutate.len;
- inline for (@typeInfo(@TypeOf(item)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(item)).@"struct".fields) |field| {
extra.appendAssumeCapacity(.{switch (field.type) {
Index,
Cau.Index,
@@ -9791,7 +9791,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 {
else => @compileError("unsupported host"),
}
const result: u32 = @intCast(ip.limbs.items.len);
- inline for (@typeInfo(@TypeOf(extra)).Struct.fields, 0..) |field, i| {
+ inline for (@typeInfo(@TypeOf(extra)).@"struct".fields, 0..) |field, i| {
const new: u32 = switch (field.type) {
u32 => @field(extra, field.name),
Index => @intFromEnum(@field(extra, field.name)),
@@ -9809,7 +9809,7 @@ fn addLimbsExtraAssumeCapacity(ip: *InternPool, extra: anytype) u32 {
fn extraDataTrail(extra: Local.Extra, comptime T: type, index: u32) struct { data: T, end: u32 } {
const extra_items = extra.view().items(.@"0");
var result: T = undefined;
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
inline for (fields, index..) |field, extra_index| {
const extra_item = extra_items[extra_index];
@field(result, field.name) = switch (field.type) {
@@ -10268,7 +10268,7 @@ fn getCoercedFunc(
const extra = local.getMutableExtra(gpa);
const prev_extra_len = extra.mutate.len;
- try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncCoerced).Struct.fields.len);
+ try extra.ensureUnusedCapacity(@typeInfo(Tag.FuncCoerced).@"struct".fields.len);
const extra_index = addExtraAssumeCapacity(extra, Tag.FuncCoerced{
.ty = ty,
@@ -10480,31 +10480,31 @@ fn dumpStatsFallible(ip: *const InternPool, arena: Allocator) anyerror!void {
.type_inferred_error_set => 0,
.type_enum_explicit, .type_enum_nonexhaustive => b: {
const info = extraData(extra_list, EnumExplicit, data);
- var ints = @typeInfo(EnumExplicit).Struct.fields.len;
+ var ints = @typeInfo(EnumExplicit).@"struct".fields.len;
if (info.zir_index == .none) ints += 1;
ints += if (info.captures_len != std.math.maxInt(u32))
info.captures_len
else
- @typeInfo(PackedU64).Struct.fields.len;
+ @typeInfo(PackedU64).@"struct".fields.len;
ints += info.fields_len;
if (info.values_map != .none) ints += info.fields_len;
break :b @sizeOf(u32) * ints;
},
.type_enum_auto => b: {
const info = extraData(extra_list, EnumAuto, data);
- const ints = @typeInfo(EnumAuto).Struct.fields.len + info.captures_len + info.fields_len;
+ const ints = @typeInfo(EnumAuto).@"struct".fields.len + info.captures_len + info.fields_len;
break :b @sizeOf(u32) * ints;
},
.type_opaque => b: {
const info = extraData(extra_list, Tag.TypeOpaque, data);
- const ints = @typeInfo(Tag.TypeOpaque).Struct.fields.len + info.captures_len;
+ const ints = @typeInfo(Tag.TypeOpaque).@"struct".fields.len + info.captures_len;
break :b @sizeOf(u32) * ints;
},
.type_struct => b: {
if (data == 0) break :b 0;
const extra = extraDataTrail(extra_list, Tag.TypeStruct, data);
const info = extra.data;
- var ints: usize = @typeInfo(Tag.TypeStruct).Struct.fields.len;
+ var ints: usize = @typeInfo(Tag.TypeStruct).@"struct".fields.len;
if (info.flags.any_captures) {
const captures_len = extra_items[extra.end];
ints += 1 + captures_len;
@@ -10535,7 +10535,7 @@ fn dumpStatsFallible(ip: *const InternPool, arena: Allocator) anyerror!void {
extra_items[extra.end]
else
0;
- break :b @sizeOf(u32) * (@typeInfo(Tag.TypeStructPacked).Struct.fields.len +
+ break :b @sizeOf(u32) * (@typeInfo(Tag.TypeStructPacked).@"struct".fields.len +
@intFromBool(extra.data.flags.any_captures) + captures_len +
extra.data.fields_len * 2);
},
@@ -10545,7 +10545,7 @@ fn dumpStatsFallible(ip: *const InternPool, arena: Allocator) anyerror!void {
extra_items[extra.end]
else
0;
- break :b @sizeOf(u32) * (@typeInfo(Tag.TypeStructPacked).Struct.fields.len +
+ break :b @sizeOf(u32) * (@typeInfo(Tag.TypeStructPacked).@"struct".fields.len +
@intFromBool(extra.data.flags.any_captures) + captures_len +
extra.data.fields_len * 3);
},
@@ -11627,7 +11627,7 @@ pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPois
.c_ulong_type,
.c_longlong_type,
.c_ulonglong_type,
- => .Int,
+ => .int,
.c_longdouble_type,
.f16_type,
@@ -11635,20 +11635,20 @@ pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPois
.f64_type,
.f80_type,
.f128_type,
- => .Float,
-
- .anyopaque_type => .Opaque,
- .bool_type => .Bool,
- .void_type => .Void,
- .type_type => .Type,
- .anyerror_type, .adhoc_inferred_error_set_type => .ErrorSet,
- .comptime_int_type => .ComptimeInt,
- .comptime_float_type => .ComptimeFloat,
- .noreturn_type => .NoReturn,
- .anyframe_type => .AnyFrame,
- .null_type => .Null,
- .undefined_type => .Undefined,
- .enum_literal_type => .EnumLiteral,
+ => .float,
+
+ .anyopaque_type => .@"opaque",
+ .bool_type => .bool,
+ .void_type => .void,
+ .type_type => .type,
+ .anyerror_type, .adhoc_inferred_error_set_type => .error_set,
+ .comptime_int_type => .comptime_int,
+ .comptime_float_type => .comptime_float,
+ .noreturn_type => .noreturn,
+ .anyframe_type => .@"anyframe",
+ .null_type => .null,
+ .undefined_type => .undefined,
+ .enum_literal_type => .enum_literal,
.manyptr_u8_type,
.manyptr_const_u8_type,
@@ -11656,11 +11656,11 @@ pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPois
.single_const_pointer_to_comptime_int_type,
.slice_const_u8_type,
.slice_const_u8_sentinel_0_type,
- => .Pointer,
+ => .pointer,
- .optional_noreturn_type => .Optional,
- .anyerror_void_error_union_type => .ErrorUnion,
- .empty_struct_type => .Struct,
+ .optional_noreturn_type => .optional,
+ .anyerror_void_error_union_type => .error_union,
+ .empty_struct_type => .@"struct",
.generic_poison_type => return error.GenericPoison,
@@ -11687,48 +11687,48 @@ pub fn zigTypeTagOrPoison(ip: *const InternPool, index: Index) error{GenericPois
.type_int_signed,
.type_int_unsigned,
- => .Int,
+ => .int,
.type_array_big,
.type_array_small,
- => .Array,
+ => .array,
- .type_vector => .Vector,
+ .type_vector => .vector,
.type_pointer,
.type_slice,
- => .Pointer,
+ => .pointer,
- .type_optional => .Optional,
- .type_anyframe => .AnyFrame,
+ .type_optional => .optional,
+ .type_anyframe => .@"anyframe",
.type_error_union,
.type_anyerror_union,
- => .ErrorUnion,
+ => .error_union,
.type_error_set,
.type_inferred_error_set,
- => .ErrorSet,
+ => .error_set,
.type_enum_auto,
.type_enum_explicit,
.type_enum_nonexhaustive,
- => .Enum,
+ => .@"enum",
.simple_type => unreachable, // handled via Index tag above
- .type_opaque => .Opaque,
+ .type_opaque => .@"opaque",
.type_struct,
.type_struct_anon,
.type_struct_packed,
.type_struct_packed_inits,
.type_tuple_anon,
- => .Struct,
+ => .@"struct",
- .type_union => .Union,
+ .type_union => .@"union",
- .type_function => .Fn,
+ .type_function => .@"fn",
// values, not types
.undef,
@@ -11919,8 +11919,8 @@ fn funcIesResolvedPtr(ip: *InternPool, func_index: Index) *Index {
const func_extra = unwrapped_func.getExtra(ip);
const func_item = unwrapped_func.getItem(ip);
const extra_index = switch (func_item.tag) {
- .func_decl => func_item.data + @typeInfo(Tag.FuncDecl).Struct.fields.len,
- .func_instance => func_item.data + @typeInfo(Tag.FuncInstance).Struct.fields.len,
+ .func_decl => func_item.data + @typeInfo(Tag.FuncDecl).@"struct".fields.len,
+ .func_instance => func_item.data + @typeInfo(Tag.FuncInstance).@"struct".fields.len,
.func_coerced => {
const uncoerced_func_index: Index = @enumFromInt(func_extra.view().items(.@"0")[
func_item.data + std.meta.fieldIndex(Tag.FuncCoerced, "func").?
@@ -11929,8 +11929,8 @@ fn funcIesResolvedPtr(ip: *InternPool, func_index: Index) *Index {
const uncoerced_func_item = unwrapped_uncoerced_func.getItem(ip);
return @ptrCast(&unwrapped_uncoerced_func.getExtra(ip).view().items(.@"0")[
switch (uncoerced_func_item.tag) {
- .func_decl => uncoerced_func_item.data + @typeInfo(Tag.FuncDecl).Struct.fields.len,
- .func_instance => uncoerced_func_item.data + @typeInfo(Tag.FuncInstance).Struct.fields.len,
+ .func_decl => uncoerced_func_item.data + @typeInfo(Tag.FuncDecl).@"struct".fields.len,
+ .func_instance => uncoerced_func_item.data + @typeInfo(Tag.FuncInstance).@"struct".fields.len,
else => unreachable,
}
]);
diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig
index 28030e3879cf..2540cf992247 100644
--- a/src/Package/Fetch.zig
+++ b/src/Package/Fetch.zig
@@ -325,7 +325,7 @@ pub fn run(f: *Fetch) RunError!void {
// "p/$hash/foo", with possibly more directories after "foo".
// We want to fail unless the resolved relative path has a
// prefix of "p/$hash/".
- const digest_len = @typeInfo(Manifest.MultiHashHexDigest).Array.len;
+ const digest_len = @typeInfo(Manifest.MultiHashHexDigest).array.len;
const prefix_len: usize = if (f.job_queue.read_only) 0 else "p/".len;
const expected_prefix = f.parent_package_root.sub_path[0 .. prefix_len + digest_len];
if (!std.mem.startsWith(u8, pkg_root.sub_path, expected_prefix)) {
@@ -670,7 +670,7 @@ fn queueJobsForDeps(f: *Fetch) RunError!void {
.url = url,
.hash = h: {
const h = dep.hash orelse break :h null;
- const digest_len = @typeInfo(Manifest.MultiHashHexDigest).Array.len;
+ const digest_len = @typeInfo(Manifest.MultiHashHexDigest).array.len;
const multihash_digest = h[0..digest_len].*;
const gop = f.job_queue.table.getOrPutAssumeCapacity(multihash_digest);
if (gop.found_existing) continue;
diff --git a/src/Sema.zig b/src/Sema.zig
index 7f39762cb207..85a1e90a480f 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -1783,7 +1783,7 @@ fn analyzeBodyInner(
const inline_body = sema.code.bodySlice(extra.end, extra.data.body_len);
const err_union = try sema.resolveInst(extra.data.operand);
const err_union_ty = sema.typeOf(err_union);
- if (err_union_ty.zigTypeTag(zcu) != .ErrorUnion) {
+ if (err_union_ty.zigTypeTag(zcu) != .error_union) {
return sema.fail(block, operand_src, "expected error union type, found '{}'", .{
err_union_ty.fmt(pt),
});
@@ -1985,14 +1985,14 @@ fn resolveDestType(
else => |e| return e,
};
- if (remove_eu and raw_ty.zigTypeTag(zcu) == .ErrorUnion) {
+ if (remove_eu and raw_ty.zigTypeTag(zcu) == .error_union) {
const eu_child = raw_ty.errorUnionPayload(zcu);
- if (remove_opt and eu_child.zigTypeTag(zcu) == .Optional) {
+ if (remove_opt and eu_child.zigTypeTag(zcu) == .optional) {
return eu_child.childType(zcu);
}
return eu_child;
}
- if (remove_opt and raw_ty.zigTypeTag(zcu) == .Optional) {
+ if (remove_opt and raw_ty.zigTypeTag(zcu) == .optional) {
return raw_ty.childType(zcu);
}
return raw_ty;
@@ -2280,7 +2280,7 @@ fn failWithExpectedOptionalType(sema: *Sema, block: *Block, src: LazySrcLoc, non
non_optional_ty.fmt(pt),
});
errdefer msg.destroy(sema.gpa);
- if (non_optional_ty.zigTypeTag(pt.zcu) == .ErrorUnion) {
+ if (non_optional_ty.zigTypeTag(pt.zcu) == .error_union) {
try sema.errNote(src, msg, "consider using 'try', 'catch', or 'if'", .{});
}
try addDeclaredHereNote(sema, msg, non_optional_ty);
@@ -2327,7 +2327,7 @@ fn failWithErrorSetCodeMissing(
fn failWithIntegerOverflow(sema: *Sema, block: *Block, src: LazySrcLoc, int_ty: Type, val: Value, vector_index: usize) CompileError {
const pt = sema.pt;
const zcu = pt.zcu;
- if (int_ty.zigTypeTag(zcu) == .Vector) {
+ if (int_ty.zigTypeTag(zcu) == .vector) {
const msg = msg: {
const msg = try sema.errMsg(src, "overflow of vector type '{}' with value '{}'", .{
int_ty.fmt(pt), val.fmtValueSema(pt, sema),
@@ -2380,7 +2380,7 @@ fn failWithInvalidFieldAccess(
const zcu = pt.zcu;
const inner_ty = if (object_ty.isSinglePointer(zcu)) object_ty.childType(zcu) else object_ty;
- if (inner_ty.zigTypeTag(zcu) == .Optional) opt: {
+ if (inner_ty.zigTypeTag(zcu) == .optional) opt: {
const child_ty = inner_ty.optionalChild(zcu);
if (!typeSupportsFieldAccess(zcu, child_ty, field_name)) break :opt;
const msg = msg: {
@@ -2390,7 +2390,7 @@ fn failWithInvalidFieldAccess(
break :msg msg;
};
return sema.failWithOwnedErrorMsg(block, msg);
- } else if (inner_ty.zigTypeTag(zcu) == .ErrorUnion) err: {
+ } else if (inner_ty.zigTypeTag(zcu) == .error_union) err: {
const child_ty = inner_ty.errorUnionPayload(zcu);
if (!typeSupportsFieldAccess(zcu, child_ty, field_name)) break :err;
const msg = msg: {
@@ -2407,16 +2407,16 @@ fn failWithInvalidFieldAccess(
fn typeSupportsFieldAccess(zcu: *const Zcu, ty: Type, field_name: InternPool.NullTerminatedString) bool {
const ip = &zcu.intern_pool;
switch (ty.zigTypeTag(zcu)) {
- .Array => return field_name.eqlSlice("len", ip),
- .Pointer => {
+ .array => return field_name.eqlSlice("len", ip),
+ .pointer => {
const ptr_info = ty.ptrInfo(zcu);
if (ptr_info.flags.size == .Slice) {
return field_name.eqlSlice("ptr", ip) or field_name.eqlSlice("len", ip);
- } else if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .Array) {
+ } else if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .array) {
return field_name.eqlSlice("len", ip);
} else return false;
},
- .Type, .Struct, .Union => return true,
+ .type, .@"struct", .@"union" => return true,
else => return false,
}
}
@@ -3384,9 +3384,9 @@ fn ensureResultUsed(
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Void, .NoReturn => return,
- .ErrorSet => return sema.fail(block, src, "error set is ignored", .{}),
- .ErrorUnion => {
+ .void, .noreturn => return,
+ .error_set => return sema.fail(block, src, "error set is ignored", .{}),
+ .error_union => {
const msg = msg: {
const msg = try sema.errMsg(src, "error union is ignored", .{});
errdefer msg.destroy(sema.gpa);
@@ -3419,8 +3419,8 @@ fn zirEnsureResultNonError(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
const src = block.nodeOffset(inst_data.src_node);
const operand_ty = sema.typeOf(operand);
switch (operand_ty.zigTypeTag(zcu)) {
- .ErrorSet => return sema.fail(block, src, "error set is discarded", .{}),
- .ErrorUnion => {
+ .error_set => return sema.fail(block, src, "error set is discarded", .{}),
+ .error_union => {
const msg = msg: {
const msg = try sema.errMsg(src, "error union is discarded", .{});
errdefer msg.destroy(sema.gpa);
@@ -3443,13 +3443,13 @@ fn zirEnsureErrUnionPayloadVoid(sema: *Sema, block: *Block, inst: Zir.Inst.Index
const src = block.nodeOffset(inst_data.src_node);
const operand = try sema.resolveInst(inst_data.operand);
const operand_ty = sema.typeOf(operand);
- const err_union_ty = if (operand_ty.zigTypeTag(zcu) == .Pointer)
+ const err_union_ty = if (operand_ty.zigTypeTag(zcu) == .pointer)
operand_ty.childType(zcu)
else
operand_ty;
- if (err_union_ty.zigTypeTag(zcu) != .ErrorUnion) return;
+ if (err_union_ty.zigTypeTag(zcu) != .error_union) return;
const payload_ty = err_union_ty.errorUnionPayload(zcu).zigTypeTag(zcu);
- if (payload_ty != .Void and payload_ty != .NoReturn) {
+ if (payload_ty != .void and payload_ty != .noreturn) {
const msg = msg: {
const msg = try sema.errMsg(src, "error union payload is ignored", .{});
errdefer msg.destroy(sema.gpa);
@@ -4198,7 +4198,7 @@ fn zirResolveInferredAlloc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Com
_ = try replacement_block.addBr(placeholder_inst, .void_value);
try sema.air_extra.ensureUnusedCapacity(
gpa,
- @typeInfo(Air.Block).Struct.fields.len + replacement_block.instructions.items.len,
+ @typeInfo(Air.Block).@"struct".fields.len + replacement_block.instructions.items.len,
);
sema.air_instructions.set(@intFromEnum(placeholder_inst), .{
.tag = .block,
@@ -4244,7 +4244,7 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
// Each arg could be an indexable, or a range, in which case the length
// is passed directly as an integer.
const is_int = switch (object_ty.zigTypeTag(zcu)) {
- .Int, .ComptimeInt => true,
+ .int, .comptime_int => true,
else => false,
};
const arg_src = block.src(.{ .for_input = .{
@@ -4259,7 +4259,7 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
errdefer msg.destroy(sema.gpa);
try sema.errNote(arg_src, msg, "for loop operand must be a range, array, slice, tuple, or vector", .{});
- if (object_ty.zigTypeTag(zcu) == .ErrorUnion) {
+ if (object_ty.zigTypeTag(zcu) == .error_union) {
try sema.errNote(arg_src, msg, "consider using 'try', 'catch', or 'if'", .{});
}
@@ -4319,7 +4319,7 @@ fn zirForLen(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
// Each arg could be an indexable, or a range, in which case the length
// is passed directly as an integer.
switch (object_ty.zigTypeTag(zcu)) {
- .Int, .ComptimeInt => continue,
+ .int, .comptime_int => continue,
else => {},
}
const arg_src = block.src(.{ .for_input = .{
@@ -4357,8 +4357,8 @@ fn optEuBasePtrInit(sema: *Sema, block: *Block, ptr: Air.Inst.Ref, src: LazySrcL
const zcu = pt.zcu;
var base_ptr = ptr;
while (true) switch (sema.typeOf(base_ptr).childType(zcu).zigTypeTag(zcu)) {
- .ErrorUnion => base_ptr = try sema.analyzeErrUnionPayloadPtr(block, src, base_ptr, false, true),
- .Optional => base_ptr = try sema.analyzeOptionalPayloadPtr(block, src, base_ptr, false, true),
+ .error_union => base_ptr = try sema.analyzeErrUnionPayloadPtr(block, src, base_ptr, false, true),
+ .optional => base_ptr = try sema.analyzeOptionalPayloadPtr(block, src, base_ptr, false, true),
else => break,
};
try sema.checkKnownAllocPtr(block, ptr, base_ptr);
@@ -4383,12 +4383,12 @@ fn zirCoercePtrElemTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE
else => |e| return e,
};
const ptr_ty = maybe_wrapped_ptr_ty.optEuBaseType(zcu);
- assert(ptr_ty.zigTypeTag(zcu) == .Pointer); // validated by a previous instruction
+ assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction
const elem_ty = ptr_ty.childType(zcu);
switch (ptr_ty.ptrSize(zcu)) {
.One => {
const uncoerced_ty = sema.typeOf(uncoerced_val);
- if (elem_ty.zigTypeTag(zcu) == .Array and elem_ty.childType(zcu).toIntern() == uncoerced_ty.toIntern()) {
+ if (elem_ty.zigTypeTag(zcu) == .array and elem_ty.childType(zcu).toIntern() == uncoerced_ty.toIntern()) {
// We're trying to initialize a *[1]T with a reference to a T - don't perform any coercion.
return uncoerced_val;
}
@@ -4403,7 +4403,7 @@ fn zirCoercePtrElemTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE
// Our goal is to coerce `uncoerced_val` to an array of `elem_ty`.
const val_ty = sema.typeOf(uncoerced_val);
switch (val_ty.zigTypeTag(zcu)) {
- .Array, .Vector => {},
+ .array, .vector => {},
else => if (!val_ty.isTuple(zcu)) {
return sema.fail(block, src, "expected array of '{}', found '{}'", .{ elem_ty.fmt(pt), val_ty.fmt(pt) });
},
@@ -4439,7 +4439,7 @@ fn zirValidateRefTy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr
else => |e| return e,
};
if (ty_operand.isGenericPoison()) return;
- if (ty_operand.optEuBaseType(zcu).zigTypeTag(zcu) != .Pointer) {
+ if (ty_operand.optEuBaseType(zcu).zigTypeTag(zcu) != .pointer) {
return sema.failWithOwnedErrorMsg(block, msg: {
const msg = try sema.errMsg(src, "expected type '{}', found pointer", .{ty_operand.fmt(pt)});
errdefer msg.destroy(sema.gpa);
@@ -4464,7 +4464,7 @@ fn zirValidateArrayInitRefTy(
else => |e| return e,
};
const ptr_ty = maybe_wrapped_ptr_ty.optEuBaseType(zcu);
- assert(ptr_ty.zigTypeTag(zcu) == .Pointer); // validated by a previous instruction
+ assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction
switch (zcu.intern_pool.indexToKey(ptr_ty.toIntern())) {
.ptr_type => |ptr_type| switch (ptr_type.flags.size) {
.Slice, .Many => {
@@ -4523,7 +4523,7 @@ fn validateArrayInitTy(
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Array => {
+ .array => {
const array_len = ty.arrayLen(zcu);
if (init_count != array_len) {
return sema.fail(block, src, "expected {d} array elements; found {d}", .{
@@ -4532,7 +4532,7 @@ fn validateArrayInitTy(
}
return;
},
- .Vector => {
+ .vector => {
const array_len = ty.arrayLen(zcu);
if (init_count != array_len) {
return sema.fail(block, src, "expected {d} vector elements; found {d}", .{
@@ -4541,7 +4541,7 @@ fn validateArrayInitTy(
}
return;
},
- .Struct => if (ty.isTuple(zcu)) {
+ .@"struct" => if (ty.isTuple(zcu)) {
try ty.resolveFields(pt);
const array_len = ty.arrayLen(zcu);
if (init_count > array_len) {
@@ -4574,7 +4574,7 @@ fn zirValidateStructInitTy(
const struct_ty = if (is_result_ty) ty.optEuBaseType(zcu) else ty;
switch (struct_ty.zigTypeTag(zcu)) {
- .Struct, .Union => return,
+ .@"struct", .@"union" => return,
else => {},
}
return sema.failWithStructInitNotSupported(block, src, struct_ty);
@@ -4599,13 +4599,13 @@ fn zirValidatePtrStructInit(
const object_ptr = try sema.resolveInst(field_ptr_extra.lhs);
const agg_ty = sema.typeOf(object_ptr).childType(zcu).optEuBaseType(zcu);
switch (agg_ty.zigTypeTag(zcu)) {
- .Struct => return sema.validateStructInit(
+ .@"struct" => return sema.validateStructInit(
block,
agg_ty,
init_src,
instrs,
),
- .Union => return sema.validateUnionInit(
+ .@"union" => return sema.validateUnionInit(
block,
agg_ty,
init_src,
@@ -5084,7 +5084,7 @@ fn zirValidatePtrArrayInit(
);
if (instrs.len != array_len) switch (array_ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
var root_msg: ?*Zcu.ErrorMsg = null;
errdefer if (root_msg) |msg| msg.destroy(sema.gpa);
@@ -5110,12 +5110,12 @@ fn zirValidatePtrArrayInit(
return sema.failWithOwnedErrorMsg(block, msg);
}
},
- .Array => {
+ .array => {
return sema.fail(block, init_src, "expected {d} array elements; found {d}", .{
array_len, instrs.len,
});
},
- .Vector => {
+ .vector => {
return sema.fail(block, init_src, "expected {d} vector elements; found {d}", .{
array_len, instrs.len,
});
@@ -5277,7 +5277,7 @@ fn zirValidateDeref(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErr
const operand = try sema.resolveInst(inst_data.operand);
const operand_ty = sema.typeOf(operand);
- if (operand_ty.zigTypeTag(zcu) != .Pointer) {
+ if (operand_ty.zigTypeTag(zcu) != .pointer) {
return sema.fail(block, src, "cannot dereference non-pointer type '{}'", .{operand_ty.fmt(pt)});
} else switch (operand_ty.ptrSize(zcu)) {
.One, .C => {},
@@ -5322,8 +5322,8 @@ fn zirValidateDestructure(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp
const operand_ty = sema.typeOf(operand);
const can_destructure = switch (operand_ty.zigTypeTag(zcu)) {
- .Array, .Vector => true,
- .Struct => operand_ty.isTuple(zcu),
+ .array, .vector => true,
+ .@"struct" => operand_ty.isTuple(zcu),
else => false,
};
@@ -5360,10 +5360,10 @@ fn failWithBadMemberAccess(
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
const kw_name = switch (agg_ty.zigTypeTag(zcu)) {
- .Union => "union",
- .Struct => "struct",
- .Opaque => "opaque",
- .Enum => "enum",
+ .@"union" => "union",
+ .@"struct" => "struct",
+ .@"opaque" => "opaque",
+ .@"enum" => "enum",
else => unreachable,
};
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
const zcu = sema.pt.zcu;
const src_loc = decl_ty.srcLocOrNull(zcu) orelse return;
const category = switch (decl_ty.zigTypeTag(zcu)) {
- .Union => "union",
- .Struct => "struct",
- .Enum => "enum",
- .Opaque => "opaque",
+ .@"union" => "union",
+ .@"struct" => "struct",
+ .@"enum" => "enum",
+ .@"opaque" => "opaque",
else => unreachable,
};
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
// Where %c is an error union or error set. In such case we need to add
// to the current function's inferred error set, if any.
if (is_ret and sema.fn_ret_ty_ies != null) switch (sema.typeOf(operand).zigTypeTag(zcu)) {
- .ErrorUnion, .ErrorSet => try sema.addToInferredErrorSet(operand),
+ .error_union, .error_set => try sema.addToInferredErrorSet(operand),
else => {},
};
@@ -5819,7 +5819,7 @@ fn zirLoop(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError
} else {
try child_block.instructions.append(gpa, loop_inst);
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len + loop_block_len);
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len + loop_block_len);
sema.air_instructions.items(.data)[@intFromEnum(loop_inst)].ty_pl.payload = sema.addExtraAssumeCapacity(
Air.Block{ .body_len = @intCast(loop_block_len) },
);
@@ -6035,7 +6035,7 @@ fn resolveBlockBody(
// We need a runtime block for scoping reasons.
_ = try child_block.addBr(merges.block_inst, .void_value);
try parent_block.instructions.append(sema.gpa, merges.block_inst);
- try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Block).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Block).@"struct".fields.len +
child_block.instructions.items.len);
sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
.ty = .void_type,
@@ -6111,7 +6111,7 @@ fn resolveAnalyzedBlock(
.dbg_inline_block => {
// Create a block containing all instruction from the body.
try parent_block.instructions.append(gpa, merges.block_inst);
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".fields.len +
child_block.instructions.items.len);
sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
.ty = .noreturn_type,
@@ -6149,7 +6149,7 @@ fn resolveAnalyzedBlock(
try parent_block.instructions.append(gpa, merges.block_inst);
switch (block_tag) {
.block => {
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len +
child_block.instructions.items.len);
sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
.ty = .void_type,
@@ -6159,7 +6159,7 @@ fn resolveAnalyzedBlock(
} };
},
.dbg_inline_block => {
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".fields.len +
child_block.instructions.items.len);
sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
.ty = .void_type,
@@ -6210,7 +6210,7 @@ fn resolveAnalyzedBlock(
const ty_inst = Air.internedToRef(resolved_ty.toIntern());
switch (block_tag) {
.block => {
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len +
child_block.instructions.items.len);
sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
.ty = ty_inst,
@@ -6220,7 +6220,7 @@ fn resolveAnalyzedBlock(
} };
},
.dbg_inline_block => {
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.DbgInlineBlock).@"struct".fields.len +
child_block.instructions.items.len);
sema.air_instructions.items(.data)[@intFromEnum(merges.block_inst)] = .{ .ty_pl = .{
.ty = ty_inst,
@@ -6257,7 +6257,7 @@ fn resolveAnalyzedBlock(
// Convert the br instruction to a block instruction that has the coercion
// and then a new br inside that returns the coerced instruction.
const sub_block_len: u32 = @intCast(coerce_block.instructions.items.len + 1);
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len +
sub_block_len);
try sema.air_instructions.ensureUnusedCapacity(gpa, 1);
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
const options = try sema.resolveExportOptions(block, options_src, extra.options);
{
- if (ptr_ty.zigTypeTag(zcu) != .Pointer) {
+ if (ptr_ty.zigTypeTag(zcu) != .pointer) {
return sema.fail(block, ptr_src, "expected pointer type, found '{}'", .{ptr_ty.fmt(pt)});
}
const ptr_ty_info = ptr_ty.ptrInfo(zcu);
@@ -6856,7 +6856,7 @@ fn popErrorReturnTrace(
// The result might be an error. If it is, we leave the error trace alone. If it isn't, we need
// to pop any error trace that may have been propagated from our arguments.
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len);
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len);
const cond_block_inst = try block.addInstAsIndex(.{
.tag = .block,
.data = .{
@@ -6885,9 +6885,9 @@ fn popErrorReturnTrace(
defer else_block.instructions.deinit(gpa);
_ = try else_block.addBr(cond_block_inst, .void_value);
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).@"struct".fields.len +
then_block.instructions.items.len + else_block.instructions.items.len +
- @typeInfo(Air.Block).Struct.fields.len + 1); // +1 for the sole .cond_br instruction in the .block
+ @typeInfo(Air.Block).@"struct".fields.len + 1); // +1 for the sole .cond_br instruction in the .block
const cond_br_inst: Air.Inst.Index = @enumFromInt(sema.air_instructions.len);
try sema.air_instructions.append(gpa, .{
@@ -7046,17 +7046,17 @@ fn checkCallArgumentCount(
const zcu = pt.zcu;
const func_ty = func_ty: {
switch (callee_ty.zigTypeTag(zcu)) {
- .Fn => break :func_ty callee_ty,
- .Pointer => {
+ .@"fn" => break :func_ty callee_ty,
+ .pointer => {
const ptr_info = callee_ty.ptrInfo(zcu);
- if (ptr_info.flags.size == .One and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .Fn) {
+ if (ptr_info.flags.size == .One and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .@"fn") {
break :func_ty Type.fromInterned(ptr_info.child);
}
},
- .Optional => {
+ .optional => {
const opt_child = callee_ty.optionalChild(zcu);
- if (opt_child.zigTypeTag(zcu) == .Fn or (opt_child.isSinglePointer(zcu) and
- opt_child.childType(zcu).zigTypeTag(zcu) == .Fn))
+ if (opt_child.zigTypeTag(zcu) == .@"fn" or (opt_child.isSinglePointer(zcu) and
+ opt_child.childType(zcu).zigTypeTag(zcu) == .@"fn"))
{
const msg = msg: {
const msg = try sema.errMsg(func_src, "cannot call optional type '{}'", .{
@@ -7125,10 +7125,10 @@ fn callBuiltin(
const callee_ty = sema.typeOf(builtin_fn);
const func_ty = func_ty: {
switch (callee_ty.zigTypeTag(zcu)) {
- .Fn => break :func_ty callee_ty,
- .Pointer => {
+ .@"fn" => break :func_ty callee_ty,
+ .pointer => {
const ptr_info = callee_ty.ptrInfo(zcu);
- if (ptr_info.flags.size == .One and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .Fn) {
+ if (ptr_info.flags.size == .One and Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .@"fn") {
break :func_ty Type.fromInterned(ptr_info.child);
}
},
@@ -7276,7 +7276,7 @@ const CallArgsInfo = union(enum) {
// Resolve the arg!
const uncoerced_arg = try sema.resolveInlineBody(block, arg_body, zir_call.call_inst);
- if (sema.typeOf(uncoerced_arg).zigTypeTag(zcu) == .NoReturn) {
+ if (sema.typeOf(uncoerced_arg).zigTypeTag(zcu) == .noreturn) {
// This terminates resolution of arguments. The caller should
// propagate this.
return uncoerced_arg;
@@ -7863,7 +7863,7 @@ fn analyzeCall(
if (param_ty) |t| assert(!t.isGenericPoison());
arg_out.* = try args_info.analyzeArg(sema, block, arg_idx, param_ty, func_ty_info, func);
try sema.validateRuntimeValue(block, args_info.argSrc(block, arg_idx), arg_out.*);
- if (sema.typeOf(arg_out.*).zigTypeTag(zcu) == .NoReturn) {
+ if (sema.typeOf(arg_out.*).zigTypeTag(zcu) == .noreturn) {
return arg_out.*;
}
}
@@ -7884,7 +7884,7 @@ fn analyzeCall(
}
}
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Call).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Call).@"struct".fields.len +
args.len);
const func_inst = try block.addInst(.{
.tag = call_tag,
@@ -7991,7 +7991,7 @@ fn analyzeInlineCallArg(
};
new_param_types[arg_i.*] = param_ty;
const casted_arg = try args_info.analyzeArg(ics.caller(), arg_block, arg_i.*, Type.fromInterned(param_ty), func_ty_info, func_inst);
- if (ics.caller().typeOf(casted_arg).zigTypeTag(zcu) == .NoReturn) {
+ if (ics.caller().typeOf(casted_arg).zigTypeTag(zcu) == .noreturn) {
return casted_arg;
}
const arg_src = args_info.argSrc(arg_block, arg_i.*);
@@ -8039,7 +8039,7 @@ fn analyzeInlineCallArg(
.param_anytype, .param_anytype_comptime => {
// No coercion needed.
const uncasted_arg = try args_info.analyzeArg(ics.caller(), arg_block, arg_i.*, Type.generic_poison, func_ty_info, func_inst);
- if (ics.caller().typeOf(uncasted_arg).zigTypeTag(zcu) == .NoReturn) {
+ if (ics.caller().typeOf(uncasted_arg).zigTypeTag(zcu) == .noreturn) {
return uncasted_arg;
}
const arg_src = args_info.argSrc(arg_block, arg_i.*);
@@ -8228,7 +8228,7 @@ fn instantiateGenericCall(
const arg_ref = try args_info.analyzeArg(sema, block, arg_index, param_ty, generic_owner_ty_info, func);
try sema.validateRuntimeValue(block, args_info.argSrc(block, arg_index), arg_ref);
const arg_ty = sema.typeOf(arg_ref);
- if (arg_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (arg_ty.zigTypeTag(zcu) == .noreturn) {
// This terminates argument analysis.
return arg_ref;
}
@@ -8345,7 +8345,7 @@ fn instantiateGenericCall(
try sema.addReferenceEntry(call_src, AnalUnit.wrap(.{ .func = callee_index }));
try zcu.ensureFuncBodyAnalysisQueued(callee_index);
- try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Call).Struct.fields.len + runtime_args.items.len);
+ try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Call).@"struct".fields.len + runtime_args.items.len);
const result = try block.addInst(.{
.tag = call_tag,
.data = .{ .pl_op = .{
@@ -8404,9 +8404,9 @@ fn zirOptionalType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
const inst_data = sema.code.instructions.items(.data)[@intFromEnum(inst)].un_node;
const operand_src = block.src(.{ .node_offset_un_op = inst_data.src_node });
const child_type = try sema.resolveType(block, operand_src, inst_data.operand);
- if (child_type.zigTypeTag(zcu) == .Opaque) {
+ if (child_type.zigTypeTag(zcu) == .@"opaque") {
return sema.fail(block, operand_src, "opaque type '{}' cannot be optional", .{child_type.fmt(pt)});
- } else if (child_type.zigTypeTag(zcu) == .Null) {
+ } else if (child_type.zigTypeTag(zcu) == .null) {
return sema.fail(block, operand_src, "type '{}' cannot be optional", .{child_type.fmt(pt)});
}
const opt_type = try pt.optionalType(child_type.toIntern());
@@ -8429,7 +8429,7 @@ fn zirArrayInitElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil
const indexable_ty = maybe_wrapped_indexable_ty.optEuBaseType(zcu);
try indexable_ty.resolveFields(pt);
assert(indexable_ty.isIndexable(zcu)); // validated by a previous instruction
- if (indexable_ty.zigTypeTag(zcu) == .Struct) {
+ if (indexable_ty.zigTypeTag(zcu) == .@"struct") {
const elem_type = indexable_ty.fieldType(@intFromEnum(bin.rhs), zcu);
return Air.internedToRef(elem_type.toIntern());
} else {
@@ -8447,7 +8447,7 @@ fn zirElemType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
else => |e| return e,
};
const ptr_ty = maybe_wrapped_ptr_ty.optEuBaseType(zcu);
- assert(ptr_ty.zigTypeTag(zcu) == .Pointer); // validated by a previous instruction
+ assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction
const elem_ty = ptr_ty.childType(zcu);
if (elem_ty.toIntern() == .anyopaque_type) {
// 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
fn validateArrayElemType(sema: *Sema, block: *Block, elem_type: Type, elem_src: LazySrcLoc) !void {
const pt = sema.pt;
const zcu = pt.zcu;
- if (elem_type.zigTypeTag(zcu) == .Opaque) {
+ if (elem_type.zigTypeTag(zcu) == .@"opaque") {
return sema.fail(block, elem_src, "array of opaque type '{}' not allowed", .{elem_type.fmt(pt)});
- } else if (elem_type.zigTypeTag(zcu) == .NoReturn) {
+ } else if (elem_type.zigTypeTag(zcu) == .noreturn) {
return sema.fail(block, elem_src, "array of 'noreturn' not allowed", .{});
}
}
@@ -8597,7 +8597,7 @@ fn zirErrorUnionType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
const error_set = try sema.resolveType(block, lhs_src, extra.lhs);
const payload = try sema.resolveType(block, rhs_src, extra.rhs);
- if (error_set.zigTypeTag(zcu) != .ErrorSet) {
+ if (error_set.zigTypeTag(zcu) != .error_set) {
return sema.fail(block, lhs_src, "expected error set type, found '{}'", .{
error_set.fmt(pt),
});
@@ -8610,11 +8610,11 @@ fn zirErrorUnionType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
fn validateErrorUnionPayloadType(sema: *Sema, block: *Block, payload_ty: Type, payload_src: LazySrcLoc) !void {
const pt = sema.pt;
const zcu = pt.zcu;
- if (payload_ty.zigTypeTag(zcu) == .Opaque) {
+ if (payload_ty.zigTypeTag(zcu) == .@"opaque") {
return sema.fail(block, payload_src, "error union with payload of opaque type '{}' not allowed", .{
payload_ty.fmt(pt),
});
- } else if (payload_ty.zigTypeTag(zcu) == .ErrorSet) {
+ } else if (payload_ty.zigTypeTag(zcu) == .error_set) {
return sema.fail(block, payload_src, "error union with payload of error set type '{}' not allowed", .{
payload_ty.fmt(pt),
});
@@ -8741,7 +8741,7 @@ fn zirMergeErrorSets(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
const rhs_src = block.src(.{ .node_offset_bin_rhs = inst_data.src_node });
const lhs = try sema.resolveInst(extra.lhs);
const rhs = try sema.resolveInst(extra.rhs);
- if (sema.typeOf(lhs).zigTypeTag(zcu) == .Bool and sema.typeOf(rhs).zigTypeTag(zcu) == .Bool) {
+ if (sema.typeOf(lhs).zigTypeTag(zcu) == .bool and sema.typeOf(rhs).zigTypeTag(zcu) == .bool) {
const msg = msg: {
const msg = try sema.errMsg(lhs_src, "expected error set type, found 'bool'", .{});
errdefer msg.destroy(sema.gpa);
@@ -8752,9 +8752,9 @@ fn zirMergeErrorSets(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileEr
}
const lhs_ty = try sema.analyzeAsType(block, lhs_src, lhs);
const rhs_ty = try sema.analyzeAsType(block, rhs_src, rhs);
- if (lhs_ty.zigTypeTag(zcu) != .ErrorSet)
+ if (lhs_ty.zigTypeTag(zcu) != .error_set)
return sema.fail(block, lhs_src, "expected error set type, found '{}'", .{lhs_ty.fmt(pt)});
- if (rhs_ty.zigTypeTag(zcu) != .ErrorSet)
+ if (rhs_ty.zigTypeTag(zcu) != .error_set)
return sema.fail(block, rhs_src, "expected error set type, found '{}'", .{rhs_ty.fmt(pt)});
// Anything merged with anyerror is anyerror.
@@ -8807,8 +8807,8 @@ fn zirIntFromEnum(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
const operand_ty = sema.typeOf(operand);
const enum_tag: Air.Inst.Ref = switch (operand_ty.zigTypeTag(zcu)) {
- .Enum => operand,
- .Union => blk: {
+ .@"enum" => operand,
+ .@"union" => blk: {
try operand_ty.resolveFields(pt);
const tag_ty = operand_ty.unionTagType(zcu) orelse {
return sema.fail(
@@ -8865,7 +8865,7 @@ fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
const dest_ty = try sema.resolveDestType(block, src, extra.lhs, .remove_eu_opt, "@enumFromInt");
const operand = try sema.resolveInst(extra.rhs);
- if (dest_ty.zigTypeTag(zcu) != .Enum) {
+ if (dest_ty.zigTypeTag(zcu) != .@"enum") {
return sema.fail(block, src, "expected enum, found '{}'", .{dest_ty.fmt(pt)});
}
_ = try sema.checkIntType(block, operand_src, sema.typeOf(operand));
@@ -8891,7 +8891,7 @@ fn zirEnumFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
return Air.internedToRef((try pt.getCoerced(int_val, dest_ty)).toIntern());
}
- if (dest_ty.intTagType(zcu).zigTypeTag(zcu) == .ComptimeInt) {
+ if (dest_ty.intTagType(zcu).zigTypeTag(zcu) == .comptime_int) {
return sema.failWithNeededComptime(block, operand_src, .{
.needed_comptime_reason = "value being casted to enum with 'comptime_int' tag type must be comptime-known",
});
@@ -8945,10 +8945,10 @@ fn analyzeOptionalPayloadPtr(
const pt = sema.pt;
const zcu = pt.zcu;
const optional_ptr_ty = sema.typeOf(optional_ptr);
- assert(optional_ptr_ty.zigTypeTag(zcu) == .Pointer);
+ assert(optional_ptr_ty.zigTypeTag(zcu) == .pointer);
const opt_type = optional_ptr_ty.childType(zcu);
- if (opt_type.zigTypeTag(zcu) != .Optional) {
+ if (opt_type.zigTypeTag(zcu) != .optional) {
return sema.failWithExpectedOptionalType(block, src, opt_type);
}
@@ -9019,8 +9019,8 @@ fn zirOptionalPayload(
const operand = try sema.resolveInst(inst_data.operand);
const operand_ty = sema.typeOf(operand);
const result_ty = switch (operand_ty.zigTypeTag(zcu)) {
- .Optional => operand_ty.optionalChild(zcu),
- .Pointer => t: {
+ .optional => operand_ty.optionalChild(zcu),
+ .pointer => t: {
if (operand_ty.ptrSize(zcu) != .C) {
return sema.failWithExpectedOptionalType(block, src, operand_ty);
}
@@ -9072,7 +9072,7 @@ fn zirErrUnionPayload(
const operand = try sema.resolveInst(inst_data.operand);
const operand_src = src;
const err_union_ty = sema.typeOf(operand);
- if (err_union_ty.zigTypeTag(zcu) != .ErrorUnion) {
+ if (err_union_ty.zigTypeTag(zcu) != .error_union) {
return sema.fail(block, operand_src, "expected error union type, found '{}'", .{
err_union_ty.fmt(pt),
});
@@ -9138,9 +9138,9 @@ fn analyzeErrUnionPayloadPtr(
const pt = sema.pt;
const zcu = pt.zcu;
const operand_ty = sema.typeOf(operand);
- assert(operand_ty.zigTypeTag(zcu) == .Pointer);
+ assert(operand_ty.zigTypeTag(zcu) == .pointer);
- if (operand_ty.childType(zcu).zigTypeTag(zcu) != .ErrorUnion) {
+ if (operand_ty.childType(zcu).zigTypeTag(zcu) != .error_union) {
return sema.fail(block, src, "expected error union type, found '{}'", .{
operand_ty.childType(zcu).fmt(pt),
});
@@ -9216,7 +9216,7 @@ fn analyzeErrUnionCode(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air
const pt = sema.pt;
const zcu = pt.zcu;
const operand_ty = sema.typeOf(operand);
- if (operand_ty.zigTypeTag(zcu) != .ErrorUnion) {
+ if (operand_ty.zigTypeTag(zcu) != .error_union) {
return sema.fail(block, src, "expected error union type, found '{}'", .{
operand_ty.fmt(pt),
});
@@ -9250,9 +9250,9 @@ fn analyzeErrUnionCodePtr(sema: *Sema, block: *Block, src: LazySrcLoc, operand:
const pt = sema.pt;
const zcu = pt.zcu;
const operand_ty = sema.typeOf(operand);
- assert(operand_ty.zigTypeTag(zcu) == .Pointer);
+ assert(operand_ty.zigTypeTag(zcu) == .pointer);
- if (operand_ty.childType(zcu).zigTypeTag(zcu) != .ErrorUnion) {
+ if (operand_ty.childType(zcu).zigTypeTag(zcu) != .error_union) {
return sema.fail(block, src, "expected error union type, found '{}'", .{
operand_ty.childType(zcu).fmt(pt),
});
@@ -9587,7 +9587,7 @@ fn funcCommon(
return sema.fail(block, param_src, "generic parameters not allowed in function with calling convention '{s}'", .{@tagName(cc_resolved)});
}
if (!param_ty.isValidParamType(zcu)) {
- const opaque_str = if (param_ty.zigTypeTag(zcu) == .Opaque) "opaque " else "";
+ const opaque_str = if (param_ty.zigTypeTag(zcu) == .@"opaque") "opaque " else "";
return sema.fail(block, param_src, "parameter of {s}type '{}' not allowed", .{
opaque_str, param_ty.fmt(pt),
});
@@ -9621,7 +9621,7 @@ fn funcCommon(
return sema.failWithOwnedErrorMsg(block, msg);
}
if (is_source_decl and !this_generic and is_noalias and
- !(param_ty.zigTypeTag(zcu) == .Pointer or param_ty.isPtrLikeOptional(zcu)))
+ !(param_ty.zigTypeTag(zcu) == .pointer or param_ty.isPtrLikeOptional(zcu)))
{
return sema.fail(block, param_src, "non-pointer parameter declared noalias", .{});
}
@@ -9629,7 +9629,7 @@ fn funcCommon(
.Interrupt => if (target.cpu.arch.isX86()) {
const err_code_size = target.ptrBitWidth();
switch (i) {
- 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", .{}),
+ 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", .{}),
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}),
else => return sema.fail(block, param_src, "'Interrupt' calling convention supports up to 2 parameters, found {d}", .{i + 1}),
}
@@ -9891,7 +9891,7 @@ fn finishFunc(
Type.fromInterned(ip.funcTypeReturnType(ip.typeOf(opt_func_index)));
if (!return_type.isValidReturnType(zcu)) {
- const opaque_str = if (return_type.zigTypeTag(zcu) == .Opaque) "opaque " else "";
+ const opaque_str = if (return_type.zigTypeTag(zcu) == .@"opaque") "opaque " else "";
return sema.fail(block, ret_ty_src, "{s}return type '{}' not allowed", .{
opaque_str, return_type.fmt(pt),
});
@@ -9953,7 +9953,7 @@ fn finishFunc(
}
switch (cc_resolved) {
- .Interrupt, .Signal => if (return_type.zigTypeTag(zcu) != .Void and return_type.zigTypeTag(zcu) != .NoReturn) {
+ .Interrupt, .Signal => if (return_type.zigTypeTag(zcu) != .void and return_type.zigTypeTag(zcu) != .noreturn) {
return sema.fail(block, ret_ty_src, "function with calling convention '{s}' must return 'void' or 'noreturn'", .{@tagName(cc_resolved)});
},
.Inline => if (is_noinline) {
@@ -10154,11 +10154,11 @@ fn analyzeAs(
error.GenericPoison => return operand,
};
- if (dest_ty_tag == .Opaque) {
+ if (dest_ty_tag == .@"opaque") {
return sema.fail(block, src, "cannot cast to opaque type '{}'", .{dest_ty.fmt(pt)});
}
- if (dest_ty_tag == .NoReturn) {
+ if (dest_ty_tag == .noreturn) {
return sema.fail(block, src, "cannot cast to noreturn", .{});
}
@@ -10183,7 +10183,7 @@ fn zirIntFromPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
const operand = try sema.resolveInst(inst_data.operand);
const operand_ty = sema.typeOf(operand);
const ptr_ty = operand_ty.scalarType(zcu);
- const is_vector = operand_ty.zigTypeTag(zcu) == .Vector;
+ const is_vector = operand_ty.zigTypeTag(zcu) == .vector;
if (!ptr_ty.isPtrAtRuntime(zcu)) {
return sema.fail(block, ptr_src, "expected pointer, found '{}'", .{ptr_ty.fmt(pt)});
}
@@ -10305,7 +10305,7 @@ fn zirStructInitFieldPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compi
const object_ptr = try sema.resolveInst(extra.lhs);
const struct_ty = sema.typeOf(object_ptr).childType(zcu);
switch (struct_ty.zigTypeTag(zcu)) {
- .Struct, .Union => {
+ .@"struct", .@"union" => {
return sema.fieldPtr(block, src, object_ptr, field_name, field_name_src, true);
},
else => {
@@ -10377,12 +10377,12 @@ fn intCast(
if (try sema.isComptimeKnown(operand)) {
return sema.coerce(block, dest_ty, operand, operand_src);
- } else if (dest_scalar_ty.zigTypeTag(zcu) == .ComptimeInt) {
+ } else if (dest_scalar_ty.zigTypeTag(zcu) == .comptime_int) {
return sema.fail(block, operand_src, "unable to cast runtime value to 'comptime_int'", .{});
}
try sema.checkVectorizableBinaryOperands(block, operand_src, dest_ty, operand_ty, dest_ty_src, operand_src);
- const is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
+ const is_vector = dest_ty.zigTypeTag(zcu) == .vector;
if ((try sema.typeHasOnePossibleValue(dest_ty))) |opv| {
// requirement: intCast(u0, input) iff input == 0
@@ -10529,29 +10529,29 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
const operand = try sema.resolveInst(extra.rhs);
const operand_ty = sema.typeOf(operand);
switch (dest_ty.zigTypeTag(zcu)) {
- .AnyFrame,
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .ErrorSet,
- .ErrorUnion,
- .Fn,
- .Frame,
- .NoReturn,
- .Null,
- .Opaque,
- .Optional,
- .Type,
- .Undefined,
- .Void,
+ .@"anyframe",
+ .comptime_float,
+ .comptime_int,
+ .enum_literal,
+ .error_set,
+ .error_union,
+ .@"fn",
+ .frame,
+ .noreturn,
+ .null,
+ .@"opaque",
+ .optional,
+ .type,
+ .undefined,
+ .void,
=> return sema.fail(block, src, "cannot @bitCast to '{}'", .{dest_ty.fmt(pt)}),
- .Enum => {
+ .@"enum" => {
const msg = msg: {
const msg = try sema.errMsg(src, "cannot @bitCast to '{}'", .{dest_ty.fmt(pt)});
errdefer msg.destroy(sema.gpa);
switch (operand_ty.zigTypeTag(zcu)) {
- .Int, .ComptimeInt => try sema.errNote(src, msg, "use @enumFromInt to cast from '{}'", .{operand_ty.fmt(pt)}),
+ .int, .comptime_int => try sema.errNote(src, msg, "use @enumFromInt to cast from '{}'", .{operand_ty.fmt(pt)}),
else => {},
}
@@ -10560,13 +10560,13 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
return sema.failWithOwnedErrorMsg(block, msg);
},
- .Pointer => {
+ .pointer => {
const msg = msg: {
const msg = try sema.errMsg(src, "cannot @bitCast to '{}'", .{dest_ty.fmt(pt)});
errdefer msg.destroy(sema.gpa);
switch (operand_ty.zigTypeTag(zcu)) {
- .Int, .ComptimeInt => try sema.errNote(src, msg, "use @ptrFromInt to cast from '{}'", .{operand_ty.fmt(pt)}),
- .Pointer => try sema.errNote(src, msg, "use @ptrCast to cast from '{}'", .{operand_ty.fmt(pt)}),
+ .int, .comptime_int => try sema.errNote(src, msg, "use @ptrFromInt to cast from '{}'", .{operand_ty.fmt(pt)}),
+ .pointer => try sema.errNote(src, msg, "use @ptrCast to cast from '{}'", .{operand_ty.fmt(pt)}),
else => {},
}
@@ -10574,10 +10574,10 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
};
return sema.failWithOwnedErrorMsg(block, msg);
},
- .Struct, .Union => if (dest_ty.containerLayout(zcu) == .auto) {
+ .@"struct", .@"union" => if (dest_ty.containerLayout(zcu) == .auto) {
const container = switch (dest_ty.zigTypeTag(zcu)) {
- .Struct => "struct",
- .Union => "union",
+ .@"struct" => "struct",
+ .@"union" => "union",
else => unreachable,
};
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
});
},
- .Array,
- .Bool,
- .Float,
- .Int,
- .Vector,
+ .array,
+ .bool,
+ .float,
+ .int,
+ .vector,
=> {},
}
switch (operand_ty.zigTypeTag(zcu)) {
- .AnyFrame,
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .ErrorSet,
- .ErrorUnion,
- .Fn,
- .Frame,
- .NoReturn,
- .Null,
- .Opaque,
- .Optional,
- .Type,
- .Undefined,
- .Void,
+ .@"anyframe",
+ .comptime_float,
+ .comptime_int,
+ .enum_literal,
+ .error_set,
+ .error_union,
+ .@"fn",
+ .frame,
+ .noreturn,
+ .null,
+ .@"opaque",
+ .optional,
+ .type,
+ .undefined,
+ .void,
=> return sema.fail(block, operand_src, "cannot @bitCast from '{}'", .{operand_ty.fmt(pt)}),
- .Enum => {
+ .@"enum" => {
const msg = msg: {
const msg = try sema.errMsg(operand_src, "cannot @bitCast from '{}'", .{operand_ty.fmt(pt)});
errdefer msg.destroy(sema.gpa);
switch (dest_ty.zigTypeTag(zcu)) {
- .Int, .ComptimeInt => try sema.errNote(operand_src, msg, "use @intFromEnum to cast to '{}'", .{dest_ty.fmt(pt)}),
+ .int, .comptime_int => try sema.errNote(operand_src, msg, "use @intFromEnum to cast to '{}'", .{dest_ty.fmt(pt)}),
else => {},
}
@@ -10623,13 +10623,13 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
};
return sema.failWithOwnedErrorMsg(block, msg);
},
- .Pointer => {
+ .pointer => {
const msg = msg: {
const msg = try sema.errMsg(operand_src, "cannot @bitCast from '{}'", .{operand_ty.fmt(pt)});
errdefer msg.destroy(sema.gpa);
switch (dest_ty.zigTypeTag(zcu)) {
- .Int, .ComptimeInt => try sema.errNote(operand_src, msg, "use @intFromPtr to cast to '{}'", .{dest_ty.fmt(pt)}),
- .Pointer => try sema.errNote(operand_src, msg, "use @ptrCast to cast to '{}'", .{dest_ty.fmt(pt)}),
+ .int, .comptime_int => try sema.errNote(operand_src, msg, "use @intFromPtr to cast to '{}'", .{dest_ty.fmt(pt)}),
+ .pointer => try sema.errNote(operand_src, msg, "use @ptrCast to cast to '{}'", .{dest_ty.fmt(pt)}),
else => {},
}
@@ -10637,10 +10637,10 @@ fn zirBitcast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
};
return sema.failWithOwnedErrorMsg(block, msg);
},
- .Struct, .Union => if (operand_ty.containerLayout(zcu) == .auto) {
+ .@"struct", .@"union" => if (operand_ty.containerLayout(zcu) == .auto) {
const container = switch (operand_ty.zigTypeTag(zcu)) {
- .Struct => "struct",
- .Union => "union",
+ .@"struct" => "struct",
+ .@"union" => "union",
else => unreachable,
};
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
});
},
- .Array,
- .Bool,
- .Float,
- .Int,
- .Vector,
+ .array,
+ .bool,
+ .float,
+ .int,
+ .vector,
=> {},
}
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
const operand_scalar_ty = operand_ty.scalarType(zcu);
try sema.checkVectorizableBinaryOperands(block, operand_src, dest_ty, operand_ty, src, operand_src);
- const is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
+ const is_vector = dest_ty.zigTypeTag(zcu) == .vector;
const target = zcu.getTarget();
const dest_is_comptime_float = switch (dest_scalar_ty.zigTypeTag(zcu)) {
- .ComptimeFloat => true,
- .Float => false,
+ .comptime_float => true,
+ .float => false,
else => return sema.fail(
block,
src,
@@ -10692,7 +10692,7 @@ fn zirFloatCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
};
switch (operand_scalar_ty.zigTypeTag(zcu)) {
- .ComptimeFloat, .Float, .ComptimeInt => {},
+ .comptime_float, .float, .comptime_int => {},
else => return sema.fail(
block,
operand_src,
@@ -10787,7 +10787,7 @@ fn zirElemPtr(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
const array_ptr = try sema.resolveInst(extra.lhs);
const elem_index = try sema.resolveInst(extra.rhs);
const indexable_ty = sema.typeOf(array_ptr);
- if (indexable_ty.zigTypeTag(zcu) != .Pointer) {
+ if (indexable_ty.zigTypeTag(zcu) != .pointer) {
const capture_src = block.src(.{ .for_capture_from_input = inst_data.src_node });
const msg = msg: {
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
const elem_index = try pt.intRef(Type.usize, extra.index);
const array_ty = sema.typeOf(array_ptr).childType(zcu);
switch (array_ty.zigTypeTag(zcu)) {
- .Array, .Vector => {},
+ .array, .vector => {},
else => if (!array_ty.isTuple(zcu)) {
return sema.failWithArrayInitNotSupported(block, src, array_ty);
},
@@ -11066,7 +11066,7 @@ const SwitchProngAnalysis = struct {
const pt = sema.pt;
const zcu = pt.zcu;
const operand_ty = sema.typeOf(spa.operand);
- if (operand_ty.zigTypeTag(zcu) != .Union) {
+ if (operand_ty.zigTypeTag(zcu) != .@"union") {
const tag_capture_src: LazySrcLoc = .{
.base_node_inst = capture_src.base_node_inst,
.offset = .{ .switch_tag_capture = capture_src.offset.switch_capture },
@@ -11102,7 +11102,7 @@ const SwitchProngAnalysis = struct {
if (inline_case_capture != .none) {
const item_val = sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, inline_case_capture, undefined) catch unreachable;
- if (operand_ty.zigTypeTag(zcu) == .Union) {
+ if (operand_ty.zigTypeTag(zcu) == .@"union") {
const field_index: u32 = @intCast(operand_ty.unionTagFieldIndex(item_val, zcu).?);
const union_obj = zcu.typeToUnion(operand_ty).?;
const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[field_index]);
@@ -11139,7 +11139,7 @@ const SwitchProngAnalysis = struct {
}
switch (operand_ty.zigTypeTag(zcu)) {
- .ErrorSet => if (spa.else_error_ty) |ty| {
+ .error_set => if (spa.else_error_ty) |ty| {
return sema.bitCast(block, ty, spa.operand, operand_src, null);
} else {
try sema.analyzeUnreachable(block, operand_src, false);
@@ -11150,7 +11150,7 @@ const SwitchProngAnalysis = struct {
}
switch (operand_ty.zigTypeTag(zcu)) {
- .Union => {
+ .@"union" => {
const union_obj = zcu.typeToUnion(operand_ty).?;
const first_item_val = sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, case_vals[0], undefined) catch unreachable;
@@ -11370,9 +11370,9 @@ const SwitchProngAnalysis = struct {
break :len coerce_block.instructions.items.len;
};
- try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.SwitchBr).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.SwitchBr).@"struct".fields.len +
cases_extra.items.len +
- @typeInfo(Air.Block).Struct.fields.len +
+ @typeInfo(Air.Block).@"struct".fields.len +
1);
const switch_br_inst: u32 = @intCast(sema.air_instructions.len);
@@ -11396,7 +11396,7 @@ const SwitchProngAnalysis = struct {
return capture_block_inst.toRef();
},
- .ErrorSet => {
+ .error_set => {
if (capture_byref) {
return sema.fail(
block,
@@ -11444,18 +11444,18 @@ fn switchCond(
const zcu = pt.zcu;
const operand_ty = sema.typeOf(operand);
switch (operand_ty.zigTypeTag(zcu)) {
- .Type,
- .Void,
- .Bool,
- .Int,
- .Float,
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .Pointer,
- .Fn,
- .ErrorSet,
- .Enum,
+ .type,
+ .void,
+ .bool,
+ .int,
+ .float,
+ .comptime_float,
+ .comptime_int,
+ .enum_literal,
+ .pointer,
+ .@"fn",
+ .error_set,
+ .@"enum",
=> {
if (operand_ty.isSlice(zcu)) {
return sema.fail(block, src, "switch on type '{}'", .{operand_ty.fmt(pt)});
@@ -11466,7 +11466,7 @@ fn switchCond(
return operand;
},
- .Union => {
+ .@"union" => {
try operand_ty.resolveFields(pt);
const enum_ty = operand_ty.unionTagType(zcu) orelse {
const msg = msg: {
@@ -11482,17 +11482,17 @@ fn switchCond(
return sema.unionToTag(block, enum_ty, operand, src);
},
- .ErrorUnion,
- .NoReturn,
- .Array,
- .Struct,
- .Undefined,
- .Null,
- .Optional,
- .Opaque,
- .Vector,
- .Frame,
- .AnyFrame,
+ .error_union,
+ .noreturn,
+ .array,
+ .@"struct",
+ .undefined,
+ .null,
+ .optional,
+ .@"opaque",
+ .vector,
+ .frame,
+ .@"anyframe",
=> return sema.fail(block, src, "switch on type '{}'", .{operand_ty.fmt(pt)}),
}
}
@@ -11593,7 +11593,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp
else
operand_ty;
- if (operand_err_set.zigTypeTag(zcu) != .ErrorUnion) {
+ if (operand_err_set.zigTypeTag(zcu) != .error_union) {
return sema.fail(block, switch_src, "expected error union type, found '{}'", .{
operand_ty.fmt(pt),
});
@@ -11791,7 +11791,7 @@ fn zirSwitchBlockErrUnion(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Comp
true,
);
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).@"struct".fields.len +
true_instructions.len + sub_block.instructions.items.len);
_ = try child_block.addInst(.{
@@ -11886,7 +11886,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
};
const maybe_union_ty = sema.typeOf(raw_operand_val);
- const union_originally = maybe_union_ty.zigTypeTag(zcu) == .Union;
+ const union_originally = maybe_union_ty.zigTypeTag(zcu) == .@"union";
// Duplicate checking variables later also used for `inline else`.
var seen_enum_fields: []?LazySrcLoc = &.{};
@@ -11904,7 +11904,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
var empty_enum = false;
const operand_ty = sema.typeOf(operand);
- const err_set = operand_ty.zigTypeTag(zcu) == .ErrorSet;
+ const err_set = operand_ty.zigTypeTag(zcu) == .error_set;
var else_error_ty: ?Type = null;
@@ -11936,8 +11936,8 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
// Validate for duplicate items, missing else prong, and invalid range.
switch (operand_ty.zigTypeTag(zcu)) {
- .Union => unreachable, // handled in `switchCond`
- .Enum => {
+ .@"union" => unreachable, // handled in `switchCond`
+ .@"enum" => {
seen_enum_fields = try gpa.alloc(?LazySrcLoc, operand_ty.enumFieldCount(zcu));
empty_enum = seen_enum_fields.len == 0 and !operand_ty.isNonexhaustiveEnum(zcu);
@memset(seen_enum_fields, null);
@@ -12046,7 +12046,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
);
}
},
- .ErrorSet => else_error_ty = try validateErrSetSwitch(
+ .error_set => else_error_ty = try validateErrSetSwitch(
sema,
block,
&seen_errors,
@@ -12058,7 +12058,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
.{ .body = special.body, .end = special.end, .src = special_prong_src },
special_prong == .@"else",
),
- .Int, .ComptimeInt => {
+ .int, .comptime_int => {
var extra_index: usize = special.end;
{
var scalar_i: u32 = 0;
@@ -12137,7 +12137,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
}
check_range: {
- if (operand_ty.zigTypeTag(zcu) == .Int) {
+ if (operand_ty.zigTypeTag(zcu) == .int) {
const min_int = try operand_ty.minInt(pt, operand_ty);
const max_int = try operand_ty.maxInt(pt, operand_ty);
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
}
}
},
- .Bool => {
+ .bool => {
var extra_index: usize = special.end;
{
var scalar_i: u32 = 0;
@@ -12238,7 +12238,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
},
}
},
- .EnumLiteral, .Void, .Fn, .Pointer, .Type => {
+ .enum_literal, .void, .@"fn", .pointer, .type => {
if (special_prong != .@"else") {
return sema.fail(
block,
@@ -12306,19 +12306,19 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
}
},
- .ErrorUnion,
- .NoReturn,
- .Array,
- .Struct,
- .Undefined,
- .Null,
- .Optional,
- .Opaque,
- .Vector,
- .Frame,
- .AnyFrame,
- .ComptimeFloat,
- .Float,
+ .error_union,
+ .noreturn,
+ .array,
+ .@"struct",
+ .undefined,
+ .null,
+ .optional,
+ .@"opaque",
+ .vector,
+ .frame,
+ .@"anyframe",
+ .comptime_float,
+ .float,
=> return sema.fail(block, operand_src, "invalid switch operand type '{}'", .{
operand_ty.fmt(pt),
}),
@@ -12401,7 +12401,7 @@ fn zirSwitchBlock(sema: *Sema, block: *Block, inst: Zir.Inst.Index, operand_is_r
if (err_set and try sema.maybeErrorUnwrap(block, special.body, operand, operand_src, false)) {
return .unreachable_value;
}
- if (zcu.backendSupportsFeature(.is_named_enum_value) and block.wantSafety() and operand_ty.zigTypeTag(zcu) == .Enum and
+ if (zcu.backendSupportsFeature(.is_named_enum_value) and block.wantSafety() and operand_ty.zigTypeTag(zcu) == .@"enum" and
(!operand_ty.isNonexhaustiveEnum(zcu) or union_originally))
{
try sema.zirDbgStmt(block, cond_dbg_node_index);
@@ -12502,7 +12502,7 @@ fn analyzeSwitchRuntimeBlock(
const block = child_block.parent.?;
const estimated_cases_extra = (scalar_cases_len + multi_cases_len) *
- @typeInfo(Air.SwitchBr.Case).Struct.fields.len + 2;
+ @typeInfo(Air.SwitchBr.Case).@"struct".fields.len + 2;
var cases_extra = try std.ArrayListUnmanaged(u32).initCapacity(gpa, estimated_cases_extra);
defer cases_extra.deinit(gpa);
@@ -12536,7 +12536,7 @@ fn analyzeSwitchRuntimeBlock(
const unresolved_item_val = sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, item, undefined) catch unreachable;
const item_val = sema.resolveLazyValue(unresolved_item_val) catch unreachable;
const field_ty = maybe_union_ty.unionFieldType(item_val, zcu).?;
- break :blk field_ty.zigTypeTag(zcu) != .NoReturn;
+ break :blk field_ty.zigTypeTag(zcu) != .noreturn;
} else true;
const prong_hint: std.builtin.BranchHint = if (err_set and
@@ -12669,7 +12669,7 @@ fn analyzeSwitchRuntimeBlock(
const analyze_body = if (union_originally) blk: {
const item_val = sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, item, undefined) catch unreachable;
const field_ty = maybe_union_ty.unionFieldType(item_val, zcu).?;
- break :blk field_ty.zigTypeTag(zcu) != .NoReturn;
+ break :blk field_ty.zigTypeTag(zcu) != .noreturn;
} else true;
if (emit_bb) try sema.emitBackwardBranch(block, block.src(.{ .switch_case_item = .{
@@ -12722,7 +12722,7 @@ fn analyzeSwitchRuntimeBlock(
for (items) |item| {
const item_val = sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, item, undefined) catch unreachable;
const field_ty = maybe_union_ty.unionFieldType(item_val, zcu).?;
- if (field_ty.zigTypeTag(zcu) != .NoReturn) break true;
+ if (field_ty.zigTypeTag(zcu) != .noreturn) break true;
} else false
else
true;
@@ -12847,7 +12847,7 @@ fn analyzeSwitchRuntimeBlock(
} else {
try sema.air_extra.ensureUnusedCapacity(
gpa,
- @typeInfo(Air.CondBr).Struct.fields.len + prev_then_body.len + cond_body.len,
+ @typeInfo(Air.CondBr).@"struct".fields.len + prev_then_body.len + cond_body.len,
);
sema.air_instructions.items(.data)[@intFromEnum(prev_cond_br)].pl_op.payload = sema.addExtraAssumeCapacity(Air.CondBr{
@@ -12869,7 +12869,7 @@ fn analyzeSwitchRuntimeBlock(
if (special.body.len != 0 or !is_first or case_block.wantSafety()) {
var emit_bb = false;
if (special.is_inline) switch (operand_ty.zigTypeTag(zcu)) {
- .Enum => {
+ .@"enum" => {
if (operand_ty.isNonexhaustiveEnum(zcu) and !union_originally) {
return sema.fail(block, special_prong_src, "cannot enumerate values of type '{}' for 'inline else'", .{
operand_ty.fmt(pt),
@@ -12887,7 +12887,7 @@ fn analyzeSwitchRuntimeBlock(
const analyze_body = if (union_originally) blk: {
const field_ty = maybe_union_ty.unionFieldType(item_val, zcu).?;
- break :blk field_ty.zigTypeTag(zcu) != .NoReturn;
+ break :blk field_ty.zigTypeTag(zcu) != .noreturn;
} else true;
if (emit_bb) try sema.emitBackwardBranch(block, special_prong_src);
@@ -12920,7 +12920,7 @@ fn analyzeSwitchRuntimeBlock(
cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items));
}
},
- .ErrorSet => {
+ .error_set => {
if (operand_ty.isAnyError(zcu)) {
return sema.fail(block, special_prong_src, "cannot enumerate values of type '{}' for 'inline else'", .{
operand_ty.fmt(pt),
@@ -12966,7 +12966,7 @@ fn analyzeSwitchRuntimeBlock(
cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items));
}
},
- .Int => {
+ .int => {
var it = try RangeSetUnhandledIterator.init(sema, operand_ty, range_set);
while (try it.next()) |cur| {
cases_len += 1;
@@ -13001,7 +13001,7 @@ fn analyzeSwitchRuntimeBlock(
cases_extra.appendSliceAssumeCapacity(@ptrCast(case_block.instructions.items));
}
},
- .Bool => {
+ .bool => {
if (true_count == 0) {
cases_len += 1;
@@ -13073,7 +13073,7 @@ fn analyzeSwitchRuntimeBlock(
if (zcu.backendSupportsFeature(.is_named_enum_value) and
special.body.len != 0 and block.wantSafety() and
- operand_ty.zigTypeTag(zcu) == .Enum and
+ operand_ty.zigTypeTag(zcu) == .@"enum" and
(!operand_ty.isNonexhaustiveEnum(zcu) or union_originally))
{
try sema.zirDbgStmt(&case_block, cond_dbg_node_index);
@@ -13086,7 +13086,7 @@ fn analyzeSwitchRuntimeBlock(
if (seen_field != null) continue;
const union_obj = zcu.typeToUnion(maybe_union_ty).?;
const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[index]);
- if (field_ty.zigTypeTag(zcu) != .NoReturn) break true;
+ if (field_ty.zigTypeTag(zcu) != .noreturn) break true;
} else false
else
true;
@@ -13128,7 +13128,7 @@ fn analyzeSwitchRuntimeBlock(
} else {
try branch_hints.append(gpa, .none); // we have the range conditionals first
try sema.air_extra.ensureUnusedCapacity(gpa, prev_then_body.len +
- @typeInfo(Air.CondBr).Struct.fields.len + case_block.instructions.items.len);
+ @typeInfo(Air.CondBr).@"struct".fields.len + case_block.instructions.items.len);
sema.air_instructions.items(.data)[@intFromEnum(prev_cond_br)].pl_op.payload = sema.addExtraAssumeCapacity(Air.CondBr{
.then_body_len = @intCast(prev_then_body.len),
@@ -13145,7 +13145,7 @@ fn analyzeSwitchRuntimeBlock(
assert(branch_hints.items.len == cases_len + 1);
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.SwitchBr).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.SwitchBr).@"struct".fields.len +
cases_extra.items.len + final_else_body.len +
(std.math.divCeil(usize, branch_hints.items.len, 10) catch unreachable)); // branch hints
@@ -13847,7 +13847,7 @@ fn maybeErrorUnwrapCondbr(sema: *Sema, block: *Block, body: []const Zir.Inst.Ind
const err_inst_data = sema.code.instructions.items(.data)[@intFromEnum(index)].un_node;
const err_operand = try sema.resolveInst(err_inst_data.operand);
const operand_ty = sema.typeOf(err_operand);
- if (operand_ty.zigTypeTag(zcu) == .ErrorSet) {
+ if (operand_ty.zigTypeTag(zcu) == .error_set) {
try sema.maybeErrorUnwrapComptime(block, body, err_operand);
return;
}
@@ -14076,9 +14076,9 @@ fn zirShl(
if (try rhs_val.compareAllWithZeroSema(.eq, pt)) {
return lhs;
}
- if (scalar_ty.zigTypeTag(zcu) != .ComptimeInt and air_tag != .shl_sat) {
+ if (scalar_ty.zigTypeTag(zcu) != .comptime_int and air_tag != .shl_sat) {
const bit_value = try pt.intValue(Type.comptime_int, scalar_ty.intInfo(zcu).bits);
- if (rhs_ty.zigTypeTag(zcu) == .Vector) {
+ if (rhs_ty.zigTypeTag(zcu) == .vector) {
var i: usize = 0;
while (i < rhs_ty.vectorLen(zcu)) : (i += 1) {
const rhs_elem = try rhs_val.elemValue(pt, i);
@@ -14097,7 +14097,7 @@ fn zirShl(
});
}
}
- if (rhs_ty.zigTypeTag(zcu) == .Vector) {
+ if (rhs_ty.zigTypeTag(zcu) == .vector) {
var i: usize = 0;
while (i < rhs_ty.vectorLen(zcu)) : (i += 1) {
const rhs_elem = try rhs_val.elemValue(pt, i);
@@ -14118,12 +14118,12 @@ fn zirShl(
const runtime_src = if (maybe_lhs_val) |lhs_val| rs: {
if (lhs_val.isUndef(zcu)) return pt.undefRef(lhs_ty);
const rhs_val = maybe_rhs_val orelse {
- if (scalar_ty.zigTypeTag(zcu) == .ComptimeInt) {
+ if (scalar_ty.zigTypeTag(zcu) == .comptime_int) {
return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be comptime-known", .{});
}
break :rs rhs_src;
};
- const val = if (scalar_ty.zigTypeTag(zcu) == .ComptimeInt)
+ const val = if (scalar_ty.zigTypeTag(zcu) == .comptime_int)
try lhs_val.shl(rhs_val, lhs_ty, sema.arena, pt)
else switch (air_tag) {
.shl_exact => val: {
@@ -14158,7 +14158,7 @@ fn zirShl(
const bit_count = scalar_ty.intInfo(zcu).bits;
if (!std.math.isPowerOfTwo(bit_count)) {
const bit_count_val = try pt.intValue(scalar_rhs_ty, bit_count);
- const ok = if (rhs_ty.zigTypeTag(zcu) == .Vector) ok: {
+ const ok = if (rhs_ty.zigTypeTag(zcu) == .vector) ok: {
const bit_count_inst = Air.internedToRef((try sema.splat(rhs_ty, bit_count_val)).toIntern());
const lt = try block.addCmpVector(rhs, bit_count_inst, .lt);
break :ok try block.addInst(.{
@@ -14188,7 +14188,7 @@ fn zirShl(
} },
});
const ov_bit = try sema.tupleFieldValByIndex(block, src, op_ov, 1, op_ov_tuple_ty);
- const any_ov_bit = if (lhs_ty.zigTypeTag(zcu) == .Vector)
+ const any_ov_bit = if (lhs_ty.zigTypeTag(zcu) == .vector)
try block.addInst(.{
.tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
.data = .{ .reduce = .{
@@ -14242,9 +14242,9 @@ fn zirShr(
if (try rhs_val.compareAllWithZeroSema(.eq, pt)) {
return lhs;
}
- if (scalar_ty.zigTypeTag(zcu) != .ComptimeInt) {
+ if (scalar_ty.zigTypeTag(zcu) != .comptime_int) {
const bit_value = try pt.intValue(Type.comptime_int, scalar_ty.intInfo(zcu).bits);
- if (rhs_ty.zigTypeTag(zcu) == .Vector) {
+ if (rhs_ty.zigTypeTag(zcu) == .vector) {
var i: usize = 0;
while (i < rhs_ty.vectorLen(zcu)) : (i += 1) {
const rhs_elem = try rhs_val.elemValue(pt, i);
@@ -14263,7 +14263,7 @@ fn zirShr(
});
}
}
- if (rhs_ty.zigTypeTag(zcu) == .Vector) {
+ if (rhs_ty.zigTypeTag(zcu) == .vector) {
var i: usize = 0;
while (i < rhs_ty.vectorLen(zcu)) : (i += 1) {
const rhs_elem = try rhs_val.elemValue(pt, i);
@@ -14297,7 +14297,7 @@ fn zirShr(
}
} else rhs_src;
- if (maybe_rhs_val == null and scalar_ty.zigTypeTag(zcu) == .ComptimeInt) {
+ if (maybe_rhs_val == null and scalar_ty.zigTypeTag(zcu) == .comptime_int) {
return sema.fail(block, src, "LHS of shift must be a fixed-width integer type, or RHS must be comptime-known", .{});
}
@@ -14308,7 +14308,7 @@ fn zirShr(
if (!std.math.isPowerOfTwo(bit_count)) {
const bit_count_val = try pt.intValue(rhs_ty.scalarType(zcu), bit_count);
- const ok = if (rhs_ty.zigTypeTag(zcu) == .Vector) ok: {
+ const ok = if (rhs_ty.zigTypeTag(zcu) == .vector) ok: {
const bit_count_inst = Air.internedToRef((try sema.splat(rhs_ty, bit_count_val)).toIntern());
const lt = try block.addCmpVector(rhs, bit_count_inst, .lt);
break :ok try block.addInst(.{
@@ -14328,7 +14328,7 @@ fn zirShr(
if (air_tag == .shr_exact) {
const back = try block.addBinOp(.shl, result, rhs);
- const ok = if (rhs_ty.zigTypeTag(zcu) == .Vector) ok: {
+ const ok = if (rhs_ty.zigTypeTag(zcu) == .vector) ok: {
const eql = try block.addCmpVector(lhs, back, .eq);
break :ok try block.addInst(.{
.tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
@@ -14374,7 +14374,7 @@ fn zirBitwise(
const casted_lhs = try sema.coerce(block, resolved_type, lhs, lhs_src);
const casted_rhs = try sema.coerce(block, resolved_type, rhs, rhs_src);
- const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
+ const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
if (!is_int) {
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.
const operand_type = sema.typeOf(operand);
const scalar_type = operand_type.scalarType(zcu);
- if (scalar_type.zigTypeTag(zcu) != .Int) {
+ if (scalar_type.zigTypeTag(zcu) != .int) {
return sema.fail(block, src, "unable to perform binary not operation on type '{}'", .{
operand_type.fmt(pt),
});
@@ -14427,7 +14427,7 @@ fn zirBitNot(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
if (try sema.resolveValue(operand)) |val| {
if (val.isUndef(zcu)) {
return pt.undefRef(operand_type);
- } else if (operand_type.zigTypeTag(zcu) == .Vector) {
+ } else if (operand_type.zigTypeTag(zcu) == .vector) {
const vec_len = try sema.usizeCast(block, operand_src, operand_type.vectorLen(zcu));
const elems = try sema.arena.alloc(InternPool.Index, vec_len);
for (elems, 0..) |*elem, i| {
@@ -14647,19 +14647,19 @@ fn zirArrayCat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
.child = resolved_elem_ty.toIntern(),
});
const ptr_addrspace = p: {
- if (lhs_ty.zigTypeTag(zcu) == .Pointer) break :p lhs_ty.ptrAddressSpace(zcu);
- if (rhs_ty.zigTypeTag(zcu) == .Pointer) break :p rhs_ty.ptrAddressSpace(zcu);
+ if (lhs_ty.zigTypeTag(zcu) == .pointer) break :p lhs_ty.ptrAddressSpace(zcu);
+ if (rhs_ty.zigTypeTag(zcu) == .pointer) break :p rhs_ty.ptrAddressSpace(zcu);
break :p null;
};
const runtime_src = if (switch (lhs_ty.zigTypeTag(zcu)) {
- .Array, .Struct => try sema.resolveValue(lhs),
- .Pointer => try sema.resolveDefinedValue(block, lhs_src, lhs),
+ .array, .@"struct" => try sema.resolveValue(lhs),
+ .pointer => try sema.resolveDefinedValue(block, lhs_src, lhs),
else => unreachable,
}) |lhs_val| rs: {
if (switch (rhs_ty.zigTypeTag(zcu)) {
- .Array, .Struct => try sema.resolveValue(rhs),
- .Pointer => try sema.resolveDefinedValue(block, rhs_src, rhs),
+ .array, .@"struct" => try sema.resolveValue(rhs),
+ .pointer => try sema.resolveDefinedValue(block, rhs_src, rhs),
else => unreachable,
}) |rhs_val| {
const lhs_sub_val = if (lhs_ty.isSinglePointer(zcu))
@@ -14789,8 +14789,8 @@ fn getArrayCatInfo(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air.Ins
const zcu = pt.zcu;
const operand_ty = sema.typeOf(operand);
switch (operand_ty.zigTypeTag(zcu)) {
- .Array => return operand_ty.arrayInfo(zcu),
- .Pointer => {
+ .array => return operand_ty.arrayInfo(zcu),
+ .pointer => {
const ptr_info = operand_ty.ptrInfo(zcu);
switch (ptr_info.flags.size) {
.Slice => {
@@ -14807,14 +14807,14 @@ fn getArrayCatInfo(sema: *Sema, block: *Block, src: LazySrcLoc, operand: Air.Ins
};
},
.One => {
- if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .Array) {
+ if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .array) {
return Type.fromInterned(ptr_info.child).arrayInfo(zcu);
}
},
.C, .Many => {},
}
},
- .Struct => {
+ .@"struct" => {
if (operand_ty.isTuple(zcu) and peer_ty.isIndexable(zcu)) {
assert(!peer_ty.isTuple(zcu));
return .{
@@ -14934,12 +14934,12 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
const lhs_len = uncoerced_lhs_ty.structFieldCount(zcu);
const lhs_dest_ty = switch (res_ty.zigTypeTag(zcu)) {
else => break :no_coerce,
- .Array => try pt.arrayType(.{
+ .array => try pt.arrayType(.{
.child = res_ty.childType(zcu).toIntern(),
.len = lhs_len,
.sentinel = if (res_ty.sentinel(zcu)) |s| s.toIntern() else .none,
}),
- .Vector => try pt.vectorType(.{
+ .vector => try pt.vectorType(.{
.child = res_ty.childType(zcu).toIntern(),
.len = lhs_len,
}),
@@ -14971,7 +14971,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
const msg = try sema.errMsg(lhs_src, "expected indexable; found '{}'", .{lhs_ty.fmt(pt)});
errdefer msg.destroy(sema.gpa);
switch (lhs_ty.zigTypeTag(zcu)) {
- .Int, .Float, .ComptimeFloat, .ComptimeInt, .Vector => {
+ .int, .float, .comptime_float, .comptime_int, .vector => {
try sema.errNote(operator_src, msg, "this operator multiplies arrays; use std.math.pow for exponentiation", .{});
},
else => {},
@@ -14996,7 +14996,7 @@ fn zirArrayMul(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
.child = lhs_info.elem_type.toIntern(),
});
- const ptr_addrspace = if (lhs_ty.zigTypeTag(zcu) == .Pointer) lhs_ty.ptrAddressSpace(zcu) else null;
+ const ptr_addrspace = if (lhs_ty.zigTypeTag(zcu) == .pointer) lhs_ty.ptrAddressSpace(zcu) else null;
const lhs_len = try sema.usizeCast(block, lhs_src, lhs_info.len);
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.
const rhs_scalar_ty = rhs_ty.scalarType(zcu);
if (rhs_scalar_ty.isUnsignedInt(zcu) or switch (rhs_scalar_ty.zigTypeTag(zcu)) {
- .Int, .ComptimeInt, .Float, .ComptimeFloat => false,
+ .int, .comptime_int, .float, .comptime_float => false,
else => true,
}) {
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!
const rhs_scalar_ty = rhs_ty.scalarType(zcu);
switch (rhs_scalar_ty.zigTypeTag(zcu)) {
- .Int, .ComptimeInt, .Float, .ComptimeFloat => {},
+ .int, .comptime_int, .float, .comptime_float => {},
else => return sema.fail(block, src, "negation of type '{}'", .{rhs_ty.fmt(pt)}),
}
@@ -15187,15 +15187,15 @@ fn zirDiv(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins
const rhs_scalar_ty = rhs_ty.scalarType(zcu);
const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
- const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
+ const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .div);
const maybe_lhs_val = try sema.resolveValueIntable(casted_lhs);
const maybe_rhs_val = try sema.resolveValueIntable(casted_rhs);
- if ((lhs_ty.zigTypeTag(zcu) == .ComptimeFloat and rhs_ty.zigTypeTag(zcu) == .ComptimeInt) or
- (lhs_ty.zigTypeTag(zcu) == .ComptimeInt and rhs_ty.zigTypeTag(zcu) == .ComptimeFloat))
+ if ((lhs_ty.zigTypeTag(zcu) == .comptime_float and rhs_ty.zigTypeTag(zcu) == .comptime_int) or
+ (lhs_ty.zigTypeTag(zcu) == .comptime_int and rhs_ty.zigTypeTag(zcu) == .comptime_float))
{
// If it makes a difference whether we coerce to ints or floats before doing the division, error.
// 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
// * other float type: result is undefined
// If the lhs is undefined, result is undefined.
switch (scalar_tag) {
- .Int, .ComptimeInt, .ComptimeFloat => {
+ .int, .comptime_int, .comptime_float => {
if (maybe_lhs_val) |lhs_val| {
if (!lhs_val.isUndef(zcu)) {
if (try lhs_val.compareAllWithZeroSema(.eq, pt)) {
const scalar_zero = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
- .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
+ .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
+ .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
else => unreachable,
};
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
const lhs_scalar_ty = lhs_ty.scalarType(zcu);
const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
- const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
+ const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .div_exact);
@@ -15382,8 +15382,8 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
} else {
if (try lhs_val.compareAllWithZeroSema(.eq, pt)) {
const scalar_zero = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
- .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
+ .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
+ .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
else => unreachable,
};
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
const ok = if (!is_int) ok: {
const floored = try block.addUnOp(.floor, result);
- if (resolved_type.zigTypeTag(zcu) == .Vector) {
+ if (resolved_type.zigTypeTag(zcu) == .vector) {
const eql = try block.addCmpVector(result, floored, .eq);
break :ok try block.addInst(.{
.tag = switch (block.float_mode) {
@@ -15462,11 +15462,11 @@ fn zirDivExact(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
const remainder = try block.addBinOp(.rem, casted_lhs, casted_rhs);
const scalar_zero = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
- .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
+ .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
+ .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
else => unreachable,
};
- if (resolved_type.zigTypeTag(zcu) == .Vector) {
+ if (resolved_type.zigTypeTag(zcu) == .vector) {
const zero_val = try sema.splat(resolved_type, scalar_zero);
const zero = Air.internedToRef(zero_val.toIntern());
const eql = try block.addCmpVector(remainder, zero, .eq);
@@ -15519,7 +15519,7 @@ fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
const rhs_scalar_ty = rhs_ty.scalarType(zcu);
const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
- const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
+ const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .div_floor);
@@ -15550,8 +15550,8 @@ fn zirDivFloor(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
if (!lhs_val.isUndef(zcu)) {
if (try lhs_val.compareAllWithZeroSema(.eq, pt)) {
const scalar_zero = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
- .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
+ .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
+ .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
else => unreachable,
};
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
const rhs_scalar_ty = rhs_ty.scalarType(zcu);
const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
- const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
+ const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .div_trunc);
@@ -15661,8 +15661,8 @@ fn zirDivTrunc(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
if (!lhs_val.isUndef(zcu)) {
if (try lhs_val.compareAllWithZeroSema(.eq, pt)) {
const scalar_zero = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
- .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
+ .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
+ .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
else => unreachable,
};
const zero_val = try sema.splat(resolved_type, scalar_zero);
@@ -15756,7 +15756,7 @@ fn addDivIntOverflowSafety(
}
var ok: Air.Inst.Ref = .none;
- if (resolved_type.zigTypeTag(zcu) == .Vector) {
+ if (resolved_type.zigTypeTag(zcu) == .vector) {
if (maybe_lhs_val == null) {
const min_int_ref = Air.internedToRef(min_int.toIntern());
ok = try block.addCmpVector(casted_lhs, min_int_ref, .neq);
@@ -15819,7 +15819,7 @@ fn addDivByZeroSafety(
try pt.intValue(resolved_type.scalarType(zcu), 0)
else
try pt.floatValue(resolved_type.scalarType(zcu), 0.0);
- const ok = if (resolved_type.zigTypeTag(zcu) == .Vector) ok: {
+ const ok = if (resolved_type.zigTypeTag(zcu) == .vector) ok: {
const zero_val = try sema.splat(resolved_type, scalar_zero);
const zero = Air.internedToRef(zero_val.toIntern());
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.
.override = &[_]?LazySrcLoc{ lhs_src, rhs_src },
});
- const is_vector = resolved_type.zigTypeTag(zcu) == .Vector;
+ const is_vector = resolved_type.zigTypeTag(zcu) == .vector;
const casted_lhs = try sema.coerce(block, resolved_type, lhs, lhs_src);
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.
const rhs_scalar_ty = rhs_ty.scalarType(zcu);
const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
- const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
+ const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .mod_rem);
@@ -15904,8 +15904,8 @@ fn zirModRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
}
if (try lhs_val.compareAllWithZeroSema(.eq, pt)) {
const scalar_zero = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
- .ComptimeInt, .Int => try pt.intValue(resolved_type.scalarType(zcu), 0),
+ .comptime_float, .float => try pt.floatValue(resolved_type.scalarType(zcu), 0.0),
+ .comptime_int, .int => try pt.intValue(resolved_type.scalarType(zcu), 0),
else => unreachable,
};
const zero_val = if (is_vector) Value.fromInterned(try pt.intern(.{ .aggregate = .{
@@ -15987,7 +15987,7 @@ fn intRem(
) CompileError!Value {
const pt = sema.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try sema.arena.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -16058,7 +16058,7 @@ fn zirMod(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins
const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
- const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
+ const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .mod);
@@ -16154,7 +16154,7 @@ fn zirRem(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Ins
const scalar_tag = resolved_type.scalarType(zcu).zigTypeTag(zcu);
- const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
+ const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, .rem);
@@ -16265,7 +16265,7 @@ fn zirOverflowArithmetic(
const lhs = try sema.coerce(block, dest_ty, uncasted_lhs, lhs_src);
const rhs = try sema.coerce(block, rhs_dest_ty, uncasted_rhs, rhs_src);
- if (dest_ty.scalarType(zcu).zigTypeTag(zcu) != .Int) {
+ if (dest_ty.scalarType(zcu).zigTypeTag(zcu) != .int) {
return sema.fail(block, src, "expected vector of integers or integer tag type, found '{}'", .{dest_ty.fmt(pt)});
}
@@ -16438,7 +16438,7 @@ fn zirOverflowArithmetic(
fn splat(sema: *Sema, ty: Type, val: Value) !Value {
const pt = sema.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) != .Vector) return val;
+ if (ty.zigTypeTag(zcu) != .vector) return val;
const repeated = try pt.intern(.{ .aggregate = .{
.ty = ty.toIntern(),
.storage = .{ .repeated_elem = val.toIntern() },
@@ -16450,7 +16450,7 @@ fn overflowArithmeticTupleType(sema: *Sema, ty: Type) !Type {
const pt = sema.pt;
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
- const ov_ty = if (ty.zigTypeTag(zcu) == .Vector) try pt.vectorType(.{
+ const ov_ty = if (ty.zigTypeTag(zcu) == .vector) try pt.vectorType(.{
.len = ty.vectorLen(zcu),
.child = .u1_type,
}) else Type.u1;
@@ -16485,8 +16485,8 @@ fn analyzeArithmetic(
const rhs_zig_ty_tag = try rhs_ty.zigTypeTagOrPoison(zcu);
try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src);
- if (lhs_zig_ty_tag == .Pointer) {
- if (rhs_zig_ty_tag == .Pointer) {
+ if (lhs_zig_ty_tag == .pointer) {
+ if (rhs_zig_ty_tag == .pointer) {
if (lhs_ty.ptrSize(zcu) != .Slice and rhs_ty.ptrSize(zcu) != .Slice) {
if (zir_tag != .sub) {
return sema.failWithInvalidPtrArithmetic(block, src, "pointer-pointer", "subtraction");
@@ -16569,7 +16569,7 @@ fn analyzeArithmetic(
const scalar_type = resolved_type.scalarType(zcu);
const scalar_tag = scalar_type.zigTypeTag(zcu);
- const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
+ const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
try sema.checkArithmeticOp(block, src, scalar_tag, lhs_zig_ty_tag, rhs_zig_ty_tag, zir_tag);
@@ -16667,7 +16667,7 @@ fn analyzeArithmetic(
return pt.undefRef(resolved_type);
}
- const val = if (scalar_tag == .ComptimeInt)
+ const val = if (scalar_tag == .comptime_int)
try sema.intAdd(lhs_val, rhs_val, resolved_type, undefined)
else
try lhs_val.intAddSat(rhs_val, resolved_type, sema.arena, pt);
@@ -16765,7 +16765,7 @@ fn analyzeArithmetic(
return pt.undefRef(resolved_type);
}
if (maybe_rhs_val) |rhs_val| {
- const val = if (scalar_tag == .ComptimeInt)
+ const val = if (scalar_tag == .comptime_int)
try sema.intSub(lhs_val, rhs_val, resolved_type, undefined)
else
try lhs_val.intSubSat(rhs_val, resolved_type, sema.arena, pt);
@@ -16789,13 +16789,13 @@ fn analyzeArithmetic(
// the result is nan.
// If either of the operands are nan, the result is nan.
const scalar_zero = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 0.0),
- .ComptimeInt, .Int => try pt.intValue(scalar_type, 0),
+ .comptime_float, .float => try pt.floatValue(scalar_type, 0.0),
+ .comptime_int, .int => try pt.intValue(scalar_type, 0),
else => unreachable,
};
const scalar_one = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 1.0),
- .ComptimeInt, .Int => try pt.intValue(scalar_type, 1),
+ .comptime_float, .float => try pt.floatValue(scalar_type, 1.0),
+ .comptime_int, .int => try pt.intValue(scalar_type, 1),
else => unreachable,
};
if (maybe_lhs_val) |lhs_val| {
@@ -16875,13 +16875,13 @@ fn analyzeArithmetic(
// If either of the operands are one, result is the other operand.
// If either of the operands are undefined, result is undefined.
const scalar_zero = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 0.0),
- .ComptimeInt, .Int => try pt.intValue(scalar_type, 0),
+ .comptime_float, .float => try pt.floatValue(scalar_type, 0.0),
+ .comptime_int, .int => try pt.intValue(scalar_type, 0),
else => unreachable,
};
const scalar_one = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 1.0),
- .ComptimeInt, .Int => try pt.intValue(scalar_type, 1),
+ .comptime_float, .float => try pt.floatValue(scalar_type, 1.0),
+ .comptime_int, .int => try pt.intValue(scalar_type, 1),
else => unreachable,
};
if (maybe_lhs_val) |lhs_val| {
@@ -16920,13 +16920,13 @@ fn analyzeArithmetic(
// If either of the operands are one, result is the other operand.
// If either of the operands are undefined, result is undefined.
const scalar_zero = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 0.0),
- .ComptimeInt, .Int => try pt.intValue(scalar_type, 0),
+ .comptime_float, .float => try pt.floatValue(scalar_type, 0.0),
+ .comptime_int, .int => try pt.intValue(scalar_type, 0),
else => unreachable,
};
const scalar_one = switch (scalar_tag) {
- .ComptimeFloat, .Float => try pt.floatValue(scalar_type, 1.0),
- .ComptimeInt, .Int => try pt.intValue(scalar_type, 1),
+ .comptime_float, .float => try pt.floatValue(scalar_type, 1.0),
+ .comptime_int, .int => try pt.intValue(scalar_type, 1),
else => unreachable,
};
if (maybe_lhs_val) |lhs_val| {
@@ -16956,7 +16956,7 @@ fn analyzeArithmetic(
return pt.undefRef(resolved_type);
}
- const val = if (scalar_tag == .ComptimeInt)
+ const val = if (scalar_tag == .comptime_int)
try lhs_val.intMul(rhs_val, resolved_type, undefined, sema.arena, pt)
else
try lhs_val.intMulSat(rhs_val, resolved_type, sema.arena, pt);
@@ -16971,7 +16971,7 @@ fn analyzeArithmetic(
try sema.requireRuntimeBlock(block, src, runtime_src);
- if (block.wantSafety() and want_safety and scalar_tag == .Int) {
+ if (block.wantSafety() and want_safety and scalar_tag == .int) {
if (zcu.backendSupportsFeature(.safety_checked_instructions)) {
if (air_tag != air_tag_safe) {
_ = try sema.preparePanicId(block, src, .integer_overflow);
@@ -16997,7 +16997,7 @@ fn analyzeArithmetic(
} },
});
const ov_bit = try sema.tupleFieldValByIndex(block, src, op_ov, 1, op_ov_tuple_ty);
- const any_ov_bit = if (resolved_type.zigTypeTag(zcu) == .Vector)
+ const any_ov_bit = if (resolved_type.zigTypeTag(zcu) == .vector)
try block.addInst(.{
.tag = if (block.float_mode == .optimized) .reduce_optimized else .reduce,
.data = .{ .reduce = .{
@@ -17170,7 +17170,7 @@ fn zirAsm(
var extra_i = extra.end;
var output_type_bits = extra.data.output_type_bits;
- var needed_capacity: usize = @typeInfo(Air.Asm).Struct.fields.len + outputs_len + inputs_len;
+ var needed_capacity: usize = @typeInfo(Air.Asm).@"struct".fields.len + outputs_len + inputs_len;
const ConstraintName = struct { c: []const u8, n: []const u8 };
const out_args = try sema.arena.alloc(Air.Inst.Ref, outputs_len);
@@ -17217,8 +17217,8 @@ fn zirAsm(
const uncasted_arg = try sema.resolveInst(input.data.operand);
const uncasted_arg_ty = sema.typeOf(uncasted_arg);
switch (uncasted_arg_ty.zigTypeTag(zcu)) {
- .ComptimeInt => arg.* = try sema.coerce(block, Type.usize, uncasted_arg, src),
- .ComptimeFloat => arg.* = try sema.coerce(block, Type.f64, uncasted_arg, src),
+ .comptime_int => arg.* = try sema.coerce(block, Type.usize, uncasted_arg, src),
+ .comptime_float => arg.* = try sema.coerce(block, Type.f64, uncasted_arg, src),
else => {
arg.* = uncasted_arg;
},
@@ -17312,32 +17312,32 @@ fn zirCmpEq(
const rhs_ty = sema.typeOf(rhs);
const lhs_ty_tag = lhs_ty.zigTypeTag(zcu);
const rhs_ty_tag = rhs_ty.zigTypeTag(zcu);
- if (lhs_ty_tag == .Null and rhs_ty_tag == .Null) {
+ if (lhs_ty_tag == .null and rhs_ty_tag == .null) {
// null == null, null != null
return if (op == .eq) .bool_true else .bool_false;
}
// comparing null with optionals
- if (lhs_ty_tag == .Null and (rhs_ty_tag == .Optional or rhs_ty.isCPtr(zcu))) {
+ if (lhs_ty_tag == .null and (rhs_ty_tag == .optional or rhs_ty.isCPtr(zcu))) {
return sema.analyzeIsNull(block, src, rhs, op == .neq);
}
- if (rhs_ty_tag == .Null and (lhs_ty_tag == .Optional or lhs_ty.isCPtr(zcu))) {
+ if (rhs_ty_tag == .null and (lhs_ty_tag == .optional or lhs_ty.isCPtr(zcu))) {
return sema.analyzeIsNull(block, src, lhs, op == .neq);
}
- if (lhs_ty_tag == .Null or rhs_ty_tag == .Null) {
- const non_null_type = if (lhs_ty_tag == .Null) rhs_ty else lhs_ty;
+ if (lhs_ty_tag == .null or rhs_ty_tag == .null) {
+ const non_null_type = if (lhs_ty_tag == .null) rhs_ty else lhs_ty;
return sema.fail(block, src, "comparison of '{}' with null", .{non_null_type.fmt(pt)});
}
- if (lhs_ty_tag == .Union and (rhs_ty_tag == .EnumLiteral or rhs_ty_tag == .Enum)) {
+ if (lhs_ty_tag == .@"union" and (rhs_ty_tag == .enum_literal or rhs_ty_tag == .@"enum")) {
return sema.analyzeCmpUnionTag(block, src, lhs, lhs_src, rhs, rhs_src, op);
}
- if (rhs_ty_tag == .Union and (lhs_ty_tag == .EnumLiteral or lhs_ty_tag == .Enum)) {
+ if (rhs_ty_tag == .@"union" and (lhs_ty_tag == .enum_literal or lhs_ty_tag == .@"enum")) {
return sema.analyzeCmpUnionTag(block, src, rhs, rhs_src, lhs, lhs_src, op);
}
- if (lhs_ty_tag == .ErrorSet and rhs_ty_tag == .ErrorSet) {
+ if (lhs_ty_tag == .error_set and rhs_ty_tag == .error_set) {
const runtime_src: LazySrcLoc = src: {
if (try sema.resolveValue(lhs)) |lval| {
if (try sema.resolveValue(rhs)) |rval| {
@@ -17360,7 +17360,7 @@ fn zirCmpEq(
try sema.requireRuntimeBlock(block, src, runtime_src);
return block.addBinOp(air_tag, lhs, rhs);
}
- if (lhs_ty_tag == .Type and rhs_ty_tag == .Type) {
+ if (lhs_ty_tag == .type and rhs_ty_tag == .type) {
const lhs_as_type = try sema.analyzeAsType(block, lhs_src, lhs);
const rhs_as_type = try sema.analyzeAsType(block, rhs_src, rhs);
return if (lhs_as_type.eql(rhs_as_type, zcu) == (op == .eq)) .bool_true else .bool_false;
@@ -17399,7 +17399,7 @@ fn analyzeCmpUnionTag(
if (try sema.resolveValue(coerced_tag)) |enum_val| {
if (enum_val.isUndef(zcu)) return pt.undefRef(Type.bool);
const field_ty = union_ty.unionFieldType(enum_val, zcu).?;
- if (field_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (field_ty.zigTypeTag(zcu) == .noreturn) {
return .bool_false;
}
}
@@ -17442,11 +17442,11 @@ fn analyzeCmp(
const zcu = pt.zcu;
const lhs_ty = sema.typeOf(lhs);
const rhs_ty = sema.typeOf(rhs);
- if (lhs_ty.zigTypeTag(zcu) != .Optional and rhs_ty.zigTypeTag(zcu) != .Optional) {
+ if (lhs_ty.zigTypeTag(zcu) != .optional and rhs_ty.zigTypeTag(zcu) != .optional) {
try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src);
}
- if (lhs_ty.zigTypeTag(zcu) == .Vector and rhs_ty.zigTypeTag(zcu) == .Vector) {
+ if (lhs_ty.zigTypeTag(zcu) == .vector and rhs_ty.zigTypeTag(zcu) == .vector) {
return sema.cmpVector(block, src, lhs, rhs, op, lhs_src, rhs_src);
}
if (lhs_ty.isNumeric(zcu) and rhs_ty.isNumeric(zcu)) {
@@ -17455,11 +17455,11 @@ fn analyzeCmp(
// numeric types.
return sema.cmpNumeric(block, src, lhs, rhs, op, lhs_src, rhs_src);
}
- if (is_equality_cmp and lhs_ty.zigTypeTag(zcu) == .ErrorUnion and rhs_ty.zigTypeTag(zcu) == .ErrorSet) {
+ if (is_equality_cmp and lhs_ty.zigTypeTag(zcu) == .error_union and rhs_ty.zigTypeTag(zcu) == .error_set) {
const casted_lhs = try sema.analyzeErrUnionCode(block, lhs_src, lhs);
return sema.cmpSelf(block, src, casted_lhs, rhs, op, lhs_src, rhs_src);
}
- if (is_equality_cmp and lhs_ty.zigTypeTag(zcu) == .ErrorSet and rhs_ty.zigTypeTag(zcu) == .ErrorUnion) {
+ if (is_equality_cmp and lhs_ty.zigTypeTag(zcu) == .error_set and rhs_ty.zigTypeTag(zcu) == .error_union) {
const casted_rhs = try sema.analyzeErrUnionCode(block, rhs_src, rhs);
return sema.cmpSelf(block, src, lhs, casted_rhs, op, lhs_src, rhs_src);
}
@@ -17505,7 +17505,7 @@ fn cmpSelf(
if (try sema.resolveValue(casted_rhs)) |rhs_val| {
if (rhs_val.isUndef(zcu)) return pt.undefRef(Type.bool);
- if (resolved_type.zigTypeTag(zcu) == .Vector) {
+ if (resolved_type.zigTypeTag(zcu) == .vector) {
const cmp_val = try sema.compareVector(lhs_val, op, rhs_val, resolved_type);
return Air.internedToRef(cmp_val.toIntern());
}
@@ -17515,7 +17515,7 @@ fn cmpSelf(
else
.bool_false;
} else {
- if (resolved_type.zigTypeTag(zcu) == .Bool) {
+ if (resolved_type.zigTypeTag(zcu) == .bool) {
// We can lower bool eq/neq more efficiently.
return sema.runtimeBoolCmp(block, src, op, casted_rhs, lhs_val.toBool(), rhs_src);
}
@@ -17524,7 +17524,7 @@ fn cmpSelf(
} else {
// For bools, we still check the other operand, because we can lower
// bool eq/neq more efficiently.
- if (resolved_type.zigTypeTag(zcu) == .Bool) {
+ if (resolved_type.zigTypeTag(zcu) == .bool) {
if (try sema.resolveValue(casted_rhs)) |rhs_val| {
if (rhs_val.isUndef(zcu)) return pt.undefRef(Type.bool);
return sema.runtimeBoolCmp(block, src, op, casted_lhs, rhs_val.toBool(), lhs_src);
@@ -17534,7 +17534,7 @@ fn cmpSelf(
}
};
try sema.requireRuntimeBlock(block, src, runtime_src);
- if (resolved_type.zigTypeTag(zcu) == .Vector) {
+ if (resolved_type.zigTypeTag(zcu) == .vector) {
return block.addCmpVector(casted_lhs, casted_rhs, op);
}
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.
const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0);
const ty = try sema.resolveType(block, operand_src, inst_data.operand);
switch (ty.zigTypeTag(pt.zcu)) {
- .Fn,
- .NoReturn,
- .Undefined,
- .Null,
- .Opaque,
+ .@"fn",
+ .noreturn,
+ .undefined,
+ .null,
+ .@"opaque",
=> return sema.fail(block, operand_src, "no size available for type '{}'", .{ty.fmt(pt)}),
- .Type,
- .EnumLiteral,
- .ComptimeFloat,
- .ComptimeInt,
- .Void,
+ .type,
+ .enum_literal,
+ .comptime_float,
+ .comptime_int,
+ .void,
=> return pt.intRef(Type.comptime_int, 0),
- .Bool,
- .Int,
- .Float,
- .Pointer,
- .Array,
- .Struct,
- .Optional,
- .ErrorUnion,
- .ErrorSet,
- .Enum,
- .Union,
- .Vector,
- .Frame,
- .AnyFrame,
+ .bool,
+ .int,
+ .float,
+ .pointer,
+ .array,
+ .@"struct",
+ .optional,
+ .error_union,
+ .error_set,
+ .@"enum",
+ .@"union",
+ .vector,
+ .frame,
+ .@"anyframe",
=> {},
}
const val = try ty.abiSizeLazy(pt);
@@ -17609,34 +17609,34 @@ fn zirBitSizeOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!A
const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0);
const operand_ty = try sema.resolveType(block, operand_src, inst_data.operand);
switch (operand_ty.zigTypeTag(zcu)) {
- .Fn,
- .NoReturn,
- .Undefined,
- .Null,
- .Opaque,
+ .@"fn",
+ .noreturn,
+ .undefined,
+ .null,
+ .@"opaque",
=> return sema.fail(block, operand_src, "no size available for type '{}'", .{operand_ty.fmt(pt)}),
- .Type,
- .EnumLiteral,
- .ComptimeFloat,
- .ComptimeInt,
- .Void,
+ .type,
+ .enum_literal,
+ .comptime_float,
+ .comptime_int,
+ .void,
=> return pt.intRef(Type.comptime_int, 0),
- .Bool,
- .Int,
- .Float,
- .Pointer,
- .Array,
- .Struct,
- .Optional,
- .ErrorUnion,
- .ErrorSet,
- .Enum,
- .Union,
- .Vector,
- .Frame,
- .AnyFrame,
+ .bool,
+ .int,
+ .float,
+ .pointer,
+ .array,
+ .@"struct",
+ .optional,
+ .error_union,
+ .error_set,
+ .@"enum",
+ .@"union",
+ .vector,
+ .frame,
+ .@"anyframe",
=> {},
}
const bit_size = try operand_ty.bitSizeSema(pt);
@@ -17893,21 +17893,21 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
}
switch (ty.zigTypeTag(zcu)) {
- .Type,
- .Void,
- .Bool,
- .NoReturn,
- .ComptimeFloat,
- .ComptimeInt,
- .Undefined,
- .Null,
- .EnumLiteral,
+ .type,
+ .void,
+ .bool,
+ .noreturn,
+ .comptime_float,
+ .comptime_int,
+ .undefined,
+ .null,
+ .enum_literal,
=> |type_info_tag| return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
.tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(type_info_tag))).toIntern(),
.val = .void_value,
} }))),
- .Fn => {
+ .@"fn" => {
const fn_info_nav = try sema.namespaceLookup(
block,
src,
@@ -18010,14 +18010,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Fn))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"fn"))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = fn_info_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .Int => {
+ .int => {
const int_info_nav = try sema.namespaceLookup(
block,
src,
@@ -18037,14 +18037,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Int))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.int))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = int_info_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .Float => {
+ .float => {
const float_info_nav = try sema.namespaceLookup(
block,
src,
@@ -18060,14 +18060,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Float))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.float))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = float_info_ty.toIntern(),
.storage = .{ .elems = &field_vals },
} }),
} })));
},
- .Pointer => {
+ .pointer => {
const info = ty.ptrInfo(zcu);
const alignment = if (info.flags.alignment.toByteUnits()) |alignment|
try pt.intValue(Type.comptime_int, alignment)
@@ -18119,14 +18119,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Pointer))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.pointer))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = pointer_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .Array => {
+ .array => {
const array_field_ty = t: {
const nav = try sema.namespaceLookup(
block,
@@ -18149,14 +18149,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Array))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.array))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = array_field_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .Vector => {
+ .vector => {
const vector_field_ty = t: {
const nav = try sema.namespaceLookup(
block,
@@ -18177,14 +18177,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Vector))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.vector))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = vector_field_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .Optional => {
+ .optional => {
const optional_field_ty = t: {
const nav = try sema.namespaceLookup(
block,
@@ -18202,14 +18202,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Optional))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.optional))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = optional_field_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .ErrorSet => {
+ .error_set => {
// Get the Error type
const error_field_ty = t: {
const nav = try sema.namespaceLookup(
@@ -18308,14 +18308,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
.val = errors_payload_val,
} });
- // Construct Type{ .ErrorSet = errors_val }
+ // Construct Type{ .error_set = errors_val }
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.ErrorSet))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.error_set))).toIntern(),
.val = errors_val,
} })));
},
- .ErrorUnion => {
+ .error_union => {
const error_union_field_ty = t: {
const nav = try sema.namespaceLookup(
block,
@@ -18335,14 +18335,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.ErrorUnion))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.error_union))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = error_union_field_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .Enum => {
+ .@"enum" => {
const is_exhaustive = Value.makeBool(ip.loadEnumType(ty.toIntern()).tag_mode != .nonexhaustive);
const enum_field_ty = t: {
@@ -18464,14 +18464,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Enum))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"enum"))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = type_enum_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .Union => {
+ .@"union" => {
const type_union_ty = t: {
const nav = try sema.namespaceLookup(
block,
@@ -18611,14 +18611,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Union))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"union"))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = type_union_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .Struct => {
+ .@"struct" => {
const type_struct_ty = t: {
const nav = try sema.namespaceLookup(
block,
@@ -18843,14 +18843,14 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Struct))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"struct"))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = type_struct_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .Opaque => {
+ .@"opaque" => {
const type_opaque_ty = t: {
const nav = try sema.namespaceLookup(
block,
@@ -18871,15 +18871,15 @@ fn zirTypeInfo(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
};
return Air.internedToRef((try pt.intern(.{ .un = .{
.ty = type_info_ty.toIntern(),
- .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.Opaque))).toIntern(),
+ .tag = (try pt.enumValueFieldIndex(type_info_tag_ty, @intFromEnum(std.builtin.TypeId.@"opaque"))).toIntern(),
.val = try pt.intern(.{ .aggregate = .{
.ty = type_opaque_ty.toIntern(),
.storage = .{ .elems = &field_values },
} }),
} })));
},
- .Frame => return sema.failWithUseOfAsync(block, src),
- .AnyFrame => return sema.failWithUseOfAsync(block, src),
+ .frame => return sema.failWithUseOfAsync(block, src),
+ .@"anyframe" => return sema.failWithUseOfAsync(block, src),
}
}
@@ -19064,8 +19064,8 @@ fn log2IntType(sema: *Sema, block: *Block, operand: Type, src: LazySrcLoc) Compi
const pt = sema.pt;
const zcu = pt.zcu;
switch (operand.zigTypeTag(zcu)) {
- .ComptimeInt => return Type.comptime_int,
- .Int => {
+ .comptime_int => return Type.comptime_int,
+ .int => {
const bits = operand.bitSize(zcu);
const count = if (bits == 0)
0
@@ -19079,7 +19079,7 @@ fn log2IntType(sema: *Sema, block: *Block, operand: Type, src: LazySrcLoc) Compi
};
return pt.intType(.unsigned, count);
},
- .Vector => {
+ .vector => {
const elem_ty = operand.elemType2(zcu);
const log2_elem_ty = try sema.log2IntType(block, elem_ty, src);
return pt.vectorType(.{
@@ -19277,9 +19277,9 @@ fn finishCondBr(
) !Air.Inst.Ref {
const gpa = sema.gpa;
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).@"struct".fields.len +
then_block.instructions.items.len + else_block.instructions.items.len +
- @typeInfo(Air.Block).Struct.fields.len + child_block.instructions.items.len + 1);
+ @typeInfo(Air.Block).@"struct".fields.len + child_block.instructions.items.len + 1);
const cond_br_payload = sema.addExtraAssumeCapacity(Air.CondBr{
.then_body_len = @intCast(then_block.instructions.items.len),
@@ -19307,8 +19307,8 @@ fn checkNullableType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !voi
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Optional, .Null, .Undefined => return,
- .Pointer => if (ty.isPtrLikeOptional(zcu)) return,
+ .optional, .null, .undefined => return,
+ .pointer => if (ty.isPtrLikeOptional(zcu)) return,
else => {},
}
return sema.failWithExpectedOptionalType(block, src, ty);
@@ -19354,7 +19354,7 @@ fn checkErrorType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !void {
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .ErrorSet, .ErrorUnion, .Undefined => return,
+ .error_set, .error_union, .undefined => return,
else => return sema.fail(block, src, "expected error union type, found '{}'", .{
ty.fmt(pt),
}),
@@ -19451,7 +19451,7 @@ fn zirCondbr(
const err_inst_data = sema.code.instructions.items(.data)[@intFromEnum(index)].un_node;
const err_operand = try sema.resolveInst(err_inst_data.operand);
const operand_ty = sema.typeOf(err_operand);
- assert(operand_ty.zigTypeTag(zcu) == .ErrorUnion);
+ assert(operand_ty.zigTypeTag(zcu) == .error_union);
const result_ty = operand_ty.errorUnionSet(zcu);
break :blk try sub_block.addTyOp(.unwrap_errunion_err, result_ty, err_operand);
};
@@ -19463,7 +19463,7 @@ fn zirCondbr(
break :h .unlikely;
} else try sema.analyzeBodyRuntimeBreak(&sub_block, else_body);
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).@"struct".fields.len +
true_instructions.len + sub_block.instructions.items.len);
_ = try parent_block.addInst(.{
.tag = .cond_br,
@@ -19490,7 +19490,7 @@ fn zirTry(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!
const err_union_ty = sema.typeOf(err_union);
const pt = sema.pt;
const zcu = pt.zcu;
- if (err_union_ty.zigTypeTag(zcu) != .ErrorUnion) {
+ if (err_union_ty.zigTypeTag(zcu) != .error_union) {
return sema.fail(parent_block, operand_src, "expected error union type, found '{}'", .{
err_union_ty.fmt(pt),
});
@@ -19524,7 +19524,7 @@ fn zirTry(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileError!
// The only interesting hint here is `.cold`, which can come from e.g. `errdefer @panic`.
const is_cold = sema.branch_hint == .cold;
- try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Try).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.Try).@"struct".fields.len +
sub_block.instructions.items.len);
const try_inst = try parent_block.addInst(.{
.tag = if (is_cold) .try_cold else .@"try",
@@ -19550,7 +19550,7 @@ fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErr
const err_union_ty = sema.typeOf(err_union);
const pt = sema.pt;
const zcu = pt.zcu;
- if (err_union_ty.zigTypeTag(zcu) != .ErrorUnion) {
+ if (err_union_ty.zigTypeTag(zcu) != .error_union) {
return sema.fail(parent_block, operand_src, "expected error union type, found '{}'", .{
err_union_ty.fmt(pt),
});
@@ -19596,7 +19596,7 @@ fn zirTryPtr(sema: *Sema, parent_block: *Block, inst: Zir.Inst.Index) CompileErr
},
});
const res_ty_ref = Air.internedToRef(res_ty.toIntern());
- try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.TryPtr).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(sema.gpa, @typeInfo(Air.TryPtr).@"struct".fields.len +
sub_block.instructions.items.len);
const try_inst = try parent_block.addInst(.{
.tag = if (is_cold) .try_ptr_cold else .try_ptr,
@@ -19747,7 +19747,7 @@ fn zirRetImplicit(
const operand = try sema.resolveInst(inst_data.operand);
const ret_ty_src = block.src(.{ .node_offset_fn_type_ret_ty = 0 });
const base_tag = sema.fn_ret_ty.baseZigTypeTag(zcu);
- if (base_tag == .NoReturn) {
+ if (base_tag == .noreturn) {
const msg = msg: {
const msg = try sema.errMsg(ret_ty_src, "function declared '{}' implicitly returns", .{
sema.fn_ret_ty.fmt(pt),
@@ -19757,7 +19757,7 @@ fn zirRetImplicit(
break :msg msg;
};
return sema.failWithOwnedErrorMsg(block, msg);
- } else if (base_tag != .Void) {
+ } else if (base_tag != .void) {
const msg = msg: {
const msg = try sema.errMsg(ret_ty_src, "function with non-void return type '{}' implicitly returns", .{
sema.fn_ret_ty.fmt(pt),
@@ -19844,9 +19844,9 @@ fn retWithErrTracing(
try sema.callBuiltin(&else_block, src, return_err_fn, .never_inline, &args, .@"error return");
_ = try else_block.addUnOp(ret_tag, operand);
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.CondBr).@"struct".fields.len +
then_block.instructions.items.len + else_block.instructions.items.len +
- @typeInfo(Air.Block).Struct.fields.len + 1);
+ @typeInfo(Air.Block).@"struct".fields.len + 1);
const cond_br_payload = sema.addExtraAssumeCapacity(Air.CondBr{
.then_body_len = @intCast(then_block.instructions.items.len),
@@ -19958,7 +19958,7 @@ fn addToInferredErrorSet(sema: *Sema, uncasted_operand: Air.Inst.Ref) !void {
const pt = sema.pt;
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
- assert(sema.fn_ret_ty.zigTypeTag(zcu) == .ErrorUnion);
+ assert(sema.fn_ret_ty.zigTypeTag(zcu) == .error_union);
const err_set_ty = sema.fn_ret_ty.errorUnionSet(zcu).toIntern();
switch (err_set_ty) {
.adhoc_inferred_error_set_type => {
@@ -19980,8 +19980,8 @@ fn addToInferredErrorSetPtr(sema: *Sema, ies: *InferredErrorSet, op_ty: Type) !v
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
switch (op_ty.zigTypeTag(zcu)) {
- .ErrorSet => try ies.addErrorSet(op_ty, ip, arena),
- .ErrorUnion => try ies.addErrorSet(op_ty.errorUnionSet(zcu), ip, arena),
+ .error_set => try ies.addErrorSet(op_ty, ip, arena),
+ .error_union => try ies.addErrorSet(op_ty.errorUnionSet(zcu), ip, arena),
else => {},
}
}
@@ -19998,7 +19998,7 @@ fn analyzeRet(
// that the coercion below works correctly.
const pt = sema.pt;
const zcu = pt.zcu;
- if (sema.fn_ret_ty_ies != null and sema.fn_ret_ty.zigTypeTag(zcu) == .ErrorUnion) {
+ if (sema.fn_ret_ty_ies != null and sema.fn_ret_ty.zigTypeTag(zcu) == .error_union) {
try sema.addToInferredErrorSet(uncasted_operand);
}
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
break :blk ty;
};
- if (elem_ty.zigTypeTag(zcu) == .NoReturn)
+ if (elem_ty.zigTypeTag(zcu) == .noreturn)
return sema.fail(block, elem_ty_src, "pointer to noreturn not allowed", .{});
const target = zcu.getTarget();
@@ -20128,7 +20128,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
const ref: Zir.Inst.Ref = @enumFromInt(sema.code.extra[extra_i]);
extra_i += 1;
break :blk try sema.resolveAddressSpace(block, addrspace_src, ref, .pointer);
- } else if (elem_ty.zigTypeTag(zcu) == .Fn and target.cpu.arch == .avr) .flash else .generic;
+ } else if (elem_ty.zigTypeTag(zcu) == .@"fn" and target.cpu.arch == .avr) .flash else .generic;
const bit_offset: u16 = if (inst_data.flags.has_bit_range) blk: {
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
}
}
- if (elem_ty.zigTypeTag(zcu) == .Fn) {
+ if (elem_ty.zigTypeTag(zcu) == .@"fn") {
if (inst_data.size != .One) {
return sema.fail(block, elem_ty_src, "function pointers must be single pointers", .{});
}
- } else if (inst_data.size == .Many and elem_ty.zigTypeTag(zcu) == .Opaque) {
+ } else if (inst_data.size == .Many and elem_ty.zigTypeTag(zcu) == .@"opaque") {
return sema.fail(block, elem_ty_src, "unknown-length pointer to opaque not allowed", .{});
} else if (inst_data.size == .C) {
if (!try sema.validateExternType(elem_ty, .other)) {
@@ -20181,7 +20181,7 @@ fn zirPtrType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
};
return sema.failWithOwnedErrorMsg(block, msg);
}
- if (elem_ty.zigTypeTag(zcu) == .Opaque) {
+ if (elem_ty.zigTypeTag(zcu) == .@"opaque") {
return sema.fail(block, elem_ty_src, "C pointers cannot point to opaque types", .{});
}
}
@@ -20226,10 +20226,10 @@ fn zirStructInitEmpty(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileE
const zcu = pt.zcu;
switch (obj_ty.zigTypeTag(zcu)) {
- .Struct => return sema.structInitEmpty(block, obj_ty, src, src),
- .Array, .Vector => return sema.arrayInitEmpty(block, src, obj_ty),
- .Void => return Air.internedToRef(Value.void.toIntern()),
- .Union => return sema.fail(block, src, "union initializer must initialize one field", .{}),
+ .@"struct" => return sema.structInitEmpty(block, obj_ty, src, src),
+ .array, .vector => return sema.arrayInitEmpty(block, src, obj_ty),
+ .void => return Air.internedToRef(Value.void.toIntern()),
+ .@"union" => return sema.fail(block, src, "union initializer must initialize one field", .{}),
else => return sema.failWithArrayInitNotSupported(block, src, obj_ty),
}
}
@@ -20249,7 +20249,7 @@ fn zirStructInitEmptyResult(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is
};
const init_ty = if (is_byref) ty: {
const ptr_ty = ty_operand.optEuBaseType(zcu);
- assert(ptr_ty.zigTypeTag(zcu) == .Pointer); // validated by a previous instruction
+ assert(ptr_ty.zigTypeTag(zcu) == .pointer); // validated by a previous instruction
if (!ptr_ty.isSlice(zcu)) {
break :ty ptr_ty.childType(zcu);
}
@@ -20263,9 +20263,9 @@ fn zirStructInitEmptyResult(sema: *Sema, block: *Block, inst: Zir.Inst.Index, is
const obj_ty = init_ty.optEuBaseType(zcu);
const empty_ref = switch (obj_ty.zigTypeTag(zcu)) {
- .Struct => try sema.structInitEmpty(block, obj_ty, src, src),
- .Array, .Vector => try sema.arrayInitEmpty(block, src, obj_ty),
- .Union => return sema.fail(block, src, "union initializer must initialize one field", .{}),
+ .@"struct" => try sema.structInitEmpty(block, obj_ty, src, src),
+ .array, .vector => try sema.arrayInitEmpty(block, src, obj_ty),
+ .@"union" => return sema.fail(block, src, "union initializer must initialize one field", .{}),
else => return sema.failWithArrayInitNotSupported(block, src, obj_ty),
};
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
const zcu = pt.zcu;
const arr_len = obj_ty.arrayLen(zcu);
if (arr_len != 0) {
- if (obj_ty.zigTypeTag(zcu) == .Array) {
+ if (obj_ty.zigTypeTag(zcu) == .array) {
return sema.fail(block, src, "expected {d} array elements; found 0", .{arr_len});
} else {
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
const init_src = block.builtinCallArgSrc(inst_data.src_node, 2);
const extra = sema.code.extraData(Zir.Inst.UnionInit, inst_data.payload_index).data;
const union_ty = try sema.resolveType(block, ty_src, extra.union_type);
- if (union_ty.zigTypeTag(pt.zcu) != .Union) {
+ if (union_ty.zigTypeTag(pt.zcu) != .@"union") {
return sema.fail(block, ty_src, "expected union type, found '{}'", .{union_ty.fmt(pt)});
}
const field_name = try sema.resolveConstStringIntern(block, field_src, extra.field_name, .{
@@ -20394,7 +20394,7 @@ fn zirStructInit(
const resolved_ty = result_ty.optEuBaseType(zcu);
try resolved_ty.resolveLayout(pt);
- if (resolved_ty.zigTypeTag(zcu) == .Struct) {
+ if (resolved_ty.zigTypeTag(zcu) == .@"struct") {
// This logic must be synchronized with that in `zirStructInitEmpty`.
// Maps field index to field_type index of where it was already initialized.
@@ -20450,7 +20450,7 @@ fn zirStructInit(
}
return sema.finishStructInit(block, src, src, field_inits, resolved_ty, result_ty, is_ref);
- } else if (resolved_ty.zigTypeTag(zcu) == .Union) {
+ } else if (resolved_ty.zigTypeTag(zcu) == .@"union") {
if (extra.data.fields_len != 1) {
return sema.fail(block, src, "union initialization expects exactly one field", .{});
}
@@ -20471,7 +20471,7 @@ fn zirStructInit(
const tag_val = try pt.enumValueFieldIndex(tag_ty, field_index);
const field_ty = Type.fromInterned(zcu.typeToUnion(resolved_ty).?.field_types.get(ip)[field_index]);
- if (field_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (field_ty.zigTypeTag(zcu) == .noreturn) {
return sema.failWithOwnedErrorMsg(block, msg: {
const msg = try sema.errMsg(src, "cannot initialize 'noreturn' field of union", .{});
errdefer msg.destroy(sema.gpa);
@@ -20756,7 +20756,7 @@ fn structInitAnon(
const init = try sema.resolveInst(item.data.init);
field_ty.* = sema.typeOf(init).toIntern();
- if (Type.fromInterned(field_ty.*).zigTypeTag(zcu) == .Opaque) {
+ if (Type.fromInterned(field_ty.*).zigTypeTag(zcu) == .@"opaque") {
const msg = msg: {
const field_src = block.src(.{ .init_elem = .{
.init_node_offset = src.offset.node_offset.x,
@@ -20867,7 +20867,7 @@ fn zirArrayInit(
else => |e| return e,
};
const array_ty = result_ty.optEuBaseType(zcu);
- const is_tuple = array_ty.zigTypeTag(zcu) == .Struct;
+ const is_tuple = array_ty.zigTypeTag(zcu) == .@"struct";
const sentinel_val = array_ty.sentinel(zcu);
var root_msg: ?*Zcu.ErrorMsg = null;
@@ -21029,7 +21029,7 @@ fn arrayInitAnon(
const operand_src = src; // TODO better source location
const elem = try sema.resolveInst(operand);
types[i] = sema.typeOf(elem).toIntern();
- if (Type.fromInterned(types[i]).zigTypeTag(zcu) == .Opaque) {
+ if (Type.fromInterned(types[i]).zigTypeTag(zcu) == .@"opaque") {
const msg = msg: {
const msg = try sema.errMsg(operand_src, "opaque types have unknown size and therefore cannot be directly embedded in structs", .{});
errdefer msg.destroy(gpa);
@@ -21148,7 +21148,7 @@ fn fieldType(
while (true) {
try cur_ty.resolveFields(pt);
switch (cur_ty.zigTypeTag(zcu)) {
- .Struct => switch (ip.indexToKey(cur_ty.toIntern())) {
+ .@"struct" => switch (ip.indexToKey(cur_ty.toIntern())) {
.anon_struct_type => |anon_struct| {
const field_index = if (anon_struct.names.len == 0)
try sema.tupleFieldIndex(block, cur_ty, field_name, field_src)
@@ -21165,20 +21165,20 @@ fn fieldType(
},
else => unreachable,
},
- .Union => {
+ .@"union" => {
const union_obj = zcu.typeToUnion(cur_ty).?;
const field_index = union_obj.loadTagType(ip).nameIndex(ip, field_name) orelse
return sema.failWithBadUnionFieldAccess(block, cur_ty, union_obj, field_src, field_name);
const field_ty = union_obj.field_types.get(ip)[field_index];
return Air.internedToRef(field_ty);
},
- .Optional => {
+ .optional => {
// Struct/array init through optional requires the child type to not be a pointer.
// If the child of .optional is a pointer it'll error on the next loop.
cur_ty = Type.fromInterned(ip.indexToKey(cur_ty.toIntern()).opt_type);
continue;
},
- .ErrorUnion => {
+ .error_union => {
cur_ty = cur_ty.errorUnionPayload(zcu);
continue;
},
@@ -21243,7 +21243,7 @@ fn zirIntFromBool(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError
const src = block.nodeOffset(inst_data.src_node);
const operand = try sema.resolveInst(inst_data.operand);
const operand_ty = sema.typeOf(operand);
- const is_vector = operand_ty.zigTypeTag(zcu) == .Vector;
+ const is_vector = operand_ty.zigTypeTag(zcu) == .vector;
const operand_scalar_ty = operand_ty.scalarType(zcu);
if (operand_scalar_ty.toIntern() != .bool_type) {
return sema.fail(block, src, "expected 'bool', found '{}'", .{operand_scalar_ty.zigTypeTag(zcu)});
@@ -21317,8 +21317,8 @@ fn zirAbs(
const scalar_ty = operand_ty.scalarType(zcu);
const result_ty = switch (scalar_ty.zigTypeTag(zcu)) {
- .ComptimeFloat, .Float, .ComptimeInt => operand_ty,
- .Int => if (scalar_ty.isSignedInt(zcu)) try operand_ty.toUnsigned(pt) else return operand,
+ .comptime_float, .float, .comptime_int => operand_ty,
+ .int => if (scalar_ty.isSignedInt(zcu)) try operand_ty.toUnsigned(pt) else return operand,
else => return sema.fail(
block,
operand_src,
@@ -21342,7 +21342,7 @@ fn maybeConstantUnaryMath(
const pt = sema.pt;
const zcu = pt.zcu;
switch (result_ty.zigTypeTag(zcu)) {
- .Vector => if (try sema.resolveValue(operand)) |val| {
+ .vector => if (try sema.resolveValue(operand)) |val| {
const scalar_ty = result_ty.scalarType(zcu);
const vec_len = result_ty.vectorLen(zcu);
if (val.isUndef(zcu))
@@ -21387,7 +21387,7 @@ fn zirUnaryMath(
const scalar_ty = operand_ty.scalarType(zcu);
switch (scalar_ty.zigTypeTag(zcu)) {
- .ComptimeFloat, .Float => {},
+ .comptime_float, .float => {},
else => return sema.fail(
block,
operand_src,
@@ -21414,13 +21414,13 @@ fn zirTagName(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
try operand_ty.resolveLayout(pt);
const enum_ty = switch (operand_ty.zigTypeTag(zcu)) {
- .EnumLiteral => {
+ .enum_literal => {
const val = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, operand, undefined);
const tag_name = ip.indexToKey(val.toIntern()).enum_literal;
return sema.addNullTerminatedStrLit(tag_name);
},
- .Enum => operand_ty,
- .Union => operand_ty.unionTagType(zcu) orelse
+ .@"enum" => operand_ty,
+ .@"union" => operand_ty.unionTagType(zcu) orelse
return sema.fail(block, src, "union '{}' is untagged", .{operand_ty.fmt(pt)}),
else => return sema.fail(block, operand_src, "expected enum or union; found '{}'", .{
operand_ty.fmt(pt),
@@ -21500,17 +21500,17 @@ fn zirReify(
}
const tag_index = type_info_ty.unionTagFieldIndex(Value.fromInterned(union_val.tag), zcu).?;
switch (@as(std.builtin.TypeId, @enumFromInt(tag_index))) {
- .Type => return .type_type,
- .Void => return .void_type,
- .Bool => return .bool_type,
- .NoReturn => return .noreturn_type,
- .ComptimeFloat => return .comptime_float_type,
- .ComptimeInt => return .comptime_int_type,
- .Undefined => return .undefined_type,
- .Null => return .null_type,
- .AnyFrame => return sema.failWithUseOfAsync(block, src),
- .EnumLiteral => return .enum_literal_type,
- .Int => {
+ .type => return .type_type,
+ .void => return .void_type,
+ .bool => return .bool_type,
+ .noreturn => return .noreturn_type,
+ .comptime_float => return .comptime_float_type,
+ .comptime_int => return .comptime_int_type,
+ .undefined => return .undefined_type,
+ .null => return .null_type,
+ .@"anyframe" => return sema.failWithUseOfAsync(block, src),
+ .enum_literal => return .enum_literal_type,
+ .int => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const signedness_val = try Value.fromInterned(union_val.val).fieldValue(
pt,
@@ -21526,7 +21526,7 @@ fn zirReify(
const ty = try pt.intType(signedness, bits);
return Air.internedToRef(ty.toIntern());
},
- .Vector => {
+ .vector => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const len_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21548,7 +21548,7 @@ fn zirReify(
});
return Air.internedToRef(ty.toIntern());
},
- .Float => {
+ .float => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const bits_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21566,7 +21566,7 @@ fn zirReify(
};
return Air.internedToRef(ty.toIntern());
},
- .Pointer => {
+ .pointer => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const size_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21631,13 +21631,13 @@ fn zirReify(
break :s .none;
};
- if (elem_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (elem_ty.zigTypeTag(zcu) == .noreturn) {
return sema.fail(block, src, "pointer to noreturn not allowed", .{});
- } else if (elem_ty.zigTypeTag(zcu) == .Fn) {
+ } else if (elem_ty.zigTypeTag(zcu) == .@"fn") {
if (ptr_size != .One) {
return sema.fail(block, src, "function pointers must be single pointers", .{});
}
- } else if (ptr_size == .Many and elem_ty.zigTypeTag(zcu) == .Opaque) {
+ } else if (ptr_size == .Many and elem_ty.zigTypeTag(zcu) == .@"opaque") {
return sema.fail(block, src, "unknown-length pointer to opaque not allowed", .{});
} else if (ptr_size == .C) {
if (!try sema.validateExternType(elem_ty, .other)) {
@@ -21652,7 +21652,7 @@ fn zirReify(
};
return sema.failWithOwnedErrorMsg(block, msg);
}
- if (elem_ty.zigTypeTag(zcu) == .Opaque) {
+ if (elem_ty.zigTypeTag(zcu) == .@"opaque") {
return sema.fail(block, src, "C pointers cannot point to opaque types", .{});
}
}
@@ -21671,7 +21671,7 @@ fn zirReify(
});
return Air.internedToRef(ty.toIntern());
},
- .Array => {
+ .array => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const len_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21700,7 +21700,7 @@ fn zirReify(
});
return Air.internedToRef(ty.toIntern());
},
- .Optional => {
+ .optional => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const child_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21712,7 +21712,7 @@ fn zirReify(
const ty = try pt.optionalType(child_ty.toIntern());
return Air.internedToRef(ty.toIntern());
},
- .ErrorUnion => {
+ .error_union => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const error_set_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21726,14 +21726,14 @@ fn zirReify(
const error_set_ty = error_set_val.toType();
const payload_ty = payload_val.toType();
- if (error_set_ty.zigTypeTag(zcu) != .ErrorSet) {
+ if (error_set_ty.zigTypeTag(zcu) != .error_set) {
return sema.fail(block, src, "Type.ErrorUnion.error_set must be an error set type", .{});
}
const ty = try pt.errorUnionType(error_set_ty, payload_ty);
return Air.internedToRef(ty.toIntern());
},
- .ErrorSet => {
+ .error_set => {
const payload_val = Value.fromInterned(union_val.val).optionalValue(zcu) orelse
return Air.internedToRef(Type.anyerror.toIntern());
@@ -21767,7 +21767,7 @@ fn zirReify(
const ty = try pt.errorSetFromUnsortedNames(names.keys());
return Air.internedToRef(ty.toIntern());
},
- .Struct => {
+ .@"struct" => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const layout_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21807,7 +21807,7 @@ fn zirReify(
return try sema.reifyStruct(block, inst, src, layout, backing_integer_val, fields_arr, name_strategy, is_tuple_val.toBool());
},
- .Enum => {
+ .@"enum" => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const tag_type_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21836,7 +21836,7 @@ fn zirReify(
return sema.reifyEnum(block, inst, src, tag_type_val.toType(), is_exhaustive_val.toBool(), fields_arr, name_strategy);
},
- .Opaque => {
+ .@"opaque" => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const decls_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21879,7 +21879,7 @@ fn zirReify(
try sema.addTypeReferenceEntry(src, wip_ty.index);
return Air.internedToRef(wip_ty.finish(ip, .none, new_namespace_index));
},
- .Union => {
+ .@"union" => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const layout_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21909,7 +21909,7 @@ fn zirReify(
return sema.reifyUnion(block, inst, src, layout, tag_type_val, fields_arr, name_strategy);
},
- .Fn => {
+ .@"fn" => {
const struct_type = ip.loadStructType(ip.typeOf(union_val.val));
const calling_convention_val = try Value.fromInterned(union_val.val).fieldValue(pt, struct_type.nameIndex(
ip,
@@ -21996,7 +21996,7 @@ fn zirReify(
});
return Air.internedToRef(ty.toIntern());
},
- .Frame => return sema.failWithUseOfAsync(block, src),
+ .frame => return sema.failWithUseOfAsync(block, src),
}
}
@@ -22067,7 +22067,7 @@ fn reifyEnum(
var done = false;
errdefer if (!done) wip_ty.cancel(ip, pt.tid);
- if (tag_ty.zigTypeTag(zcu) != .Int) {
+ if (tag_ty.zigTypeTag(zcu) != .int) {
return sema.fail(block, src, "Type.Enum.tag_type must be an integer type", .{});
}
@@ -22344,7 +22344,7 @@ fn reifyUnion(
for (field_types) |field_ty_ip| {
const field_ty = Type.fromInterned(field_ty_ip);
- if (field_ty.zigTypeTag(zcu) == .Opaque) {
+ if (field_ty.zigTypeTag(zcu) == .@"opaque") {
return sema.failWithOwnedErrorMsg(block, msg: {
const msg = try sema.errMsg(src, "opaque types have unknown size and therefore cannot be directly embedded in unions", .{});
errdefer msg.destroy(gpa);
@@ -22602,7 +22602,7 @@ fn reifyStruct(
struct_type.field_inits.get(ip)[field_idx] = field_default;
}
- if (field_ty.zigTypeTag(zcu) == .Opaque) {
+ if (field_ty.zigTypeTag(zcu) == .@"opaque") {
return sema.failWithOwnedErrorMsg(block, msg: {
const msg = try sema.errMsg(src, "opaque types have unknown size and therefore cannot be directly embedded in structs", .{});
errdefer msg.destroy(gpa);
@@ -22611,7 +22611,7 @@ fn reifyStruct(
break :msg msg;
});
}
- if (field_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (field_ty.zigTypeTag(zcu) == .noreturn) {
return sema.failWithOwnedErrorMsg(block, msg: {
const msg = try sema.errMsg(src, "struct fields cannot be 'noreturn'", .{});
errdefer msg.destroy(gpa);
@@ -22794,7 +22794,7 @@ fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
const operand_ty = sema.typeOf(operand);
try sema.checkVectorizableBinaryOperands(block, operand_src, dest_ty, operand_ty, src, operand_src);
- const is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
+ const is_vector = dest_ty.zigTypeTag(zcu) == .vector;
const dest_scalar_ty = dest_ty.scalarType(zcu);
const operand_scalar_ty = operand_ty.scalarType(zcu);
@@ -22805,7 +22805,7 @@ fn zirIntFromFloat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
if (try sema.resolveValue(operand)) |operand_val| {
const result_val = try sema.intFromFloat(block, operand_src, operand_val, operand_ty, dest_ty, .truncate);
return Air.internedToRef(result_val.toIntern());
- } else if (dest_scalar_ty.zigTypeTag(zcu) == .ComptimeInt) {
+ } else if (dest_scalar_ty.zigTypeTag(zcu) == .comptime_int) {
return sema.failWithNeededComptime(block, operand_src, .{
.needed_comptime_reason = "value being casted to 'comptime_int' must be comptime-known",
});
@@ -22877,7 +22877,7 @@ fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
const operand_ty = sema.typeOf(operand);
try sema.checkVectorizableBinaryOperands(block, operand_src, dest_ty, operand_ty, src, operand_src);
- const is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
+ const is_vector = dest_ty.zigTypeTag(zcu) == .vector;
const dest_scalar_ty = dest_ty.scalarType(zcu);
const operand_scalar_ty = operand_ty.scalarType(zcu);
@@ -22888,7 +22888,7 @@ fn zirFloatFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileErro
if (try sema.resolveValue(operand)) |operand_val| {
const result_val = try operand_val.floatFromIntAdvanced(sema.arena, operand_ty, dest_ty, pt, .sema);
return Air.internedToRef(result_val.toIntern());
- } else if (dest_scalar_ty.zigTypeTag(zcu) == .ComptimeFloat) {
+ } else if (dest_scalar_ty.zigTypeTag(zcu) == .comptime_float) {
return sema.failWithNeededComptime(block, operand_src, .{
.needed_comptime_reason = "value being casted to 'comptime_float' must be comptime-known",
});
@@ -22923,7 +22923,7 @@ fn zirPtrFromInt(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
const dest_ty = try sema.resolveDestType(block, src, extra.lhs, .remove_eu, "@ptrFromInt");
try sema.checkVectorizableBinaryOperands(block, operand_src, dest_ty, uncoerced_operand_ty, src, operand_src);
- const is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
+ const is_vector = dest_ty.zigTypeTag(zcu) == .vector;
const operand_ty = if (is_vector) operand_ty: {
const len = dest_ty.vectorLen(zcu);
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!
}
try sema.requireRuntimeBlock(block, src, operand_src);
if (!is_vector) {
- if (block.wantSafety() and (try elem_ty.hasRuntimeBitsSema(pt) or elem_ty.zigTypeTag(zcu) == .Fn)) {
+ if (block.wantSafety() and (try elem_ty.hasRuntimeBitsSema(pt) or elem_ty.zigTypeTag(zcu) == .@"fn")) {
if (!ptr_ty.isAllowzeroPtr(zcu)) {
const is_non_zero = try block.addBinOp(.cmp_neq, operand_coerced, .zero_usize);
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!
}
const len = dest_ty.vectorLen(zcu);
- if (block.wantSafety() and (try elem_ty.hasRuntimeBitsSema(pt) or elem_ty.zigTypeTag(zcu) == .Fn)) {
+ if (block.wantSafety() and (try elem_ty.hasRuntimeBitsSema(pt) or elem_ty.zigTypeTag(zcu) == .@"fn")) {
for (0..len) |i| {
const idx_ref = try pt.intRef(Type.usize, i);
const elem_coerced = try block.addBinOp(.array_elem_val, operand_coerced, idx_ref);
@@ -23042,11 +23042,11 @@ fn ptrFromIntVal(
return sema.fail(block, operand_src, "pointer type '{}' requires aligned address", .{ptr_ty.fmt(pt)});
return switch (ptr_ty.zigTypeTag(zcu)) {
- .Optional => Value.fromInterned(try pt.intern(.{ .opt = .{
+ .optional => Value.fromInterned(try pt.intern(.{ .opt = .{
.ty = ptr_ty.toIntern(),
.val = if (addr == 0) .none else (try pt.ptrIntValue(ptr_ty.childType(zcu), addr)).toIntern(),
} })),
- .Pointer => try pt.ptrIntValue(ptr_ty, addr),
+ .pointer => try pt.ptrIntValue(ptr_ty, addr),
else => unreachable,
};
}
@@ -23064,16 +23064,16 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData
const dest_tag = base_dest_ty.zigTypeTag(zcu);
const operand_tag = base_operand_ty.zigTypeTag(zcu);
- if (dest_tag != .ErrorSet and dest_tag != .ErrorUnion) {
+ if (dest_tag != .error_set and dest_tag != .error_union) {
return sema.fail(block, src, "expected error set or error union type, found '{s}'", .{@tagName(dest_tag)});
}
- if (operand_tag != .ErrorSet and operand_tag != .ErrorUnion) {
+ if (operand_tag != .error_set and operand_tag != .error_union) {
return sema.fail(block, src, "expected error set or error union type, found '{s}'", .{@tagName(operand_tag)});
}
- if (dest_tag == .ErrorSet and operand_tag == .ErrorUnion) {
+ if (dest_tag == .error_set and operand_tag == .error_union) {
return sema.fail(block, src, "cannot cast an error union type to error set", .{});
}
- if (dest_tag == .ErrorUnion and operand_tag == .ErrorUnion and
+ if (dest_tag == .error_union and operand_tag == .error_union and
base_dest_ty.errorUnionPayload(zcu).toIntern() != base_operand_ty.errorUnionPayload(zcu).toIntern())
{
return sema.failWithOwnedErrorMsg(block, msg: {
@@ -23088,8 +23088,8 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData
break :msg msg;
});
}
- const dest_ty = if (dest_tag == .ErrorUnion) base_dest_ty.errorUnionSet(zcu) else base_dest_ty;
- const operand_ty = if (operand_tag == .ErrorUnion) base_operand_ty.errorUnionSet(zcu) else base_operand_ty;
+ const dest_ty = if (dest_tag == .error_union) base_dest_ty.errorUnionSet(zcu) else base_dest_ty;
+ const operand_ty = if (operand_tag == .error_union) base_operand_ty.errorUnionSet(zcu) else base_operand_ty;
// operand must be defined since it can be an invalid error value
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
break :disjoint true;
};
- if (disjoint and dest_tag != .ErrorUnion) {
+ if (disjoint and dest_tag != .error_union) {
return sema.fail(block, src, "error sets '{}' and '{}' have no common errors", .{
operand_ty.fmt(pt), dest_ty.fmt(pt),
});
@@ -23131,7 +23131,7 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData
if (!dest_ty.isAnyError(zcu)) check: {
const operand_val = zcu.intern_pool.indexToKey(val.toIntern());
var error_name: InternPool.NullTerminatedString = undefined;
- if (operand_tag == .ErrorUnion) {
+ if (operand_tag == .error_union) {
if (operand_val.error_union.val != .err_name) break :check;
error_name = operand_val.error_union.val.err_name;
} else {
@@ -23153,7 +23153,7 @@ fn zirErrorCast(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData
dest_ty.toIntern() != .adhoc_inferred_error_set_type and
zcu.backendSupportsFeature(.error_set_has_value))
{
- if (dest_tag == .ErrorUnion) {
+ if (dest_tag == .error_union) {
const err_code = try sema.analyzeErrUnionCode(block, operand_src, operand);
const err_int = try block.addBitCast(err_int_ty, err_code);
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
}
fn zirPtrCastFull(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref {
- const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
+ const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
const extra = sema.code.extraData(Zir.Inst.BinNode, extended.operand).data;
const src = block.nodeOffset(extra.node);
@@ -23239,10 +23239,10 @@ fn ptrCastFull(
try Type.fromInterned(dest_info.child).resolveLayout(pt);
const src_slice_like = src_info.flags.size == .Slice or
- (src_info.flags.size == .One and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .Array);
+ (src_info.flags.size == .One and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .array);
const dest_slice_like = dest_info.flags.size == .Slice or
- (dest_info.flags.size == .One and Type.fromInterned(dest_info.child).zigTypeTag(zcu) == .Array);
+ (dest_info.flags.size == .One and Type.fromInterned(dest_info.child).zigTypeTag(zcu) == .array);
if (dest_info.flags.size == .Slice and !src_slice_like) {
return sema.fail(block, src, "illegal pointer cast to slice", .{});
@@ -23277,7 +23277,7 @@ fn ptrCastFull(
errdefer msg.destroy(sema.gpa);
if (dest_info.flags.size == .Many and
(src_info.flags.size == .Slice or
- (src_info.flags.size == .One and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .Array)))
+ (src_info.flags.size == .One and Type.fromInterned(src_info.child).zigTypeTag(zcu) == .array)))
{
try sema.errNote(src, msg, "use 'ptr' field to convert slice to many pointer", .{});
} else {
@@ -23473,7 +23473,7 @@ fn ptrCastFull(
}
const ptr = if (src_info.flags.size == .Slice and dest_info.flags.size != .Slice) ptr: {
- if (operand_ty.zigTypeTag(zcu) == .Optional) {
+ if (operand_ty.zigTypeTag(zcu) == .optional) {
break :ptr try sema.analyzeOptionalSlicePtr(block, operand_src, operand, operand_ty);
} else {
break :ptr try sema.analyzeSlicePtr(block, operand_src, operand, operand_ty);
@@ -23485,7 +23485,7 @@ fn ptrCastFull(
var info = dest_info;
info.flags.size = .Many;
const ty = try pt.ptrTypeSema(info);
- if (dest_ty.zigTypeTag(zcu) == .Optional) {
+ if (dest_ty.zigTypeTag(zcu) == .optional) {
break :blk try pt.optionalType(ty.toIntern());
} else {
break :blk ty;
@@ -23535,7 +23535,7 @@ fn ptrCastFull(
try sema.validateRuntimeValue(block, operand_src, ptr);
if (block.wantSafety() and operand_ty.ptrAllowsZero(zcu) and !dest_ty.ptrAllowsZero(zcu) and
- (try Type.fromInterned(dest_info.child).hasRuntimeBitsSema(pt) or Type.fromInterned(dest_info.child).zigTypeTag(zcu) == .Fn))
+ (try Type.fromInterned(dest_info.child).hasRuntimeBitsSema(pt) or Type.fromInterned(dest_info.child).zigTypeTag(zcu) == .@"fn"))
{
const ptr_int = try block.addUnOp(.int_from_ptr, ptr);
const is_non_zero = try block.addBinOp(.cmp_neq, ptr_int, .zero_usize);
@@ -23570,7 +23570,7 @@ fn ptrCastFull(
var intermediate_info = src_info;
intermediate_info.flags.address_space = dest_info.flags.address_space;
const intermediate_ptr_ty = try pt.ptrTypeSema(intermediate_info);
- const intermediate_ty = if (dest_ptr_ty.zigTypeTag(zcu) == .Optional) blk: {
+ const intermediate_ty = if (dest_ptr_ty.zigTypeTag(zcu) == .optional) blk: {
break :blk try pt.optionalType(intermediate_ptr_ty.toIntern());
} else intermediate_ptr_ty;
const intermediate = try block.addInst(.{
@@ -23613,7 +23613,7 @@ fn ptrCastFull(
fn zirPtrCastNoDest(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) CompileError!Air.Inst.Ref {
const pt = sema.pt;
const zcu = pt.zcu;
- const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
+ const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
const extra = sema.code.extraData(Zir.Inst.UnNode, extended.operand).data;
const src = block.nodeOffset(extra.node);
@@ -23628,7 +23628,7 @@ fn zirPtrCastNoDest(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Inst
const dest_ty = blk: {
const dest_ty = try pt.ptrTypeSema(ptr_info);
- if (operand_ty.zigTypeTag(zcu) == .Optional) {
+ if (operand_ty.zigTypeTag(zcu) == .optional) {
break :blk try pt.optionalType(dest_ty.toIntern());
}
break :blk dest_ty;
@@ -23657,13 +23657,13 @@ fn zirTruncate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
const operand_ty = sema.typeOf(operand);
const operand_scalar_ty = try sema.checkIntOrVectorAllowComptime(block, operand_ty, operand_src);
- const operand_is_vector = operand_ty.zigTypeTag(zcu) == .Vector;
- const dest_is_vector = dest_ty.zigTypeTag(zcu) == .Vector;
+ const operand_is_vector = operand_ty.zigTypeTag(zcu) == .vector;
+ const dest_is_vector = dest_ty.zigTypeTag(zcu) == .vector;
if (operand_is_vector != dest_is_vector) {
return sema.fail(block, operand_src, "expected type '{}', found '{}'", .{ dest_ty.fmt(pt), operand_ty.fmt(pt) });
}
- if (dest_scalar_ty.zigTypeTag(zcu) == .ComptimeInt) {
+ if (dest_scalar_ty.zigTypeTag(zcu) == .comptime_int) {
return sema.coerce(block, dest_ty, operand, operand_src);
}
@@ -23673,7 +23673,7 @@ fn zirTruncate(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Ai
return Air.internedToRef(val.toIntern());
}
- if (operand_scalar_ty.zigTypeTag(zcu) != .ComptimeInt) {
+ if (operand_scalar_ty.zigTypeTag(zcu) != .comptime_int) {
const operand_info = operand_ty.intInfo(zcu);
if (try sema.typeHasOnePossibleValue(operand_ty)) |val| {
return Air.internedToRef(val.toIntern());
@@ -23751,7 +23751,7 @@ fn zirBitCount(
const result_scalar_ty = try pt.smallestUnsignedInt(bits);
switch (operand_ty.zigTypeTag(zcu)) {
- .Vector => {
+ .vector => {
const vec_len = operand_ty.vectorLen(zcu);
const result_ty = try pt.vectorType(.{
.len = vec_len,
@@ -23776,7 +23776,7 @@ fn zirBitCount(
return block.addTyOp(air_tag, result_ty, operand);
}
},
- .Int => {
+ .int => {
if (try sema.resolveValueResolveLazy(operand)) |val| {
if (val.isUndef(zcu)) return pt.undefRef(result_scalar_ty);
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
}
switch (operand_ty.zigTypeTag(zcu)) {
- .Int => {
+ .int => {
const runtime_src = if (try sema.resolveValue(operand)) |val| {
if (val.isUndef(zcu)) return pt.undefRef(operand_ty);
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
try sema.requireRuntimeBlock(block, src, runtime_src);
return block.addTyOp(.byte_swap, operand_ty, operand);
},
- .Vector => {
+ .vector => {
const runtime_src = if (try sema.resolveValue(operand)) |val| {
if (val.isUndef(zcu))
return pt.undefRef(operand_ty);
@@ -23862,7 +23862,7 @@ fn zirBitReverse(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!
const pt = sema.pt;
const zcu = pt.zcu;
switch (operand_ty.zigTypeTag(zcu)) {
- .Int => {
+ .int => {
const runtime_src = if (try sema.resolveValue(operand)) |val| {
if (val.isUndef(zcu)) return pt.undefRef(operand_ty);
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!
try sema.requireRuntimeBlock(block, src, runtime_src);
return block.addTyOp(.bit_reverse, operand_ty, operand);
},
- .Vector => {
+ .vector => {
const runtime_src = if (try sema.resolveValue(operand)) |val| {
if (val.isUndef(zcu))
return pt.undefRef(operand_ty);
@@ -23924,7 +23924,7 @@ fn bitOffsetOf(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!u6
const ip = &zcu.intern_pool;
try ty.resolveLayout(pt);
switch (ty.zigTypeTag(zcu)) {
- .Struct => {},
+ .@"struct" => {},
else => return sema.fail(block, lhs_src, "expected struct type, found '{}'", .{ty.fmt(pt)}),
}
@@ -23959,7 +23959,7 @@ fn checkNamespaceType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) Com
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Struct, .Enum, .Union, .Opaque => return,
+ .@"struct", .@"enum", .@"union", .@"opaque" => return,
else => return sema.fail(block, src, "expected struct, enum, union, or opaque; found '{}'", .{ty.fmt(pt)}),
}
}
@@ -23969,8 +23969,8 @@ fn checkIntType(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) CompileEr
const pt = sema.pt;
const zcu = pt.zcu;
switch (try ty.zigTypeTagOrPoison(zcu)) {
- .ComptimeInt => return true,
- .Int => return false,
+ .comptime_int => return true,
+ .int => return false,
else => return sema.fail(block, src, "expected integer type, found '{}'", .{ty.fmt(pt)}),
}
}
@@ -23984,7 +23984,7 @@ fn checkInvalidPtrIntArithmetic(
const pt = sema.pt;
const zcu = pt.zcu;
switch (try ty.zigTypeTagOrPoison(zcu)) {
- .Pointer => switch (ty.ptrSize(zcu)) {
+ .pointer => switch (ty.ptrSize(zcu)) {
.One, .Slice => return,
.Many, .C => return sema.failWithInvalidPtrArithmetic(block, src, "pointer-integer", "addition and subtraction"),
},
@@ -24001,8 +24001,8 @@ fn checkArithmeticOp(
rhs_zig_ty_tag: std.builtin.TypeId,
zir_tag: Zir.Inst.Tag,
) CompileError!void {
- const is_int = scalar_tag == .Int or scalar_tag == .ComptimeInt;
- const is_float = scalar_tag == .Float or scalar_tag == .ComptimeFloat;
+ const is_int = scalar_tag == .int or scalar_tag == .comptime_int;
+ const is_float = scalar_tag == .float or scalar_tag == .comptime_float;
if (!is_int and !(is_float and floatOpAllowed(zir_tag))) {
return sema.fail(block, src, "invalid operands to binary expression: '{s}' and '{s}'", .{
@@ -24020,8 +24020,8 @@ fn checkPtrOperand(
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Pointer => return,
- .Fn => {
+ .pointer => return,
+ .@"fn" => {
const msg = msg: {
const msg = try sema.errMsg(
ty_src,
@@ -24036,7 +24036,7 @@ fn checkPtrOperand(
};
return sema.failWithOwnedErrorMsg(block, msg);
},
- .Optional => if (ty.childType(zcu).zigTypeTag(zcu) == .Pointer) return,
+ .optional => if (ty.childType(zcu).zigTypeTag(zcu) == .pointer) return,
else => {},
}
return sema.fail(block, ty_src, "expected pointer type, found '{}'", .{ty.fmt(pt)});
@@ -24052,8 +24052,8 @@ fn checkPtrType(
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Pointer => if (allow_slice or !ty.isSlice(zcu)) return,
- .Fn => {
+ .pointer => if (allow_slice or !ty.isSlice(zcu)) return,
+ .@"fn" => {
const msg = msg: {
const msg = try sema.errMsg(
ty_src,
@@ -24068,7 +24068,7 @@ fn checkPtrType(
};
return sema.failWithOwnedErrorMsg(block, msg);
},
- .Optional => if (ty.childType(zcu).zigTypeTag(zcu) == .Pointer) return,
+ .optional => if (ty.childType(zcu).zigTypeTag(zcu) == .pointer) return,
else => {},
}
return sema.fail(block, ty_src, "expected pointer type, found '{}'", .{ty.fmt(pt)});
@@ -24083,8 +24083,8 @@ fn checkVectorElemType(
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Int, .Float, .Bool => return,
- .Optional, .Pointer => if (ty.isPtrAtRuntime(zcu)) return,
+ .int, .float, .bool => return,
+ .optional, .pointer => if (ty.isPtrAtRuntime(zcu)) return,
else => {},
}
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(
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .ComptimeInt, .ComptimeFloat, .Float => {},
+ .comptime_int, .comptime_float, .float => {},
else => return sema.fail(block, ty_src, "expected float type, found '{}'", .{ty.fmt(pt)}),
}
}
@@ -24113,9 +24113,9 @@ fn checkNumericType(
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .ComptimeFloat, .Float, .ComptimeInt, .Int => {},
- .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
- .ComptimeFloat, .Float, .ComptimeInt, .Int => {},
+ .comptime_float, .float, .comptime_int, .int => {},
+ .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
+ .comptime_float, .float, .comptime_int, .int => {},
else => |t| return sema.fail(block, ty_src, "expected number, found '{}'", .{t}),
},
else => return sema.fail(block, ty_src, "expected number, found '{}'", .{ty.fmt(pt)}),
@@ -24167,7 +24167,7 @@ fn checkAtomicPtrOperand(
const ptr_ty = sema.typeOf(ptr);
const ptr_data = switch (try ptr_ty.zigTypeTagOrPoison(zcu)) {
- .Pointer => ptr_ty.ptrInfo(zcu),
+ .pointer => ptr_ty.ptrInfo(zcu),
else => {
const wanted_ptr_ty = try pt.ptrTypeSema(wanted_ptr_data);
_ = try sema.coerce(block, wanted_ptr_ty, ptr, ptr_src);
@@ -24208,11 +24208,11 @@ fn checkIntOrVector(
const zcu = pt.zcu;
const operand_ty = sema.typeOf(operand);
switch (try operand_ty.zigTypeTagOrPoison(zcu)) {
- .Int => return operand_ty,
- .Vector => {
+ .int => return operand_ty,
+ .vector => {
const elem_ty = operand_ty.childType(zcu);
switch (try elem_ty.zigTypeTagOrPoison(zcu)) {
- .Int => return elem_ty,
+ .int => return elem_ty,
else => return sema.fail(block, operand_src, "expected vector of integers; found vector of '{}'", .{
elem_ty.fmt(pt),
}),
@@ -24233,11 +24233,11 @@ fn checkIntOrVectorAllowComptime(
const pt = sema.pt;
const zcu = pt.zcu;
switch (try operand_ty.zigTypeTagOrPoison(zcu)) {
- .Int, .ComptimeInt => return operand_ty,
- .Vector => {
+ .int, .comptime_int => return operand_ty,
+ .vector => {
const elem_ty = operand_ty.childType(zcu);
switch (try elem_ty.zigTypeTagOrPoison(zcu)) {
- .Int, .ComptimeInt => return elem_ty,
+ .int, .comptime_int => return elem_ty,
else => return sema.fail(block, operand_src, "expected vector of integers; found vector of '{}'", .{
elem_ty.fmt(pt),
}),
@@ -24277,7 +24277,7 @@ fn checkSimdBinOp(
const rhs_ty = sema.typeOf(uncasted_rhs);
try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src);
- const vec_len: ?usize = if (lhs_ty.zigTypeTag(zcu) == .Vector) lhs_ty.vectorLen(zcu) else null;
+ const vec_len: ?usize = if (lhs_ty.zigTypeTag(zcu) == .vector) lhs_ty.vectorLen(zcu) else null;
const result_ty = try sema.resolvePeerTypes(block, src, &.{ uncasted_lhs, uncasted_rhs }, .{
.override = &[_]?LazySrcLoc{ lhs_src, rhs_src },
});
@@ -24308,14 +24308,14 @@ fn checkVectorizableBinaryOperands(
const zcu = pt.zcu;
const lhs_zig_ty_tag = try lhs_ty.zigTypeTagOrPoison(zcu);
const rhs_zig_ty_tag = try rhs_ty.zigTypeTagOrPoison(zcu);
- if (lhs_zig_ty_tag != .Vector and rhs_zig_ty_tag != .Vector) return;
+ if (lhs_zig_ty_tag != .vector and rhs_zig_ty_tag != .vector) return;
const lhs_is_vector = switch (lhs_zig_ty_tag) {
- .Vector, .Array => true,
+ .vector, .array => true,
else => false,
};
const rhs_is_vector = switch (rhs_zig_ty_tag) {
- .Vector, .Array => true,
+ .vector, .array => true,
else => false,
};
@@ -24477,7 +24477,7 @@ fn zirCmpxchg(
// zig fmt: on
const expected_value = try sema.resolveInst(extra.expected_value);
const elem_ty = sema.typeOf(expected_value);
- if (elem_ty.zigTypeTag(zcu) == .Float) {
+ if (elem_ty.zigTypeTag(zcu) == .float) {
return sema.fail(
block,
elem_ty_src,
@@ -24602,7 +24602,7 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
const pt = sema.pt;
const zcu = pt.zcu;
- if (operand_ty.zigTypeTag(zcu) != .Vector) {
+ if (operand_ty.zigTypeTag(zcu) != .vector) {
return sema.fail(block, operand_src, "expected vector, found '{}'", .{operand_ty.fmt(pt)});
}
@@ -24611,13 +24611,13 @@ fn zirReduce(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
// Type-check depending on operation.
switch (operation) {
.And, .Or, .Xor => switch (scalar_ty.zigTypeTag(zcu)) {
- .Int, .Bool => {},
+ .int, .bool => {},
else => return sema.fail(block, operand_src, "@reduce operation '{s}' requires integer or boolean operand; found '{}'", .{
@tagName(operation), operand_ty.fmt(pt),
}),
},
.Min, .Max, .Add, .Mul => switch (scalar_ty.zigTypeTag(zcu)) {
- .Int, .Float => {},
+ .int, .float => {},
else => return sema.fail(block, operand_src, "@reduce operation '{s}' requires integer or float operand; found '{}'", .{
@tagName(operation), operand_ty.fmt(pt),
}),
@@ -24677,7 +24677,7 @@ fn zirShuffle(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
var mask_ty = sema.typeOf(mask);
const mask_len = switch (sema.typeOf(mask).zigTypeTag(zcu)) {
- .Array, .Vector => sema.typeOf(mask).arrayLen(zcu),
+ .array, .vector => sema.typeOf(mask).arrayLen(zcu),
else => return sema.fail(block, mask_src, "expected vector or array, found '{}'", .{sema.typeOf(mask).fmt(pt)}),
};
mask_ty = try pt.vectorType(.{
@@ -24715,16 +24715,16 @@ fn analyzeShuffle(
});
const maybe_a_len = switch (sema.typeOf(a).zigTypeTag(zcu)) {
- .Array, .Vector => sema.typeOf(a).arrayLen(zcu),
- .Undefined => null,
+ .array, .vector => sema.typeOf(a).arrayLen(zcu),
+ .undefined => null,
else => return sema.fail(block, a_src, "expected vector or array with element type '{}', found '{}'", .{
elem_ty.fmt(pt),
sema.typeOf(a).fmt(pt),
}),
};
const maybe_b_len = switch (sema.typeOf(b).zigTypeTag(zcu)) {
- .Array, .Vector => sema.typeOf(b).arrayLen(zcu),
- .Undefined => null,
+ .array, .vector => sema.typeOf(b).arrayLen(zcu),
+ .undefined => null,
else => return sema.fail(block, b_src, "expected vector or array with element type '{}', found '{}'", .{
elem_ty.fmt(pt),
sema.typeOf(b).fmt(pt),
@@ -24869,7 +24869,7 @@ fn zirSelect(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.InstData) C
const pred_ty = sema.typeOf(pred_uncoerced);
const vec_len_u64 = switch (try pred_ty.zigTypeTagOrPoison(zcu)) {
- .Vector, .Array => pred_ty.arrayLen(zcu),
+ .vector, .array => pred_ty.arrayLen(zcu),
else => return sema.fail(block, pred_src, "expected vector or array, found '{}'", .{pred_ty.fmt(pt)}),
};
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
const op = try sema.resolveAtomicRmwOp(block, op_src, extra.operation);
switch (elem_ty.zigTypeTag(zcu)) {
- .Enum => if (op != .Xchg) {
+ .@"enum" => if (op != .Xchg) {
return sema.fail(block, op_src, "@atomicRmw with enum only allowed with .Xchg", .{});
},
- .Bool => if (op != .Xchg) {
+ .bool => if (op != .Xchg) {
return sema.fail(block, op_src, "@atomicRmw with bool only allowed with .Xchg", .{});
},
- .Float => switch (op) {
+ .float => switch (op) {
.Xchg, .Add, .Sub, .Max, .Min => {},
else => return sema.fail(block, op_src, "@atomicRmw with float only allowed with .Xchg, .Add, .Sub, .Max, and .Min", .{}),
},
@@ -25135,7 +25135,7 @@ fn zirMulAdd(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.
const zcu = pt.zcu;
switch (ty.scalarType(zcu).zigTypeTag(zcu)) {
- .ComptimeFloat, .Float => {},
+ .comptime_float, .float => {},
else => return sema.fail(block, src, "expected vector of floats or float type, found '{}'", .{ty.fmt(pt)}),
}
@@ -25281,7 +25281,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
const ip = &zcu.intern_pool;
const extra = sema.code.extraData(Zir.Inst.FieldParentPtr, extended.operand).data;
- const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
+ const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
assert(!flags.ptr_cast);
const inst_src = block.nodeOffset(extra.src_node);
@@ -25296,7 +25296,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
}
const parent_ty = Type.fromInterned(parent_ptr_info.child);
switch (parent_ty.zigTypeTag(zcu)) {
- .Struct, .Union => {},
+ .@"struct", .@"union" => {},
else => return sema.fail(block, inst_src, "expected pointer to struct or union type, found '{}'", .{parent_ptr_ty.fmt(pt)}),
}
try parent_ty.resolveLayout(pt);
@@ -25305,7 +25305,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
.needed_comptime_reason = "field name must be comptime-known",
});
const field_index = switch (parent_ty.zigTypeTag(zcu)) {
- .Struct => blk: {
+ .@"struct" => blk: {
if (parent_ty.isTuple(zcu)) {
if (field_name.eqlSlice("len", ip)) {
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
break :blk try sema.structFieldIndex(block, parent_ty, field_name, field_name_src);
}
},
- .Union => try sema.unionFieldIndex(block, parent_ty, field_name, field_name_src),
+ .@"union" => try sema.unionFieldIndex(block, parent_ty, field_name, field_name_src),
else => unreachable,
};
- if (parent_ty.zigTypeTag(zcu) == .Struct and parent_ty.structFieldIsComptime(field_index, zcu)) {
+ if (parent_ty.zigTypeTag(zcu) == .@"struct" and parent_ty.structFieldIsComptime(field_index, zcu)) {
return sema.fail(block, field_name_src, "cannot get @fieldParentPtr of a comptime field", .{});
}
@@ -25400,7 +25400,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
const result = if (try sema.resolveDefinedValue(block, field_ptr_src, casted_field_ptr)) |field_ptr_val| result: {
switch (parent_ty.zigTypeTag(zcu)) {
- .Struct => switch (parent_ty.containerLayout(zcu)) {
+ .@"struct" => switch (parent_ty.containerLayout(zcu)) {
.auto => {},
.@"extern" => {
const byte_offset = parent_ty.structFieldOffset(field_index, zcu);
@@ -25417,7 +25417,7 @@ fn zirFieldParentPtr(sema: *Sema, block: *Block, extended: Zir.Inst.Extended.Ins
break :result Air.internedToRef(parent_ptr_val.toIntern());
},
},
- .Union => switch (parent_ty.containerLayout(zcu)) {
+ .@"union" => switch (parent_ty.containerLayout(zcu)) {
.auto => {},
.@"extern", .@"packed" => {
// 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
// lowering. The AIR instruction requires pointers with element types of
// equal ABI size.
- if (dest_ty.zigTypeTag(zcu) != .Pointer or src_ty.zigTypeTag(zcu) != .Pointer) {
+ if (dest_ty.zigTypeTag(zcu) != .pointer or src_ty.zigTypeTag(zcu) != .pointer) {
return sema.fail(block, src, "TODO: lower @memcpy to a for loop because the source or destination iterable is a tuple", .{});
}
@@ -26034,7 +26034,7 @@ fn zirMemset(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
switch (ptr_info.flags.size) {
.Slice => break :dest_elem_ty Type.fromInterned(ptr_info.child),
.One => {
- if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .Array) {
+ if (Type.fromInterned(ptr_info.child).zigTypeTag(zcu) == .array) {
break :dest_elem_ty Type.fromInterned(ptr_info.child).childType(zcu);
}
},
@@ -26533,7 +26533,7 @@ fn zirCDefine(
.needed_comptime_reason = "name of macro being undefined must be comptime-known",
});
const rhs = try sema.resolveInst(extra.rhs);
- if (sema.typeOf(rhs).zigTypeTag(zcu) != .Void) {
+ if (sema.typeOf(rhs).zigTypeTag(zcu) != .void) {
const value = try sema.resolveConstString(block, val_src, extra.rhs, .{
.needed_comptime_reason = "value of macro being undefined must be comptime-known",
});
@@ -26951,7 +26951,7 @@ fn validateVarType(
return sema.failWithOwnedErrorMsg(block, msg);
}
} else {
- if (var_ty.zigTypeTag(zcu) == .Opaque) {
+ if (var_ty.zigTypeTag(zcu) == .@"opaque") {
return sema.fail(
block,
src,
@@ -26968,7 +26968,7 @@ fn validateVarType(
errdefer msg.destroy(sema.gpa);
try sema.explainWhyTypeIsComptime(msg, src, var_ty);
- if (var_ty.zigTypeTag(zcu) == .ComptimeInt or var_ty.zigTypeTag(zcu) == .ComptimeFloat) {
+ if (var_ty.zigTypeTag(zcu) == .comptime_int or var_ty.zigTypeTag(zcu) == .comptime_float) {
try sema.errNote(src, msg, "to modify this variable at runtime, it must be given an explicit fixed-size number type", .{});
}
@@ -27003,42 +27003,42 @@ fn explainWhyTypeIsComptimeInner(
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
switch (ty.zigTypeTag(zcu)) {
- .Bool,
- .Int,
- .Float,
- .ErrorSet,
- .Enum,
- .Frame,
- .AnyFrame,
- .Void,
+ .bool,
+ .int,
+ .float,
+ .error_set,
+ .@"enum",
+ .frame,
+ .@"anyframe",
+ .void,
=> return,
- .Fn => {
+ .@"fn" => {
try sema.errNote(src_loc, msg, "use '*const {}' for a function pointer type", .{ty.fmt(pt)});
},
- .Type => {
+ .type => {
try sema.errNote(src_loc, msg, "types are not available at runtime", .{});
},
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .NoReturn,
- .Undefined,
- .Null,
+ .comptime_float,
+ .comptime_int,
+ .enum_literal,
+ .noreturn,
+ .undefined,
+ .null,
=> return,
- .Opaque => {
+ .@"opaque" => {
try sema.errNote(src_loc, msg, "opaque type '{}' has undefined size", .{ty.fmt(pt)});
},
- .Array, .Vector => {
+ .array, .vector => {
try sema.explainWhyTypeIsComptimeInner(msg, src_loc, ty.childType(zcu), type_set);
},
- .Pointer => {
+ .pointer => {
const elem_ty = ty.elemType2(zcu);
- if (elem_ty.zigTypeTag(zcu) == .Fn) {
+ if (elem_ty.zigTypeTag(zcu) == .@"fn") {
const fn_info = zcu.typeToFunc(elem_ty).?;
if (fn_info.is_generic) {
try sema.errNote(src_loc, msg, "function is generic", .{});
@@ -27055,14 +27055,14 @@ fn explainWhyTypeIsComptimeInner(
try sema.explainWhyTypeIsComptimeInner(msg, src_loc, ty.childType(zcu), type_set);
},
- .Optional => {
+ .optional => {
try sema.explainWhyTypeIsComptimeInner(msg, src_loc, ty.optionalChild(zcu), type_set);
},
- .ErrorUnion => {
+ .error_union => {
try sema.explainWhyTypeIsComptimeInner(msg, src_loc, ty.errorUnionPayload(zcu), type_set);
},
- .Struct => {
+ .@"struct" => {
if ((try type_set.getOrPut(sema.gpa, ty.toIntern())).found_existing) return;
if (zcu.typeToStruct(ty)) |struct_type| {
@@ -27082,7 +27082,7 @@ fn explainWhyTypeIsComptimeInner(
// TODO tuples
},
- .Union => {
+ .@"union" => {
if ((try type_set.getOrPut(sema.gpa, ty.toIntern())).found_existing) return;
if (zcu.typeToUnion(ty)) |union_obj| {
@@ -27123,34 +27123,34 @@ fn validateExternType(
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Type,
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .Undefined,
- .Null,
- .ErrorUnion,
- .ErrorSet,
- .Frame,
+ .type,
+ .comptime_float,
+ .comptime_int,
+ .enum_literal,
+ .undefined,
+ .null,
+ .error_union,
+ .error_set,
+ .frame,
=> return false,
- .Void => return position == .union_field or position == .ret_ty or position == .struct_field or position == .element,
- .NoReturn => return position == .ret_ty,
- .Opaque,
- .Bool,
- .Float,
- .AnyFrame,
+ .void => return position == .union_field or position == .ret_ty or position == .struct_field or position == .element,
+ .noreturn => return position == .ret_ty,
+ .@"opaque",
+ .bool,
+ .float,
+ .@"anyframe",
=> return true,
- .Pointer => {
- if (ty.childType(zcu).zigTypeTag(zcu) == .Fn) {
+ .pointer => {
+ if (ty.childType(zcu).zigTypeTag(zcu) == .@"fn") {
return ty.isConstPtr(zcu) and try sema.validateExternType(ty.childType(zcu), .other);
}
return !(ty.isSlice(zcu) or try ty.comptimeOnlySema(pt));
},
- .Int => switch (ty.intInfo(zcu).bits) {
+ .int => switch (ty.intInfo(zcu).bits) {
0, 8, 16, 32, 64, 128 => return true,
else => return false,
},
- .Fn => {
+ .@"fn" => {
if (position != .other) return false;
const target = zcu.getTarget();
// 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(
}
return !target_util.fnCallConvAllowsZigTypes(target, ty.fnCallingConvention(zcu));
},
- .Enum => {
+ .@"enum" => {
return sema.validateExternType(ty.intTagType(zcu), position);
},
- .Struct, .Union => switch (ty.containerLayout(zcu)) {
+ .@"struct", .@"union" => switch (ty.containerLayout(zcu)) {
.@"extern" => return true,
.@"packed" => {
const bit_size = try ty.bitSizeSema(pt);
@@ -27174,12 +27174,12 @@ fn validateExternType(
},
.auto => return !(try ty.hasRuntimeBitsSema(pt)),
},
- .Array => {
+ .array => {
if (position == .ret_ty or position == .param_ty) return false;
return sema.validateExternType(ty.elemType2(zcu), .element);
},
- .Vector => return sema.validateExternType(ty.elemType2(zcu), .element),
- .Optional => return ty.isPtrLikeOptional(zcu),
+ .vector => return sema.validateExternType(ty.elemType2(zcu), .element),
+ .optional => return ty.isPtrLikeOptional(zcu),
}
}
@@ -27193,29 +27193,29 @@ fn explainWhyTypeIsNotExtern(
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Opaque,
- .Bool,
- .Float,
- .AnyFrame,
+ .@"opaque",
+ .bool,
+ .float,
+ .@"anyframe",
=> return,
- .Type,
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .Undefined,
- .Null,
- .ErrorUnion,
- .ErrorSet,
- .Frame,
+ .type,
+ .comptime_float,
+ .comptime_int,
+ .enum_literal,
+ .undefined,
+ .null,
+ .error_union,
+ .error_set,
+ .frame,
=> return,
- .Pointer => {
+ .pointer => {
if (ty.isSlice(zcu)) {
try sema.errNote(src_loc, msg, "slices have no guaranteed in-memory representation", .{});
} else {
const pointee_ty = ty.childType(zcu);
- if (!ty.isConstPtr(zcu) and pointee_ty.zigTypeTag(zcu) == .Fn) {
+ if (!ty.isConstPtr(zcu) and pointee_ty.zigTypeTag(zcu) == .@"fn") {
try sema.errNote(src_loc, msg, "pointer to extern function must be 'const'", .{});
} else if (try ty.comptimeOnlySema(pt)) {
try sema.errNote(src_loc, msg, "pointer to comptime-only type '{}'", .{pointee_ty.fmt(pt)});
@@ -27224,14 +27224,14 @@ fn explainWhyTypeIsNotExtern(
try sema.explainWhyTypeIsNotExtern(msg, src_loc, pointee_ty, .other);
}
},
- .Void => try sema.errNote(src_loc, msg, "'void' is a zero bit type; for C 'void' use 'anyopaque'", .{}),
- .NoReturn => try sema.errNote(src_loc, msg, "'noreturn' is only allowed as a return type", .{}),
- .Int => if (!std.math.isPowerOfTwo(ty.intInfo(zcu).bits)) {
+ .void => try sema.errNote(src_loc, msg, "'void' is a zero bit type; for C 'void' use 'anyopaque'", .{}),
+ .noreturn => try sema.errNote(src_loc, msg, "'noreturn' is only allowed as a return type", .{}),
+ .int => if (!std.math.isPowerOfTwo(ty.intInfo(zcu).bits)) {
try sema.errNote(src_loc, msg, "only integers with 0 or power of two bits are extern compatible", .{});
} else {
try sema.errNote(src_loc, msg, "only integers with 0, 8, 16, 32, 64 and 128 bits are extern compatible", .{});
},
- .Fn => {
+ .@"fn" => {
if (position != .other) {
try sema.errNote(src_loc, msg, "type has no guaranteed in-memory representation", .{});
try sema.errNote(src_loc, msg, "use '*const ' to make a function pointer type", .{});
@@ -27244,14 +27244,14 @@ fn explainWhyTypeIsNotExtern(
else => return,
}
},
- .Enum => {
+ .@"enum" => {
const tag_ty = ty.intTagType(zcu);
try sema.errNote(src_loc, msg, "enum tag type '{}' is not extern compatible", .{tag_ty.fmt(pt)});
try sema.explainWhyTypeIsNotExtern(msg, src_loc, tag_ty, position);
},
- .Struct => try sema.errNote(src_loc, msg, "only extern structs and ABI sized packed structs are extern compatible", .{}),
- .Union => try sema.errNote(src_loc, msg, "only extern unions and ABI sized packed unions are extern compatible", .{}),
- .Array => {
+ .@"struct" => try sema.errNote(src_loc, msg, "only extern structs and ABI sized packed structs are extern compatible", .{}),
+ .@"union" => try sema.errNote(src_loc, msg, "only extern unions and ABI sized packed unions are extern compatible", .{}),
+ .array => {
if (position == .ret_ty) {
return sema.errNote(src_loc, msg, "arrays are not allowed as a return type", .{});
} else if (position == .param_ty) {
@@ -27259,8 +27259,8 @@ fn explainWhyTypeIsNotExtern(
}
try sema.explainWhyTypeIsNotExtern(msg, src_loc, ty.elemType2(zcu), .element);
},
- .Vector => try sema.explainWhyTypeIsNotExtern(msg, src_loc, ty.elemType2(zcu), .element),
- .Optional => try sema.errNote(src_loc, msg, "only pointer like optionals are extern compatible", .{}),
+ .vector => try sema.explainWhyTypeIsNotExtern(msg, src_loc, ty.elemType2(zcu), .element),
+ .optional => try sema.errNote(src_loc, msg, "only pointer like optionals are extern compatible", .{}),
}
}
@@ -27270,34 +27270,34 @@ fn validatePackedType(sema: *Sema, ty: Type) !bool {
const pt = sema.pt;
const zcu = pt.zcu;
return switch (ty.zigTypeTag(zcu)) {
- .Type,
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .Undefined,
- .Null,
- .ErrorUnion,
- .ErrorSet,
- .Frame,
- .NoReturn,
- .Opaque,
- .AnyFrame,
- .Fn,
- .Array,
+ .type,
+ .comptime_float,
+ .comptime_int,
+ .enum_literal,
+ .undefined,
+ .null,
+ .error_union,
+ .error_set,
+ .frame,
+ .noreturn,
+ .@"opaque",
+ .@"anyframe",
+ .@"fn",
+ .array,
=> false,
- .Optional => return ty.isPtrLikeOptional(zcu),
- .Void,
- .Bool,
- .Float,
- .Int,
- .Vector,
+ .optional => return ty.isPtrLikeOptional(zcu),
+ .void,
+ .bool,
+ .float,
+ .int,
+ .vector,
=> true,
- .Enum => switch (zcu.intern_pool.loadEnumType(ty.toIntern()).tag_mode) {
+ .@"enum" => switch (zcu.intern_pool.loadEnumType(ty.toIntern()).tag_mode) {
.auto => false,
.explicit, .nonexhaustive => true,
},
- .Pointer => !ty.isSlice(zcu) and !try ty.comptimeOnlySema(pt),
- .Struct, .Union => ty.containerLayout(zcu) == .@"packed",
+ .pointer => !ty.isSlice(zcu) and !try ty.comptimeOnlySema(pt),
+ .@"struct", .@"union" => ty.containerLayout(zcu) == .@"packed",
};
}
@@ -27310,40 +27310,40 @@ fn explainWhyTypeIsNotPacked(
const pt = sema.pt;
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Void,
- .Bool,
- .Float,
- .Int,
- .Vector,
- .Enum,
+ .void,
+ .bool,
+ .float,
+ .int,
+ .vector,
+ .@"enum",
=> return,
- .Type,
- .ComptimeFloat,
- .ComptimeInt,
- .EnumLiteral,
- .Undefined,
- .Null,
- .Frame,
- .NoReturn,
- .Opaque,
- .ErrorUnion,
- .ErrorSet,
- .AnyFrame,
- .Optional,
- .Array,
+ .type,
+ .comptime_float,
+ .comptime_int,
+ .enum_literal,
+ .undefined,
+ .null,
+ .frame,
+ .noreturn,
+ .@"opaque",
+ .error_union,
+ .error_set,
+ .@"anyframe",
+ .optional,
+ .array,
=> try sema.errNote(src_loc, msg, "type has no guaranteed in-memory representation", .{}),
- .Pointer => if (ty.isSlice(zcu)) {
+ .pointer => if (ty.isSlice(zcu)) {
try sema.errNote(src_loc, msg, "slices have no guaranteed in-memory representation", .{});
} else {
try sema.errNote(src_loc, msg, "comptime-only pointer has no guaranteed in-memory representation", .{});
try sema.explainWhyTypeIsComptime(msg, src_loc, ty);
},
- .Fn => {
+ .@"fn" => {
try sema.errNote(src_loc, msg, "type has no guaranteed in-memory representation", .{});
try sema.errNote(src_loc, msg, "use '*const ' to make a function pointer type", .{});
},
- .Struct => try sema.errNote(src_loc, msg, "only packed structs layout are allowed in packed types", .{}),
- .Union => try sema.errNote(src_loc, msg, "only packed unions layout are allowed in packed types", .{}),
+ .@"struct" => try sema.errNote(src_loc, msg, "only packed structs layout are allowed in packed types", .{}),
+ .@"union" => try sema.errNote(src_loc, msg, "only packed unions layout are allowed in packed types", .{}),
}
}
@@ -27356,7 +27356,7 @@ fn prepareSimplePanic(sema: *Sema, block: *Block, src: LazySrcLoc) !void {
const fn_val = try sema.resolveConstValue(block, src, fn_ref, .{
.needed_comptime_reason = "panic handler must be comptime-known",
});
- assert(fn_val.typeOf(zcu).zigTypeTag(zcu) == .Fn);
+ assert(fn_val.typeOf(zcu).zigTypeTag(zcu) == .@"fn");
assert(try fn_val.typeOf(zcu).fnHasRuntimeBitsSema(pt));
try zcu.ensureFuncBodyAnalysisQueued(fn_val.toIntern());
zcu.panic_func_index = fn_val.toIntern();
@@ -27444,9 +27444,9 @@ fn addSafetyCheckExtra(
try parent_block.instructions.ensureUnusedCapacity(gpa, 1);
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len +
1 + // The main block only needs space for the cond_br.
- @typeInfo(Air.CondBr).Struct.fields.len +
+ @typeInfo(Air.CondBr).@"struct".fields.len +
1 + // The ok branch of the cond_br only needs space for the br.
fail_block.instructions.items.len);
@@ -27614,7 +27614,7 @@ fn panicSentinelMismatch(
break :blk try parent_block.addTyOp(.load, sentinel_ty, sentinel_ptr);
};
- const ok = if (sentinel_ty.zigTypeTag(zcu) == .Vector) ok: {
+ const ok = if (sentinel_ty.zigTypeTag(zcu) == .vector) ok: {
const eql =
try parent_block.addCmpVector(expected_sentinel, actual_sentinel, .eq);
break :ok try parent_block.addInst(.{
@@ -27727,7 +27727,7 @@ fn fieldVal(
object_ty;
switch (inner_ty.zigTypeTag(zcu)) {
- .Array => {
+ .array => {
if (field_name.eqlSlice("len", ip)) {
return Air.internedToRef((try pt.intValue(Type.usize, inner_ty.arrayLen(zcu))).toIntern());
} else if (field_name.eqlSlice("ptr", ip) and is_pointer_to) {
@@ -27756,7 +27756,7 @@ fn fieldVal(
);
}
},
- .Pointer => {
+ .pointer => {
const ptr_info = inner_ty.ptrInfo(zcu);
if (ptr_info.flags.size == .Slice) {
if (field_name.eqlSlice("ptr", ip)) {
@@ -27781,7 +27781,7 @@ fn fieldVal(
}
}
},
- .Type => {
+ .type => {
const dereffed_type = if (is_pointer_to)
try sema.analyzeLoad(block, src, object, object_src)
else
@@ -27791,7 +27791,7 @@ fn fieldVal(
const child_type = val.toType();
switch (try child_type.zigTypeTagOrPoison(zcu)) {
- .ErrorSet => {
+ .error_set => {
switch (ip.indexToKey(child_type.toIntern())) {
.error_set_type => |error_set_type| blk: {
if (error_set_type.nameIndex(ip, field_name) != null) break :blk;
@@ -27818,7 +27818,7 @@ fn fieldVal(
.name = field_name,
} })));
},
- .Union => {
+ .@"union" => {
if (try sema.namespaceLookupVal(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
return inst;
}
@@ -27831,7 +27831,7 @@ fn fieldVal(
}
return sema.failWithBadMemberAccess(block, child_type, field_name_src, field_name);
},
- .Enum => {
+ .@"enum" => {
if (try sema.namespaceLookupVal(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
return inst;
}
@@ -27841,7 +27841,7 @@ fn fieldVal(
const enum_val = try pt.enumValueFieldIndex(child_type, field_index);
return Air.internedToRef(enum_val.toIntern());
},
- .Struct, .Opaque => {
+ .@"struct", .@"opaque" => {
switch (child_type.toIntern()) {
.empty_struct_type, .anyopaque_type => {}, // no namespace
else => if (try sema.namespaceLookupVal(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
@@ -27854,19 +27854,19 @@ fn fieldVal(
const msg = try sema.errMsg(src, "type '{}' has no members", .{child_type.fmt(pt)});
errdefer msg.destroy(sema.gpa);
if (child_type.isSlice(zcu)) try sema.errNote(src, msg, "slice values have 'len' and 'ptr' members", .{});
- if (child_type.zigTypeTag(zcu) == .Array) try sema.errNote(src, msg, "array values have 'len' member", .{});
+ if (child_type.zigTypeTag(zcu) == .array) try sema.errNote(src, msg, "array values have 'len' member", .{});
break :msg msg;
}),
}
},
- .Struct => if (is_pointer_to) {
+ .@"struct" => if (is_pointer_to) {
// Avoid loading the entire struct by fetching a pointer and loading that
const field_ptr = try sema.structFieldPtr(block, src, object, field_name, field_name_src, inner_ty, false);
return sema.analyzeLoad(block, src, field_ptr, object_src);
} else {
return sema.structFieldVal(block, src, object, field_name, field_name_src, inner_ty);
},
- .Union => if (is_pointer_to) {
+ .@"union" => if (is_pointer_to) {
// Avoid loading the entire union by fetching a pointer and loading that
const field_ptr = try sema.unionFieldPtr(block, src, object, field_name, field_name_src, inner_ty, false);
return sema.analyzeLoad(block, src, field_ptr, object_src);
@@ -27896,7 +27896,7 @@ fn fieldPtr(
const object_ptr_src = src; // TODO better source location
const object_ptr_ty = sema.typeOf(object_ptr);
const object_ty = switch (object_ptr_ty.zigTypeTag(zcu)) {
- .Pointer => object_ptr_ty.childType(zcu),
+ .pointer => object_ptr_ty.childType(zcu),
else => return sema.fail(block, object_ptr_src, "expected pointer, found '{}'", .{object_ptr_ty.fmt(pt)}),
};
@@ -27911,7 +27911,7 @@ fn fieldPtr(
object_ty;
switch (inner_ty.zigTypeTag(zcu)) {
- .Array => {
+ .array => {
if (field_name.eqlSlice("len", ip)) {
const int_val = try pt.intValue(Type.usize, inner_ty.arrayLen(zcu));
return uavRef(sema, int_val.toIntern());
@@ -27955,7 +27955,7 @@ fn fieldPtr(
);
}
},
- .Pointer => if (inner_ty.isSlice(zcu)) {
+ .pointer => if (inner_ty.isSlice(zcu)) {
const inner_ptr = if (is_pointer_to)
try sema.analyzeLoad(block, src, object_ptr, object_ptr_src)
else
@@ -28010,7 +28010,7 @@ fn fieldPtr(
);
}
},
- .Type => {
+ .type => {
_ = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, object_ptr, undefined);
const result = try sema.analyzeLoad(block, src, object_ptr, object_ptr_src);
const inner = if (is_pointer_to)
@@ -28022,7 +28022,7 @@ fn fieldPtr(
const child_type = val.toType();
switch (child_type.zigTypeTag(zcu)) {
- .ErrorSet => {
+ .error_set => {
switch (ip.indexToKey(child_type.toIntern())) {
.error_set_type => |error_set_type| blk: {
if (error_set_type.nameIndex(ip, field_name) != null) {
@@ -28051,7 +28051,7 @@ fn fieldPtr(
.name = field_name,
} }));
},
- .Union => {
+ .@"union" => {
if (try sema.namespaceLookupRef(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
return inst;
}
@@ -28065,7 +28065,7 @@ fn fieldPtr(
}
return sema.failWithBadMemberAccess(block, child_type, field_name_src, field_name);
},
- .Enum => {
+ .@"enum" => {
if (try sema.namespaceLookupRef(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
return inst;
}
@@ -28076,7 +28076,7 @@ fn fieldPtr(
const idx_val = try pt.enumValueFieldIndex(child_type, field_index_u32);
return uavRef(sema, idx_val.toIntern());
},
- .Struct, .Opaque => {
+ .@"struct", .@"opaque" => {
if (try sema.namespaceLookupRef(block, src, child_type.getNamespaceIndex(zcu), field_name)) |inst| {
return inst;
}
@@ -28085,7 +28085,7 @@ fn fieldPtr(
else => return sema.fail(block, src, "type '{}' has no members", .{child_type.fmt(pt)}),
}
},
- .Struct => {
+ .@"struct" => {
const inner_ptr = if (is_pointer_to)
try sema.analyzeLoad(block, src, object_ptr, object_ptr_src)
else
@@ -28094,7 +28094,7 @@ fn fieldPtr(
try sema.checkKnownAllocPtr(block, inner_ptr, field_ptr);
return field_ptr;
},
- .Union => {
+ .@"union" => {
const inner_ptr = if (is_pointer_to)
try sema.analyzeLoad(block, src, object_ptr, object_ptr_src)
else
@@ -28134,13 +28134,13 @@ fn fieldCallBind(
const ip = &zcu.intern_pool;
const raw_ptr_src = src; // TODO better source location
const raw_ptr_ty = sema.typeOf(raw_ptr);
- const inner_ty = if (raw_ptr_ty.zigTypeTag(zcu) == .Pointer and (raw_ptr_ty.ptrSize(zcu) == .One or raw_ptr_ty.ptrSize(zcu) == .C))
+ const inner_ty = if (raw_ptr_ty.zigTypeTag(zcu) == .pointer and (raw_ptr_ty.ptrSize(zcu) == .One or raw_ptr_ty.ptrSize(zcu) == .C))
raw_ptr_ty.childType(zcu)
else
return sema.fail(block, raw_ptr_src, "expected single pointer, found '{}'", .{raw_ptr_ty.fmt(pt)});
// Optionally dereference a second pointer to get the concrete type.
- const is_double_ptr = inner_ty.zigTypeTag(zcu) == .Pointer and inner_ty.ptrSize(zcu) == .One;
+ const is_double_ptr = inner_ty.zigTypeTag(zcu) == .pointer and inner_ty.ptrSize(zcu) == .One;
const concrete_ty = if (is_double_ptr) inner_ty.childType(zcu) else inner_ty;
const ptr_ty = if (is_double_ptr) inner_ty else raw_ptr_ty;
const object_ptr = if (is_double_ptr)
@@ -28150,7 +28150,7 @@ fn fieldCallBind(
find_field: {
switch (concrete_ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
try concrete_ty.resolveFields(pt);
if (zcu.typeToStruct(concrete_ty)) |struct_type| {
const field_index = struct_type.nameIndex(ip, field_name) orelse
@@ -28176,14 +28176,14 @@ fn fieldCallBind(
}
}
},
- .Union => {
+ .@"union" => {
try concrete_ty.resolveFields(pt);
const union_obj = zcu.typeToUnion(concrete_ty).?;
_ = union_obj.loadTagType(ip).nameIndex(ip, field_name) orelse break :find_field;
const field_ptr = try unionFieldPtr(sema, block, src, object_ptr, field_name, field_name_src, concrete_ty, false);
return .{ .direct = try sema.analyzeLoad(block, src, field_ptr, src) };
},
- .Type => {
+ .type => {
const namespace = try sema.analyzeLoad(block, src, object_ptr, src);
return .{ .direct = try sema.fieldVal(block, src, namespace, field_name, field_name_src) };
},
@@ -28205,7 +28205,7 @@ fn fieldCallBind(
const first_param_type = Type.fromInterned(func_type.param_types.get(ip)[0]);
if (first_param_type.isGenericPoison() or
- (first_param_type.zigTypeTag(zcu) == .Pointer and
+ (first_param_type.zigTypeTag(zcu) == .pointer and
(first_param_type.ptrSize(zcu) == .One or
first_param_type.ptrSize(zcu) == .C) and
first_param_type.childType(zcu).eql(concrete_ty, zcu)))
@@ -28225,7 +28225,7 @@ fn fieldCallBind(
.func_inst = decl_val,
.arg0_inst = deref,
} };
- } else if (first_param_type.zigTypeTag(zcu) == .Optional) {
+ } else if (first_param_type.zigTypeTag(zcu) == .optional) {
const child = first_param_type.optionalChild(zcu);
if (child.eql(concrete_ty, zcu)) {
const deref = try sema.analyzeLoad(block, src, object_ptr, src);
@@ -28233,7 +28233,7 @@ fn fieldCallBind(
.func_inst = decl_val,
.arg0_inst = deref,
} };
- } else if (child.zigTypeTag(zcu) == .Pointer and
+ } else if (child.zigTypeTag(zcu) == .pointer and
child.ptrSize(zcu) == .One and
child.childType(zcu).eql(concrete_ty, zcu))
{
@@ -28242,7 +28242,7 @@ fn fieldCallBind(
.arg0_inst = object_ptr,
} };
}
- } else if (first_param_type.zigTypeTag(zcu) == .ErrorUnion and
+ } else if (first_param_type.zigTypeTag(zcu) == .error_union and
first_param_type.errorUnionPayload(zcu).eql(concrete_ty, zcu))
{
const deref = try sema.analyzeLoad(block, src, object_ptr, src);
@@ -28270,7 +28270,7 @@ fn fieldCallBind(
.{field_name.fmt(ip)},
);
}
- if (concrete_ty.zigTypeTag(zcu) == .ErrorUnion) {
+ if (concrete_ty.zigTypeTag(zcu) == .error_union) {
try sema.errNote(src, msg, "consider using 'try', 'catch', or 'if'", .{});
}
if (is_double_ptr) {
@@ -28302,7 +28302,7 @@ fn finishFieldCallBind(
});
const container_ty = ptr_ty.childType(zcu);
- if (container_ty.zigTypeTag(zcu) == .Struct) {
+ if (container_ty.zigTypeTag(zcu) == .@"struct") {
if (container_ty.structFieldIsComptime(field_index, zcu)) {
try container_ty.resolveStructFieldInits(pt);
const default_val = (try container_ty.structFieldValueComptime(pt, field_index)).?;
@@ -28382,7 +28382,7 @@ fn structFieldPtr(
const pt = sema.pt;
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
- assert(struct_ty.zigTypeTag(zcu) == .Struct);
+ assert(struct_ty.zigTypeTag(zcu) == .@"struct");
try struct_ty.resolveFields(pt);
try struct_ty.resolveLayout(pt);
@@ -28508,7 +28508,7 @@ fn structFieldVal(
const pt = sema.pt;
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
- assert(struct_ty.zigTypeTag(zcu) == .Struct);
+ assert(struct_ty.zigTypeTag(zcu) == .@"struct");
try struct_ty.resolveFields(pt);
@@ -28646,7 +28646,7 @@ fn unionFieldPtr(
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
- assert(union_ty.zigTypeTag(zcu) == .Union);
+ assert(union_ty.zigTypeTag(zcu) == .@"union");
const union_ptr_ty = sema.typeOf(union_ptr);
const union_ptr_info = union_ptr_ty.ptrInfo(zcu);
@@ -28673,7 +28673,7 @@ fn unionFieldPtr(
});
const enum_field_index: u32 = @intCast(Type.fromInterned(union_obj.enum_tag_ty).enumFieldIndex(field_name, zcu).?);
- if (initializing and field_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (initializing and field_ty.zigTypeTag(zcu) == .noreturn) {
const msg = msg: {
const msg = try sema.errMsg(src, "cannot initialize 'noreturn' field of union", .{});
errdefer msg.destroy(sema.gpa);
@@ -28736,7 +28736,7 @@ fn unionFieldPtr(
const active_tag = try block.addTyOp(.get_union_tag, Type.fromInterned(union_obj.enum_tag_ty), union_val);
try sema.panicInactiveUnionField(block, src, active_tag, wanted_tag);
}
- if (field_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (field_ty.zigTypeTag(zcu) == .noreturn) {
_ = try block.addNoOp(.unreach);
return .unreachable_value;
}
@@ -28755,7 +28755,7 @@ fn unionFieldVal(
const pt = sema.pt;
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
- assert(union_ty.zigTypeTag(zcu) == .Union);
+ assert(union_ty.zigTypeTag(zcu) == .@"union");
try union_ty.resolveFields(pt);
const union_obj = zcu.typeToUnion(union_ty).?;
@@ -28811,7 +28811,7 @@ fn unionFieldVal(
const active_tag = try block.addTyOp(.get_union_tag, Type.fromInterned(union_obj.enum_tag_ty), union_byval);
try sema.panicInactiveUnionField(block, src, active_tag, wanted_tag);
}
- if (field_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (field_ty.zigTypeTag(zcu) == .noreturn) {
_ = try block.addNoOp(.unreach);
return .unreachable_value;
}
@@ -28835,14 +28835,14 @@ fn elemPtr(
const indexable_ptr_ty = sema.typeOf(indexable_ptr);
const indexable_ty = switch (indexable_ptr_ty.zigTypeTag(zcu)) {
- .Pointer => indexable_ptr_ty.childType(zcu),
+ .pointer => indexable_ptr_ty.childType(zcu),
else => return sema.fail(block, indexable_ptr_src, "expected pointer, found '{}'", .{indexable_ptr_ty.fmt(pt)}),
};
try checkIndexable(sema, block, src, indexable_ty);
const elem_ptr = switch (indexable_ty.zigTypeTag(zcu)) {
- .Array, .Vector => try sema.elemPtrArray(block, src, indexable_ptr_src, indexable_ptr, elem_index_src, elem_index, init, oob_safety),
- .Struct => blk: {
+ .array, .vector => try sema.elemPtrArray(block, src, indexable_ptr_src, indexable_ptr, elem_index_src, elem_index, init, oob_safety),
+ .@"struct" => blk: {
// Tuple field access.
const index_val = try sema.resolveConstDefinedValue(block, elem_index_src, elem_index, .{
.needed_comptime_reason = "tuple field access index must be comptime-known",
@@ -28898,8 +28898,8 @@ fn elemPtrOneLayerOnly(
.One => {
const child_ty = indexable_ty.childType(zcu);
const elem_ptr = switch (child_ty.zigTypeTag(zcu)) {
- .Array, .Vector => try sema.elemPtrArray(block, src, indexable_src, indexable, elem_index_src, elem_index, init, oob_safety),
- .Struct => blk: {
+ .array, .vector => try sema.elemPtrArray(block, src, indexable_src, indexable, elem_index_src, elem_index, init, oob_safety),
+ .@"struct" => blk: {
assert(child_ty.isTuple(zcu));
const index_val = try sema.resolveConstDefinedValue(block, elem_index_src, elem_index, .{
.needed_comptime_reason = "tuple field access index must be comptime-known",
@@ -28936,7 +28936,7 @@ fn elemVal(
const elem_index = try sema.coerce(block, Type.usize, elem_index_uncasted, elem_index_src);
switch (indexable_ty.zigTypeTag(zcu)) {
- .Pointer => switch (indexable_ty.ptrSize(zcu)) {
+ .pointer => switch (indexable_ty.ptrSize(zcu)) {
.Slice => return sema.elemValSlice(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety),
.Many, .C => {
const maybe_indexable_val = try sema.resolveDefinedValue(block, indexable_src, indexable);
@@ -28963,7 +28963,7 @@ fn elemVal(
.One => {
arr_sent: {
const inner_ty = indexable_ty.childType(zcu);
- if (inner_ty.zigTypeTag(zcu) != .Array) break :arr_sent;
+ if (inner_ty.zigTypeTag(zcu) != .array) break :arr_sent;
const sentinel = inner_ty.sentinel(zcu) orelse break :arr_sent;
const index_val = try sema.resolveDefinedValue(block, elem_index_src, elem_index) orelse break :arr_sent;
const index = try sema.usizeCast(block, src, try index_val.toUnsignedIntSema(pt));
@@ -28974,12 +28974,12 @@ fn elemVal(
return sema.analyzeLoad(block, indexable_src, elem_ptr, elem_index_src);
},
},
- .Array => return sema.elemValArray(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety),
- .Vector => {
+ .array => return sema.elemValArray(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety),
+ .vector => {
// TODO: If the index is a vector, the result should be a vector.
return sema.elemValArray(block, src, indexable_src, indexable, elem_index_src, elem_index, oob_safety);
},
- .Struct => {
+ .@"struct" => {
// Tuple field access.
const index_val = try sema.resolveConstDefinedValue(block, elem_index_src, elem_index, .{
.needed_comptime_reason = "tuple field access index must be comptime-known",
@@ -29448,7 +29448,7 @@ fn coerceExtra(
}
switch (dest_ty.zigTypeTag(zcu)) {
- .Optional => optional: {
+ .optional => optional: {
if (maybe_inst_val) |val| {
// undefined sets the optional bit also to undefined.
if (val.toIntern() == .undef) {
@@ -29472,7 +29472,7 @@ fn coerceExtra(
anyopaque_check: {
if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :optional;
const elem_ty = inst_ty.elemType2(zcu);
- if (elem_ty.zigTypeTag(zcu) == .Pointer or elem_ty.isPtrLikeOptional(zcu)) {
+ if (elem_ty.zigTypeTag(zcu) == .pointer or elem_ty.isPtrLikeOptional(zcu)) {
in_memory_result = .{ .double_ptr_to_anyopaque = .{
.actual = inst_ty,
.wanted = dest_ty,
@@ -29499,11 +29499,11 @@ fn coerceExtra(
};
return try sema.wrapOptional(block, dest_ty, intermediate, inst_src);
},
- .Pointer => pointer: {
+ .pointer => pointer: {
const dest_info = dest_ty.ptrInfo(zcu);
// Function body to function pointer.
- if (inst_ty.zigTypeTag(zcu) == .Fn) {
+ if (inst_ty.zigTypeTag(zcu) == .@"fn") {
const fn_val = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, inst, undefined);
const fn_nav = switch (zcu.intern_pool.indexToKey(fn_val.toIntern())) {
.func => |f| f.owner_nav,
@@ -29521,7 +29521,7 @@ fn coerceExtra(
if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :pointer;
const ptr_elem_ty = inst_ty.childType(zcu);
const array_ty = Type.fromInterned(dest_info.child);
- if (array_ty.zigTypeTag(zcu) != .Array) break :single_item;
+ if (array_ty.zigTypeTag(zcu) != .array) break :single_item;
const array_elem_ty = array_ty.childType(zcu);
if (array_ty.arrayLen(zcu) != 1) break :single_item;
const dest_is_mut = !dest_info.flags.is_const;
@@ -29537,7 +29537,7 @@ fn coerceExtra(
if (!inst_ty.isSinglePointer(zcu)) break :src_array_ptr;
if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :pointer;
const array_ty = inst_ty.childType(zcu);
- if (array_ty.zigTypeTag(zcu) != .Array) break :src_array_ptr;
+ if (array_ty.zigTypeTag(zcu) != .array) break :src_array_ptr;
const array_elem_type = array_ty.childType(zcu);
const dest_is_mut = !dest_info.flags.is_const;
@@ -29612,10 +29612,10 @@ fn coerceExtra(
// cast from *T and [*]T to *anyopaque
// but don't do it if the source type is a double pointer
- if (dest_info.child == .anyopaque_type and inst_ty.zigTypeTag(zcu) == .Pointer) to_anyopaque: {
+ if (dest_info.child == .anyopaque_type and inst_ty.zigTypeTag(zcu) == .pointer) to_anyopaque: {
if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :pointer;
const elem_ty = inst_ty.elemType2(zcu);
- if (elem_ty.zigTypeTag(zcu) == .Pointer or elem_ty.isPtrLikeOptional(zcu)) {
+ if (elem_ty.zigTypeTag(zcu) == .pointer or elem_ty.isPtrLikeOptional(zcu)) {
in_memory_result = .{ .double_ptr_to_anyopaque = .{
.actual = inst_ty,
.wanted = dest_ty,
@@ -29636,19 +29636,19 @@ fn coerceExtra(
switch (dest_info.flags.size) {
// coercion to C pointer
.C => switch (inst_ty.zigTypeTag(zcu)) {
- .Null => return Air.internedToRef(try pt.intern(.{ .ptr = .{
+ .null => return Air.internedToRef(try pt.intern(.{ .ptr = .{
.ty = dest_ty.toIntern(),
.base_addr = .int,
.byte_offset = 0,
} })),
- .ComptimeInt => {
+ .comptime_int => {
const addr = sema.coerceExtra(block, Type.usize, inst, inst_src, .{ .report_err = false }) catch |err| switch (err) {
error.NotCoercible => break :pointer,
else => |e| return e,
};
return try sema.coerceCompatiblePtrs(block, dest_ty, addr, inst_src);
},
- .Int => {
+ .int => {
const ptr_size_ty = switch (inst_ty.intInfo(zcu).signedness) {
.signed => Type.isize,
.unsigned => Type.usize,
@@ -29663,7 +29663,7 @@ fn coerceExtra(
};
return try sema.coerceCompatiblePtrs(block, dest_ty, addr, inst_src);
},
- .Pointer => p: {
+ .pointer => p: {
if (!sema.checkPtrAttributes(dest_ty, inst_ty, &in_memory_result)) break :p;
const inst_info = inst_ty.ptrInfo(zcu);
switch (try sema.coerceInMemoryAllowed(
@@ -29693,7 +29693,7 @@ fn coerceExtra(
else => {},
},
.One => switch (Type.fromInterned(dest_info.child).zigTypeTag(zcu)) {
- .Union => {
+ .@"union" => {
// pointer to anonymous struct to pointer to union
if (inst_ty.isSinglePointer(zcu) and
inst_ty.childType(zcu).isAnonStruct(zcu) and
@@ -29702,7 +29702,7 @@ fn coerceExtra(
return sema.coerceAnonStructToUnionPtrs(block, dest_ty, dest_ty_src, inst, inst_src);
}
},
- .Struct => {
+ .@"struct" => {
// pointer to anonymous struct to pointer to struct
if (inst_ty.isSinglePointer(zcu) and
inst_ty.childType(zcu).isAnonStruct(zcu) and
@@ -29714,7 +29714,7 @@ fn coerceExtra(
};
}
},
- .Array => {
+ .array => {
// pointer to tuple to pointer to array
if (inst_ty.isSinglePointer(zcu) and
inst_ty.childType(zcu).isTuple(zcu) and
@@ -29726,7 +29726,7 @@ fn coerceExtra(
else => {},
},
.Slice => to_slice: {
- if (inst_ty.zigTypeTag(zcu) == .Array) {
+ if (inst_ty.zigTypeTag(zcu) == .array) {
return sema.fail(
block,
inst_src,
@@ -29795,10 +29795,10 @@ fn coerceExtra(
},
}
},
- .Int, .ComptimeInt => switch (inst_ty.zigTypeTag(zcu)) {
- .Float, .ComptimeFloat => float: {
+ .int, .comptime_int => switch (inst_ty.zigTypeTag(zcu)) {
+ .float, .comptime_float => float: {
const val = maybe_inst_val orelse {
- if (dest_ty.zigTypeTag(zcu) == .ComptimeInt) {
+ if (dest_ty.zigTypeTag(zcu) == .comptime_int) {
if (!opts.report_err) return error.NotCoercible;
return sema.failWithNeededComptime(block, inst_src, .{
.needed_comptime_reason = "value being casted to 'comptime_int' must be comptime-known",
@@ -29809,7 +29809,7 @@ fn coerceExtra(
const result_val = try sema.intFromFloat(block, inst_src, val, inst_ty, dest_ty, .exact);
return Air.internedToRef(result_val.toIntern());
},
- .Int, .ComptimeInt => {
+ .int, .comptime_int => {
if (maybe_inst_val) |val| {
// comptime-known integer to other number
if (!(try sema.intFitsInType(val, dest_ty, null))) {
@@ -29824,7 +29824,7 @@ fn coerceExtra(
else => unreachable,
};
}
- if (dest_ty.zigTypeTag(zcu) == .ComptimeInt) {
+ if (dest_ty.zigTypeTag(zcu) == .comptime_int) {
if (!opts.report_err) return error.NotCoercible;
if (opts.no_cast_to_comptime_int) return inst;
return sema.failWithNeededComptime(block, inst_src, .{
@@ -29845,13 +29845,13 @@ fn coerceExtra(
},
else => {},
},
- .Float, .ComptimeFloat => switch (inst_ty.zigTypeTag(zcu)) {
- .ComptimeFloat => {
+ .float, .comptime_float => switch (inst_ty.zigTypeTag(zcu)) {
+ .comptime_float => {
const val = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, inst, undefined);
const result_val = try val.floatCast(dest_ty, pt);
return Air.internedToRef(result_val.toIntern());
},
- .Float => {
+ .float => {
if (maybe_inst_val) |val| {
const result_val = try val.floatCast(dest_ty, pt);
if (!val.eql(try result_val.floatCast(inst_ty, pt), inst_ty, zcu)) {
@@ -29863,7 +29863,7 @@ fn coerceExtra(
);
}
return Air.internedToRef(result_val.toIntern());
- } else if (dest_ty.zigTypeTag(zcu) == .ComptimeFloat) {
+ } else if (dest_ty.zigTypeTag(zcu) == .comptime_float) {
if (!opts.report_err) return error.NotCoercible;
return sema.failWithNeededComptime(block, inst_src, .{
.needed_comptime_reason = "value being casted to 'comptime_float' must be comptime-known",
@@ -29878,9 +29878,9 @@ fn coerceExtra(
return block.addTyOp(.fpext, dest_ty, inst);
}
},
- .Int, .ComptimeInt => int: {
+ .int, .comptime_int => int: {
const val = maybe_inst_val orelse {
- if (dest_ty.zigTypeTag(zcu) == .ComptimeFloat) {
+ if (dest_ty.zigTypeTag(zcu) == .comptime_float) {
if (!opts.report_err) return error.NotCoercible;
return sema.failWithNeededComptime(block, inst_src, .{
.needed_comptime_reason = "value being casted to 'comptime_float' must be comptime-known",
@@ -29903,8 +29903,8 @@ fn coerceExtra(
},
else => {},
},
- .Enum => switch (inst_ty.zigTypeTag(zcu)) {
- .EnumLiteral => {
+ .@"enum" => switch (inst_ty.zigTypeTag(zcu)) {
+ .enum_literal => {
// enum literal to enum
const val = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, inst, undefined);
const string = zcu.intern_pool.indexToKey(val.toIntern()).enum_literal;
@@ -29915,7 +29915,7 @@ fn coerceExtra(
};
return Air.internedToRef((try pt.enumValueFieldIndex(dest_ty, @intCast(field_index))).toIntern());
},
- .Union => blk: {
+ .@"union" => blk: {
// union to its own tag type
const union_tag_ty = inst_ty.unionTagType(zcu) orelse break :blk;
if (union_tag_ty.eql(dest_ty, zcu)) {
@@ -29924,8 +29924,8 @@ fn coerceExtra(
},
else => {},
},
- .ErrorUnion => switch (inst_ty.zigTypeTag(zcu)) {
- .ErrorUnion => eu: {
+ .error_union => switch (inst_ty.zigTypeTag(zcu)) {
+ .error_union => eu: {
if (maybe_inst_val) |inst_val| {
switch (inst_val.toIntern()) {
.undef => return pt.undefRef(dest_ty),
@@ -29952,7 +29952,7 @@ fn coerceExtra(
}
}
},
- .ErrorSet => {
+ .error_set => {
// E to E!T
return sema.wrapErrorUnionSet(block, dest_ty, inst, inst_src);
},
@@ -29971,17 +29971,17 @@ fn coerceExtra(
};
},
},
- .Union => switch (inst_ty.zigTypeTag(zcu)) {
- .Enum, .EnumLiteral => return sema.coerceEnumToUnion(block, dest_ty, dest_ty_src, inst, inst_src),
- .Struct => {
+ .@"union" => switch (inst_ty.zigTypeTag(zcu)) {
+ .@"enum", .enum_literal => return sema.coerceEnumToUnion(block, dest_ty, dest_ty_src, inst, inst_src),
+ .@"struct" => {
if (inst_ty.isAnonStruct(zcu)) {
return sema.coerceAnonStructToUnion(block, dest_ty, dest_ty_src, inst, inst_src);
}
},
else => {},
},
- .Array => switch (inst_ty.zigTypeTag(zcu)) {
- .Array => array_to_array: {
+ .array => switch (inst_ty.zigTypeTag(zcu)) {
+ .array => array_to_array: {
// Array coercions are allowed only if the child is IMC and the sentinel is unchanged or removed.
if (.ok != try sema.coerceInMemoryAllowed(
block,
@@ -30005,8 +30005,8 @@ fn coerceExtra(
return sema.coerceArrayLike(block, dest_ty, dest_ty_src, inst, inst_src);
},
- .Vector => return sema.coerceArrayLike(block, dest_ty, dest_ty_src, inst, inst_src),
- .Struct => {
+ .vector => return sema.coerceArrayLike(block, dest_ty, dest_ty_src, inst, inst_src),
+ .@"struct" => {
if (inst == .empty_struct) {
return sema.arrayInitEmpty(block, inst_src, dest_ty);
}
@@ -30016,16 +30016,16 @@ fn coerceExtra(
},
else => {},
},
- .Vector => switch (inst_ty.zigTypeTag(zcu)) {
- .Array, .Vector => return sema.coerceArrayLike(block, dest_ty, dest_ty_src, inst, inst_src),
- .Struct => {
+ .vector => switch (inst_ty.zigTypeTag(zcu)) {
+ .array, .vector => return sema.coerceArrayLike(block, dest_ty, dest_ty_src, inst, inst_src),
+ .@"struct" => {
if (inst_ty.isTuple(zcu)) {
return sema.coerceTupleToArray(block, dest_ty, dest_ty_src, inst, inst_src);
}
},
else => {},
},
- .Struct => blk: {
+ .@"struct" => blk: {
if (inst == .empty_struct) {
return sema.structInitEmpty(block, dest_ty, dest_ty_src, inst_src);
}
@@ -30046,7 +30046,7 @@ fn coerceExtra(
if (!opts.report_err) return error.NotCoercible;
- if (opts.is_ret and dest_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (opts.is_ret and dest_ty.zigTypeTag(zcu) == .noreturn) {
const msg = msg: {
const msg = try sema.errMsg(inst_src, "function declared 'noreturn' returns", .{});
errdefer msg.destroy(sema.gpa);
@@ -30066,7 +30066,7 @@ fn coerceExtra(
errdefer msg.destroy(sema.gpa);
// E!T to T
- if (inst_ty.zigTypeTag(zcu) == .ErrorUnion and
+ if (inst_ty.zigTypeTag(zcu) == .error_union and
(try sema.coerceInMemoryAllowed(block, inst_ty.errorUnionPayload(zcu), dest_ty, false, target, dest_ty_src, inst_src, maybe_inst_val)) == .ok)
{
try sema.errNote(inst_src, msg, "cannot convert error union to payload type", .{});
@@ -30074,7 +30074,7 @@ fn coerceExtra(
}
// ?T to T
- if (inst_ty.zigTypeTag(zcu) == .Optional and
+ if (inst_ty.zigTypeTag(zcu) == .optional and
(try sema.coerceInMemoryAllowed(block, inst_ty.optionalChild(zcu), dest_ty, false, target, dest_ty_src, inst_src, maybe_inst_val)) == .ok)
{
try sema.errNote(inst_src, msg, "cannot convert optional to payload type", .{});
@@ -30515,7 +30515,7 @@ pub fn coerceInMemoryAllowed(
const src_tag = src_ty.zigTypeTag(zcu);
// Differently-named integers with the same number of bits.
- if (dest_tag == .Int and src_tag == .Int) {
+ if (dest_tag == .int and src_tag == .int) {
const dest_info = dest_ty.intInfo(zcu);
const src_info = src_ty.intInfo(zcu);
@@ -30540,7 +30540,7 @@ pub fn coerceInMemoryAllowed(
}
// Comptime int to regular int.
- if (dest_tag == .Int and src_tag == .ComptimeInt) {
+ if (dest_tag == .int and src_tag == .comptime_int) {
if (src_val) |val| {
if (!(try sema.intFitsInType(val, dest_ty, null))) {
return .{ .comptime_int_not_coercible = .{ .wanted = dest_ty, .actual = val } };
@@ -30549,7 +30549,7 @@ pub fn coerceInMemoryAllowed(
}
// Differently-named floats with the same number of bits.
- if (dest_tag == .Float and src_tag == .Float) {
+ if (dest_tag == .float and src_tag == .float) {
const dest_bits = dest_ty.floatBits(target);
const src_bits = src_ty.floatBits(target);
if (dest_bits == src_bits) {
@@ -30572,12 +30572,12 @@ pub fn coerceInMemoryAllowed(
}
// Functions
- if (dest_tag == .Fn and src_tag == .Fn) {
+ if (dest_tag == .@"fn" and src_tag == .@"fn") {
return try sema.coerceInMemoryAllowedFns(block, dest_ty, src_ty, target, dest_src, src_src);
}
// Error Unions
- if (dest_tag == .ErrorUnion and src_tag == .ErrorUnion) {
+ if (dest_tag == .error_union and src_tag == .error_union) {
const dest_payload = dest_ty.errorUnionPayload(zcu);
const src_payload = src_ty.errorUnionPayload(zcu);
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(
}
// Error Sets
- if (dest_tag == .ErrorSet and src_tag == .ErrorSet) {
+ if (dest_tag == .error_set and src_tag == .error_set) {
return try sema.coerceInMemoryAllowedErrorSets(block, dest_ty, src_ty, dest_src, src_src);
}
// Arrays
- if (dest_tag == .Array and src_tag == .Array) {
+ if (dest_tag == .array and src_tag == .array) {
const dest_info = dest_ty.arrayInfo(zcu);
const src_info = src_ty.arrayInfo(zcu);
if (dest_info.len != src_info.len) {
@@ -30638,7 +30638,7 @@ pub fn coerceInMemoryAllowed(
}
// Vectors
- if (dest_tag == .Vector and src_tag == .Vector) {
+ if (dest_tag == .vector and src_tag == .vector) {
const dest_len = dest_ty.vectorLen(zcu);
const src_len = src_ty.vectorLen(zcu);
if (dest_len != src_len) {
@@ -30663,8 +30663,8 @@ pub fn coerceInMemoryAllowed(
}
// Arrays <-> Vectors
- if ((dest_tag == .Vector and src_tag == .Array) or
- (dest_tag == .Array and src_tag == .Vector))
+ if ((dest_tag == .vector and src_tag == .array) or
+ (dest_tag == .array and src_tag == .vector))
{
const dest_len = dest_ty.arrayLen(zcu);
const src_len = src_ty.arrayLen(zcu);
@@ -30686,7 +30686,7 @@ pub fn coerceInMemoryAllowed(
} };
}
- if (dest_tag == .Array) {
+ if (dest_tag == .array) {
const dest_info = dest_ty.arrayInfo(zcu);
if (dest_info.sentinel != null) {
return InMemoryCoercionResult{ .array_sentinel = .{
@@ -30707,7 +30707,7 @@ pub fn coerceInMemoryAllowed(
}
// Optionals
- if (dest_tag == .Optional and src_tag == .Optional) {
+ if (dest_tag == .optional and src_tag == .optional) {
if ((maybe_dest_ptr_ty != null) != (maybe_src_ptr_ty != null)) {
return InMemoryCoercionResult{ .optional_shape = .{
.actual = src_ty,
@@ -31000,7 +31000,7 @@ fn coerceInMemoryAllowedPtrs(
if (child != .ok) allow: {
// As a special case, we also allow coercing `*[n:s]T` to `*[n]T`, akin to dropping the sentinel from a slice.
// `*[n:s]T` cannot coerce in memory to `*[n]T` since they have different sizes.
- if (src_child.zigTypeTag(zcu) == .Array and dest_child.zigTypeTag(zcu) == .Array and
+ if (src_child.zigTypeTag(zcu) == .array and dest_child.zigTypeTag(zcu) == .array and
src_child.sentinel(zcu) != null and dest_child.sentinel(zcu) == null and
.ok == try sema.coerceInMemoryAllowed(block, dest_child.childType(zcu), src_child.childType(zcu), !dest_info.flags.is_const, target, dest_src, src_src, null))
{
@@ -31095,19 +31095,19 @@ fn coerceVarArgParam(
const uncasted_ty = sema.typeOf(inst);
const coerced = switch (uncasted_ty.zigTypeTag(zcu)) {
// TODO consider casting to c_int/f64 if they fit
- .ComptimeInt, .ComptimeFloat => return sema.fail(
+ .comptime_int, .comptime_float => return sema.fail(
block,
inst_src,
"integer and float literals passed to variadic function must be casted to a fixed-size number type",
.{},
),
- .Fn => fn_ptr: {
+ .@"fn" => fn_ptr: {
const fn_val = try sema.resolveConstDefinedValue(block, LazySrcLoc.unneeded, inst, undefined);
const fn_nav = zcu.funcInfo(fn_val.toIntern()).owner_nav;
break :fn_ptr try sema.analyzeNavRef(inst_src, fn_nav);
},
- .Array => return sema.fail(block, inst_src, "arrays must be passed by reference to variadic function", .{}),
- .Float => float: {
+ .array => return sema.fail(block, inst_src, "arrays must be passed by reference to variadic function", .{}),
+ .float => float: {
const target = zcu.getTarget();
const double_bits = target.cTypeBitSize(.double);
const inst_bits = uncasted_ty.floatBits(target);
@@ -31202,7 +31202,7 @@ fn storePtr2(
// this code does not handle tuple-to-struct coercion which requires dealing with missing
// fields.
const operand_ty = sema.typeOf(uncasted_operand);
- if (operand_ty.isTuple(zcu) and elem_ty.zigTypeTag(zcu) == .Array) {
+ if (operand_ty.isTuple(zcu) and elem_ty.zigTypeTag(zcu) == .array) {
const field_count = operand_ty.structFieldCount(zcu);
var i: u32 = 0;
while (i < field_count) : (i += 1) {
@@ -31397,16 +31397,16 @@ fn obtainBitCastedVectorPtr(sema: *Sema, ptr: Air.Inst.Ref) ?Air.Inst.Ref {
const pt = sema.pt;
const zcu = pt.zcu;
const array_ty = sema.typeOf(ptr).childType(zcu);
- if (array_ty.zigTypeTag(zcu) != .Array) return null;
+ if (array_ty.zigTypeTag(zcu) != .array) return null;
var ptr_ref = ptr;
var ptr_inst = ptr_ref.toIndex() orelse return null;
const air_datas = sema.air_instructions.items(.data);
const air_tags = sema.air_instructions.items(.tag);
const vector_ty = while (air_tags[@intFromEnum(ptr_inst)] == .bitcast) {
ptr_ref = air_datas[@intFromEnum(ptr_inst)].ty_op.operand;
- if (!sema.isKnownZigType(ptr_ref, .Pointer)) return null;
+ if (!sema.isKnownZigType(ptr_ref, .pointer)) return null;
const child_ty = sema.typeOf(ptr_ref).childType(zcu);
- if (child_ty.zigTypeTag(zcu) == .Vector) break child_ty;
+ if (child_ty.zigTypeTag(zcu) == .vector) break child_ty;
ptr_inst = ptr_ref.toIndex() orelse return null;
} else return null;
@@ -31504,7 +31504,7 @@ fn bitCast(
if (try sema.resolveValue(inst)) |val| {
if (val.isUndef(zcu))
return pt.undefRef(dest_ty);
- if (old_ty.zigTypeTag(zcu) == .ErrorSet and dest_ty.zigTypeTag(zcu) == .ErrorSet) {
+ if (old_ty.zigTypeTag(zcu) == .error_set and dest_ty.zigTypeTag(zcu) == .error_set) {
// Special case: we sometimes call `bitCast` on error set values, but they
// don't have a well-defined layout, so we can't use `bitCastVal` on them.
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
const zcu = pt.zcu;
const dest_info = dest_ty.ptrInfo(zcu);
const inst_info = inst_ty.ptrInfo(zcu);
- const len0 = (Type.fromInterned(inst_info.child).zigTypeTag(zcu) == .Array and (Type.fromInterned(inst_info.child).arrayLenIncludingSentinel(zcu) == 0 or
+ const len0 = (Type.fromInterned(inst_info.child).zigTypeTag(zcu) == .array and (Type.fromInterned(inst_info.child).arrayLenIncludingSentinel(zcu) == 0 or
(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
(Type.fromInterned(inst_info.child).isTuple(zcu) and Type.fromInterned(inst_info.child).structFieldCount(zcu) == 0);
@@ -31615,9 +31615,9 @@ fn coerceCompatiblePtrs(
);
}
try sema.requireRuntimeBlock(block, inst_src, null);
- const inst_allows_zero = inst_ty.zigTypeTag(zcu) != .Pointer or inst_ty.ptrAllowsZero(zcu);
+ const inst_allows_zero = inst_ty.zigTypeTag(zcu) != .pointer or inst_ty.ptrAllowsZero(zcu);
if (block.wantSafety() and inst_allows_zero and !dest_ty.ptrAllowsZero(zcu) and
- (try dest_ty.elemType2(zcu).hasRuntimeBitsSema(pt) or dest_ty.elemType2(zcu).zigTypeTag(zcu) == .Fn))
+ (try dest_ty.elemType2(zcu).hasRuntimeBitsSema(pt) or dest_ty.elemType2(zcu).zigTypeTag(zcu) == .@"fn"))
{
const actual_ptr = if (inst_ty.isSlice(zcu))
try sema.analyzeSlicePtr(block, inst_src, inst, inst_ty)
@@ -31674,7 +31674,7 @@ fn coerceEnumToUnion(
const union_obj = zcu.typeToUnion(union_ty).?;
const field_ty = Type.fromInterned(union_obj.field_types.get(ip)[field_index]);
try field_ty.resolveFields(pt);
- if (field_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (field_ty.zigTypeTag(zcu) == .noreturn) {
const msg = msg: {
const msg = try sema.errMsg(inst_src, "cannot initialize 'noreturn' field of union", .{});
errdefer msg.destroy(sema.gpa);
@@ -31729,7 +31729,7 @@ fn coerceEnumToUnion(
errdefer if (msg) |some| some.destroy(sema.gpa);
for (union_obj.field_types.get(ip), 0..) |field_ty, field_index| {
- if (Type.fromInterned(field_ty).zigTypeTag(zcu) == .NoReturn) {
+ if (Type.fromInterned(field_ty).zigTypeTag(zcu) == .noreturn) {
const err_msg = msg orelse try sema.errMsg(
inst_src,
"runtime coercion from enum '{}' to union '{}' which has a 'noreturn' field",
@@ -31911,7 +31911,7 @@ fn coerceArrayLike(
if (dest_ty.isVector(zcu) and inst_ty.isVector(zcu) and (try sema.resolveValue(inst)) == null) {
const inst_elem_ty = inst_ty.childType(zcu);
switch (dest_elem_ty.zigTypeTag(zcu)) {
- .Int => if (inst_elem_ty.isInt(zcu)) {
+ .int => if (inst_elem_ty.isInt(zcu)) {
// integer widening
const dst_info = dest_elem_ty.intInfo(zcu);
const src_info = inst_elem_ty.intInfo(zcu);
@@ -31923,7 +31923,7 @@ fn coerceArrayLike(
return block.addTyOp(.intcast, dest_ty, inst);
}
},
- .Float => if (inst_elem_ty.isRuntimeFloat()) {
+ .float => if (inst_elem_ty.isRuntimeFloat()) {
// float widening
const src_bits = inst_elem_ty.floatBits(target);
const dst_bits = dest_elem_ty.floatBits(target);
@@ -32504,10 +32504,10 @@ fn analyzeLoad(
const zcu = pt.zcu;
const ptr_ty = sema.typeOf(ptr);
const elem_ty = switch (ptr_ty.zigTypeTag(zcu)) {
- .Pointer => ptr_ty.childType(zcu),
+ .pointer => ptr_ty.childType(zcu),
else => return sema.fail(block, ptr_src, "expected pointer, found '{}'", .{ptr_ty.fmt(pt)}),
};
- if (elem_ty.zigTypeTag(zcu) == .Opaque) {
+ if (elem_ty.zigTypeTag(zcu) == .@"opaque") {
return sema.fail(block, ptr_src, "cannot load opaque type '{}'", .{elem_ty.fmt(pt)});
}
@@ -32621,10 +32621,10 @@ fn analyzeIsNull(
const inverted_non_null_res: Air.Inst.Ref = if (invert_logic) .bool_true else .bool_false;
const operand_ty = sema.typeOf(operand);
- if (operand_ty.zigTypeTag(zcu) == .Optional and operand_ty.optionalChild(zcu).zigTypeTag(zcu) == .NoReturn) {
+ if (operand_ty.zigTypeTag(zcu) == .optional and operand_ty.optionalChild(zcu).zigTypeTag(zcu) == .noreturn) {
return inverted_non_null_res;
}
- if (operand_ty.zigTypeTag(zcu) != .Optional and !operand_ty.isPtrLikeOptional(zcu)) {
+ if (operand_ty.zigTypeTag(zcu) != .optional and !operand_ty.isPtrLikeOptional(zcu)) {
return inverted_non_null_res;
}
try sema.requireRuntimeBlock(block, src, null);
@@ -32641,13 +32641,13 @@ fn analyzePtrIsNonErrComptimeOnly(
const pt = sema.pt;
const zcu = pt.zcu;
const ptr_ty = sema.typeOf(operand);
- assert(ptr_ty.zigTypeTag(zcu) == .Pointer);
+ assert(ptr_ty.zigTypeTag(zcu) == .pointer);
const child_ty = ptr_ty.childType(zcu);
const child_tag = child_ty.zigTypeTag(zcu);
- if (child_tag != .ErrorSet and child_tag != .ErrorUnion) return .bool_true;
- if (child_tag == .ErrorSet) return .bool_false;
- assert(child_tag == .ErrorUnion);
+ if (child_tag != .error_set and child_tag != .error_union) return .bool_true;
+ if (child_tag == .error_set) return .bool_false;
+ assert(child_tag == .error_union);
_ = block;
_ = src;
@@ -32666,12 +32666,12 @@ fn analyzeIsNonErrComptimeOnly(
const ip = &zcu.intern_pool;
const operand_ty = sema.typeOf(operand);
const ot = operand_ty.zigTypeTag(zcu);
- if (ot != .ErrorSet and ot != .ErrorUnion) return .bool_true;
- if (ot == .ErrorSet) return .bool_false;
- assert(ot == .ErrorUnion);
+ if (ot != .error_set and ot != .error_union) return .bool_true;
+ if (ot == .error_set) return .bool_false;
+ assert(ot == .error_union);
const payload_ty = operand_ty.errorUnionPayload(zcu);
- if (payload_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (payload_ty.zigTypeTag(zcu) == .noreturn) {
return .bool_false;
}
@@ -32828,7 +32828,7 @@ fn analyzeSlice(
// the slice operand to be a pointer. In the case of a non-array, it will be a double pointer.
const ptr_ptr_ty = sema.typeOf(ptr_ptr);
const ptr_ptr_child_ty = switch (ptr_ptr_ty.zigTypeTag(zcu)) {
- .Pointer => ptr_ptr_ty.childType(zcu),
+ .pointer => ptr_ptr_ty.childType(zcu),
else => return sema.fail(block, ptr_src, "expected pointer, found '{}'", .{ptr_ptr_ty.fmt(pt)}),
};
@@ -32838,15 +32838,15 @@ fn analyzeSlice(
var elem_ty: Type = undefined;
var ptr_sentinel: ?Value = null;
switch (ptr_ptr_child_ty.zigTypeTag(zcu)) {
- .Array => {
+ .array => {
ptr_sentinel = ptr_ptr_child_ty.sentinel(zcu);
elem_ty = ptr_ptr_child_ty.childType(zcu);
},
- .Pointer => switch (ptr_ptr_child_ty.ptrSize(zcu)) {
+ .pointer => switch (ptr_ptr_child_ty.ptrSize(zcu)) {
.One => {
const double_child_ty = ptr_ptr_child_ty.childType(zcu);
ptr_or_slice = try sema.analyzeLoad(block, src, ptr_ptr, ptr_src);
- if (double_child_ty.zigTypeTag(zcu) == .Array) {
+ if (double_child_ty.zigTypeTag(zcu) == .array) {
ptr_sentinel = double_child_ty.sentinel(zcu);
slice_ty = ptr_ptr_child_ty;
array_ty = double_child_ty;
@@ -32961,7 +32961,7 @@ fn analyzeSlice(
const ptr = if (slice_ty.isSlice(zcu))
try sema.analyzeSlicePtr(block, ptr_src, ptr_or_slice, slice_ty)
- else if (array_ty.zigTypeTag(zcu) == .Array) ptr: {
+ else if (array_ty.zigTypeTag(zcu) == .array) ptr: {
var manyptr_ty_key = zcu.intern_pool.indexToKey(slice_ty.toIntern()).ptr_type;
assert(manyptr_ty_key.child == array_ty.toIntern());
assert(manyptr_ty_key.flags.size == .One);
@@ -32980,7 +32980,7 @@ fn analyzeSlice(
// we might learn of the length because it is a comptime-known slice value.
var end_is_len = uncasted_end_opt == .none;
const end = e: {
- if (array_ty.zigTypeTag(zcu) == .Array) {
+ if (array_ty.zigTypeTag(zcu) == .array) {
const len_val = try pt.intValue(Type.usize, array_ty.arrayLen(zcu));
if (!end_is_len) {
@@ -33215,7 +33215,7 @@ fn analyzeSlice(
}
bounds_check: {
- const actual_len = if (array_ty.zigTypeTag(zcu) == .Array)
+ const actual_len = if (array_ty.zigTypeTag(zcu) == .array)
try pt.intRef(Type.usize, array_ty.arrayLenIncludingSentinel(zcu))
else if (slice_ty.isSlice(zcu)) l: {
const slice_len_inst = try block.addTyOp(.slice_len, Type.usize, ptr_or_slice);
@@ -33273,7 +33273,7 @@ fn analyzeSlice(
}
// requirement: end <= len
- const opt_len_inst = if (array_ty.zigTypeTag(zcu) == .Array)
+ const opt_len_inst = if (array_ty.zigTypeTag(zcu) == .array)
try pt.intRef(Type.usize, array_ty.arrayLenIncludingSentinel(zcu))
else if (slice_ty.isSlice(zcu)) blk: {
if (try sema.resolveDefinedValue(block, src, ptr_or_slice)) |slice_val| {
@@ -33342,12 +33342,12 @@ fn cmpNumeric(
// One exception to heterogeneous comparison: comptime_float needs to
// coerce to fixed-width float.
- const lhs = if (lhs_ty_tag == .ComptimeFloat and rhs_ty_tag == .Float)
+ const lhs = if (lhs_ty_tag == .comptime_float and rhs_ty_tag == .float)
try sema.coerce(block, rhs_ty, uncasted_lhs, lhs_src)
else
uncasted_lhs;
- const rhs = if (lhs_ty_tag == .Float and rhs_ty_tag == .ComptimeFloat)
+ const rhs = if (lhs_ty_tag == .float and rhs_ty_tag == .comptime_float)
try sema.coerce(block, lhs_ty, uncasted_rhs, rhs_src)
else
uncasted_rhs;
@@ -33356,11 +33356,11 @@ fn cmpNumeric(
if (try sema.resolveValue(lhs)) |lhs_val| {
if (try sema.resolveValue(rhs)) |rhs_val| {
// Compare ints: const vs. undefined (or vice versa)
- 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)) {
+ 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)) {
if (try sema.compareIntsOnlyPossibleResult(try sema.resolveLazyValue(lhs_val), op, rhs_ty)) |res| {
return if (res) .bool_true else .bool_false;
}
- } 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)) {
+ } 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)) {
if (try sema.compareIntsOnlyPossibleResult(try sema.resolveLazyValue(rhs_val), op.reverse(), lhs_ty)) |res| {
return if (res) .bool_true else .bool_false;
}
@@ -33377,7 +33377,7 @@ fn cmpNumeric(
else
.bool_false;
} else {
- if (!lhs_val.isUndef(zcu) and (lhs_ty.isInt(zcu) or lhs_ty_tag == .ComptimeInt) and rhs_ty.isInt(zcu)) {
+ if (!lhs_val.isUndef(zcu) and (lhs_ty.isInt(zcu) or lhs_ty_tag == .comptime_int) and rhs_ty.isInt(zcu)) {
// Compare ints: const vs. var
if (try sema.compareIntsOnlyPossibleResult(try sema.resolveLazyValue(lhs_val), op, rhs_ty)) |res| {
return if (res) .bool_true else .bool_false;
@@ -33387,7 +33387,7 @@ fn cmpNumeric(
}
} else {
if (try sema.resolveValueResolveLazy(rhs)) |rhs_val| {
- if (!rhs_val.isUndef(zcu) and (rhs_ty.isInt(zcu) or rhs_ty_tag == .ComptimeInt) and lhs_ty.isInt(zcu)) {
+ if (!rhs_val.isUndef(zcu) and (rhs_ty.isInt(zcu) or rhs_ty_tag == .comptime_int) and lhs_ty.isInt(zcu)) {
// Compare ints: var vs. const
if (try sema.compareIntsOnlyPossibleResult(try sema.resolveLazyValue(rhs_val), op.reverse(), lhs_ty)) |res| {
return if (res) .bool_true else .bool_false;
@@ -33407,11 +33407,11 @@ fn cmpNumeric(
// For floats, emit a float comparison instruction.
const lhs_is_float = switch (lhs_ty_tag) {
- .Float, .ComptimeFloat => true,
+ .float, .comptime_float => true,
else => false,
};
const rhs_is_float = switch (rhs_ty_tag) {
- .Float, .ComptimeFloat => true,
+ .float, .comptime_float => true,
else => false,
};
@@ -33419,9 +33419,9 @@ fn cmpNumeric(
// Smaller fixed-width floats coerce to larger fixed-width floats.
// comptime_float coerces to fixed-width float.
const dest_ty = x: {
- if (lhs_ty_tag == .ComptimeFloat) {
+ if (lhs_ty_tag == .comptime_float) {
break :x rhs_ty;
- } else if (rhs_ty_tag == .ComptimeFloat) {
+ } else if (rhs_ty_tag == .comptime_float) {
break :x lhs_ty;
}
if (lhs_ty.floatBits(target) >= rhs_ty.floatBits(target)) {
@@ -33691,8 +33691,8 @@ fn cmpVector(
const zcu = pt.zcu;
const lhs_ty = sema.typeOf(lhs);
const rhs_ty = sema.typeOf(rhs);
- assert(lhs_ty.zigTypeTag(zcu) == .Vector);
- assert(rhs_ty.zigTypeTag(zcu) == .Vector);
+ assert(lhs_ty.zigTypeTag(zcu) == .vector);
+ assert(rhs_ty.zigTypeTag(zcu) == .vector);
try sema.checkVectorizableBinaryOperands(block, src, lhs_ty, rhs_ty, lhs_src, rhs_src);
const resolved_ty = try sema.resolvePeerTypes(block, src, &.{ lhs, rhs }, .{ .override = &.{ lhs_src, rhs_src } });
@@ -34005,22 +34005,22 @@ const PeerResolveStrategy = enum {
fn select(ty: Type, zcu: *Zcu) PeerResolveStrategy {
return switch (ty.zigTypeTag(zcu)) {
- .Type, .Void, .Bool, .Opaque, .Frame, .AnyFrame => .exact,
- .NoReturn, .Undefined => .unknown,
- .Null => .nullable,
- .ComptimeInt => .comptime_int,
- .Int => .fixed_int,
- .ComptimeFloat => .comptime_float,
- .Float => .fixed_float,
- .Pointer => if (ty.ptrInfo(zcu).flags.size == .C) .c_ptr else .ptr,
- .Array => .array,
- .Vector => .vector,
- .Optional => .optional,
- .ErrorSet => .error_set,
- .ErrorUnion => .error_union,
- .EnumLiteral, .Enum, .Union => .enum_or_union,
- .Struct => if (ty.isTupleOrAnonStruct(zcu)) .coercible_struct else .exact,
- .Fn => .func,
+ .type, .void, .bool, .@"opaque", .frame, .@"anyframe" => .exact,
+ .noreturn, .undefined => .unknown,
+ .null => .nullable,
+ .comptime_int => .comptime_int,
+ .int => .fixed_int,
+ .comptime_float => .comptime_float,
+ .float => .fixed_float,
+ .pointer => if (ty.ptrInfo(zcu).flags.size == .C) .c_ptr else .ptr,
+ .array => .array,
+ .vector => .vector,
+ .optional => .optional,
+ .error_set => .error_set,
+ .error_union => .error_union,
+ .enum_literal, .@"enum", .@"union" => .enum_or_union,
+ .@"struct" => if (ty.isTupleOrAnonStruct(zcu)) .coercible_struct else .exact,
+ .@"fn" => .func,
};
}
};
@@ -34213,7 +34213,7 @@ fn resolvePeerTypesInner(
for (peer_tys) |*ty_ptr| {
const ty = ty_ptr.* orelse continue;
switch (ty.zigTypeTag(zcu)) {
- .NoReturn, .Undefined => ty_ptr.* = null,
+ .noreturn, .undefined => ty_ptr.* = null,
else => {},
}
}
@@ -34228,7 +34228,7 @@ fn resolvePeerTypesInner(
var final_set: ?Type = null;
for (peer_tys, 0..) |opt_ty, i| {
const ty = opt_ty orelse continue;
- if (ty.zigTypeTag(zcu) != .ErrorSet) return .{ .conflict = .{
+ if (ty.zigTypeTag(zcu) != .error_set) return .{ .conflict = .{
.peer_idx_a = strat_reason,
.peer_idx_b = i,
} };
@@ -34246,12 +34246,12 @@ fn resolvePeerTypesInner(
for (peer_tys, peer_vals) |*ty_ptr, *val_ptr| {
const ty = ty_ptr.* orelse continue;
const set_ty = switch (ty.zigTypeTag(zcu)) {
- .ErrorSet => blk: {
+ .error_set => blk: {
ty_ptr.* = null; // no payload to decide on
val_ptr.* = null;
break :blk ty;
},
- .ErrorUnion => blk: {
+ .error_union => blk: {
const set_ty = ty.errorUnionSet(zcu);
ty_ptr.* = ty.errorUnionPayload(zcu);
if (val_ptr.*) |eu_val| switch (ip.indexToKey(eu_val.toIntern())) {
@@ -34300,11 +34300,11 @@ fn resolvePeerTypesInner(
for (peer_tys, peer_vals) |*ty_ptr, *val_ptr| {
const ty = ty_ptr.* orelse continue;
switch (ty.zigTypeTag(zcu)) {
- .Null => {
+ .null => {
ty_ptr.* = null;
val_ptr.* = null;
},
- .Optional => {
+ .optional => {
ty_ptr.* = ty.optionalChild(zcu);
if (val_ptr.*) |opt_val| val_ptr.* = if (!opt_val.isUndef(zcu)) opt_val.optionalValue(zcu) else null;
},
@@ -34482,8 +34482,8 @@ fn resolvePeerTypesInner(
for (peer_tys, peer_vals, 0..) |opt_ty, opt_val, i| {
const ty = opt_ty orelse continue;
switch (ty.zigTypeTag(zcu)) {
- .ComptimeInt => continue, // comptime-known integers can always coerce to C pointers
- .Int => {
+ .comptime_int => continue, // comptime-known integers can always coerce to C pointers
+ .int => {
if (opt_val != null) {
// Always allow the coercion for comptime-known ints
continue;
@@ -34494,7 +34494,7 @@ fn resolvePeerTypesInner(
if (bits <= ptr_bits) continue;
}
},
- .Null => continue,
+ .null => continue,
else => {},
}
@@ -34581,8 +34581,8 @@ fn resolvePeerTypesInner(
for (peer_tys, 0..) |opt_ty, i| {
const ty = opt_ty orelse continue;
const peer_info: InternPool.Key.PtrType = switch (ty.zigTypeTag(zcu)) {
- .Pointer => ty.ptrInfo(zcu),
- .Fn => .{
+ .pointer => ty.ptrInfo(zcu),
+ .@"fn" => .{
.child = ty.toIntern(),
.flags = .{
.address_space = target_util.defaultAddressSpace(target, .global_constant),
@@ -34889,7 +34889,7 @@ fn resolvePeerTypesInner(
first_idx = i;
continue;
};
- if (ty.zigTypeTag(zcu) != .Fn) return .{ .conflict = .{
+ if (ty.zigTypeTag(zcu) != .@"fn") return .{ .conflict = .{
.peer_idx_a = strat_reason,
.peer_idx_b = i,
} };
@@ -34918,7 +34918,7 @@ fn resolvePeerTypesInner(
for (peer_tys, 0..) |opt_ty, i| {
const ty = opt_ty orelse continue;
switch (ty.zigTypeTag(zcu)) {
- .EnumLiteral, .Enum, .Union => {},
+ .enum_literal, .@"enum", .@"union" => {},
else => return .{ .conflict = .{
.peer_idx_a = strat_reason,
.peer_idx_b = i,
@@ -34937,16 +34937,16 @@ fn resolvePeerTypesInner(
} };
switch (cur_ty.zigTypeTag(zcu)) {
- .EnumLiteral => {
+ .enum_literal => {
opt_cur_ty = ty;
cur_ty_idx = i;
},
- .Enum => switch (ty.zigTypeTag(zcu)) {
- .EnumLiteral => {},
- .Enum => {
+ .@"enum" => switch (ty.zigTypeTag(zcu)) {
+ .enum_literal => {},
+ .@"enum" => {
if (!ty.eql(cur_ty, zcu)) return generic_err;
},
- .Union => {
+ .@"union" => {
const tag_ty = ty.unionTagTypeHypothetical(zcu);
if (!tag_ty.eql(cur_ty, zcu)) return generic_err;
opt_cur_ty = ty;
@@ -34954,13 +34954,13 @@ fn resolvePeerTypesInner(
},
else => unreachable,
},
- .Union => switch (ty.zigTypeTag(zcu)) {
- .EnumLiteral => {},
- .Enum => {
+ .@"union" => switch (ty.zigTypeTag(zcu)) {
+ .enum_literal => {},
+ .@"enum" => {
const cur_tag_ty = cur_ty.unionTagTypeHypothetical(zcu);
if (!ty.eql(cur_tag_ty, zcu)) return generic_err;
},
- .Union => {
+ .@"union" => {
if (!ty.eql(cur_ty, zcu)) return generic_err;
},
else => unreachable,
@@ -34975,7 +34975,7 @@ fn resolvePeerTypesInner(
for (peer_tys, 0..) |opt_ty, i| {
const ty = opt_ty orelse continue;
switch (ty.zigTypeTag(zcu)) {
- .ComptimeInt => {},
+ .comptime_int => {},
else => return .{ .conflict = .{
.peer_idx_a = strat_reason,
.peer_idx_b = i,
@@ -34989,7 +34989,7 @@ fn resolvePeerTypesInner(
for (peer_tys, 0..) |opt_ty, i| {
const ty = opt_ty orelse continue;
switch (ty.zigTypeTag(zcu)) {
- .ComptimeInt, .ComptimeFloat => {},
+ .comptime_int, .comptime_float => {},
else => return .{ .conflict = .{
.peer_idx_a = strat_reason,
.peer_idx_b = i,
@@ -35012,7 +35012,7 @@ fn resolvePeerTypesInner(
const peer_tag = ty.zigTypeTag(zcu);
switch (peer_tag) {
- .ComptimeInt => {
+ .comptime_int => {
// If the value is undefined, we can't refine to a fixed-width int
if (opt_val == null or opt_val.?.isUndef(zcu)) return .{ .conflict = .{
.peer_idx_a = strat_reason,
@@ -35022,7 +35022,7 @@ fn resolvePeerTypesInner(
ptr_opt_val.* = try sema.resolveLazyValue(opt_val.?);
continue;
},
- .Int => {},
+ .int => {},
else => return .{ .conflict = .{
.peer_idx_a = strat_reason,
.peer_idx_b = i,
@@ -35091,14 +35091,14 @@ fn resolvePeerTypesInner(
for (peer_tys, peer_vals, 0..) |opt_ty, opt_val, i| {
const ty = opt_ty orelse continue;
switch (ty.zigTypeTag(zcu)) {
- .ComptimeFloat, .ComptimeInt => {},
- .Int => {
+ .comptime_float, .comptime_int => {},
+ .int => {
if (opt_val == null) return .{ .conflict = .{
.peer_idx_a = strat_reason,
.peer_idx_b = i,
} };
},
- .Float => {
+ .float => {
if (opt_cur_ty) |cur_ty| {
if (cur_ty.eql(ty, zcu)) continue;
// Recreate the type so we eliminate any c_longdouble
@@ -35330,11 +35330,11 @@ fn typeIsArrayLike(sema: *Sema, ty: Type) ?ArrayLike {
const pt = sema.pt;
const zcu = pt.zcu;
return switch (ty.zigTypeTag(zcu)) {
- .Array => .{
+ .array => .{
.len = ty.arrayLen(zcu),
.elem_ty = ty.childType(zcu),
},
- .Struct => {
+ .@"struct" => {
const field_count = ty.structFieldCount(zcu);
if (field_count == 0) return .{
.len = 0,
@@ -35625,7 +35625,7 @@ fn backingIntType(
const small: Zir.Inst.StructDecl.Small = @bitCast(extended.small);
if (small.has_backing_int) {
- var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).Struct.fields.len;
+ var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).@"struct".fields.len;
const captures_len = if (small.has_captures_len) blk: {
const captures_len = zir.extra[extra_index];
extra_index += 1;
@@ -35700,12 +35700,12 @@ fn checkIndexable(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !void {
fn checkMemOperand(sema: *Sema, block: *Block, src: LazySrcLoc, ty: Type) !void {
const pt = sema.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Pointer) {
+ if (ty.zigTypeTag(zcu) == .pointer) {
switch (ty.ptrSize(zcu)) {
.Slice, .Many, .C => return,
.One => {
const elem_ty = ty.childType(zcu);
- if (elem_ty.zigTypeTag(zcu) == .Array) return;
+ if (elem_ty.zigTypeTag(zcu) == .array) return;
// TODO https://github.com/ziglang/zig/issues/15479
// if (elem_ty.isTuple()) return;
},
@@ -35797,7 +35797,7 @@ pub fn resolveUnionLayout(sema: *Sema, ty: Type) SemaError!void {
for (0..union_type.field_types.len) |field_index| {
const field_ty = Type.fromInterned(union_type.field_types.get(ip)[field_index]);
- if (try field_ty.comptimeOnlySema(pt) or field_ty.zigTypeTag(pt.zcu) == .NoReturn) continue; // TODO: should this affect alignment?
+ if (try field_ty.comptimeOnlySema(pt) or field_ty.zigTypeTag(pt.zcu) == .noreturn) continue; // TODO: should this affect alignment?
max_size = @max(max_size, field_ty.abiSizeSema(pt) catch |err| switch (err) {
error.AnalysisFail => {
@@ -36185,7 +36185,7 @@ fn structZirInfo(zir: Zir, zir_index: Zir.Inst.Index) struct {
const extended = zir.instructions.items(.data)[@intFromEnum(zir_index)].extended;
assert(extended.opcode == .struct_decl);
const small: Zir.Inst.StructDecl.Small = @bitCast(extended.small);
- var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).Struct.fields.len;
+ var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).@"struct".fields.len;
const captures_len = if (small.has_captures_len) blk: {
const captures_len = zir.extra[extra_index];
@@ -36357,7 +36357,7 @@ fn structFields(
struct_type.field_types.get(ip)[field_i] = field_ty.toIntern();
- if (field_ty.zigTypeTag(zcu) == .Opaque) {
+ if (field_ty.zigTypeTag(zcu) == .@"opaque") {
const msg = msg: {
const msg = try sema.errMsg(ty_src, "opaque types have unknown size and therefore cannot be directly embedded in structs", .{});
errdefer msg.destroy(sema.gpa);
@@ -36367,7 +36367,7 @@ fn structFields(
};
return sema.failWithOwnedErrorMsg(&block_scope, msg);
}
- if (field_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (field_ty.zigTypeTag(zcu) == .noreturn) {
const msg = msg: {
const msg = try sema.errMsg(ty_src, "struct fields cannot be 'noreturn'", .{});
errdefer msg.destroy(sema.gpa);
@@ -36635,7 +36635,7 @@ fn unionFields(
if (small.auto_enum_tag) {
// The provided type is an integer type and we must construct the enum tag type here.
int_tag_ty = provided_ty;
- if (int_tag_ty.zigTypeTag(zcu) != .Int and int_tag_ty.zigTypeTag(zcu) != .ComptimeInt) {
+ if (int_tag_ty.zigTypeTag(zcu) != .int and int_tag_ty.zigTypeTag(zcu) != .comptime_int) {
return sema.fail(&block_scope, tag_ty_src, "expected integer tag type, found '{}'", .{int_tag_ty.fmt(pt)});
}
@@ -36834,7 +36834,7 @@ fn unionFields(
}
}
- if (field_ty.zigTypeTag(zcu) == .Opaque) {
+ if (field_ty.zigTypeTag(zcu) == .@"opaque") {
const msg = msg: {
const msg = try sema.errMsg(type_src, "opaque types have unknown size and therefore cannot be directly embedded in unions", .{});
errdefer msg.destroy(sema.gpa);
@@ -36932,7 +36932,7 @@ fn generateUnionTagTypeNumbered(
const name = try ip.getOrPutStringFmt(
gpa,
pt.tid,
- "@typeInfo({}).Union.tag_type.?",
+ "@typeInfo({}).@\"union\".tag_type.?",
.{union_name.fmt(ip)},
.no_embedded_nulls,
);
@@ -36968,7 +36968,7 @@ fn generateUnionTagTypeSimple(
const name = try ip.getOrPutStringFmt(
gpa,
pt.tid,
- "@typeInfo({}).Union.tag_type.?",
+ "@typeInfo({}).@\"union\".tag_type.?",
.{union_name.fmt(ip)},
.no_embedded_nulls,
);
@@ -37637,7 +37637,7 @@ fn intAdd(sema: *Sema, lhs: Value, rhs: Value, ty: Type, overflow_idx: *?usize)
fn intAddInner(sema: *Sema, lhs: Value, rhs: Value, ty: Type, overflow_idx: *usize) !Value {
const pt = sema.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try sema.arena.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -37693,7 +37693,7 @@ fn numberAddWrapScalar(
const zcu = pt.zcu;
if (lhs.isUndef(zcu) or rhs.isUndef(zcu)) return pt.undefValue(ty);
- if (ty.zigTypeTag(zcu) == .ComptimeInt) {
+ if (ty.zigTypeTag(zcu) == .comptime_int) {
return sema.intAdd(lhs, rhs, ty, undefined);
}
@@ -37729,7 +37729,7 @@ fn intSub(sema: *Sema, lhs: Value, rhs: Value, ty: Type, overflow_idx: *?usize)
fn intSubInner(sema: *Sema, lhs: Value, rhs: Value, ty: Type, overflow_idx: *usize) !Value {
const pt = sema.pt;
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const result_data = try sema.arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
const scalar_ty = ty.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -37786,7 +37786,7 @@ fn numberSubWrapScalar(
const zcu = pt.zcu;
if (lhs.isUndef(zcu) or rhs.isUndef(zcu)) return pt.undefValue(ty);
- if (ty.zigTypeTag(zcu) == .ComptimeInt) {
+ if (ty.zigTypeTag(zcu) == .comptime_int) {
return sema.intSub(lhs, rhs, ty, undefined);
}
@@ -37806,7 +37806,7 @@ fn intSubWithOverflow(
) !Value.OverflowArithmeticResult {
const pt = sema.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const vec_len = ty.vectorLen(zcu);
const overflowed_data = try sema.arena.alloc(InternPool.Index, vec_len);
const result_data = try sema.arena.alloc(InternPool.Index, vec_len);
@@ -37879,7 +37879,7 @@ fn intFromFloat(
) CompileError!Value {
const pt = sema.pt;
const zcu = pt.zcu;
- if (float_ty.zigTypeTag(zcu) == .Vector) {
+ if (float_ty.zigTypeTag(zcu) == .vector) {
const result_data = try sema.arena.alloc(InternPool.Index, float_ty.vectorLen(zcu));
for (result_data, 0..) |*scalar, i| {
const elem_val = try val.elemValue(pt, i);
@@ -38015,7 +38015,7 @@ fn intFitsInType(
},
},
.aggregate => |aggregate| {
- assert(ty.zigTypeTag(zcu) == .Vector);
+ assert(ty.zigTypeTag(zcu) == .vector);
return switch (aggregate.storage) {
.bytes => |bytes| for (bytes.toSlice(ty.vectorLen(zcu), &zcu.intern_pool), 0..) |byte, i| {
if (byte == 0) continue;
@@ -38070,7 +38070,7 @@ fn intAddWithOverflow(
) !Value.OverflowArithmeticResult {
const pt = sema.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const vec_len = ty.vectorLen(zcu);
const overflowed_data = try sema.arena.alloc(InternPool.Index, vec_len);
const result_data = try sema.arena.alloc(InternPool.Index, vec_len);
@@ -38143,7 +38143,7 @@ fn compareAll(
) CompileError!bool {
const pt = sema.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
var i: usize = 0;
while (i < ty.vectorLen(zcu)) : (i += 1) {
const lhs_elem = try lhs.elemValue(pt, i);
@@ -38194,7 +38194,7 @@ fn compareVector(
) !Value {
const pt = sema.pt;
const zcu = pt.zcu;
- assert(ty.zigTypeTag(zcu) == .Vector);
+ assert(ty.zigTypeTag(zcu) == .vector);
const result_data = try sema.arena.alloc(InternPool.Index, ty.vectorLen(zcu));
for (result_data, 0..) |*scalar, i| {
const lhs_elem = try lhs.elemValue(pt, i);
@@ -38555,7 +38555,7 @@ pub fn resolveDeclaredEnum(
if (tag_type_ref != .none) {
const ty = try sema.resolveType(&block, tag_ty_src, tag_type_ref);
- if (ty.zigTypeTag(zcu) != .Int and ty.zigTypeTag(zcu) != .ComptimeInt) {
+ if (ty.zigTypeTag(zcu) != .int and ty.zigTypeTag(zcu) != .comptime_int) {
return sema.fail(&block, tag_ty_src, "expected integer tag type, found '{}'", .{ty.fmt(pt)});
}
break :ty ty;
diff --git a/src/Sema/bitcast.zig b/src/Sema/bitcast.zig
index 04229532fc83..d3adbe7eb82b 100644
--- a/src/Sema/bitcast.zig
+++ b/src/Sema/bitcast.zig
@@ -274,7 +274,7 @@ const UnpackValueBits = struct {
=> try unpack.primitive(val),
.aggregate => switch (ty.zigTypeTag(zcu)) {
- .Vector => {
+ .vector => {
const len: usize = @intCast(ty.arrayLen(zcu));
for (0..len) |i| {
// We reverse vector elements in packed memory on BE targets.
@@ -286,7 +286,7 @@ const UnpackValueBits = struct {
try unpack.add(elem_val);
}
},
- .Array => {
+ .array => {
// Each element is padded up to its ABI size. Padding bits are undefined.
// The final element does not have trailing padding.
// Elements are reversed in packed memory on BE targets.
@@ -316,7 +316,7 @@ const UnpackValueBits = struct {
try unpack.add(s);
};
},
- .Struct => switch (ty.containerLayout(zcu)) {
+ .@"struct" => switch (ty.containerLayout(zcu)) {
.auto => unreachable, // ill-defined layout
.@"extern" => switch (endian) {
.little => {
@@ -473,7 +473,7 @@ const PackValueBits = struct {
const ip = &zcu.intern_pool;
const arena = pack.arena;
switch (ty.zigTypeTag(zcu)) {
- .Vector => {
+ .vector => {
// Elements are bit-packed.
const len = ty.arrayLen(zcu);
const elem_ty = ty.childType(zcu);
@@ -496,7 +496,7 @@ const PackValueBits = struct {
.storage = .{ .elems = elems },
} }));
},
- .Array => {
+ .array => {
// Each element is padded up to its ABI size. The final element does not have trailing padding.
const len = ty.arrayLen(zcu);
const elem_ty = ty.childType(zcu);
@@ -530,7 +530,7 @@ const PackValueBits = struct {
.storage = .{ .elems = elems },
} }));
},
- .Struct => switch (ty.containerLayout(zcu)) {
+ .@"struct" => switch (ty.containerLayout(zcu)) {
.auto => unreachable, // ill-defined layout
.@"extern" => {
const elems = try arena.alloc(InternPool.Index, ty.structFieldCount(zcu));
@@ -587,7 +587,7 @@ const PackValueBits = struct {
} }));
},
},
- .Union => {
+ .@"union" => {
// We will attempt to read as the backing representation. If this emits
// `error.ReinterpretDeclRef`, we will try each union field, preferring larger ones.
// We will also attempt smaller fields when we get `undefined`, as if some bits are
diff --git a/src/Sema/comptime_ptr_access.zig b/src/Sema/comptime_ptr_access.zig
index 893ea6db3665..10e81d7a9efc 100644
--- a/src/Sema/comptime_ptr_access.zig
+++ b/src/Sema/comptime_ptr_access.zig
@@ -226,7 +226,7 @@ fn loadComptimePtrInner(
.variable => return .runtime_load,
// We let `.@"extern"` through here if it's a function.
// This allows you to alias `extern fn`s.
- .@"extern" => |e| if (Type.fromInterned(e.ty).zigTypeTag(zcu) == .Fn)
+ .@"extern" => |e| if (Type.fromInterned(e.ty).zigTypeTag(zcu) == .@"fn")
break :val .{ .interned = val }
else
return .runtime_load,
@@ -296,8 +296,8 @@ fn loadComptimePtrInner(
const agg_ty = agg_val.typeOf(zcu);
switch (agg_ty.zigTypeTag(zcu)) {
- .Struct, .Pointer => break :val try agg_val.getElem(sema.pt, @intCast(base_index.index)),
- .Union => {
+ .@"struct", .pointer => break :val try agg_val.getElem(sema.pt, @intCast(base_index.index)),
+ .@"union" => {
const tag_val: Value, const payload_mv: MutableValue = switch (agg_val) {
.un => |un| .{ Value.fromInterned(un.tag), un.payload.* },
.interned => |ip_index| switch (ip.indexToKey(ip_index)) {
@@ -321,7 +321,7 @@ fn loadComptimePtrInner(
};
if (ptr.byte_offset == 0 and host_bits == 0) {
- if (load_ty.zigTypeTag(zcu) != .Array or array_offset == 0) {
+ if (load_ty.zigTypeTag(zcu) != .array or array_offset == 0) {
if (.ok == try sema.coerceInMemoryAllowed(
block,
load_ty,
@@ -366,7 +366,7 @@ fn loadComptimePtrInner(
null,
)) {
// Changing the length of an array.
- const skip_base: u64 = extra_base_index + if (load_ty.zigTypeTag(zcu) == .Array) skip: {
+ const skip_base: u64 = extra_base_index + if (load_ty.zigTypeTag(zcu) == .array) skip: {
break :skip load_ty.childType(zcu).arrayBase(zcu)[1] * array_offset;
} else 0;
if (skip_base + load_count > val_count) return .{ .out_of_bounds = base_val.typeOf(zcu) };
@@ -394,7 +394,7 @@ fn loadComptimePtrInner(
var cur_val = base_val;
var cur_offset = ptr.byte_offset;
- if (load_ty.zigTypeTag(zcu) == .Array and array_offset > 0) {
+ if (load_ty.zigTypeTag(zcu) == .array and array_offset > 0) {
cur_offset += try load_ty.childType(zcu).abiSizeSema(pt) * array_offset;
}
@@ -410,30 +410,30 @@ fn loadComptimePtrInner(
while (true) {
const cur_ty = cur_val.typeOf(zcu);
switch (cur_ty.zigTypeTag(zcu)) {
- .NoReturn,
- .Type,
- .ComptimeInt,
- .ComptimeFloat,
- .Null,
- .Undefined,
- .EnumLiteral,
- .Opaque,
- .Fn,
- .ErrorUnion,
+ .noreturn,
+ .type,
+ .comptime_int,
+ .comptime_float,
+ .null,
+ .undefined,
+ .enum_literal,
+ .@"opaque",
+ .@"fn",
+ .error_union,
=> unreachable, // ill-defined layout
- .Int,
- .Float,
- .Bool,
- .Void,
- .Pointer,
- .ErrorSet,
- .AnyFrame,
- .Frame,
- .Enum,
- .Vector,
+ .int,
+ .float,
+ .bool,
+ .void,
+ .pointer,
+ .error_set,
+ .@"anyframe",
+ .frame,
+ .@"enum",
+ .vector,
=> break, // terminal types (no sub-values)
- .Optional => break, // this can only be a pointer-like optional so is terminal
- .Array => {
+ .optional => break, // this can only be a pointer-like optional so is terminal
+ .array => {
const elem_ty = cur_ty.childType(zcu);
const elem_size = try elem_ty.abiSizeSema(pt);
const elem_idx = cur_offset / elem_size;
@@ -446,7 +446,7 @@ fn loadComptimePtrInner(
break;
}
},
- .Struct => switch (cur_ty.containerLayout(zcu)) {
+ .@"struct" => switch (cur_ty.containerLayout(zcu)) {
.auto => unreachable, // ill-defined layout
.@"packed" => break, // let the bitcast logic handle this
.@"extern" => for (0..cur_ty.structFieldCount(zcu)) |field_idx| {
@@ -459,7 +459,7 @@ fn loadComptimePtrInner(
}
} else break, // pointer spans multiple fields
},
- .Union => switch (cur_ty.containerLayout(zcu)) {
+ .@"union" => switch (cur_ty.containerLayout(zcu)) {
.auto => unreachable, // ill-defined layout
.@"packed" => break, // let the bitcast logic handle this
.@"extern" => {
@@ -692,11 +692,11 @@ fn prepareComptimePtrStore(
const agg_ty = agg_val.typeOf(zcu);
switch (agg_ty.zigTypeTag(zcu)) {
- .Struct, .Pointer => break :strat .{ .direct = .{
+ .@"struct", .pointer => break :strat .{ .direct = .{
.val = try agg_val.elem(pt, sema.arena, @intCast(base_index.index)),
.alloc = alloc,
} },
- .Union => {
+ .@"union" => {
if (agg_val.* == .interned and Value.fromInterned(agg_val.interned).isUndef(zcu)) {
return .undef;
}
@@ -717,7 +717,7 @@ fn prepareComptimePtrStore(
};
if (ptr.byte_offset == 0) {
- if (store_ty.zigTypeTag(zcu) != .Array or array_offset == 0) direct: {
+ if (store_ty.zigTypeTag(zcu) != .array or array_offset == 0) direct: {
const base_val_ty = switch (base_strat) {
.direct => |direct| direct.val.typeOf(zcu),
.index => |index| index.val.typeOf(zcu).childType(zcu),
@@ -770,7 +770,7 @@ fn prepareComptimePtrStore(
}
if (base_elem_offset + extra_base_index + store_count > val_count) return .{ .out_of_bounds = oob_ty };
- if (store_ty.zigTypeTag(zcu) == .Array) {
+ if (store_ty.zigTypeTag(zcu) == .array) {
const skip = store_ty.childType(zcu).arrayBase(zcu)[1] * array_offset;
return .{ .flat_index = .{
.alloc = base_strat.alloc(),
@@ -780,7 +780,7 @@ fn prepareComptimePtrStore(
}
// `base_val` must be an array, since otherwise the "direct reinterpret" logic above noticed it.
- assert(base_val.typeOf(zcu).zigTypeTag(zcu) == .Array);
+ assert(base_val.typeOf(zcu).zigTypeTag(zcu) == .array);
var index: u64 = base_elem_offset + extra_base_index;
const arr_val, const arr_index = (try recursiveIndex(sema, base_val, &index)).?;
@@ -816,7 +816,7 @@ fn prepareComptimePtrStore(
return .{ .needed_well_defined = cur_val.typeOf(zcu) };
}
- if (store_ty.zigTypeTag(zcu) == .Array and array_offset > 0) {
+ if (store_ty.zigTypeTag(zcu) == .array and array_offset > 0) {
cur_offset += try store_ty.childType(zcu).abiSizeSema(pt) * array_offset;
}
@@ -832,30 +832,30 @@ fn prepareComptimePtrStore(
while (true) {
const cur_ty = cur_val.typeOf(zcu);
switch (cur_ty.zigTypeTag(zcu)) {
- .NoReturn,
- .Type,
- .ComptimeInt,
- .ComptimeFloat,
- .Null,
- .Undefined,
- .EnumLiteral,
- .Opaque,
- .Fn,
- .ErrorUnion,
+ .noreturn,
+ .type,
+ .comptime_int,
+ .comptime_float,
+ .null,
+ .undefined,
+ .enum_literal,
+ .@"opaque",
+ .@"fn",
+ .error_union,
=> unreachable, // ill-defined layout
- .Int,
- .Float,
- .Bool,
- .Void,
- .Pointer,
- .ErrorSet,
- .AnyFrame,
- .Frame,
- .Enum,
- .Vector,
+ .int,
+ .float,
+ .bool,
+ .void,
+ .pointer,
+ .error_set,
+ .@"anyframe",
+ .frame,
+ .@"enum",
+ .vector,
=> break, // terminal types (no sub-values)
- .Optional => break, // this can only be a pointer-like optional so is terminal
- .Array => {
+ .optional => break, // this can only be a pointer-like optional so is terminal
+ .array => {
const elem_ty = cur_ty.childType(zcu);
const elem_size = try elem_ty.abiSizeSema(pt);
const elem_idx = cur_offset / elem_size;
@@ -868,7 +868,7 @@ fn prepareComptimePtrStore(
break;
}
},
- .Struct => switch (cur_ty.containerLayout(zcu)) {
+ .@"struct" => switch (cur_ty.containerLayout(zcu)) {
.auto => unreachable, // ill-defined layout
.@"packed" => break, // let the bitcast logic handle this
.@"extern" => for (0..cur_ty.structFieldCount(zcu)) |field_idx| {
@@ -881,7 +881,7 @@ fn prepareComptimePtrStore(
}
} else break, // pointer spans multiple fields
},
- .Union => switch (cur_ty.containerLayout(zcu)) {
+ .@"union" => switch (cur_ty.containerLayout(zcu)) {
.auto => unreachable, // ill-defined layout
.@"packed" => break, // let the bitcast logic handle this
.@"extern" => {
@@ -942,7 +942,7 @@ fn flattenArray(
return;
}
- if (ty.zigTypeTag(zcu) != .Array) {
+ if (ty.zigTypeTag(zcu) != .array) {
out[@intCast(next_idx.*)] = (try val.intern(sema.pt, sema.arena)).toIntern();
next_idx.* += 1;
return;
@@ -975,7 +975,7 @@ fn unflattenArray(
const zcu = sema.pt.zcu;
const arena = sema.arena;
- if (ty.zigTypeTag(zcu) != .Array) {
+ if (ty.zigTypeTag(zcu) != .array) {
const val = Value.fromInterned(elems[@intCast(next_idx.*)]);
next_idx.* += 1;
return sema.pt.getCoerced(val, ty);
@@ -1008,7 +1008,7 @@ fn recursiveIndex(
const pt = sema.pt;
const ty = mv.typeOf(pt.zcu);
- assert(ty.zigTypeTag(pt.zcu) == .Array);
+ assert(ty.zigTypeTag(pt.zcu) == .array);
const ty_base_elems = ty.arrayBase(pt.zcu)[1];
if (index.* >= ty_base_elems) {
@@ -1017,7 +1017,7 @@ fn recursiveIndex(
}
const elem_ty = ty.childType(pt.zcu);
- if (elem_ty.zigTypeTag(pt.zcu) != .Array) {
+ if (elem_ty.zigTypeTag(pt.zcu) != .array) {
assert(index.* < ty.arrayLenIncludingSentinel(pt.zcu)); // should be handled by initial check
return .{ mv, index.* };
}
diff --git a/src/Type.zig b/src/Type.zig
index 2925592a3787..2048fc852b72 100644
--- a/src/Type.zig
+++ b/src/Type.zig
@@ -31,8 +31,8 @@ pub fn zigTypeTagOrPoison(ty: Type, zcu: *const Zcu) error{GenericPoison}!std.bu
pub fn baseZigTypeTag(self: Type, mod: *Zcu) std.builtin.TypeId {
return switch (self.zigTypeTag(mod)) {
- .ErrorUnion => self.errorUnionPayload(mod).baseZigTypeTag(mod),
- .Optional => {
+ .error_union => self.errorUnionPayload(mod).baseZigTypeTag(mod),
+ .optional => {
return self.optionalChild(mod).baseZigTypeTag(mod);
},
else => |t| t,
@@ -41,37 +41,37 @@ pub fn baseZigTypeTag(self: Type, mod: *Zcu) std.builtin.TypeId {
pub fn isSelfComparable(ty: Type, zcu: *const Zcu, is_equality_cmp: bool) bool {
return switch (ty.zigTypeTag(zcu)) {
- .Int,
- .Float,
- .ComptimeFloat,
- .ComptimeInt,
+ .int,
+ .float,
+ .comptime_float,
+ .comptime_int,
=> true,
- .Vector => ty.elemType2(zcu).isSelfComparable(zcu, is_equality_cmp),
-
- .Bool,
- .Type,
- .Void,
- .ErrorSet,
- .Fn,
- .Opaque,
- .AnyFrame,
- .Enum,
- .EnumLiteral,
+ .vector => ty.elemType2(zcu).isSelfComparable(zcu, is_equality_cmp),
+
+ .bool,
+ .type,
+ .void,
+ .error_set,
+ .@"fn",
+ .@"opaque",
+ .@"anyframe",
+ .@"enum",
+ .enum_literal,
=> is_equality_cmp,
- .NoReturn,
- .Array,
- .Struct,
- .Undefined,
- .Null,
- .ErrorUnion,
- .Union,
- .Frame,
+ .noreturn,
+ .array,
+ .@"struct",
+ .undefined,
+ .null,
+ .error_union,
+ .@"union",
+ .frame,
=> false,
- .Pointer => !ty.isSlice(zcu) and (is_equality_cmp or ty.isCPtr(zcu)),
- .Optional => {
+ .pointer => !ty.isSlice(zcu) and (is_equality_cmp or ty.isCPtr(zcu)),
+ .optional => {
if (!is_equality_cmp) return false;
return ty.optionalChild(zcu).isSelfComparable(zcu, is_equality_cmp);
},
@@ -80,9 +80,9 @@ pub fn isSelfComparable(ty: Type, zcu: *const Zcu, is_equality_cmp: bool) bool {
/// If it is a function pointer, returns the function type. Otherwise returns null.
pub fn castPtrToFn(ty: Type, zcu: *const Zcu) ?Type {
- if (ty.zigTypeTag(zcu) != .Pointer) return null;
+ if (ty.zigTypeTag(zcu) != .pointer) return null;
const elem_ty = ty.childType(zcu);
- if (elem_ty.zigTypeTag(zcu) != .Fn) return null;
+ if (elem_ty.zigTypeTag(zcu) != .@"fn") return null;
return elem_ty;
}
@@ -267,7 +267,7 @@ pub fn print(ty: Type, writer: anytype, pt: Zcu.PerThread) @TypeOf(writer).Error
},
.inferred_error_set_type => |func_index| {
const func_nav = ip.getNav(zcu.funcInfo(func_index).owner_nav);
- try writer.print("@typeInfo(@typeInfo(@TypeOf({})).Fn.return_type.?).ErrorUnion.error_set", .{
+ try writer.print("@typeInfo(@typeInfo(@TypeOf({})).@\"fn\".return_type.?).error_union.error_set", .{
func_nav.fqn.fmt(ip),
});
},
@@ -796,7 +796,7 @@ pub fn fnHasRuntimeBitsInner(
pub fn isFnOrHasRuntimeBits(ty: Type, zcu: *Zcu) bool {
switch (ty.zigTypeTag(zcu)) {
- .Fn => return ty.fnHasRuntimeBits(zcu),
+ .@"fn" => return ty.fnHasRuntimeBits(zcu),
else => return ty.hasRuntimeBits(zcu),
}
}
@@ -804,7 +804,7 @@ pub fn isFnOrHasRuntimeBits(ty: Type, zcu: *Zcu) bool {
/// Same as `isFnOrHasRuntimeBits` but comptime-only types may return a false positive.
pub fn isFnOrHasRuntimeBitsIgnoreComptime(ty: Type, zcu: *Zcu) bool {
return switch (ty.zigTypeTag(zcu)) {
- .Fn => true,
+ .@"fn" => true,
else => return ty.hasRuntimeBitsIgnoreComptime(zcu),
};
}
@@ -1216,9 +1216,9 @@ fn abiAlignmentInnerOptional(
const child_type = ty.optionalChild(zcu);
switch (child_type.zigTypeTag(zcu)) {
- .Pointer => return .{ .scalar = ptrAbiAlignment(target) },
- .ErrorSet => return Type.anyerror.abiAlignmentInner(strat, zcu, tid),
- .NoReturn => return .{ .scalar = .@"1" },
+ .pointer => return .{ .scalar = ptrAbiAlignment(target) },
+ .error_set => return Type.anyerror.abiAlignmentInner(strat, zcu, tid),
+ .noreturn => return .{ .scalar = .@"1" },
else => {},
}
@@ -2053,7 +2053,7 @@ pub fn elemType2(ty: Type, zcu: *const Zcu) Type {
fn shallowElemType(child_ty: Type, zcu: *const Zcu) Type {
return switch (child_ty.zigTypeTag(zcu)) {
- .Array, .Vector => child_ty.childType(zcu),
+ .array, .vector => child_ty.childType(zcu),
else => child_ty,
};
}
@@ -2061,7 +2061,7 @@ fn shallowElemType(child_ty: Type, zcu: *const Zcu) Type {
/// For vectors, returns the element type. Otherwise returns self.
pub fn scalarType(ty: Type, zcu: *const Zcu) Type {
return switch (ty.zigTypeTag(zcu)) {
- .Vector => ty.childType(zcu),
+ .vector => ty.childType(zcu),
else => ty,
};
}
@@ -2217,7 +2217,7 @@ pub fn isAnyError(ty: Type, zcu: *const Zcu) bool {
pub fn isError(ty: Type, zcu: *const Zcu) bool {
return switch (ty.zigTypeTag(zcu)) {
- .ErrorUnion, .ErrorSet => true,
+ .error_union, .error_set => true,
else => false,
};
}
@@ -2341,8 +2341,8 @@ pub fn isUnsignedInt(ty: Type, zcu: *const Zcu) bool {
/// If this function returns true, then intInfo() can be called on the type.
pub fn isAbiInt(ty: Type, zcu: *const Zcu) bool {
return switch (ty.zigTypeTag(zcu)) {
- .Int, .Enum, .ErrorSet => true,
- .Struct => ty.containerLayout(zcu) == .@"packed",
+ .int, .@"enum", .error_set => true,
+ .@"struct" => ty.containerLayout(zcu) == .@"packed",
else => false,
};
}
@@ -2494,14 +2494,14 @@ pub fn fnCallingConvention(ty: Type, zcu: *const Zcu) std.builtin.CallingConvent
pub fn isValidParamType(self: Type, zcu: *const Zcu) bool {
return switch (self.zigTypeTagOrPoison(zcu) catch return true) {
- .Opaque, .NoReturn => false,
+ .@"opaque", .noreturn => false,
else => true,
};
}
pub fn isValidReturnType(self: Type, zcu: *const Zcu) bool {
return switch (self.zigTypeTagOrPoison(zcu) catch return true) {
- .Opaque => false,
+ .@"opaque" => false,
else => true,
};
}
@@ -2782,8 +2782,8 @@ pub fn comptimeOnlyInner(
.ptr_type => |ptr_type| {
const child_ty = Type.fromInterned(ptr_type.child);
switch (child_ty.zigTypeTag(zcu)) {
- .Fn => return !try child_ty.fnHasRuntimeBitsInner(strat, zcu, tid),
- .Opaque => return false,
+ .@"fn" => return !try child_ty.fnHasRuntimeBitsInner(strat, zcu, tid),
+ .@"opaque" => return false,
else => return child_ty.comptimeOnlyInner(strat, zcu, tid),
}
},
@@ -2954,7 +2954,7 @@ pub fn comptimeOnlyInner(
}
pub fn isVector(ty: Type, zcu: *const Zcu) bool {
- return ty.zigTypeTag(zcu) == .Vector;
+ return ty.zigTypeTag(zcu) == .vector;
}
/// Returns 0 if not a vector, otherwise returns @bitSizeOf(Element) * vector_len.
@@ -2966,40 +2966,40 @@ pub fn totalVectorBits(ty: Type, zcu: *Zcu) u64 {
pub fn isArrayOrVector(ty: Type, zcu: *const Zcu) bool {
return switch (ty.zigTypeTag(zcu)) {
- .Array, .Vector => true,
+ .array, .vector => true,
else => false,
};
}
pub fn isIndexable(ty: Type, zcu: *const Zcu) bool {
return switch (ty.zigTypeTag(zcu)) {
- .Array, .Vector => true,
- .Pointer => switch (ty.ptrSize(zcu)) {
+ .array, .vector => true,
+ .pointer => switch (ty.ptrSize(zcu)) {
.Slice, .Many, .C => true,
.One => switch (ty.childType(zcu).zigTypeTag(zcu)) {
- .Array, .Vector => true,
- .Struct => ty.childType(zcu).isTuple(zcu),
+ .array, .vector => true,
+ .@"struct" => ty.childType(zcu).isTuple(zcu),
else => false,
},
},
- .Struct => ty.isTuple(zcu),
+ .@"struct" => ty.isTuple(zcu),
else => false,
};
}
pub fn indexableHasLen(ty: Type, zcu: *const Zcu) bool {
return switch (ty.zigTypeTag(zcu)) {
- .Array, .Vector => true,
- .Pointer => switch (ty.ptrSize(zcu)) {
+ .array, .vector => true,
+ .pointer => switch (ty.ptrSize(zcu)) {
.Many, .C => false,
.Slice => true,
.One => switch (ty.childType(zcu).zigTypeTag(zcu)) {
- .Array, .Vector => true,
- .Struct => ty.childType(zcu).isTuple(zcu),
+ .array, .vector => true,
+ .@"struct" => ty.childType(zcu).isTuple(zcu),
else => false,
},
},
- .Struct => ty.isTuple(zcu),
+ .@"struct" => ty.isTuple(zcu),
else => false,
};
}
@@ -3030,7 +3030,7 @@ pub fn getParentNamespace(ty: Type, zcu: *Zcu) InternPool.OptionalNamespaceIndex
pub fn minInt(ty: Type, pt: Zcu.PerThread, dest_ty: Type) !Value {
const zcu = pt.zcu;
const scalar = try minIntScalar(ty.scalarType(zcu), pt, dest_ty.scalarType(zcu));
- return if (ty.zigTypeTag(zcu) == .Vector) Value.fromInterned(try pt.intern(.{ .aggregate = .{
+ return if (ty.zigTypeTag(zcu) == .vector) Value.fromInterned(try pt.intern(.{ .aggregate = .{
.ty = dest_ty.toIntern(),
.storage = .{ .repeated_elem = scalar.toIntern() },
} })) else scalar;
@@ -3061,7 +3061,7 @@ pub fn minIntScalar(ty: Type, pt: Zcu.PerThread, dest_ty: Type) !Value {
pub fn maxInt(ty: Type, pt: Zcu.PerThread, dest_ty: Type) !Value {
const zcu = pt.zcu;
const scalar = try maxIntScalar(ty.scalarType(zcu), pt, dest_ty.scalarType(zcu));
- return if (ty.zigTypeTag(zcu) == .Vector) Value.fromInterned(try pt.intern(.{ .aggregate = .{
+ return if (ty.zigTypeTag(zcu) == .vector) Value.fromInterned(try pt.intern(.{ .aggregate = .{
.ty = dest_ty.toIntern(),
.storage = .{ .repeated_elem = scalar.toIntern() },
} })) else scalar;
@@ -3539,8 +3539,8 @@ pub fn isSimpleTupleOrAnonStruct(ty: Type, zcu: *const Zcu) bool {
pub fn optEuBaseType(ty: Type, zcu: *const Zcu) Type {
var cur = ty;
while (true) switch (cur.zigTypeTag(zcu)) {
- .Optional => cur = cur.optionalChild(zcu),
- .ErrorUnion => cur = cur.errorUnionPayload(zcu),
+ .optional => cur = cur.optionalChild(zcu),
+ .error_union => cur = cur.errorUnionPayload(zcu),
else => return cur,
};
}
@@ -3548,8 +3548,8 @@ pub fn optEuBaseType(ty: Type, zcu: *const Zcu) Type {
pub fn toUnsigned(ty: Type, pt: Zcu.PerThread) !Type {
const zcu = pt.zcu;
return switch (ty.zigTypeTag(zcu)) {
- .Int => pt.intType(.unsigned, ty.intInfo(zcu).bits),
- .Vector => try pt.vectorType(.{
+ .int => pt.intType(.unsigned, ty.intInfo(zcu).bits),
+ .vector => try pt.vectorType(.{
.len = ty.vectorLen(zcu),
.child = (try ty.childType(zcu).toUnsigned(pt)).toIntern(),
}),
@@ -3625,7 +3625,7 @@ pub fn getCaptures(ty: Type, zcu: *const Zcu) InternPool.CaptureValue.Slice {
pub fn arrayBase(ty: Type, zcu: *const Zcu) struct { Type, u64 } {
var cur_ty: Type = ty;
var cur_len: u64 = 1;
- while (cur_ty.zigTypeTag(zcu) == .Array) {
+ while (cur_ty.zigTypeTag(zcu) == .array) {
cur_len *= cur_ty.arrayLenIncludingSentinel(zcu);
cur_ty = cur_ty.childType(zcu);
}
@@ -3692,7 +3692,7 @@ pub fn resolveLayout(ty: Type, pt: Zcu.PerThread) SemaError!void {
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
switch (ty.zigTypeTag(zcu)) {
- .Struct => switch (ip.indexToKey(ty.toIntern())) {
+ .@"struct" => switch (ip.indexToKey(ty.toIntern())) {
.anon_struct_type => |anon_struct_type| for (0..anon_struct_type.types.len) |i| {
const field_ty = Type.fromInterned(anon_struct_type.types.get(ip)[i]);
try field_ty.resolveLayout(pt);
@@ -3700,21 +3700,21 @@ pub fn resolveLayout(ty: Type, pt: Zcu.PerThread) SemaError!void {
.struct_type => return ty.resolveStructInner(pt, .layout),
else => unreachable,
},
- .Union => return ty.resolveUnionInner(pt, .layout),
- .Array => {
+ .@"union" => return ty.resolveUnionInner(pt, .layout),
+ .array => {
if (ty.arrayLenIncludingSentinel(zcu) == 0) return;
const elem_ty = ty.childType(zcu);
return elem_ty.resolveLayout(pt);
},
- .Optional => {
+ .optional => {
const payload_ty = ty.optionalChild(zcu);
return payload_ty.resolveLayout(pt);
},
- .ErrorUnion => {
+ .error_union => {
const payload_ty = ty.errorUnionPayload(zcu);
return payload_ty.resolveLayout(pt);
},
- .Fn => {
+ .@"fn" => {
const info = zcu.typeToFunc(ty).?;
if (info.is_generic) {
// Resolving of generic function types is deferred to when
@@ -3830,30 +3830,30 @@ pub fn resolveFully(ty: Type, pt: Zcu.PerThread) SemaError!void {
const ip = &zcu.intern_pool;
switch (ty.zigTypeTag(zcu)) {
- .Type,
- .Void,
- .Bool,
- .NoReturn,
- .Int,
- .Float,
- .ComptimeFloat,
- .ComptimeInt,
- .Undefined,
- .Null,
- .ErrorSet,
- .Enum,
- .Opaque,
- .Frame,
- .AnyFrame,
- .Vector,
- .EnumLiteral,
+ .type,
+ .void,
+ .bool,
+ .noreturn,
+ .int,
+ .float,
+ .comptime_float,
+ .comptime_int,
+ .undefined,
+ .null,
+ .error_set,
+ .@"enum",
+ .@"opaque",
+ .frame,
+ .@"anyframe",
+ .vector,
+ .enum_literal,
=> {},
- .Pointer => return ty.childType(zcu).resolveFully(pt),
- .Array => return ty.childType(zcu).resolveFully(pt),
- .Optional => return ty.optionalChild(zcu).resolveFully(pt),
- .ErrorUnion => return ty.errorUnionPayload(zcu).resolveFully(pt),
- .Fn => {
+ .pointer => return ty.childType(zcu).resolveFully(pt),
+ .array => return ty.childType(zcu).resolveFully(pt),
+ .optional => return ty.optionalChild(zcu).resolveFully(pt),
+ .error_union => return ty.errorUnionPayload(zcu).resolveFully(pt),
+ .@"fn" => {
const info = zcu.typeToFunc(ty).?;
if (info.is_generic) return;
for (0..info.param_types.len) |i| {
@@ -3863,7 +3863,7 @@ pub fn resolveFully(ty: Type, pt: Zcu.PerThread) SemaError!void {
try Type.fromInterned(info.return_type).resolveFully(pt);
},
- .Struct => switch (ip.indexToKey(ty.toIntern())) {
+ .@"struct" => switch (ip.indexToKey(ty.toIntern())) {
.anon_struct_type => |anon_struct_type| for (0..anon_struct_type.types.len) |i| {
const field_ty = Type.fromInterned(anon_struct_type.types.get(ip)[i]);
try field_ty.resolveFully(pt);
@@ -3871,7 +3871,7 @@ pub fn resolveFully(ty: Type, pt: Zcu.PerThread) SemaError!void {
.struct_type => return ty.resolveStructInner(pt, .full),
else => unreachable,
},
- .Union => return ty.resolveUnionInner(pt, .full),
+ .@"union" => return ty.resolveUnionInner(pt, .full),
}
}
diff --git a/src/Value.zig b/src/Value.zig
index 0843045f75d3..e29e0338843c 100644
--- a/src/Value.zig
+++ b/src/Value.zig
@@ -64,7 +64,7 @@ pub fn fmtValueSemaFull(ctx: print_value.FormatContext) std.fmt.Formatter(print_
/// Asserts `val` is an array of `u8`
pub fn toIpString(val: Value, ty: Type, pt: Zcu.PerThread) !InternPool.NullTerminatedString {
const zcu = pt.zcu;
- assert(ty.zigTypeTag(zcu) == .Array);
+ assert(ty.zigTypeTag(zcu) == .array);
assert(ty.childType(zcu).toIntern() == .u8_type);
const ip = &zcu.intern_pool;
switch (zcu.intern_pool.indexToKey(val.toIntern()).aggregate.storage) {
@@ -349,12 +349,12 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
return;
}
switch (ty.zigTypeTag(zcu)) {
- .Void => {},
- .Bool => {
+ .void => {},
+ .bool => {
buffer[0] = @intFromBool(val.toBool());
},
- .Int, .Enum, .ErrorSet, .Pointer => |tag| {
- const int_ty = if (tag == .Pointer) int_ty: {
+ .int, .@"enum", .error_set, .pointer => |tag| {
+ const int_ty = if (tag == .pointer) int_ty: {
if (ty.isSlice(zcu)) return error.IllDefinedMemoryLayout;
if (ip.getBackingAddrTag(val.toIntern()).? != .int) return error.ReinterpretDeclRef;
break :int_ty Type.usize;
@@ -367,7 +367,7 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
const bigint = val.toBigInt(&bigint_buffer, zcu);
bigint.writeTwosComplement(buffer[0..byte_count], endian);
},
- .Float => switch (ty.floatBits(target)) {
+ .float => switch (ty.floatBits(target)) {
16 => std.mem.writeInt(u16, buffer[0..2], @bitCast(val.toFloat(f16, zcu)), endian),
32 => std.mem.writeInt(u32, buffer[0..4], @bitCast(val.toFloat(f32, zcu)), endian),
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{
128 => std.mem.writeInt(u128, buffer[0..16], @bitCast(val.toFloat(f128, zcu)), endian),
else => unreachable,
},
- .Array => {
+ .array => {
const len = ty.arrayLen(zcu);
const elem_ty = ty.childType(zcu);
const elem_size: usize = @intCast(elem_ty.abiSize(zcu));
@@ -387,13 +387,13 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
buf_off += elem_size;
}
},
- .Vector => {
+ .vector => {
// We use byte_count instead of abi_size here, so that any padding bytes
// follow the data bytes, on both big- and little-endian systems.
const byte_count = (@as(usize, @intCast(ty.bitSize(zcu))) + 7) / 8;
return writeToPackedMemory(val, ty, pt, buffer[0..byte_count], 0);
},
- .Struct => {
+ .@"struct" => {
const struct_type = zcu.typeToStruct(ty) orelse return error.IllDefinedMemoryLayout;
switch (struct_type.layout) {
.auto => return error.IllDefinedMemoryLayout,
@@ -415,7 +415,7 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
},
}
},
- .Union => switch (ty.containerLayout(zcu)) {
+ .@"union" => switch (ty.containerLayout(zcu)) {
.auto => return error.IllDefinedMemoryLayout, // Sema is supposed to have emitted a compile error already
.@"extern" => {
if (val.unionTag(zcu)) |union_tag| {
@@ -437,7 +437,7 @@ pub fn writeToMemory(val: Value, pt: Zcu.PerThread, buffer: []u8) error{
return writeToPackedMemory(val, ty, pt, buffer[0..byte_count], 0);
},
},
- .Optional => {
+ .optional => {
if (!ty.isPtrLikeOptional(zcu)) return error.IllDefinedMemoryLayout;
const opt_val = val.optionalValue(zcu);
if (opt_val) |some| {
@@ -473,8 +473,8 @@ pub fn writeToPackedMemory(
return;
}
switch (ty.zigTypeTag(zcu)) {
- .Void => {},
- .Bool => {
+ .void => {},
+ .bool => {
const byte_index = switch (endian) {
.little => bit_offset / 8,
.big => buffer.len - bit_offset / 8 - 1,
@@ -485,7 +485,7 @@ pub fn writeToPackedMemory(
buffer[byte_index] &= ~(@as(u8, 1) << @as(u3, @intCast(bit_offset % 8)));
}
},
- .Int, .Enum => {
+ .int, .@"enum" => {
if (buffer.len == 0) return;
const bits = ty.intInfo(zcu).bits;
if (bits == 0) return;
@@ -503,7 +503,7 @@ pub fn writeToPackedMemory(
},
}
},
- .Float => switch (ty.floatBits(target)) {
+ .float => switch (ty.floatBits(target)) {
16 => std.mem.writePackedInt(u16, buffer, bit_offset, @bitCast(val.toFloat(f16, zcu)), endian),
32 => std.mem.writePackedInt(u32, buffer, bit_offset, @bitCast(val.toFloat(f32, zcu)), endian),
64 => std.mem.writePackedInt(u64, buffer, bit_offset, @bitCast(val.toFloat(f64, zcu)), endian),
@@ -511,7 +511,7 @@ pub fn writeToPackedMemory(
128 => std.mem.writePackedInt(u128, buffer, bit_offset, @bitCast(val.toFloat(f128, zcu)), endian),
else => unreachable,
},
- .Vector => {
+ .vector => {
const elem_ty = ty.childType(zcu);
const elem_bit_size: u16 = @intCast(elem_ty.bitSize(zcu));
const len: usize = @intCast(ty.arrayLen(zcu));
@@ -526,7 +526,7 @@ pub fn writeToPackedMemory(
bits += elem_bit_size;
}
},
- .Struct => {
+ .@"struct" => {
const struct_type = ip.loadStructType(ty.toIntern());
// Sema is supposed to have emitted a compile error already in the case of Auto,
// and Extern is handled in non-packed writeToMemory.
@@ -544,7 +544,7 @@ pub fn writeToPackedMemory(
bits += field_bits;
}
},
- .Union => {
+ .@"union" => {
const union_obj = zcu.typeToUnion(ty).?;
switch (union_obj.flagsUnordered(ip).layout) {
.auto, .@"extern" => unreachable, // Handled in non-packed writeToMemory
@@ -561,12 +561,12 @@ pub fn writeToPackedMemory(
},
}
},
- .Pointer => {
+ .pointer => {
assert(!ty.isSlice(zcu)); // No well defined layout.
if (ip.getBackingAddrTag(val.toIntern()).? != .int) return error.ReinterpretDeclRef;
return val.writeToPackedMemory(Type.usize, pt, buffer, bit_offset);
},
- .Optional => {
+ .optional => {
assert(ty.isPtrLikeOptional(zcu));
const child = ty.optionalChild(zcu);
const opt_val = val.optionalValue(zcu);
@@ -599,18 +599,18 @@ pub fn readFromMemory(
const target = zcu.getTarget();
const endian = target.cpu.arch.endian();
switch (ty.zigTypeTag(zcu)) {
- .Void => return Value.void,
- .Bool => {
+ .void => return Value.void,
+ .bool => {
if (buffer[0] == 0) {
return Value.false;
} else {
return Value.true;
}
},
- .Int, .Enum => |ty_tag| {
+ .int, .@"enum" => |ty_tag| {
const int_ty = switch (ty_tag) {
- .Int => ty,
- .Enum => ty.intTagType(zcu),
+ .int => ty,
+ .@"enum" => ty.intTagType(zcu),
else => unreachable,
};
const int_info = int_ty.intInfo(zcu);
@@ -639,7 +639,7 @@ pub fn readFromMemory(
return zcu.getCoerced(try zcu.intValue_big(int_ty, bigint.toConst()), ty);
}
},
- .Float => return Value.fromInterned(try pt.intern(.{ .float = .{
+ .float => return Value.fromInterned(try pt.intern(.{ .float = .{
.ty = ty.toIntern(),
.storage = switch (ty.floatBits(target)) {
16 => .{ .f16 = @bitCast(std.mem.readInt(u16, buffer[0..2], endian)) },
@@ -650,7 +650,7 @@ pub fn readFromMemory(
else => unreachable,
},
} })),
- .Array => {
+ .array => {
const elem_ty = ty.childType(zcu);
const elem_size = elem_ty.abiSize(zcu);
const elems = try arena.alloc(InternPool.Index, @intCast(ty.arrayLen(zcu)));
@@ -664,13 +664,13 @@ pub fn readFromMemory(
.storage = .{ .elems = elems },
} }));
},
- .Vector => {
+ .vector => {
// We use byte_count instead of abi_size here, so that any padding bytes
// follow the data bytes, on both big- and little-endian systems.
const byte_count = (@as(usize, @intCast(ty.bitSize(zcu))) + 7) / 8;
return readFromPackedMemory(ty, zcu, buffer[0..byte_count], 0, arena);
},
- .Struct => {
+ .@"struct" => {
const struct_type = zcu.typeToStruct(ty).?;
switch (struct_type.layout) {
.auto => unreachable, // Sema is supposed to have emitted a compile error already
@@ -694,7 +694,7 @@ pub fn readFromMemory(
},
}
},
- .ErrorSet => {
+ .error_set => {
const bits = zcu.errorSetBits();
const byte_count: u16 = @intCast((@as(u17, bits) + 7) / 8);
const int = std.mem.readVarInt(u64, buffer[0..byte_count], endian);
@@ -706,7 +706,7 @@ pub fn readFromMemory(
.name = name,
} }));
},
- .Union => switch (ty.containerLayout(zcu)) {
+ .@"union" => switch (ty.containerLayout(zcu)) {
.auto => return error.IllDefinedMemoryLayout,
.@"extern" => {
const union_size = ty.abiSize(zcu);
@@ -723,7 +723,7 @@ pub fn readFromMemory(
return readFromPackedMemory(ty, zcu, buffer[0..byte_count], 0, arena);
},
},
- .Pointer => {
+ .pointer => {
assert(!ty.isSlice(zcu)); // No well defined layout.
const int_val = try readFromMemory(Type.usize, zcu, buffer, arena);
return Value.fromInterned(try pt.intern(.{ .ptr = .{
@@ -732,7 +732,7 @@ pub fn readFromMemory(
.byte_offset = int_val.toUnsignedInt(zcu),
} }));
},
- .Optional => {
+ .optional => {
assert(ty.isPtrLikeOptional(zcu));
const child_ty = ty.optionalChild(zcu);
const child_val = try readFromMemory(child_ty, zcu, buffer, arena);
@@ -768,8 +768,8 @@ pub fn readFromPackedMemory(
const target = zcu.getTarget();
const endian = target.cpu.arch.endian();
switch (ty.zigTypeTag(zcu)) {
- .Void => return Value.void,
- .Bool => {
+ .void => return Value.void,
+ .bool => {
const byte = switch (endian) {
.big => buffer[buffer.len - bit_offset / 8 - 1],
.little => buffer[bit_offset / 8],
@@ -780,7 +780,7 @@ pub fn readFromPackedMemory(
return Value.true;
}
},
- .Int => {
+ .int => {
if (buffer.len == 0) return pt.intValue(ty, 0);
const int_info = ty.intInfo(zcu);
const bits = int_info.bits;
@@ -804,12 +804,12 @@ pub fn readFromPackedMemory(
bigint.readPackedTwosComplement(buffer, bit_offset, bits, endian, int_info.signedness);
return pt.intValue_big(ty, bigint.toConst());
},
- .Enum => {
+ .@"enum" => {
const int_ty = ty.intTagType(zcu);
const int_val = try Value.readFromPackedMemory(int_ty, pt, buffer, bit_offset, arena);
return pt.getCoerced(int_val, ty);
},
- .Float => return Value.fromInterned(try pt.intern(.{ .float = .{
+ .float => return Value.fromInterned(try pt.intern(.{ .float = .{
.ty = ty.toIntern(),
.storage = switch (ty.floatBits(target)) {
16 => .{ .f16 = @bitCast(std.mem.readPackedInt(u16, buffer, bit_offset, endian)) },
@@ -820,7 +820,7 @@ pub fn readFromPackedMemory(
else => unreachable,
},
} })),
- .Vector => {
+ .vector => {
const elem_ty = ty.childType(zcu);
const elems = try arena.alloc(InternPool.Index, @intCast(ty.arrayLen(zcu)));
@@ -837,7 +837,7 @@ pub fn readFromPackedMemory(
.storage = .{ .elems = elems },
} }));
},
- .Struct => {
+ .@"struct" => {
// Sema is supposed to have emitted a compile error already for Auto layout structs,
// and Extern is handled by non-packed readFromMemory.
const struct_type = zcu.typeToPackedStruct(ty).?;
@@ -854,7 +854,7 @@ pub fn readFromPackedMemory(
.storage = .{ .elems = field_vals },
} }));
},
- .Union => switch (ty.containerLayout(zcu)) {
+ .@"union" => switch (ty.containerLayout(zcu)) {
.auto, .@"extern" => unreachable, // Handled by non-packed readFromMemory
.@"packed" => {
const backing_ty = try ty.unionBackingType(pt);
@@ -866,7 +866,7 @@ pub fn readFromPackedMemory(
} }));
},
},
- .Pointer => {
+ .pointer => {
assert(!ty.isSlice(zcu)); // No well defined layout.
const int_val = try readFromPackedMemory(Type.usize, pt, buffer, bit_offset, arena);
return Value.fromInterned(try pt.intern(.{ .ptr = .{
@@ -875,7 +875,7 @@ pub fn readFromPackedMemory(
.byte_offset = int_val.toUnsignedInt(zcu),
} }));
},
- .Optional => {
+ .optional => {
assert(ty.isPtrLikeOptional(zcu));
const child_ty = ty.optionalChild(zcu);
const child_val = try readFromPackedMemory(child_ty, pt, buffer, bit_offset, arena);
@@ -1155,7 +1155,7 @@ pub fn compareHeteroAdvanced(
/// For vectors, returns true if comparison is true for ALL elements.
pub fn compareAll(lhs: Value, op: std.math.CompareOperator, rhs: Value, ty: Type, pt: Zcu.PerThread) !bool {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const scalar_ty = ty.scalarType(zcu);
for (0..ty.vectorLen(zcu)) |i| {
const lhs_elem = try lhs.elemValue(pt, i);
@@ -1519,7 +1519,7 @@ pub fn floatFromIntAdvanced(
comptime strat: ResolveStrat,
) !Value {
const zcu = pt.zcu;
- if (int_ty.zigTypeTag(zcu) == .Vector) {
+ if (int_ty.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, int_ty.vectorLen(zcu));
const scalar_ty = float_ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -1573,7 +1573,7 @@ fn calcLimbLenFloat(scalar: anytype) usize {
}
const w_value = @abs(scalar);
- return @divFloor(@as(std.math.big.Limb, @intFromFloat(std.math.log2(w_value))), @typeInfo(std.math.big.Limb).Int.bits) + 1;
+ return @divFloor(@as(std.math.big.Limb, @intFromFloat(std.math.log2(w_value))), @typeInfo(std.math.big.Limb).int.bits) + 1;
}
pub const OverflowArithmeticResult = struct {
@@ -1589,7 +1589,7 @@ pub fn intAddSat(
arena: Allocator,
pt: Zcu.PerThread,
) !Value {
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
const scalar_ty = ty.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -1640,7 +1640,7 @@ pub fn intSubSat(
arena: Allocator,
pt: Zcu.PerThread,
) !Value {
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
const scalar_ty = ty.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -1692,7 +1692,7 @@ pub fn intMulWithOverflow(
pt: Zcu.PerThread,
) !OverflowArithmeticResult {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const vec_len = ty.vectorLen(zcu);
const overflowed_data = try arena.alloc(InternPool.Index, vec_len);
const result_data = try arena.alloc(InternPool.Index, vec_len);
@@ -1770,7 +1770,7 @@ pub fn numberMulWrap(
pt: Zcu.PerThread,
) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -1797,7 +1797,7 @@ pub fn numberMulWrapScalar(
const zcu = pt.zcu;
if (lhs.isUndef(zcu) or rhs.isUndef(zcu)) return Value.undef;
- if (ty.zigTypeTag(zcu) == .ComptimeInt) {
+ if (ty.zigTypeTag(zcu) == .comptime_int) {
return intMul(lhs, rhs, ty, undefined, arena, pt);
}
@@ -1817,7 +1817,7 @@ pub fn intMulSat(
arena: Allocator,
pt: Zcu.PerThread,
) !Value {
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
const scalar_ty = ty.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -1897,7 +1897,7 @@ pub fn numberMin(lhs: Value, rhs: Value, zcu: *Zcu) Value {
/// operands must be (vectors of) integers; handles undefined scalars.
pub fn bitwiseNot(val: Value, ty: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -1941,7 +1941,7 @@ pub fn bitwiseNotScalar(val: Value, ty: Type, arena: Allocator, pt: Zcu.PerThrea
/// operands must be (vectors of) integers; handles undefined scalars.
pub fn bitwiseAnd(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2014,7 +2014,7 @@ fn intValueAa(ty: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
/// operands must be (vectors of) integers; handles undefined scalars.
pub fn bitwiseNand(lhs: Value, rhs: Value, ty: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2044,7 +2044,7 @@ pub fn bitwiseNandScalar(lhs: Value, rhs: Value, ty: Type, arena: Allocator, pt:
/// operands must be (vectors of) integers; handles undefined scalars.
pub fn bitwiseOr(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2097,7 +2097,7 @@ pub fn bitwiseOrScalar(orig_lhs: Value, orig_rhs: Value, ty: Type, arena: Alloca
/// operands must be (vectors of) integers; handles undefined scalars.
pub fn bitwiseXor(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2157,7 +2157,7 @@ pub fn intDiv(lhs: Value, rhs: Value, ty: Type, overflow_idx: *?usize, allocator
}
fn intDivInner(lhs: Value, rhs: Value, ty: Type, overflow_idx: *usize, allocator: Allocator, pt: Zcu.PerThread) !Value {
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
const scalar_ty = ty.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2213,7 +2213,7 @@ pub fn intDivScalar(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt:
}
pub fn intDivFloor(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
const scalar_ty = ty.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2256,7 +2256,7 @@ pub fn intDivFloorScalar(lhs: Value, rhs: Value, ty: Type, allocator: Allocator,
}
pub fn intMod(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
const scalar_ty = ty.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2328,7 +2328,7 @@ pub fn isNegativeInf(val: Value, zcu: *const Zcu) bool {
}
pub fn floatRem(lhs: Value, rhs: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
- if (float_type.zigTypeTag(pt.zcu) == .Vector) {
+ if (float_type.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
const scalar_ty = float_type.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2362,7 +2362,7 @@ pub fn floatRemScalar(lhs: Value, rhs: Value, float_type: Type, pt: Zcu.PerThrea
}
pub fn floatMod(lhs: Value, rhs: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
- if (float_type.zigTypeTag(pt.zcu) == .Vector) {
+ if (float_type.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
const scalar_ty = float_type.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2419,7 +2419,7 @@ pub fn intMul(lhs: Value, rhs: Value, ty: Type, overflow_idx: *?usize, allocator
fn intMulInner(lhs: Value, rhs: Value, ty: Type, overflow_idx: *usize, allocator: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2471,7 +2471,7 @@ pub fn intMulScalar(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt:
pub fn intTrunc(val: Value, ty: Type, allocator: Allocator, signedness: std.builtin.Signedness, bits: u16, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2496,7 +2496,7 @@ pub fn intTruncBitsAsValue(
pt: Zcu.PerThread,
) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2540,7 +2540,7 @@ pub fn intTruncScalar(
pub fn shl(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2588,7 +2588,7 @@ pub fn shlWithOverflow(
allocator: Allocator,
pt: Zcu.PerThread,
) !OverflowArithmeticResult {
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const vec_len = ty.vectorLen(pt.zcu);
const overflowed_data = try allocator.alloc(InternPool.Index, vec_len);
const result_data = try allocator.alloc(InternPool.Index, vec_len);
@@ -2653,7 +2653,7 @@ pub fn shlSat(
arena: Allocator,
pt: Zcu.PerThread,
) !Value {
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
const scalar_ty = ty.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2704,7 +2704,7 @@ pub fn shlTrunc(
arena: Allocator,
pt: Zcu.PerThread,
) !Value {
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
const scalar_ty = ty.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2734,7 +2734,7 @@ pub fn shlTruncScalar(
}
pub fn shr(lhs: Value, rhs: Value, ty: Type, allocator: Allocator, pt: Zcu.PerThread) !Value {
- if (ty.zigTypeTag(pt.zcu) == .Vector) {
+ if (ty.zigTypeTag(pt.zcu) == .vector) {
const result_data = try allocator.alloc(InternPool.Index, ty.vectorLen(pt.zcu));
const scalar_ty = ty.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2789,7 +2789,7 @@ pub fn floatNeg(
pt: Zcu.PerThread,
) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2829,7 +2829,7 @@ pub fn floatAdd(
pt: Zcu.PerThread,
) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2875,7 +2875,7 @@ pub fn floatSub(
pt: Zcu.PerThread,
) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2920,7 +2920,7 @@ pub fn floatDiv(
arena: Allocator,
pt: Zcu.PerThread,
) !Value {
- if (float_type.zigTypeTag(pt.zcu) == .Vector) {
+ if (float_type.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
const scalar_ty = float_type.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -2965,7 +2965,7 @@ pub fn floatDivFloor(
arena: Allocator,
pt: Zcu.PerThread,
) !Value {
- if (float_type.zigTypeTag(pt.zcu) == .Vector) {
+ if (float_type.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
const scalar_ty = float_type.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3010,7 +3010,7 @@ pub fn floatDivTrunc(
arena: Allocator,
pt: Zcu.PerThread,
) !Value {
- if (float_type.zigTypeTag(pt.zcu) == .Vector) {
+ if (float_type.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
const scalar_ty = float_type.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3056,7 +3056,7 @@ pub fn floatMul(
pt: Zcu.PerThread,
) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3095,7 +3095,7 @@ pub fn floatMulScalar(
}
pub fn sqrt(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
- if (float_type.zigTypeTag(pt.zcu) == .Vector) {
+ if (float_type.zigTypeTag(pt.zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(pt.zcu));
const scalar_ty = float_type.scalarType(pt.zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3129,7 +3129,7 @@ pub fn sqrtScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Err
pub fn sin(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3163,7 +3163,7 @@ pub fn sinScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Erro
pub fn cos(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3197,7 +3197,7 @@ pub fn cosScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Erro
pub fn tan(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3231,7 +3231,7 @@ pub fn tanScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Erro
pub fn exp(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3265,7 +3265,7 @@ pub fn expScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Erro
pub fn exp2(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3299,7 +3299,7 @@ pub fn exp2Scalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Err
pub fn log(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3333,7 +3333,7 @@ pub fn logScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Erro
pub fn log2(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3367,7 +3367,7 @@ pub fn log2Scalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Err
pub fn log10(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3401,7 +3401,7 @@ pub fn log10Scalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Er
pub fn abs(val: Value, ty: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, ty.vectorLen(zcu));
const scalar_ty = ty.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3419,21 +3419,21 @@ pub fn abs(val: Value, ty: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
pub fn absScalar(val: Value, ty: Type, pt: Zcu.PerThread, arena: Allocator) Allocator.Error!Value {
const zcu = pt.zcu;
switch (ty.zigTypeTag(zcu)) {
- .Int => {
+ .int => {
var buffer: Value.BigIntSpace = undefined;
var operand_bigint = try val.toBigInt(&buffer, zcu).toManaged(arena);
operand_bigint.abs();
return pt.intValue_big(try ty.toUnsigned(pt), operand_bigint.toConst());
},
- .ComptimeInt => {
+ .comptime_int => {
var buffer: Value.BigIntSpace = undefined;
var operand_bigint = try val.toBigInt(&buffer, zcu).toManaged(arena);
operand_bigint.abs();
return pt.intValue_big(ty, operand_bigint.toConst());
},
- .ComptimeFloat, .Float => {
+ .comptime_float, .float => {
const target = zcu.getTarget();
const storage: InternPool.Key.Float.Storage = switch (ty.floatBits(target)) {
16 => .{ .f16 = @abs(val.toFloat(f16, zcu)) },
@@ -3454,7 +3454,7 @@ pub fn absScalar(val: Value, ty: Type, pt: Zcu.PerThread, arena: Allocator) Allo
pub fn floor(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3488,7 +3488,7 @@ pub fn floorScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Er
pub fn ceil(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3522,7 +3522,7 @@ pub fn ceilScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Err
pub fn round(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3556,7 +3556,7 @@ pub fn roundScalar(val: Value, float_type: Type, pt: Zcu.PerThread) Allocator.Er
pub fn trunc(val: Value, float_type: Type, arena: Allocator, pt: Zcu.PerThread) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3597,7 +3597,7 @@ pub fn mulAdd(
pt: Zcu.PerThread,
) !Value {
const zcu = pt.zcu;
- if (float_type.zigTypeTag(zcu) == .Vector) {
+ if (float_type.zigTypeTag(zcu) == .vector) {
const result_data = try arena.alloc(InternPool.Index, float_type.vectorLen(zcu));
const scalar_ty = float_type.scalarType(zcu);
for (result_data, 0..) |*scalar, i| {
@@ -3720,7 +3720,7 @@ pub fn ptrOptPayload(parent_ptr: Value, pt: Zcu.PerThread) !Value {
const opt_ty = parent_ptr_ty.childType(zcu);
assert(parent_ptr_ty.ptrSize(zcu) == .One);
- assert(opt_ty.zigTypeTag(zcu) == .Optional);
+ assert(opt_ty.zigTypeTag(zcu) == .optional);
const result_ty = try pt.ptrTypeSema(info: {
var new = parent_ptr_ty.ptrInfo(zcu);
@@ -3754,7 +3754,7 @@ pub fn ptrEuPayload(parent_ptr: Value, pt: Zcu.PerThread) !Value {
const eu_ty = parent_ptr_ty.childType(zcu);
assert(parent_ptr_ty.ptrSize(zcu) == .One);
- assert(eu_ty.zigTypeTag(zcu) == .ErrorUnion);
+ assert(eu_ty.zigTypeTag(zcu) == .error_union);
const result_ty = try pt.ptrTypeSema(info: {
var new = parent_ptr_ty.ptrInfo(zcu);
@@ -3789,7 +3789,7 @@ pub fn ptrField(parent_ptr: Value, field_idx: u32, pt: Zcu.PerThread) !Value {
// Exiting this `switch` indicates that the `field` pointer representation should be used.
// `field_align` may be `.none` to represent the natural alignment of `field_ty`, but is not necessarily.
const field_ty: Type, const field_align: InternPool.Alignment = switch (aggregate_ty.zigTypeTag(zcu)) {
- .Struct => field: {
+ .@"struct" => field: {
const field_ty = aggregate_ty.fieldType(field_idx, zcu);
switch (aggregate_ty.containerLayout(zcu)) {
.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 {
},
}
},
- .Union => field: {
+ .@"union" => field: {
const union_obj = zcu.typeToUnion(aggregate_ty).?;
const field_ty = Type.fromInterned(union_obj.field_types.get(&zcu.intern_pool)[field_idx]);
switch (aggregate_ty.containerLayout(zcu)) {
@@ -3887,7 +3887,7 @@ pub fn ptrField(parent_ptr: Value, field_idx: u32, pt: Zcu.PerThread) !Value {
},
}
},
- .Pointer => field_ty: {
+ .pointer => field_ty: {
assert(aggregate_ty.isSlice(zcu));
break :field_ty switch (field_idx) {
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
if (result_ty.ptrInfo(zcu).packed_offset.host_size != 0) {
// Since we have a bit-pointer, the pointer address should be unchanged.
- assert(elem_ty.zigTypeTag(zcu) == .Vector);
+ assert(elem_ty.zigTypeTag(zcu) == .vector);
return pt.getCoerced(parent_ptr, result_ty);
}
@@ -3955,8 +3955,8 @@ pub fn ptrElem(orig_parent_ptr: Value, field_idx: u64, pt: Zcu.PerThread) !Value
const strat: PtrStrat = switch (parent_ptr_ty.ptrSize(zcu)) {
.One => switch (elem_ty.zigTypeTag(zcu)) {
- .Vector => .{ .offset = field_idx * @divExact(try elem_ty.childType(zcu).bitSizeSema(pt), 8) },
- .Array => strat: {
+ .vector => .{ .offset = field_idx * @divExact(try elem_ty.childType(zcu).bitSizeSema(pt), 8) },
+ .array => strat: {
const arr_elem_ty = elem_ty.childType(zcu);
if (try arr_elem_ty.comptimeOnlySema(pt)) {
break :strat .{ .elem_ptr = arr_elem_ty };
@@ -4178,19 +4178,19 @@ pub fn pointerDerivationAdvanced(ptr_val: Value, arena: Allocator, pt: Zcu.PerTh
const base_ptr_ty = base_ptr.typeOf(zcu);
const agg_ty = base_ptr_ty.childType(zcu);
const field_ty, const field_align = switch (agg_ty.zigTypeTag(zcu)) {
- .Struct => .{ agg_ty.fieldType(@intCast(field.index), zcu), try agg_ty.fieldAlignmentInner(
+ .@"struct" => .{ agg_ty.fieldType(@intCast(field.index), zcu), try agg_ty.fieldAlignmentInner(
@intCast(field.index),
if (have_sema) .sema else .normal,
pt.zcu,
if (have_sema) pt.tid else {},
) },
- .Union => .{ agg_ty.unionFieldTypeByIndex(@intCast(field.index), zcu), try agg_ty.fieldAlignmentInner(
+ .@"union" => .{ agg_ty.unionFieldTypeByIndex(@intCast(field.index), zcu), try agg_ty.fieldAlignmentInner(
@intCast(field.index),
if (have_sema) .sema else .normal,
pt.zcu,
if (have_sema) pt.tid else {},
) },
- .Pointer => .{ switch (field.index) {
+ .pointer => .{ switch (field.index) {
Value.slice_ptr_index => agg_ty.slicePtrFieldType(zcu),
Value.slice_len_index => Type.usize,
else => unreachable,
@@ -4268,31 +4268,31 @@ pub fn pointerDerivationAdvanced(ptr_val: Value, arena: Allocator, pt: Zcu.PerTh
break;
}
switch (cur_ty.zigTypeTag(zcu)) {
- .NoReturn,
- .Type,
- .ComptimeInt,
- .ComptimeFloat,
- .Null,
- .Undefined,
- .EnumLiteral,
- .Opaque,
- .Fn,
- .ErrorUnion,
- .Int,
- .Float,
- .Bool,
- .Void,
- .Pointer,
- .ErrorSet,
- .AnyFrame,
- .Frame,
- .Enum,
- .Vector,
- .Optional,
- .Union,
+ .noreturn,
+ .type,
+ .comptime_int,
+ .comptime_float,
+ .null,
+ .undefined,
+ .enum_literal,
+ .@"opaque",
+ .@"fn",
+ .error_union,
+ .int,
+ .float,
+ .bool,
+ .void,
+ .pointer,
+ .error_set,
+ .@"anyframe",
+ .frame,
+ .@"enum",
+ .vector,
+ .optional,
+ .@"union",
=> break,
- .Array => {
+ .array => {
const elem_ty = cur_ty.childType(zcu);
const elem_size = elem_ty.abiSize(zcu);
const start_idx = cur_offset / elem_size;
@@ -4321,7 +4321,7 @@ pub fn pointerDerivationAdvanced(ptr_val: Value, arena: Allocator, pt: Zcu.PerTh
break;
}
},
- .Struct => switch (cur_ty.containerLayout(zcu)) {
+ .@"struct" => switch (cur_ty.containerLayout(zcu)) {
.auto, .@"packed" => break,
.@"extern" => for (0..cur_ty.structFieldCount(zcu)) |field_idx| {
const field_ty = cur_ty.fieldType(field_idx, zcu);
diff --git a/src/Zcu.zig b/src/Zcu.zig
index 7a03535c2f68..148570d85a8d 100644
--- a/src/Zcu.zig
+++ b/src/Zcu.zig
@@ -43,9 +43,9 @@ const dev = @import("dev.zig");
comptime {
@setEvalBranchQuota(4000);
for (
- @typeInfo(Zir.Inst.Ref).Enum.fields,
- @typeInfo(Air.Inst.Ref).Enum.fields,
- @typeInfo(InternPool.Index).Enum.fields,
+ @typeInfo(Zir.Inst.Ref).@"enum".fields,
+ @typeInfo(Air.Inst.Ref).@"enum".fields,
+ @typeInfo(InternPool.Index).@"enum".fields,
) |zir_field, air_field, ip_field| {
assert(mem.eql(u8, zir_field.name, ip_field.name));
assert(mem.eql(u8, air_field.name, ip_field.name));
@@ -246,7 +246,7 @@ pub const PanicId = enum {
memcpy_alias,
noreturn_returned,
- pub const len = @typeInfo(PanicId).Enum.fields.len;
+ pub const len = @typeInfo(PanicId).@"enum".fields.len;
};
pub const GlobalErrorSet = std.AutoArrayHashMapUnmanaged(InternPool.NullTerminatedString, void);
diff --git a/src/Zcu/PerThread.zig b/src/Zcu/PerThread.zig
index 67e0e9ee8b11..0a581773e9ae 100644
--- a/src/Zcu/PerThread.zig
+++ b/src/Zcu/PerThread.zig
@@ -921,7 +921,7 @@ fn createFileRootStruct(
assert(!small.has_captures_len);
assert(!small.has_backing_int);
assert(small.layout == .auto);
- var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).Struct.fields.len;
+ var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).@"struct".fields.len;
const fields_len = if (small.has_fields_len) blk: {
const fields_len = file.zir.extra[extra_index];
extra_index += 1;
@@ -1005,7 +1005,7 @@ fn updateFileNamespace(pt: Zcu.PerThread, file_index: Zcu.File.Index) Allocator.
const extended = file.zir.instructions.items(.data)[@intFromEnum(Zir.Inst.Index.main_struct_inst)].extended;
const small: Zir.Inst.StructDecl.Small = @bitCast(extended.small);
- var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).Struct.fields.len;
+ var extra_index: usize = extended.operand + @typeInfo(Zir.Inst.StructDecl).@"struct".fields.len;
extra_index += @intFromBool(small.has_fields_len);
const decls_len = if (small.has_decls_len) blk: {
const decls_len = file.zir.extra[extra_index];
@@ -2080,7 +2080,7 @@ fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index) Zcu.SemaError!
func.setCallsOrAwaitsErrorableFn(ip, false);
// First few indexes of extra are reserved and set at the end.
- const reserved_count = @typeInfo(Air.ExtraIndex).Enum.fields.len;
+ const reserved_count = @typeInfo(Air.ExtraIndex).@"enum".fields.len;
try sema.air_extra.ensureTotalCapacity(gpa, reserved_count);
sema.air_extra.items.len += reserved_count;
@@ -2204,7 +2204,7 @@ fn analyzeFnBody(pt: Zcu.PerThread, func_index: InternPool.Index) Zcu.SemaError!
}
// Copy the block into place and mark that as the main block.
- try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).Struct.fields.len +
+ try sema.air_extra.ensureUnusedCapacity(gpa, @typeInfo(Air.Block).@"struct".fields.len +
inner_block.instructions.items.len);
const main_block_index = sema.addExtraAssumeCapacity(Air.Block{
.body_len = @intCast(inner_block.instructions.items.len),
@@ -2405,7 +2405,7 @@ fn processExportsInner(
.resolved => |r| Value.fromInterned(r.val),
};
// If the value is a function, we also need to check if that function succeeded analysis.
- if (val.typeOf(zcu).zigTypeTag(zcu) == .Fn) {
+ if (val.typeOf(zcu).zigTypeTag(zcu) == .@"fn") {
const func_unit = AnalUnit.wrap(.{ .func = val.toIntern() });
if (zcu.failed_analysis.contains(func_unit)) break :failed true;
if (zcu.transitive_failed_analysis.contains(func_unit)) break :failed true;
@@ -2869,7 +2869,7 @@ pub fn errorSetFromUnsortedNames(
/// Supports only pointers, not pointer-like optionals.
pub fn ptrIntValue(pt: Zcu.PerThread, ty: Type, x: u64) Allocator.Error!Value {
const zcu = pt.zcu;
- assert(ty.zigTypeTag(zcu) == .Pointer and !ty.isSlice(zcu));
+ assert(ty.zigTypeTag(zcu) == .pointer and !ty.isSlice(zcu));
assert(x != 0 or ty.isAllowzeroPtr(zcu));
return Value.fromInterned(try pt.intern(.{ .ptr = .{
.ty = ty.toIntern(),
@@ -2882,7 +2882,7 @@ pub fn ptrIntValue(pt: Zcu.PerThread, ty: Type, x: u64) Allocator.Error!Value {
pub fn enumValue(pt: Zcu.PerThread, ty: Type, tag_int: InternPool.Index) Allocator.Error!Value {
if (std.debug.runtime_safety) {
const tag = ty.zigTypeTag(pt.zcu);
- assert(tag == .Enum);
+ assert(tag == .@"enum");
}
return Value.fromInterned(try pt.intern(.{ .enum_tag = .{
.ty = ty.toIntern(),
diff --git a/src/arch/aarch64/CodeGen.zig b/src/arch/aarch64/CodeGen.zig
index 0ed37b79d7d9..c61e540c4a53 100644
--- a/src/arch/aarch64/CodeGen.zig
+++ b/src/arch/aarch64/CodeGen.zig
@@ -1324,7 +1324,7 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
.compare_flags => |cond| break :result MCValue{ .compare_flags = cond.negate() },
else => {
switch (operand_ty.zigTypeTag(zcu)) {
- .Bool => {
+ .bool => {
// TODO convert this to mvn + and
const op_reg = switch (operand) {
.register => |r| r,
@@ -1355,8 +1355,8 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
break :result MCValue{ .register = dest_reg };
},
- .Vector => return self.fail("TODO bitwise not for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO bitwise not for vectors", .{}),
+ .int => {
const int_info = operand_ty.intInfo(zcu);
if (int_info.bits <= 64) {
const op_reg = switch (operand) {
@@ -1412,9 +1412,9 @@ fn minMax(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO ARM min/max on floats", .{}),
- .Vector => return self.fail("TODO ARM min/max on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO ARM min/max on floats", .{}),
+ .vector => return self.fail("TODO ARM min/max on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
@@ -1903,9 +1903,9 @@ fn addSub(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO binary operations on floats", .{}),
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO binary operations on floats", .{}),
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
@@ -1965,8 +1965,8 @@ fn mul(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
@@ -1998,8 +1998,8 @@ fn divFloat(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO div_float", .{}),
- .Vector => return self.fail("TODO div_float on vectors", .{}),
+ .float => return self.fail("TODO div_float", .{}),
+ .vector => return self.fail("TODO div_float on vectors", .{}),
else => unreachable,
}
}
@@ -2015,9 +2015,9 @@ fn divTrunc(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO div on floats", .{}),
- .Vector => return self.fail("TODO div on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO div on floats", .{}),
+ .vector => return self.fail("TODO div on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
@@ -2050,9 +2050,9 @@ fn divFloor(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO div on floats", .{}),
- .Vector => return self.fail("TODO div on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO div on floats", .{}),
+ .vector => return self.fail("TODO div on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
@@ -2084,9 +2084,9 @@ fn divExact(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO div on floats", .{}),
- .Vector => return self.fail("TODO div on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO div on floats", .{}),
+ .vector => return self.fail("TODO div on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
@@ -2121,9 +2121,9 @@ fn rem(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO rem/zcu on floats", .{}),
- .Vector => return self.fail("TODO rem/zcu on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO rem/zcu on floats", .{}),
+ .vector => return self.fail("TODO rem/zcu on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
@@ -2193,9 +2193,9 @@ fn modulo(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO zcu on floats", .{}),
- .Vector => return self.fail("TODO zcu on vectors", .{}),
- .Int => return self.fail("TODO zcu on ints", .{}),
+ .float => return self.fail("TODO zcu on floats", .{}),
+ .vector => return self.fail("TODO zcu on vectors", .{}),
+ .int => return self.fail("TODO zcu on ints", .{}),
else => unreachable,
}
}
@@ -2212,8 +2212,8 @@ fn wrappingArithmetic(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
// Generate an add/sub/mul
@@ -2248,8 +2248,8 @@ fn bitwise(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
@@ -2284,8 +2284,8 @@ fn shiftExact(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
const rhs_immediate = try rhs_bind.resolveToImmediate(self);
@@ -2335,8 +2335,8 @@ fn shiftNormal(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
// Generate a shl_exact/shr_exact
@@ -2376,7 +2376,7 @@ fn booleanOp(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Bool => {
+ .bool => {
assert((try lhs_bind.resolveToImmediate(self)) == null); // should have been handled by Sema
assert((try rhs_bind.resolveToImmediate(self)) == null); // should have been handled by Sema
@@ -2404,7 +2404,7 @@ fn ptrArithmetic(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Pointer => {
+ .pointer => {
assert(rhs_ty.eql(Type.usize, zcu));
const ptr_ty = lhs_ty;
@@ -2539,8 +2539,8 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void {
const overflow_bit_offset = @as(u32, @intCast(tuple_ty.structFieldOffset(1, zcu)));
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
switch (int_info.bits) {
@@ -2667,8 +2667,8 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
const overflow_bit_offset = @as(u32, @intCast(tuple_ty.structFieldOffset(1, zcu)));
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
@@ -2892,8 +2892,8 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
const overflow_bit_offset = @as(u32, @intCast(tuple_ty.structFieldOffset(1, zcu)));
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement shl_with_overflow for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement shl_with_overflow for vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
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
const ip = &zcu.intern_pool;
const fn_ty = switch (ty.zigTypeTag(zcu)) {
- .Fn => ty,
- .Pointer => ty.childType(zcu),
+ .@"fn" => ty,
+ .pointer => ty.childType(zcu),
else => unreachable,
};
@@ -4388,7 +4388,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
},
else => return self.fail("TODO implement calling bitcasted functions", .{}),
} else {
- assert(ty.zigTypeTag(zcu) == .Pointer);
+ assert(ty.zigTypeTag(zcu) == .pointer);
const mcv = try self.resolveInst(callee);
try self.genSetReg(ty, .x30, mcv);
@@ -4523,7 +4523,7 @@ fn cmp(
const pt = self.pt;
const zcu = pt.zcu;
const int_ty = switch (lhs_ty.zigTypeTag(zcu)) {
- .Optional => blk: {
+ .optional => blk: {
const payload_ty = lhs_ty.optionalChild(zcu);
if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
break :blk Type.u1;
@@ -4533,12 +4533,12 @@ fn cmp(
return self.fail("TODO ARM cmp non-pointer optionals", .{});
}
},
- .Float => return self.fail("TODO ARM cmp floats", .{}),
- .Enum => lhs_ty.intTagType(zcu),
- .Int => lhs_ty,
- .Bool => Type.u1,
- .Pointer => Type.usize,
- .ErrorSet => Type.u16,
+ .float => return self.fail("TODO ARM cmp floats", .{}),
+ .@"enum" => lhs_ty.intTagType(zcu),
+ .int => lhs_ty,
+ .bool => Type.u1,
+ .pointer => Type.usize,
+ .error_set => Type.u16,
else => unreachable,
};
@@ -6243,7 +6243,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
var ncrn: usize = 0; // Next Core Register Number
var nsaa: u32 = 0; // Next stacked argument address
- if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (ret_ty.zigTypeTag(zcu) == .noreturn) {
result.return_value = .{ .unreach = {} };
} else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu) and !ret_ty.isError(zcu)) {
result.return_value = .{ .none = {} };
@@ -6301,7 +6301,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
result.stack_align = 16;
},
.Unspecified => {
- if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (ret_ty.zigTypeTag(zcu) == .noreturn) {
result.return_value = .{ .unreach = {} };
} else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu) and !ret_ty.isError(zcu)) {
result.return_value = .{ .none = {} };
diff --git a/src/arch/aarch64/abi.zig b/src/arch/aarch64/abi.zig
index b3926b8cc15d..99c67d676186 100644
--- a/src/arch/aarch64/abi.zig
+++ b/src/arch/aarch64/abi.zig
@@ -20,7 +20,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
var maybe_float_bits: ?u16 = null;
switch (ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
if (ty.containerLayout(zcu) == .@"packed") return .byval;
const float_count = countFloats(ty, zcu, &maybe_float_bits);
if (float_count <= sret_float_count) return .{ .float_array = float_count };
@@ -30,7 +30,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
if (bit_size > 64) return .double_integer;
return .integer;
},
- .Union => {
+ .@"union" => {
if (ty.containerLayout(zcu) == .@"packed") return .byval;
const float_count = countFloats(ty, zcu, &maybe_float_bits);
if (float_count <= sret_float_count) return .{ .float_array = float_count };
@@ -40,35 +40,35 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
if (bit_size > 64) return .double_integer;
return .integer;
},
- .Int, .Enum, .ErrorSet, .Float, .Bool => return .byval,
- .Vector => {
+ .int, .@"enum", .error_set, .float, .bool => return .byval,
+ .vector => {
const bit_size = ty.bitSize(zcu);
// TODO is this controlled by a cpu feature?
if (bit_size > 128) return .memory;
return .byval;
},
- .Optional => {
+ .optional => {
std.debug.assert(ty.isPtrLikeOptional(zcu));
return .byval;
},
- .Pointer => {
+ .pointer => {
std.debug.assert(!ty.isSlice(zcu));
return .byval;
},
- .ErrorUnion,
- .Frame,
- .AnyFrame,
- .NoReturn,
- .Void,
- .Type,
- .ComptimeFloat,
- .ComptimeInt,
- .Undefined,
- .Null,
- .Fn,
- .Opaque,
- .EnumLiteral,
- .Array,
+ .error_union,
+ .frame,
+ .@"anyframe",
+ .noreturn,
+ .void,
+ .type,
+ .comptime_float,
+ .comptime_int,
+ .undefined,
+ .null,
+ .@"fn",
+ .@"opaque",
+ .enum_literal,
+ .array,
=> unreachable,
}
}
@@ -79,7 +79,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u8 {
const target = zcu.getTarget();
const invalid = std.math.maxInt(u8);
switch (ty.zigTypeTag(zcu)) {
- .Union => {
+ .@"union" => {
const union_obj = zcu.typeToUnion(ty).?;
var max_count: u8 = 0;
for (union_obj.field_types.get(ip)) |field_ty| {
@@ -90,7 +90,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u8 {
}
return max_count;
},
- .Struct => {
+ .@"struct" => {
const fields_len = ty.structFieldCount(zcu);
var count: u8 = 0;
var i: u32 = 0;
@@ -103,7 +103,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u8 {
}
return count;
},
- .Float => {
+ .float => {
const float_bits = maybe_float_bits.* orelse {
maybe_float_bits.* = ty.floatBits(target);
return 1;
@@ -111,7 +111,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u8 {
if (ty.floatBits(target) == float_bits) return 1;
return invalid;
},
- .Void => return 0,
+ .void => return 0,
else => return invalid,
}
}
@@ -119,14 +119,14 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u8 {
pub fn getFloatArrayType(ty: Type, zcu: *Zcu) ?Type {
const ip = &zcu.intern_pool;
switch (ty.zigTypeTag(zcu)) {
- .Union => {
+ .@"union" => {
const union_obj = zcu.typeToUnion(ty).?;
for (union_obj.field_types.get(ip)) |field_ty| {
if (getFloatArrayType(Type.fromInterned(field_ty), zcu)) |some| return some;
}
return null;
},
- .Struct => {
+ .@"struct" => {
const fields_len = ty.structFieldCount(zcu);
var i: u32 = 0;
while (i < fields_len) : (i += 1) {
@@ -135,7 +135,7 @@ pub fn getFloatArrayType(ty: Type, zcu: *Zcu) ?Type {
}
return null;
},
- .Float => return ty,
+ .float => return ty,
else => return null,
}
}
diff --git a/src/arch/arm/CodeGen.zig b/src/arch/arm/CodeGen.zig
index 90bd3606300a..d693c06ec9a7 100644
--- a/src/arch/arm/CodeGen.zig
+++ b/src/arch/arm/CodeGen.zig
@@ -1286,7 +1286,7 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
.cpsr_flags => |cond| break :result MCValue{ .cpsr_flags = cond.negate() },
else => {
switch (operand_ty.zigTypeTag(zcu)) {
- .Bool => {
+ .bool => {
var op_reg: Register = undefined;
var dest_reg: Register = undefined;
@@ -1316,8 +1316,8 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
break :result MCValue{ .register = dest_reg };
},
- .Vector => return self.fail("TODO bitwise not for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO bitwise not for vectors", .{}),
+ .int => {
const int_info = operand_ty.intInfo(zcu);
if (int_info.bits <= 32) {
var op_reg: Register = undefined;
@@ -1375,9 +1375,9 @@ fn minMax(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO ARM min/max on floats", .{}),
- .Vector => return self.fail("TODO ARM min/max on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO ARM min/max on floats", .{}),
+ .vector => return self.fail("TODO ARM min/max on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
@@ -1596,8 +1596,8 @@ fn airOverflow(self: *Self, inst: Air.Inst.Index) !void {
const overflow_bit_offset: u32 = @intCast(tuple_ty.structFieldOffset(1, zcu));
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits < 32) {
@@ -1710,8 +1710,8 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
const overflow_bit_offset: u32 = @intCast(tuple_ty.structFieldOffset(1, zcu));
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 16) {
@@ -1873,8 +1873,8 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
const overflow_bit_offset: u32 = @intCast(tuple_ty.structFieldOffset(1, zcu));
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement shl_with_overflow for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement shl_with_overflow for vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
const stack_offset = try self.allocMem(tuple_size, tuple_align, inst);
@@ -3021,7 +3021,7 @@ fn airFieldParentPtr(self: *Self, inst: Air.Inst.Index) !void {
const field_ptr = try self.resolveInst(extra.field_ptr);
const struct_ty = ty_pl.ty.toType().childType(zcu);
- if (struct_ty.zigTypeTag(zcu) == .Union) {
+ if (struct_ty.zigTypeTag(zcu) == .@"union") {
return self.fail("TODO implement @fieldParentPtr codegen for unions", .{});
}
@@ -3411,9 +3411,9 @@ fn addSub(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO ARM binary operations on floats", .{}),
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO ARM binary operations on floats", .{}),
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
@@ -3468,9 +3468,9 @@ fn mul(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO ARM binary operations on floats", .{}),
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO ARM binary operations on floats", .{}),
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
@@ -3502,8 +3502,8 @@ fn divFloat(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO ARM binary operations on floats", .{}),
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .float => return self.fail("TODO ARM binary operations on floats", .{}),
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
else => unreachable,
}
}
@@ -3519,9 +3519,9 @@ fn divTrunc(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO ARM binary operations on floats", .{}),
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO ARM binary operations on floats", .{}),
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
@@ -3563,9 +3563,9 @@ fn divFloor(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO ARM binary operations on floats", .{}),
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO ARM binary operations on floats", .{}),
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
@@ -3612,9 +3612,9 @@ fn divExact(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO ARM binary operations on floats", .{}),
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => return self.fail("TODO ARM div_exact", .{}),
+ .float => return self.fail("TODO ARM binary operations on floats", .{}),
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => return self.fail("TODO ARM div_exact", .{}),
else => unreachable,
}
}
@@ -3630,9 +3630,9 @@ fn rem(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO ARM binary operations on floats", .{}),
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO ARM binary operations on floats", .{}),
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
@@ -3700,9 +3700,9 @@ fn modulo(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO ARM binary operations on floats", .{}),
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => return self.fail("TODO ARM zcu", .{}),
+ .float => return self.fail("TODO ARM binary operations on floats", .{}),
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => return self.fail("TODO ARM zcu", .{}),
else => unreachable,
}
}
@@ -3719,8 +3719,8 @@ fn wrappingArithmetic(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
// Generate an add/sub/mul
@@ -3758,8 +3758,8 @@ fn bitwise(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
@@ -3804,8 +3804,8 @@ fn shiftExact(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
const rhs_immediate = try rhs_bind.resolveToImmediate(self);
@@ -3844,8 +3844,8 @@ fn shiftNormal(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO ARM binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO ARM binary operations on vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 32) {
// Generate a shl_exact/shr_exact
@@ -3888,7 +3888,7 @@ fn booleanOp(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Bool => {
+ .bool => {
const lhs_immediate = try lhs_bind.resolveToImmediate(self);
const rhs_immediate = try rhs_bind.resolveToImmediate(self);
@@ -3923,7 +3923,7 @@ fn ptrArithmetic(
const pt = self.pt;
const zcu = pt.zcu;
switch (lhs_ty.zigTypeTag(zcu)) {
- .Pointer => {
+ .pointer => {
assert(rhs_ty.eql(Type.usize, zcu));
const ptr_ty = lhs_ty;
@@ -4259,8 +4259,8 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
const ip = &zcu.intern_pool;
const fn_ty = switch (ty.zigTypeTag(zcu)) {
- .Fn => ty,
- .Pointer => ty.childType(zcu),
+ .@"fn" => ty,
+ .pointer => ty.childType(zcu),
else => unreachable,
};
@@ -4337,7 +4337,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
return self.fail("TODO implement calling bitcasted functions", .{});
},
} else {
- assert(ty.zigTypeTag(zcu) == .Pointer);
+ assert(ty.zigTypeTag(zcu) == .pointer);
const mcv = try self.resolveInst(callee);
try self.genSetReg(Type.usize, .lr, mcv);
@@ -4494,7 +4494,7 @@ fn cmp(
const pt = self.pt;
const zcu = pt.zcu;
const int_ty = switch (lhs_ty.zigTypeTag(zcu)) {
- .Optional => blk: {
+ .optional => blk: {
const payload_ty = lhs_ty.optionalChild(zcu);
if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
break :blk Type.u1;
@@ -4504,12 +4504,12 @@ fn cmp(
return self.fail("TODO ARM cmp non-pointer optionals", .{});
}
},
- .Float => return self.fail("TODO ARM cmp floats", .{}),
- .Enum => lhs_ty.intTagType(zcu),
- .Int => lhs_ty,
- .Bool => Type.u1,
- .Pointer => Type.usize,
- .ErrorSet => Type.u16,
+ .float => return self.fail("TODO ARM cmp floats", .{}),
+ .@"enum" => lhs_ty.intTagType(zcu),
+ .int => lhs_ty,
+ .bool => Type.u1,
+ .pointer => Type.usize,
+ .error_set => Type.u16,
else => unreachable,
};
@@ -6211,7 +6211,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
var ncrn: usize = 0; // Next Core Register Number
var nsaa: u32 = 0; // Next stacked argument address
- if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (ret_ty.zigTypeTag(zcu) == .noreturn) {
result.return_value = .{ .unreach = {} };
} else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
result.return_value = .{ .none = {} };
@@ -6258,7 +6258,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type) !CallMCValues {
result.stack_align = 8;
},
.Unspecified => {
- if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (ret_ty.zigTypeTag(zcu) == .noreturn) {
result.return_value = .{ .unreach = {} };
} else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu) and !ret_ty.isError(zcu)) {
result.return_value = .{ .none = {} };
diff --git a/src/arch/arm/abi.zig b/src/arch/arm/abi.zig
index 718350164c70..b29bb523abd2 100644
--- a/src/arch/arm/abi.zig
+++ b/src/arch/arm/abi.zig
@@ -31,7 +31,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu, ctx: Context) Class {
const max_byval_size = 512;
const ip = &zcu.intern_pool;
switch (ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
const bit_size = ty.bitSize(zcu);
if (ty.containerLayout(zcu) == .@"packed") {
if (bit_size > 64) return .memory;
@@ -53,7 +53,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu, ctx: Context) Class {
}
return Class.arrSize(bit_size, 32);
},
- .Union => {
+ .@"union" => {
const bit_size = ty.bitSize(zcu);
const union_obj = zcu.typeToUnion(ty).?;
if (union_obj.flagsUnordered(ip).layout == .@"packed") {
@@ -73,48 +73,48 @@ pub fn classifyType(ty: Type, zcu: *Zcu, ctx: Context) Class {
}
return Class.arrSize(bit_size, 32);
},
- .Bool, .Float => return .byval,
- .Int => {
+ .bool, .float => return .byval,
+ .int => {
// TODO this is incorrect for _BitInt(128) but implementing
// this correctly makes implementing compiler-rt impossible.
// const bit_size = ty.bitSize(zcu);
// if (bit_size > 64) return .memory;
return .byval;
},
- .Enum, .ErrorSet => {
+ .@"enum", .error_set => {
const bit_size = ty.bitSize(zcu);
if (bit_size > 64) return .memory;
return .byval;
},
- .Vector => {
+ .vector => {
const bit_size = ty.bitSize(zcu);
// TODO is this controlled by a cpu feature?
if (ctx == .ret and bit_size > 128) return .memory;
if (bit_size > 512) return .memory;
return .byval;
},
- .Optional => {
+ .optional => {
assert(ty.isPtrLikeOptional(zcu));
return .byval;
},
- .Pointer => {
+ .pointer => {
assert(!ty.isSlice(zcu));
return .byval;
},
- .ErrorUnion,
- .Frame,
- .AnyFrame,
- .NoReturn,
- .Void,
- .Type,
- .ComptimeFloat,
- .ComptimeInt,
- .Undefined,
- .Null,
- .Fn,
- .Opaque,
- .EnumLiteral,
- .Array,
+ .error_union,
+ .frame,
+ .@"anyframe",
+ .noreturn,
+ .void,
+ .type,
+ .comptime_float,
+ .comptime_int,
+ .undefined,
+ .null,
+ .@"fn",
+ .@"opaque",
+ .enum_literal,
+ .array,
=> unreachable,
}
}
@@ -125,7 +125,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u32 {
const target = zcu.getTarget();
const invalid = std.math.maxInt(u32);
switch (ty.zigTypeTag(zcu)) {
- .Union => {
+ .@"union" => {
const union_obj = zcu.typeToUnion(ty).?;
var max_count: u32 = 0;
for (union_obj.field_types.get(ip)) |field_ty| {
@@ -136,7 +136,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u32 {
}
return max_count;
},
- .Struct => {
+ .@"struct" => {
const fields_len = ty.structFieldCount(zcu);
var count: u32 = 0;
var i: u32 = 0;
@@ -149,7 +149,7 @@ fn countFloats(ty: Type, zcu: *Zcu, maybe_float_bits: *?u16) u32 {
}
return count;
},
- .Float => {
+ .float => {
const float_bits = maybe_float_bits.* orelse {
const float_bits = ty.floatBits(target);
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 {
if (ty.floatBits(target) == float_bits) return 1;
return invalid;
},
- .Void => return 0,
+ .void => return 0,
else => return invalid,
}
}
diff --git a/src/arch/arm/bits.zig b/src/arch/arm/bits.zig
index 5802b909533e..37386b9c629a 100644
--- a/src/arch/arm/bits.zig
+++ b/src/arch/arm/bits.zig
@@ -1299,7 +1299,7 @@ pub const Instruction = union(enum) {
}
pub fn pop(cond: Condition, args: anytype) Instruction {
- if (@typeInfo(@TypeOf(args)) != .Struct) {
+ if (@typeInfo(@TypeOf(args)) != .@"struct") {
@compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(args)));
}
@@ -1323,7 +1323,7 @@ pub const Instruction = union(enum) {
}
pub fn push(cond: Condition, args: anytype) Instruction {
- if (@typeInfo(@TypeOf(args)) != .Struct) {
+ if (@typeInfo(@TypeOf(args)) != .@"struct") {
@compileError("Expected tuple or struct argument, found " ++ @typeName(@TypeOf(args)));
}
diff --git a/src/arch/riscv64/CodeGen.zig b/src/arch/riscv64/CodeGen.zig
index 2df0dbc3284a..a70618a394f3 100644
--- a/src/arch/riscv64/CodeGen.zig
+++ b/src/arch/riscv64/CodeGen.zig
@@ -675,14 +675,14 @@ fn restoreState(func: *Func, state: State, deaths: []const Air.Inst.Index, compt
) |inst, *tracking| tracking.resurrect(inst, state.scope_generation);
for (deaths) |death| try func.processDeath(death);
- const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).Array.len]RegisterLock;
+ const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).array.len]RegisterLock;
var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) =
if (opts.update_tracking)
{} else std.heap.stackFallback(@sizeOf(ExpectedContents), func.gpa);
var reg_locks = if (opts.update_tracking) {} else try std.ArrayList(RegisterLock).initCapacity(
stack.get(),
- @typeInfo(ExpectedContents).Array.len,
+ @typeInfo(ExpectedContents).array.len,
);
defer if (!opts.update_tracking) {
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 {
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
switch (Type.fromInterned(lazy_sym.ty).zigTypeTag(zcu)) {
- .Enum => {
+ .@"enum" => {
const enum_ty = Type.fromInterned(lazy_sym.ty);
wip_mir_log.debug("{}.@tagName:", .{enum_ty.fmt(pt)});
@@ -1945,7 +1945,7 @@ fn memSize(func: *Func, ty: Type) Memory.Size {
const pt = func.pt;
const zcu = pt.zcu;
return switch (ty.zigTypeTag(zcu)) {
- .Float => Memory.Size.fromBitSize(ty.floatBits(func.target.*)),
+ .float => Memory.Size.fromBitSize(ty.floatBits(func.target.*)),
else => Memory.Size.fromByteSize(ty.abiSize(zcu)),
};
}
@@ -2094,24 +2094,24 @@ fn typeRegClass(func: *Func, ty: Type) abi.RegisterClass {
const pt = func.pt;
const zcu = pt.zcu;
return switch (ty.zigTypeTag(zcu)) {
- .Float => .float,
- .Vector => .vector,
+ .float => .float,
+ .vector => .vector,
else => .int,
};
}
fn regGeneralClassForType(func: *Func, ty: Type) RegisterManager.RegisterBitSet {
return switch (ty.zigTypeTag(func.pt.zcu)) {
- .Float => abi.Registers.Float.general_purpose,
- .Vector => abi.Registers.Vector.general_purpose,
+ .float => abi.Registers.Float.general_purpose,
+ .vector => abi.Registers.Vector.general_purpose,
else => abi.Registers.Integer.general_purpose,
};
}
fn regTempClassForType(func: *Func, ty: Type) RegisterManager.RegisterBitSet {
return switch (ty.zigTypeTag(func.pt.zcu)) {
- .Float => abi.Registers.Float.temporary,
- .Vector => abi.Registers.Vector.general_purpose, // there are no temporary vector registers
+ .float => abi.Registers.Float.temporary,
+ .vector => abi.Registers.Vector.general_purpose, // there are no temporary vector registers
else => abi.Registers.Integer.temporary,
};
}
@@ -2122,8 +2122,8 @@ fn allocRegOrMem(func: *Func, elem_ty: Type, inst: ?Air.Inst.Index, reg_ok: bool
const bit_size = elem_ty.bitSize(zcu);
const min_size: u64 = switch (elem_ty.zigTypeTag(zcu)) {
- .Float => if (func.hasFeature(.d)) 64 else 32,
- .Vector => 256, // TODO: calculate it from avl * vsew
+ .float => if (func.hasFeature(.d)) 64 else 32,
+ .vector => 256, // TODO: calculate it from avl * vsew
else => 64,
};
@@ -2131,7 +2131,7 @@ fn allocRegOrMem(func: *Func, elem_ty: Type, inst: ?Air.Inst.Index, reg_ok: bool
if (func.register_manager.tryAllocReg(inst, func.regGeneralClassForType(elem_ty))) |reg| {
return .{ .register = reg };
}
- } else if (reg_ok and elem_ty.zigTypeTag(zcu) == .Vector) {
+ } else if (reg_ok and elem_ty.zigTypeTag(zcu) == .vector) {
return func.fail("did you forget to extend vector registers before allocating", .{});
}
@@ -2358,7 +2358,7 @@ fn airNot(func: *Func, inst: Air.Inst.Index) !void {
(try func.allocRegOrMem(func.typeOfIndex(inst), inst, true)).register;
switch (ty.zigTypeTag(zcu)) {
- .Bool => {
+ .bool => {
_ = try func.addInst(.{
.tag = .pseudo_not,
.data = .{
@@ -2369,7 +2369,7 @@ fn airNot(func: *Func, inst: Air.Inst.Index) !void {
},
});
},
- .Int => {
+ .int => {
const size = ty.bitSize(zcu);
if (!math.isPowerOfTwo(size))
return func.fail("TODO: airNot non-pow 2 int size", .{});
@@ -2485,7 +2485,7 @@ fn binOp(
// don't have support for certain sizes of addition
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => {}, // works differently and fails in a different place
+ .vector => {}, // works differently and fails in a different place
else => if (lhs_ty.bitSize(zcu) > 64) return func.fail("TODO: binOp >= 64 bits", .{}),
}
@@ -2578,7 +2578,7 @@ fn genBinOp(
}
switch (lhs_ty.zigTypeTag(zcu)) {
- .Int => {
+ .int => {
const mnem: Mnemonic = switch (tag) {
.add, .add_wrap => switch (bit_size) {
8, 16, 64 => .add,
@@ -2617,7 +2617,7 @@ fn genBinOp(
},
});
},
- .Float => {
+ .float => {
const mir_tag: Mnemonic = switch (tag) {
.add => switch (bit_size) {
32 => .fadds,
@@ -2648,7 +2648,7 @@ fn genBinOp(
},
});
},
- .Vector => {
+ .vector => {
const num_elem = lhs_ty.vectorLen(zcu);
const elem_size = lhs_ty.childType(zcu).bitSize(zcu);
@@ -2656,18 +2656,18 @@ fn genBinOp(
const mir_tag: Mnemonic = switch (tag) {
.add => switch (child_ty.zigTypeTag(zcu)) {
- .Int => .vaddvv,
- .Float => .vfaddvv,
+ .int => .vaddvv,
+ .float => .vfaddvv,
else => unreachable,
},
.sub => switch (child_ty.zigTypeTag(zcu)) {
- .Int => .vsubvv,
- .Float => .vfsubvv,
+ .int => .vsubvv,
+ .float => .vfsubvv,
else => unreachable,
},
.mul => switch (child_ty.zigTypeTag(zcu)) {
- .Int => .vmulvv,
- .Float => .vfmulvv,
+ .int => .vmulvv,
+ .float => .vfmulvv,
else => unreachable,
},
else => return func.fail("TODO: genBinOp {s} Vector", .{@tagName(tag)}),
@@ -2905,7 +2905,7 @@ fn genBinOp(
// s0 was 0, leaving a2 unchanged as a0.
.min, .max => {
switch (lhs_ty.zigTypeTag(zcu)) {
- .Int => {
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
const mask_reg, const mask_lock = try func.allocReg(.int);
@@ -2981,8 +2981,8 @@ fn airAddWithOverflow(func: *Func, inst: Air.Inst.Index) !void {
const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else result: {
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return func.fail("TODO implement add with overflow for Vector type", .{}),
- .Int => {
+ .vector => return func.fail("TODO implement add with overflow for Vector type", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
const tuple_ty = func.typeOfIndex(inst);
@@ -3263,7 +3263,7 @@ fn airMulWithOverflow(func: *Func, inst: Air.Inst.Index) !void {
switch (lhs_ty.zigTypeTag(zcu)) {
else => |x| return func.fail("TODO: airMulWithOverflow {s}", .{@tagName(x)}),
- .Int => {
+ .int => {
if (std.debug.runtime_safety) assert(lhs_ty.eql(rhs_ty, zcu));
const trunc_reg = try func.copyToTmpRegister(lhs_ty, .{ .register = dest_reg });
@@ -4129,7 +4129,7 @@ fn airAbs(func: *Func, inst: Air.Inst.Index) !void {
const operand = try func.resolveInst(ty_op.operand);
switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => if (ty.zigTypeTag(zcu) == .Vector) {
+ .int => if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO implement airAbs for {}", .{ty.fmt(pt)});
} else {
const int_info = scalar_ty.intInfo(zcu);
@@ -4182,7 +4182,7 @@ fn airAbs(func: *Func, inst: Air.Inst.Index) !void {
break :result return_mcv;
},
- .Float => {
+ .float => {
const float_bits = scalar_ty.floatBits(zcu.getTarget());
const mnem: Mnemonic = switch (float_bits) {
16 => return func.fail("TODO: airAbs 16-bit float", .{}),
@@ -4228,7 +4228,7 @@ fn airByteSwap(func: *Func, inst: Air.Inst.Index) !void {
const operand = try func.resolveInst(ty_op.operand);
switch (ty.zigTypeTag(zcu)) {
- .Int => {
+ .int => {
const int_bits = ty.intInfo(zcu).bits;
// bytes are no-op
@@ -4308,7 +4308,7 @@ fn airUnaryMath(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
defer func.register_manager.unlockReg(dst_lock);
switch (ty.zigTypeTag(zcu)) {
- .Float => {
+ .float => {
assert(dst_class == .float);
switch (operand_bit_size) {
@@ -4334,7 +4334,7 @@ fn airUnaryMath(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
else => return func.fail("TODO: airUnaryMath Float {s}", .{@tagName(tag)}),
}
},
- .Int => {
+ .int => {
assert(dst_class == .int);
switch (tag) {
@@ -4824,8 +4824,8 @@ fn genCall(
.air => |callee| fn_info: {
const callee_ty = func.typeOf(callee);
break :fn_info switch (callee_ty.zigTypeTag(zcu)) {
- .Fn => callee_ty,
- .Pointer => callee_ty.childType(zcu),
+ .@"fn" => callee_ty,
+ .pointer => callee_ty.childType(zcu),
else => unreachable,
};
},
@@ -4977,7 +4977,7 @@ fn genCall(
else => return func.fail("TODO implement calling bitcasted functions", .{}),
}
} else {
- assert(func.typeOf(callee).zigTypeTag(zcu) == .Pointer);
+ assert(func.typeOf(callee).zigTypeTag(zcu) == .pointer);
const addr_reg, const addr_lock = try func.allocReg(.int);
defer func.register_manager.unlockReg(addr_lock);
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 {
const lhs_ty = func.typeOf(bin_op.lhs);
switch (lhs_ty.zigTypeTag(zcu)) {
- .Int,
- .Enum,
- .Bool,
- .Pointer,
- .ErrorSet,
- .Optional,
+ .int,
+ .@"enum",
+ .bool,
+ .pointer,
+ .error_set,
+ .optional,
=> {
const int_ty = switch (lhs_ty.zigTypeTag(zcu)) {
- .Enum => lhs_ty.intTagType(zcu),
- .Int => lhs_ty,
- .Bool => Type.u1,
- .Pointer => Type.u64,
- .ErrorSet => Type.anyerror,
- .Optional => blk: {
+ .@"enum" => lhs_ty.intTagType(zcu),
+ .int => lhs_ty,
+ .bool => Type.u1,
+ .pointer => Type.u64,
+ .error_set => Type.anyerror,
+ .optional => blk: {
const payload_ty = lhs_ty.optionalChild(zcu);
if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
break :blk Type.u1;
@@ -5138,7 +5138,7 @@ fn airCmp(func: *Func, inst: Air.Inst.Index, tag: Air.Inst.Tag) !void {
return func.fail("TODO riscv cmp for ints > 64 bits", .{});
}
},
- .Float => {
+ .float => {
const float_bits = lhs_ty.floatBits(func.target.*);
const float_reg_size: u32 = if (func.hasFeature(.d)) 64 else 32;
if (float_bits > float_reg_size) {
@@ -7456,8 +7456,8 @@ fn airAtomicRmw(func: *Func, inst: Air.Inst.Index) !void {
return func.fail("TODO: airAtomicRmw non-pow 2", .{});
switch (val_ty.zigTypeTag(pt.zcu)) {
- .Enum, .Int => {},
- inline .Bool, .Float, .Pointer => |ty| return func.fail("TODO: airAtomicRmw {s}", .{@tagName(ty)}),
+ .@"enum", .int => {},
+ inline .bool, .float, .pointer => |ty| return func.fail("TODO: airAtomicRmw {s}", .{@tagName(ty)}),
else => unreachable,
}
@@ -7861,7 +7861,7 @@ fn airAggregateInit(func: *Func, inst: Air.Inst.Index) !void {
const result: MCValue = result: {
switch (result_ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
const frame_index = try func.allocFrameIndex(FrameAlloc.initSpill(result_ty, zcu));
if (result_ty.containerLayout(zcu) == .@"packed") {
const struct_obj = zcu.typeToStruct(result_ty).?;
@@ -7916,7 +7916,7 @@ fn airAggregateInit(func: *Func, inst: Air.Inst.Index) !void {
}
break :result .{ .load_frame = .{ .index = frame_index } };
},
- .Array => {
+ .array => {
const elem_ty = result_ty.childType(zcu);
const frame_index = try func.allocFrameIndex(FrameAlloc.initSpill(result_ty, zcu));
const elem_size: u32 = @intCast(elem_ty.abiSize(zcu));
@@ -8099,7 +8099,7 @@ fn resolveCallingConventionValues(
result.stack_align = .@"16";
// Return values
- if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (ret_ty.zigTypeTag(zcu) == .noreturn) {
result.return_value = InstTracking.init(.unreach);
} else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
result.return_value = InstTracking.init(.none);
diff --git a/src/arch/riscv64/abi.zig b/src/arch/riscv64/abi.zig
index 5e8f57cc0b82..3ce63130834d 100644
--- a/src/arch/riscv64/abi.zig
+++ b/src/arch/riscv64/abi.zig
@@ -15,7 +15,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
const max_byval_size = target.ptrBitWidth() * 2;
switch (ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
const bit_size = ty.bitSize(zcu);
if (ty.containerLayout(zcu) == .@"packed") {
if (bit_size > max_byval_size) return .memory;
@@ -44,7 +44,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
if (bit_size > max_byval_size / 2) return .double_integer;
return .integer;
},
- .Union => {
+ .@"union" => {
const bit_size = ty.bitSize(zcu);
if (ty.containerLayout(zcu) == .@"packed") {
if (bit_size > max_byval_size) return .memory;
@@ -55,40 +55,40 @@ pub fn classifyType(ty: Type, zcu: *Zcu) Class {
if (bit_size > max_byval_size / 2) return .double_integer;
return .integer;
},
- .Bool => return .integer,
- .Float => return .byval,
- .Int, .Enum, .ErrorSet => {
+ .bool => return .integer,
+ .float => return .byval,
+ .int, .@"enum", .error_set => {
const bit_size = ty.bitSize(zcu);
if (bit_size > max_byval_size) return .memory;
return .byval;
},
- .Vector => {
+ .vector => {
const bit_size = ty.bitSize(zcu);
if (bit_size > max_byval_size) return .memory;
return .integer;
},
- .Optional => {
+ .optional => {
std.debug.assert(ty.isPtrLikeOptional(zcu));
return .byval;
},
- .Pointer => {
+ .pointer => {
std.debug.assert(!ty.isSlice(zcu));
return .byval;
},
- .ErrorUnion,
- .Frame,
- .AnyFrame,
- .NoReturn,
- .Void,
- .Type,
- .ComptimeFloat,
- .ComptimeInt,
- .Undefined,
- .Null,
- .Fn,
- .Opaque,
- .EnumLiteral,
- .Array,
+ .error_union,
+ .frame,
+ .@"anyframe",
+ .noreturn,
+ .void,
+ .type,
+ .comptime_float,
+ .comptime_int,
+ .undefined,
+ .null,
+ .@"fn",
+ .@"opaque",
+ .enum_literal,
+ .array,
=> unreachable,
}
}
@@ -104,11 +104,11 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
.none, .none, .none, .none,
};
switch (ty.zigTypeTag(zcu)) {
- .Bool, .Void, .NoReturn => {
+ .bool, .void, .noreturn => {
result[0] = .integer;
return result;
},
- .Pointer => switch (ty.ptrSize(zcu)) {
+ .pointer => switch (ty.ptrSize(zcu)) {
.Slice => {
result[0] = .integer;
result[1] = .integer;
@@ -119,14 +119,14 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
return result;
},
},
- .Optional => {
+ .optional => {
if (ty.isPtrLikeOptional(zcu)) {
result[0] = .integer;
return result;
}
return memory_class;
},
- .Int, .Enum, .ErrorSet => {
+ .int, .@"enum", .error_set => {
const int_bits = ty.intInfo(zcu).bits;
if (int_bits <= 64) {
result[0] = .integer;
@@ -139,7 +139,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
}
unreachable; // support > 128 bit int arguments
},
- .Float => {
+ .float => {
const target = zcu.getTarget();
const features = target.cpu.features;
@@ -151,7 +151,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
}
unreachable; // support split float args
},
- .ErrorUnion => {
+ .error_union => {
const payload_ty = ty.errorUnionPayload(zcu);
const payload_bits = payload_ty.bitSize(zcu);
@@ -163,7 +163,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
return memory_class;
},
- .Struct, .Union => {
+ .@"struct", .@"union" => {
const layout = ty.containerLayout(zcu);
const ty_size = ty.abiSize(zcu);
@@ -176,7 +176,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
return memory_class;
},
- .Array => {
+ .array => {
const ty_size = ty.abiSize(zcu);
if (ty_size <= 8) {
result[0] = .integer;
@@ -189,7 +189,7 @@ pub fn classifySystem(ty: Type, zcu: *Zcu) [8]SystemClass {
}
return memory_class;
},
- .Vector => {
+ .vector => {
// we pass vectors through integer registers if they are small enough to fit.
const vec_bits = ty.totalVectorBits(zcu);
if (vec_bits <= 64) {
diff --git a/src/arch/riscv64/bits.zig b/src/arch/riscv64/bits.zig
index 9899345c0a21..5427a87e0104 100644
--- a/src/arch/riscv64/bits.zig
+++ b/src/arch/riscv64/bits.zig
@@ -115,7 +115,7 @@ pub const Immediate = union(enum) {
}
pub fn asBits(imm: Immediate, comptime T: type) T {
- const int_info = @typeInfo(T).Int;
+ const int_info = @typeInfo(T).int;
if (int_info.signedness != .unsigned) @compileError("Immediate.asBits needs unsigned T");
return switch (imm) {
.signed => |x| @bitCast(@as(std.meta.Int(.signed, int_info.bits), @intCast(x))),
@@ -189,7 +189,7 @@ pub const Register = enum(u8) {
/// The goal of this function is to return the same ID for `zero` and `x0` but two
/// seperate IDs for `x0` and `f0`. We will assume that each register set has 32 registers
/// and is repeated twice, once for the named version, once for the number version.
- pub fn id(reg: Register) std.math.IntFittingRange(0, @typeInfo(Register).Enum.fields.len) {
+ pub fn id(reg: Register) std.math.IntFittingRange(0, @typeInfo(Register).@"enum".fields.len) {
const base = switch (@intFromEnum(reg)) {
// zig fmt: off
@intFromEnum(Register.zero) ... @intFromEnum(Register.x31) => @intFromEnum(Register.zero),
@@ -252,7 +252,7 @@ pub const FrameIndex = enum(u32) {
/// Other indices are used for local variable stack slots
_,
- pub const named_count = @typeInfo(FrameIndex).Enum.fields.len;
+ pub const named_count = @typeInfo(FrameIndex).@"enum".fields.len;
pub fn isNamed(fi: FrameIndex) bool {
return @intFromEnum(fi) < named_count;
diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig
index e6c5a6d2176a..2cb07fb25f57 100644
--- a/src/arch/sparc64/CodeGen.zig
+++ b/src/arch/sparc64/CodeGen.zig
@@ -770,8 +770,8 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
const rhs_ty = self.typeOf(extra.rhs);
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement add_with_overflow/sub_with_overflow for vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
switch (int_info.bits) {
@@ -1231,8 +1231,8 @@ fn airByteSwap(self: *Self, inst: Air.Inst.Index) !void {
const operand = try self.resolveInst(ty_op.operand);
const operand_ty = self.typeOf(ty_op.operand);
switch (operand_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO byteswap for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO byteswap for vectors", .{}),
+ .int => {
const int_info = operand_ty.intInfo(zcu);
if (int_info.bits == 8) break :result operand;
@@ -1310,8 +1310,8 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
const fn_ty = switch (ty.zigTypeTag(zcu)) {
- .Fn => ty,
- .Pointer => ty.childType(zcu),
+ .@"fn" => ty,
+ .pointer => ty.childType(zcu),
else => unreachable,
};
@@ -1363,7 +1363,7 @@ fn airCall(self: *Self, inst: Air.Inst.Index, modifier: std.builtin.CallModifier
return self.fail("TODO implement calling bitcasted functions", .{});
},
} else {
- assert(ty.zigTypeTag(zcu) == .Pointer);
+ assert(ty.zigTypeTag(zcu) == .pointer);
const mcv = try self.resolveInst(callee);
try self.genSetReg(ty, .o7, mcv);
@@ -1419,13 +1419,13 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
const lhs_ty = self.typeOf(bin_op.lhs);
const int_ty = switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => unreachable, // Handled by cmp_vector.
- .Enum => lhs_ty.intTagType(zcu),
- .Int => lhs_ty,
- .Bool => Type.u1,
- .Pointer => Type.usize,
- .ErrorSet => Type.u16,
- .Optional => blk: {
+ .vector => unreachable, // Handled by cmp_vector.
+ .@"enum" => lhs_ty.intTagType(zcu),
+ .int => lhs_ty,
+ .bool => Type.u1,
+ .pointer => Type.usize,
+ .error_set => Type.u16,
+ .optional => blk: {
const payload_ty = lhs_ty.optionalChild(zcu);
if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
break :blk Type.u1;
@@ -1435,7 +1435,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
return self.fail("TODO SPARCv9 cmp non-pointer optionals", .{});
}
},
- .Float => return self.fail("TODO SPARCv9 cmp floats", .{}),
+ .float => return self.fail("TODO SPARCv9 cmp floats", .{}),
else => unreachable,
};
@@ -2031,8 +2031,8 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
const rhs_ty = self.typeOf(extra.rhs);
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
switch (int_info.bits) {
@@ -2105,7 +2105,7 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
},
else => {
switch (operand_ty.zigTypeTag(zcu)) {
- .Bool => {
+ .bool => {
const op_reg = switch (operand) {
.register => |r| r,
else => try self.copyToTmpRegister(operand_ty, operand),
@@ -2136,8 +2136,8 @@ fn airNot(self: *Self, inst: Air.Inst.Index) !void {
break :result MCValue{ .register = dest_reg };
},
- .Vector => return self.fail("TODO bitwise not for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO bitwise not for vectors", .{}),
+ .int => {
const int_info = operand_ty.intInfo(zcu);
if (int_info.bits <= 64) {
const op_reg = switch (operand) {
@@ -2329,8 +2329,8 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
const rhs_ty = self.typeOf(extra.rhs);
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement mul_with_overflow for vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
try self.spillConditionFlagsIfOccupied();
@@ -2858,9 +2858,9 @@ fn binOp(
.cmp_eq,
=> {
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO binary operations on floats", .{}),
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO binary operations on floats", .{}),
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
@@ -2932,8 +2932,8 @@ fn binOp(
// Truncate if necessary
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
const result_reg = result.register;
@@ -2949,8 +2949,8 @@ fn binOp(
.div_trunc => {
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
assert(lhs_ty.eql(rhs_ty, zcu));
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
@@ -2982,7 +2982,7 @@ fn binOp(
.ptr_add => {
switch (lhs_ty.zigTypeTag(zcu)) {
- .Pointer => {
+ .pointer => {
const ptr_ty = lhs_ty;
const elem_ty = switch (ptr_ty.ptrSize(zcu)) {
.One => ptr_ty.childType(zcu).childType(zcu), // ptr to array, so get array element type
@@ -3014,7 +3014,7 @@ fn binOp(
.bool_or,
=> {
switch (lhs_ty.zigTypeTag(zcu)) {
- .Bool => {
+ .bool => {
assert(lhs != .immediate); // should have been handled by Sema
assert(rhs != .immediate); // should have been handled by Sema
@@ -3044,8 +3044,8 @@ fn binOp(
// Truncate if necessary
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
// 32 and 64 bit operands doesn't need truncating
@@ -3066,8 +3066,8 @@ fn binOp(
.shr_exact,
=> {
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO binary operations on vectors", .{}),
- .Int => {
+ .vector => return self.fail("TODO binary operations on vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
const rhs_immediate_ok = rhs == .immediate;
@@ -4329,9 +4329,9 @@ fn minMax(
const zcu = pt.zcu;
assert(lhs_ty.eql(rhs_ty, zcu));
switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => return self.fail("TODO min/max on floats", .{}),
- .Vector => return self.fail("TODO min/max on vectors", .{}),
- .Int => {
+ .float => return self.fail("TODO min/max on floats", .{}),
+ .vector => return self.fail("TODO min/max on vectors", .{}),
+ .int => {
const int_info = lhs_ty.intInfo(zcu);
if (int_info.bits <= 64) {
// TODO skip register setting when one of the operands
@@ -4515,7 +4515,7 @@ fn resolveCallingConventionValues(self: *Self, fn_ty: Type, role: RegisterView)
result.stack_byte_count = next_stack_offset;
result.stack_align = .@"16";
- if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (ret_ty.zigTypeTag(zcu) == .noreturn) {
result.return_value = .{ .unreach = {} };
} else if (!ret_ty.hasRuntimeBits(zcu)) {
result.return_value = .{ .none = {} };
diff --git a/src/arch/wasm/CodeGen.zig b/src/arch/wasm/CodeGen.zig
index 7627d3b2777c..a3a51c72334f 100644
--- a/src/arch/wasm/CodeGen.zig
+++ b/src/arch/wasm/CodeGen.zig
@@ -1004,19 +1004,19 @@ fn typeToValtype(ty: Type, pt: Zcu.PerThread, target: std.Target) wasm.Valtype {
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
return switch (ty.zigTypeTag(zcu)) {
- .Float => switch (ty.floatBits(target)) {
+ .float => switch (ty.floatBits(target)) {
16 => .i32, // stored/loaded as u16
32 => .f32,
64 => .f64,
80, 128 => .i32,
else => unreachable,
},
- .Int, .Enum => switch (ty.intInfo(zcu).bits) {
+ .int, .@"enum" => switch (ty.intInfo(zcu).bits) {
0...32 => .i32,
33...64 => .i64,
else => .i32,
},
- .Struct => blk: {
+ .@"struct" => blk: {
if (zcu.typeToPackedStruct(ty)) |packed_struct| {
const backing_int_ty = Type.fromInterned(packed_struct.backingIntTypeUnordered(ip));
break :blk typeToValtype(backing_int_ty, pt, target);
@@ -1024,11 +1024,11 @@ fn typeToValtype(ty: Type, pt: Zcu.PerThread, target: std.Target) wasm.Valtype {
break :blk .i32;
}
},
- .Vector => switch (determineSimdStoreStrategy(ty, zcu, target)) {
+ .vector => switch (determineSimdStoreStrategy(ty, zcu, target)) {
.direct => .v128,
.unrolled => .i32,
},
- .Union => switch (ty.containerLayout(zcu)) {
+ .@"union" => switch (ty.containerLayout(zcu)) {
.@"packed" => blk: {
const int_ty = pt.intType(.unsigned, @as(u16, @intCast(ty.bitSize(zcu)))) catch @panic("out of memory");
break :blk typeToValtype(int_ty, pt, target);
@@ -1430,7 +1430,7 @@ fn lowerArg(func: *CodeGen, cc: std.builtin.CallingConvention, ty: Type, value:
const ty_classes = abi.classifyType(ty, zcu);
assert(ty_classes[0] != .none);
switch (ty.zigTypeTag(zcu)) {
- .Struct, .Union => {
+ .@"struct", .@"union" => {
if (ty_classes[0] == .indirect) {
return func.lowerToStack(value);
}
@@ -1445,7 +1445,7 @@ fn lowerArg(func: *CodeGen, cc: std.builtin.CallingConvention, ty: Type, value:
else => try func.emitWValue(value),
}
},
- .Int, .Float => {
+ .int, .float => {
if (ty_classes[1] == .none) {
return func.lowerToStack(value);
}
@@ -1719,27 +1719,27 @@ fn isByRef(ty: Type, pt: Zcu.PerThread, target: std.Target) bool {
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
switch (ty.zigTypeTag(zcu)) {
- .Type,
- .ComptimeInt,
- .ComptimeFloat,
- .EnumLiteral,
- .Undefined,
- .Null,
- .Opaque,
+ .type,
+ .comptime_int,
+ .comptime_float,
+ .enum_literal,
+ .undefined,
+ .null,
+ .@"opaque",
=> unreachable,
- .NoReturn,
- .Void,
- .Bool,
- .ErrorSet,
- .Fn,
- .AnyFrame,
+ .noreturn,
+ .void,
+ .bool,
+ .error_set,
+ .@"fn",
+ .@"anyframe",
=> return false,
- .Array,
- .Frame,
+ .array,
+ .frame,
=> return ty.hasRuntimeBitsIgnoreComptime(zcu),
- .Union => {
+ .@"union" => {
if (zcu.typeToUnion(ty)) |union_obj| {
if (union_obj.flagsUnordered(ip).layout == .@"packed") {
return ty.abiSize(zcu) > 8;
@@ -1747,30 +1747,30 @@ fn isByRef(ty: Type, pt: Zcu.PerThread, target: std.Target) bool {
}
return ty.hasRuntimeBitsIgnoreComptime(zcu);
},
- .Struct => {
+ .@"struct" => {
if (zcu.typeToPackedStruct(ty)) |packed_struct| {
return isByRef(Type.fromInterned(packed_struct.backingIntTypeUnordered(ip)), pt, target);
}
return ty.hasRuntimeBitsIgnoreComptime(zcu);
},
- .Vector => return determineSimdStoreStrategy(ty, zcu, target) == .unrolled,
- .Int => return ty.intInfo(zcu).bits > 64,
- .Enum => return ty.intInfo(zcu).bits > 64,
- .Float => return ty.floatBits(target) > 64,
- .ErrorUnion => {
+ .vector => return determineSimdStoreStrategy(ty, zcu, target) == .unrolled,
+ .int => return ty.intInfo(zcu).bits > 64,
+ .@"enum" => return ty.intInfo(zcu).bits > 64,
+ .float => return ty.floatBits(target) > 64,
+ .error_union => {
const pl_ty = ty.errorUnionPayload(zcu);
if (!pl_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
return false;
}
return true;
},
- .Optional => {
+ .optional => {
if (ty.isPtrLikeOptional(zcu)) return false;
const pl_type = ty.optionalChild(zcu);
- if (pl_type.zigTypeTag(zcu) == .ErrorSet) return false;
+ if (pl_type.zigTypeTag(zcu) == .error_set) return false;
return pl_type.hasRuntimeBitsIgnoreComptime(zcu);
},
- .Pointer => {
+ .pointer => {
// Slices act like struct and will be passed by reference
if (ty.isSlice(zcu)) return true;
return false;
@@ -1788,7 +1788,7 @@ const SimdStoreStrategy = enum {
/// features are enabled, the function will return `.direct`. This would allow to store
/// it using a instruction, rather than an unrolled version.
fn determineSimdStoreStrategy(ty: Type, zcu: *Zcu, target: std.Target) SimdStoreStrategy {
- std.debug.assert(ty.zigTypeTag(zcu) == .Vector);
+ std.debug.assert(ty.zigTypeTag(zcu) == .vector);
if (ty.bitSize(zcu) != 128) return .unrolled;
const hasFeature = std.Target.wasm.featureSetHas;
const features = target.cpu.features;
@@ -2106,7 +2106,7 @@ fn airRet(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
} else if (fn_info.cc == .C and ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
switch (ret_ty.zigTypeTag(zcu)) {
// Aggregate types can be lowered as a singular value
- .Struct, .Union => {
+ .@"struct", .@"union" => {
const scalar_type = abi.scalarType(ret_ty, zcu);
try func.emitWValue(operand);
const opcode = buildOpcode(.{
@@ -2189,8 +2189,8 @@ fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
const fn_ty = switch (ty.zigTypeTag(zcu)) {
- .Fn => ty,
- .Pointer => ty.childType(zcu),
+ .@"fn" => ty,
+ .pointer => ty.childType(zcu),
else => unreachable,
};
const ret_ty = fn_ty.fnReturnType(zcu);
@@ -2261,7 +2261,7 @@ fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif
} else {
// in this case we call a function pointer
// so load its value onto the stack
- std.debug.assert(ty.zigTypeTag(zcu) == .Pointer);
+ std.debug.assert(ty.zigTypeTag(zcu) == .pointer);
const operand = try func.resolveInst(pl_op.operand);
try func.emitWValue(operand);
@@ -2281,7 +2281,7 @@ fn airCall(func: *CodeGen, inst: Air.Inst.Index, modifier: std.builtin.CallModif
} else if (first_param_sret) {
break :result_value sret;
// TODO: Make this less fragile and optimize
- } else if (zcu.typeToFunc(fn_ty).?.cc == .C and ret_ty.zigTypeTag(zcu) == .Struct or ret_ty.zigTypeTag(zcu) == .Union) {
+ } else if (zcu.typeToFunc(fn_ty).?.cc == .C and ret_ty.zigTypeTag(zcu) == .@"struct" or ret_ty.zigTypeTag(zcu) == .@"union") {
const result_local = try func.allocLocal(ret_ty);
try func.addLabel(.local_set, result_local.local.value);
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
const zcu = pt.zcu;
const abi_size = ty.abiSize(zcu);
switch (ty.zigTypeTag(zcu)) {
- .ErrorUnion => {
+ .error_union => {
const pl_ty = ty.errorUnionPayload(zcu);
if (!pl_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
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
const len = @as(u32, @intCast(abi_size));
return func.memcpy(lhs, rhs, .{ .imm32 = len });
},
- .Optional => {
+ .optional => {
if (ty.isPtrLikeOptional(zcu)) {
return func.store(lhs, rhs, Type.usize, 0);
}
@@ -2388,18 +2388,18 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE
if (!pl_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
return func.store(lhs, rhs, Type.u8, 0);
}
- if (pl_ty.zigTypeTag(zcu) == .ErrorSet) {
+ if (pl_ty.zigTypeTag(zcu) == .error_set) {
return func.store(lhs, rhs, Type.anyerror, 0);
}
const len = @as(u32, @intCast(abi_size));
return func.memcpy(lhs, rhs, .{ .imm32 = len });
},
- .Struct, .Array, .Union => if (isByRef(ty, pt, func.target.*)) {
+ .@"struct", .array, .@"union" => if (isByRef(ty, pt, func.target.*)) {
const len = @as(u32, @intCast(abi_size));
return func.memcpy(lhs, rhs, .{ .imm32 = len });
},
- .Vector => switch (determineSimdStoreStrategy(ty, zcu, func.target.*)) {
+ .vector => switch (determineSimdStoreStrategy(ty, zcu, func.target.*)) {
.unrolled => {
const len: u32 = @intCast(abi_size);
return func.memcpy(lhs, rhs, .{ .imm32 = len });
@@ -2418,7 +2418,7 @@ fn store(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, offset: u32) InnerE
return func.addInst(.{ .tag = .simd_prefix, .data = .{ .payload = extra_index } });
},
},
- .Pointer => {
+ .pointer => {
if (ty.isSlice(zcu)) {
// store pointer first
// 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
return;
}
},
- .Int, .Enum, .Float => if (abi_size > 8 and abi_size <= 16) {
+ .int, .@"enum", .float => if (abi_size > 8 and abi_size <= 16) {
try func.emitWValue(lhs);
const lsb = try func.load(rhs, Type.u64, 0);
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
// load local's value from memory by its stack position
try func.emitWValue(operand);
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
// TODO: Add helper functions for simd opcodes
const extra_index = @as(u32, @intCast(func.mir_extra.items.len));
// stores as := opcode, offset, alignment (opcode::memarg)
@@ -2571,7 +2571,7 @@ fn airArg(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
// When we have an argument that's passed using more than a single parameter,
// we combine them into a single stack value
if (arg_classes[0] == .direct and arg_classes[1] == .direct) {
- if (arg_ty.zigTypeTag(zcu) != .Int and arg_ty.zigTypeTag(zcu) != .Float) {
+ if (arg_ty.zigTypeTag(zcu) != .int and arg_ty.zigTypeTag(zcu) != .float) {
return func.fail(
"TODO: Implement C-ABI argument for type '{}'",
.{arg_ty.fmt(pt)},
@@ -2647,7 +2647,7 @@ fn binOp(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: Op) InnerError!
}
if (isByRef(ty, pt, func.target.*)) {
- if (ty.zigTypeTag(zcu) == .Int) {
+ if (ty.zigTypeTag(zcu) == .int) {
return func.binOpBigInt(lhs, rhs, ty, op);
} else {
return func.fail(
@@ -2822,7 +2822,7 @@ fn airAbs(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const scalar_ty = ty.scalarType(zcu);
switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => if (ty.zigTypeTag(zcu) == .Vector) {
+ .int => if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO implement airAbs for {}", .{ty.fmt(pt)});
} else {
const int_bits = ty.intInfo(zcu).bits;
@@ -2887,7 +2887,7 @@ fn airAbs(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
else => unreachable,
}
},
- .Float => {
+ .float => {
const result = try func.floatOp(.fabs, ty, &.{operand});
return func.finishAir(inst, result, &.{ty_op.operand});
},
@@ -2907,7 +2907,7 @@ fn airUnaryFloatOp(func: *CodeGen, inst: Air.Inst.Index, op: FloatOp) InnerError
fn floatOp(func: *CodeGen, float_op: FloatOp, ty: Type, args: []const WValue) InnerError!WValue {
const pt = func.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: Implement floatOps for vectors", .{});
}
@@ -3021,7 +3021,7 @@ fn airWrapBinOp(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
const lhs_ty = func.typeOf(bin_op.lhs);
const rhs_ty = func.typeOf(bin_op.rhs);
- if (lhs_ty.zigTypeTag(zcu) == .Vector or rhs_ty.zigTypeTag(zcu) == .Vector) {
+ if (lhs_ty.zigTypeTag(zcu) == .vector or rhs_ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: Implement wrapping arithmetic for vectors", .{});
}
@@ -3139,7 +3139,7 @@ fn lowerPtr(func: *CodeGen, ptr_val: InternPool.Index, prev_offset: u64) InnerEr
const base_ptr = Value.fromInterned(field.base);
const base_ty = base_ptr.typeOf(zcu).childType(zcu);
const field_off: u64 = switch (base_ty.zigTypeTag(zcu)) {
- .Pointer => off: {
+ .pointer => off: {
assert(base_ty.isSlice(zcu));
break :off switch (field.index) {
Value.slice_ptr_index => 0,
@@ -3147,11 +3147,11 @@ fn lowerPtr(func: *CodeGen, ptr_val: InternPool.Index, prev_offset: u64) InnerEr
else => unreachable,
};
},
- .Struct => switch (base_ty.containerLayout(zcu)) {
+ .@"struct" => switch (base_ty.containerLayout(zcu)) {
.auto => base_ty.structFieldOffset(@intCast(field.index), zcu),
.@"extern", .@"packed" => unreachable,
},
- .Union => switch (base_ty.containerLayout(zcu)) {
+ .@"union" => switch (base_ty.containerLayout(zcu)) {
.auto => off: {
// Keep in sync with the `un` case of `generateSymbol`.
const layout = base_ty.unionGetLayout(zcu);
@@ -3184,7 +3184,7 @@ fn lowerUavRef(
const zcu = pt.zcu;
const ty = Type.fromInterned(zcu.intern_pool.typeOf(uav.val));
- const is_fn_body = ty.zigTypeTag(zcu) == .Fn;
+ const is_fn_body = ty.zigTypeTag(zcu) == .@"fn";
if (!is_fn_body and !ty.hasRuntimeBitsIgnoreComptime(zcu)) {
return .{ .imm32 = 0xaaaaaaaa };
}
@@ -3404,34 +3404,34 @@ fn emitUndefined(func: *CodeGen, ty: Type) InnerError!WValue {
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
switch (ty.zigTypeTag(zcu)) {
- .Bool, .ErrorSet => return .{ .imm32 = 0xaaaaaaaa },
- .Int, .Enum => switch (ty.intInfo(zcu).bits) {
+ .bool, .error_set => return .{ .imm32 = 0xaaaaaaaa },
+ .int, .@"enum" => switch (ty.intInfo(zcu).bits) {
0...32 => return .{ .imm32 = 0xaaaaaaaa },
33...64 => return .{ .imm64 = 0xaaaaaaaaaaaaaaaa },
else => unreachable,
},
- .Float => switch (ty.floatBits(func.target.*)) {
+ .float => switch (ty.floatBits(func.target.*)) {
16 => return .{ .imm32 = 0xaaaaaaaa },
32 => return .{ .float32 = @as(f32, @bitCast(@as(u32, 0xaaaaaaaa))) },
64 => return .{ .float64 = @as(f64, @bitCast(@as(u64, 0xaaaaaaaaaaaaaaaa))) },
else => unreachable,
},
- .Pointer => switch (func.arch()) {
+ .pointer => switch (func.arch()) {
.wasm32 => return .{ .imm32 = 0xaaaaaaaa },
.wasm64 => return .{ .imm64 = 0xaaaaaaaaaaaaaaaa },
else => unreachable,
},
- .Optional => {
+ .optional => {
const pl_ty = ty.optionalChild(zcu);
if (ty.optionalReprIsPayload(zcu)) {
return func.emitUndefined(pl_ty);
}
return .{ .imm32 = 0xaaaaaaaa };
},
- .ErrorUnion => {
+ .error_union => {
return .{ .imm32 = 0xaaaaaaaa };
},
- .Struct => {
+ .@"struct" => {
const packed_struct = zcu.typeToPackedStruct(ty).?;
return func.emitUndefined(Type.fromInterned(packed_struct.backingIntTypeUnordered(ip)));
},
@@ -3604,7 +3604,7 @@ fn cmp(func: *CodeGen, lhs: WValue, rhs: WValue, ty: Type, op: std.math.CompareO
assert(!(lhs != .stack and rhs == .stack));
const pt = func.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Optional and !ty.optionalReprIsPayload(zcu)) {
+ if (ty.zigTypeTag(zcu) == .optional and !ty.optionalReprIsPayload(zcu)) {
const payload_ty = ty.optionalChild(zcu);
if (payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
// 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
const signedness: std.builtin.Signedness = blk: {
// by default we tell the operand type is unsigned (i.e. bools and enum values)
- if (ty.zigTypeTag(zcu) != .Int) break :blk .unsigned;
+ if (ty.zigTypeTag(zcu) != .int) break :blk .unsigned;
// incase of an actual integer, we emit the correct signedness
break :blk ty.intInfo(zcu).signedness;
@@ -3743,7 +3743,7 @@ fn airNot(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const zcu = pt.zcu;
const result = result: {
- if (operand_ty.zigTypeTag(zcu) == .Bool) {
+ if (operand_ty.zigTypeTag(zcu) == .bool) {
try func.emitWValue(operand);
try func.addTag(.i32_eqz);
const not_tmp = try func.allocLocal(operand_ty);
@@ -3922,14 +3922,14 @@ fn structFieldPtr(
const offset = switch (struct_ty.containerLayout(zcu)) {
.@"packed" => switch (struct_ty.zigTypeTag(zcu)) {
- .Struct => offset: {
+ .@"struct" => offset: {
if (result_ty.ptrInfo(zcu).packed_offset.host_size != 0) {
break :offset @as(u32, 0);
}
const struct_type = zcu.typeToStruct(struct_ty).?;
break :offset @divExact(pt.structPackedFieldBitOffset(struct_type, index) + struct_ptr_ty_info.packed_offset.bit_offset, 8);
},
- .Union => 0,
+ .@"union" => 0,
else => unreachable,
},
else => struct_ty.structFieldOffset(index, zcu),
@@ -3961,7 +3961,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const result: WValue = switch (struct_ty.containerLayout(zcu)) {
.@"packed" => switch (struct_ty.zigTypeTag(zcu)) {
- .Struct => result: {
+ .@"struct" => result: {
const packed_struct = zcu.typeToPackedStruct(struct_ty).?;
const offset = pt.structPackedFieldBitOffset(packed_struct, field_index);
const backing_ty = Type.fromInterned(packed_struct.backingIntTypeUnordered(ip));
@@ -3981,7 +3981,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
else
try func.binOp(operand, const_wvalue, backing_ty, .shr);
- if (field_ty.zigTypeTag(zcu) == .Float) {
+ if (field_ty.zigTypeTag(zcu) == .float) {
const int_type = try pt.intType(.unsigned, @as(u16, @intCast(field_ty.bitSize(zcu))));
const truncated = try func.trunc(shifted_value, int_type, backing_ty);
break :result try func.bitcast(field_ty, int_type, truncated);
@@ -3995,7 +3995,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
}
break :result try func.trunc(shifted_value, field_ty, backing_ty);
},
- .Union => result: {
+ .@"union" => result: {
if (isByRef(struct_ty, pt, func.target.*)) {
if (!isByRef(field_ty, pt, func.target.*)) {
break :result try func.load(operand, field_ty, 0);
@@ -4007,7 +4007,7 @@ fn airStructFieldVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
}
const union_int_type = try pt.intType(.unsigned, @as(u16, @intCast(struct_ty.bitSize(zcu))));
- if (field_ty.zigTypeTag(zcu) == .Float) {
+ if (field_ty.zigTypeTag(zcu) == .float) {
const int_type = try pt.intType(.unsigned, @as(u16, @intCast(field_ty.bitSize(zcu))));
const truncated = try func.trunc(operand, int_type, union_int_type);
break :result try func.bitcast(field_ty, int_type, truncated);
@@ -4136,7 +4136,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
// for errors that are not present in any branch. This is fine as this default
// case will never be hit for those cases but we do save runtime cost and size
// by using a jump table for this instead of if-else chains.
- break :blk if (has_else_body or target_ty.zigTypeTag(zcu) == .ErrorSet) switch_br.cases_len else unreachable;
+ break :blk if (has_else_body or target_ty.zigTypeTag(zcu) == .error_set) switch_br.cases_len else unreachable;
};
func.mir_extra.appendAssumeCapacity(idx);
} else if (has_else_body) {
@@ -4147,7 +4147,7 @@ fn airSwitchBr(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const signedness: std.builtin.Signedness = blk: {
// by default we tell the operand type is unsigned (i.e. bools and enum values)
- if (target_ty.zigTypeTag(zcu) != .Int) break :blk .unsigned;
+ if (target_ty.zigTypeTag(zcu) != .int) break :blk .unsigned;
// incase of an actual integer, we emit the correct signedness
break :blk target_ty.intInfo(zcu).signedness;
@@ -4364,7 +4364,7 @@ fn airIntcast(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const operand_ty = func.typeOf(ty_op.operand);
const pt = func.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector or operand_ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector or operand_ty.zigTypeTag(zcu) == .vector) {
return func.fail("todo Wasm intcast for vectors", .{});
}
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 {
const pt = func.pt;
const zcu = pt.zcu;
- if (wanted_ty.zigTypeTag(zcu) == .Vector or op_ty.zigTypeTag(zcu) == .Vector) {
+ if (wanted_ty.zigTypeTag(zcu) == .vector or op_ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: trunc for vectors", .{});
}
@@ -4990,7 +4990,7 @@ fn airArrayElemVal(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
try func.addTag(.i32_mul);
try func.addTag(.i32_add);
} else {
- std.debug.assert(array_ty.zigTypeTag(zcu) == .Vector);
+ std.debug.assert(array_ty.zigTypeTag(zcu) == .vector);
switch (index) {
inline .imm32, .imm64 => |lane| {
@@ -5281,7 +5281,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const result: WValue = result_value: {
switch (result_ty.zigTypeTag(zcu)) {
- .Array => {
+ .array => {
const result = try func.allocStack(result_ty);
const elem_ty = result_ty.childType(zcu);
const elem_size = @as(u32, @intCast(elem_ty.abiSize(zcu)));
@@ -5320,7 +5320,7 @@ fn airAggregateInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
}
break :result_value result;
},
- .Struct => switch (result_ty.containerLayout(zcu)) {
+ .@"struct" => switch (result_ty.containerLayout(zcu)) {
.@"packed" => {
if (isByRef(result_ty, pt, func.target.*)) {
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 {
break :result_value result;
},
},
- .Vector => return func.fail("TODO: Wasm backend: implement airAggregateInit for vectors", .{}),
+ .vector => return func.fail("TODO: Wasm backend: implement airAggregateInit for vectors", .{}),
else => unreachable,
}
};
@@ -5458,7 +5458,7 @@ fn airUnionInit(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
} else {
const operand = try func.resolveInst(extra.init);
const union_int_type = try pt.intType(.unsigned, @as(u16, @intCast(union_ty.bitSize(zcu))));
- if (field_ty.zigTypeTag(zcu) == .Float) {
+ if (field_ty.zigTypeTag(zcu) == .float) {
const int_type = try pt.intType(.unsigned, @intCast(field_ty.bitSize(zcu)));
const bitcasted = try func.bitcast(field_ty, int_type, operand);
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 {
const operand = try func.resolveInst(ty_op.operand);
const op_ty = func.typeOf(ty_op.operand);
- if (op_ty.zigTypeTag(zcu) == .Vector) {
+ if (op_ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: Implement @popCount for vectors", .{});
}
@@ -5862,7 +5862,7 @@ fn airBitReverse(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const operand = try func.resolveInst(ty_op.operand);
const ty = func.typeOf(ty_op.operand);
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: Implement @bitReverse for vectors", .{});
}
@@ -6028,7 +6028,7 @@ fn airAddSubWithOverflow(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerErro
const pt = func.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: Implement overflow arithmetic for vectors", .{});
}
@@ -6075,7 +6075,7 @@ fn airShlWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const ty = func.typeOf(extra.lhs);
const rhs_ty = func.typeOf(extra.rhs);
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: Implement overflow arithmetic for vectors", .{});
}
@@ -6121,7 +6121,7 @@ fn airMulWithOverflow(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const pt = func.pt;
const zcu = pt.zcu;
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: Implement overflow arithmetic for vectors", .{});
}
@@ -6251,7 +6251,7 @@ fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
const bin_op = func.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
const ty = func.typeOfIndex(inst);
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: `@maximum` and `@minimum` for vectors", .{});
}
@@ -6262,7 +6262,7 @@ fn airMaxMin(func: *CodeGen, inst: Air.Inst.Index, op: Op) InnerError!void {
const lhs = try func.resolveInst(bin_op.lhs);
const rhs = try func.resolveInst(bin_op.rhs);
- if (ty.zigTypeTag(zcu) == .Float) {
+ if (ty.zigTypeTag(zcu) == .float) {
var fn_name_buf: [64]u8 = undefined;
const float_bits = ty.floatBits(func.target.*);
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 {
const bin_op = func.air.extraData(Air.Bin, pl_op.payload).data;
const ty = func.typeOfIndex(inst);
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: `@mulAdd` for vectors", .{});
}
@@ -6326,7 +6326,7 @@ fn airClz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
const ty = func.typeOf(ty_op.operand);
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: `@clz` for vectors", .{});
}
@@ -6378,7 +6378,7 @@ fn airCtz(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const ty = func.typeOf(ty_op.operand);
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: `@ctz` for vectors", .{});
}
@@ -6571,7 +6571,7 @@ fn airByteSwap(func: *CodeGen, inst: Air.Inst.Index) InnerError!void {
const ty = func.typeOfIndex(inst);
const operand = try func.resolveInst(ty_op.operand);
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
return func.fail("TODO: @byteSwap for vectors", .{});
}
const int_info = ty.intInfo(zcu);
diff --git a/src/arch/wasm/abi.zig b/src/arch/wasm/abi.zig
index b6e66ad85e33..5a1d2fdb0bd0 100644
--- a/src/arch/wasm/abi.zig
+++ b/src/arch/wasm/abi.zig
@@ -27,7 +27,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) [2]Class {
const target = zcu.getTarget();
if (!ty.hasRuntimeBitsIgnoreComptime(zcu)) return none;
switch (ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
const struct_type = zcu.typeToStruct(ty).?;
if (struct_type.layout == .@"packed") {
if (ty.bitSize(zcu) <= 64) return direct;
@@ -45,30 +45,30 @@ pub fn classifyType(ty: Type, zcu: *Zcu) [2]Class {
}
return classifyType(field_ty, zcu);
},
- .Int, .Enum, .ErrorSet => {
+ .int, .@"enum", .error_set => {
const int_bits = ty.intInfo(zcu).bits;
if (int_bits <= 64) return direct;
if (int_bits <= 128) return .{ .direct, .direct };
return memory;
},
- .Float => {
+ .float => {
const float_bits = ty.floatBits(target);
if (float_bits <= 64) return direct;
if (float_bits <= 128) return .{ .direct, .direct };
return memory;
},
- .Bool => return direct,
- .Vector => return direct,
- .Array => return memory,
- .Optional => {
+ .bool => return direct,
+ .vector => return direct,
+ .array => return memory,
+ .optional => {
assert(ty.isPtrLikeOptional(zcu));
return direct;
},
- .Pointer => {
+ .pointer => {
assert(!ty.isSlice(zcu));
return direct;
},
- .Union => {
+ .@"union" => {
const union_obj = zcu.typeToUnion(ty).?;
if (union_obj.flagsUnordered(ip).layout == .@"packed") {
if (ty.bitSize(zcu) <= 64) return direct;
@@ -80,19 +80,19 @@ pub fn classifyType(ty: Type, zcu: *Zcu) [2]Class {
const first_field_ty = Type.fromInterned(union_obj.field_types.get(ip)[0]);
return classifyType(first_field_ty, zcu);
},
- .ErrorUnion,
- .Frame,
- .AnyFrame,
- .NoReturn,
- .Void,
- .Type,
- .ComptimeFloat,
- .ComptimeInt,
- .Undefined,
- .Null,
- .Fn,
- .Opaque,
- .EnumLiteral,
+ .error_union,
+ .frame,
+ .@"anyframe",
+ .noreturn,
+ .void,
+ .type,
+ .comptime_float,
+ .comptime_int,
+ .undefined,
+ .null,
+ .@"fn",
+ .@"opaque",
+ .enum_literal,
=> unreachable,
}
}
@@ -103,7 +103,7 @@ pub fn classifyType(ty: Type, zcu: *Zcu) [2]Class {
pub fn scalarType(ty: Type, zcu: *Zcu) Type {
const ip = &zcu.intern_pool;
switch (ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
if (zcu.typeToPackedStruct(ty)) |packed_struct| {
return scalarType(Type.fromInterned(packed_struct.backingIntTypeUnordered(ip)), zcu);
} else {
@@ -111,7 +111,7 @@ pub fn scalarType(ty: Type, zcu: *Zcu) Type {
return scalarType(ty.fieldType(0, zcu), zcu);
}
},
- .Union => {
+ .@"union" => {
const union_obj = zcu.typeToUnion(ty).?;
if (union_obj.flagsUnordered(ip).layout != .@"packed") {
const layout = Type.getUnionLayout(union_obj, zcu);
diff --git a/src/arch/x86_64/CodeGen.zig b/src/arch/x86_64/CodeGen.zig
index 4385c3328657..adde0b461f1e 100644
--- a/src/arch/x86_64/CodeGen.zig
+++ b/src/arch/x86_64/CodeGen.zig
@@ -2419,7 +2419,7 @@ fn genLazy(self: *Self, lazy_sym: link.File.LazySymbol) InnerError!void {
const zcu = pt.zcu;
const ip = &zcu.intern_pool;
switch (Type.fromInterned(lazy_sym.ty).zigTypeTag(zcu)) {
- .Enum => {
+ .@"enum" => {
const enum_ty = Type.fromInterned(lazy_sym.ty);
wip_mir_log.debug("{}.@tagName:", .{enum_ty.fmt(pt)});
@@ -2704,13 +2704,13 @@ fn allocRegOrMemAdvanced(self: *Self, ty: Type, inst: ?Air.Inst.Index, reg_ok: b
if (reg_ok) need_mem: {
if (abi_size <= @as(u32, switch (ty.zigTypeTag(zcu)) {
- .Float => switch (ty.floatBits(self.target.*)) {
+ .float => switch (ty.floatBits(self.target.*)) {
16, 32, 64, 128 => 16,
80 => break :need_mem,
else => unreachable,
},
- .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
16, 32, 64, 128 => if (self.hasFeature(.avx)) 32 else 16,
80 => break :need_mem,
else => unreachable,
@@ -2733,11 +2733,11 @@ fn regClassForType(self: *Self, ty: Type) RegisterManager.RegisterBitSet {
const pt = self.pt;
const zcu = pt.zcu;
return switch (ty.zigTypeTag(zcu)) {
- .Float => switch (ty.floatBits(self.target.*)) {
+ .float => switch (ty.floatBits(self.target.*)) {
80 => abi.RegisterClass.x87,
else => abi.RegisterClass.sse,
},
- .Vector => switch (ty.childType(zcu).toIntern()) {
+ .vector => switch (ty.childType(zcu).toIntern()) {
.bool_type, .u1_type => abi.RegisterClass.gp,
else => if (ty.isAbiInt(zcu) and ty.intInfo(zcu).bits == 1)
abi.RegisterClass.gp
@@ -2801,14 +2801,14 @@ fn restoreState(self: *Self, state: State, deaths: []const Air.Inst.Index, compt
) |inst, *tracking| tracking.resurrect(inst, state.scope_generation);
for (deaths) |death| try self.processDeath(death);
- const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).Array.len]RegisterLock;
+ const ExpectedContents = [@typeInfo(RegisterManager.TrackedRegisters).array.len]RegisterLock;
var stack align(@max(@alignOf(ExpectedContents), @alignOf(std.heap.StackFallbackAllocator(0)))) =
if (opts.update_tracking)
{} else std.heap.stackFallback(@sizeOf(ExpectedContents), self.gpa);
var reg_locks = if (opts.update_tracking) {} else try std.ArrayList(RegisterLock).initCapacity(
stack.get(),
- @typeInfo(ExpectedContents).Array.len,
+ @typeInfo(ExpectedContents).array.len,
);
defer if (!opts.update_tracking) {
for (reg_locks.items) |lock| self.register_manager.unlockReg(lock);
@@ -3475,8 +3475,8 @@ fn airTrunc(self: *Self, inst: Air.Inst.Index) !void {
break :dst dst_mcv;
};
- if (dst_ty.zigTypeTag(zcu) == .Vector) {
- assert(src_ty.zigTypeTag(zcu) == .Vector and dst_ty.vectorLen(zcu) == src_ty.vectorLen(zcu));
+ if (dst_ty.zigTypeTag(zcu) == .vector) {
+ assert(src_ty.zigTypeTag(zcu) == .vector and dst_ty.vectorLen(zcu) == src_ty.vectorLen(zcu));
const dst_elem_ty = dst_ty.childType(zcu);
const dst_elem_abi_size: u32 = @intCast(dst_elem_ty.abiSize(zcu));
const src_elem_ty = src_ty.childType(zcu);
@@ -3714,7 +3714,7 @@ fn airMulDivBinOp(self: *Self, inst: Air.Inst.Index) !void {
const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
const dst_ty = self.typeOfIndex(inst);
switch (dst_ty.zigTypeTag(zcu)) {
- .Float, .Vector => break :result try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs),
+ .float, .vector => break :result try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs),
else => {},
}
const dst_abi_size: u32 = @intCast(dst_ty.abiSize(zcu));
@@ -3941,7 +3941,7 @@ fn airAddSat(self: *Self, inst: Air.Inst.Index) !void {
const zcu = pt.zcu;
const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
const ty = self.typeOf(bin_op.lhs);
- if (ty.zigTypeTag(zcu) == .Vector or ty.abiSize(zcu) > 8) return self.fail(
+ if (ty.zigTypeTag(zcu) == .vector or ty.abiSize(zcu) > 8) return self.fail(
"TODO implement airAddSat for {}",
.{ty.fmt(pt)},
);
@@ -4042,7 +4042,7 @@ fn airSubSat(self: *Self, inst: Air.Inst.Index) !void {
const zcu = pt.zcu;
const bin_op = self.air.instructions.items(.data)[@intFromEnum(inst)].bin_op;
const ty = self.typeOf(bin_op.lhs);
- if (ty.zigTypeTag(zcu) == .Vector or ty.abiSize(zcu) > 8) return self.fail(
+ if (ty.zigTypeTag(zcu) == .vector or ty.abiSize(zcu) > 8) return self.fail(
"TODO implement airSubSat for {}",
.{ty.fmt(pt)},
);
@@ -4216,7 +4216,7 @@ fn airMulSat(self: *Self, inst: Air.Inst.Index) !void {
break :result dst_mcv;
}
- if (ty.zigTypeTag(zcu) == .Vector or ty.abiSize(zcu) > 8) return self.fail(
+ if (ty.zigTypeTag(zcu) == .vector or ty.abiSize(zcu) > 8) return self.fail(
"TODO implement airMulSat for {}",
.{ty.fmt(pt)},
);
@@ -4287,8 +4287,8 @@ fn airAddSubWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
const tag = self.air.instructions.items(.tag)[@intFromEnum(inst)];
const ty = self.typeOf(bin_op.lhs);
switch (ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement add/sub with overflow for Vector type", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement add/sub with overflow for Vector type", .{}),
+ .int => {
try self.spillEflagsIfOccupied();
try self.spillRegisters(&.{ .rcx, .rdi, .rsi });
const reg_locks = self.register_manager.lockRegsAssumeUnused(3, .{ .rcx, .rdi, .rsi });
@@ -4354,8 +4354,8 @@ fn airShlWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
const lhs_ty = self.typeOf(bin_op.lhs);
const rhs_ty = self.typeOf(bin_op.rhs);
switch (lhs_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement shl with overflow for Vector type", .{}),
- .Int => {
+ .vector => return self.fail("TODO implement shl with overflow for Vector type", .{}),
+ .int => {
try self.spillEflagsIfOccupied();
try self.spillRegisters(&.{ .rcx, .rdi, .rsi });
const reg_locks = self.register_manager.lockRegsAssumeUnused(3, .{ .rcx, .rdi, .rsi });
@@ -4510,8 +4510,8 @@ fn airMulWithOverflow(self: *Self, inst: Air.Inst.Index) !void {
const tuple_ty = self.typeOfIndex(inst);
const dst_ty = self.typeOf(bin_op.lhs);
const result: MCValue = switch (dst_ty.zigTypeTag(zcu)) {
- .Vector => return self.fail("TODO implement airMulWithOverflow for {}", .{dst_ty.fmt(pt)}),
- .Int => result: {
+ .vector => return self.fail("TODO implement airMulWithOverflow for {}", .{dst_ty.fmt(pt)}),
+ .int => result: {
const dst_info = dst_ty.intInfo(zcu);
if (dst_info.bits > 128 and dst_info.signedness == .unsigned) {
const slow_inc = self.hasFeature(.slow_incdec);
@@ -5005,7 +5005,7 @@ fn airShlShrBinOp(self: *Self, inst: Air.Inst.Index) !void {
const rhs_ty = self.typeOf(bin_op.rhs);
const result: MCValue = result: {
switch (lhs_ty.zigTypeTag(zcu)) {
- .Int => {
+ .int => {
try self.spillRegisters(&.{.rcx});
try self.register_manager.getKnownReg(.rcx, null);
const lhs_mcv = try self.resolveInst(bin_op.lhs);
@@ -5047,8 +5047,8 @@ fn airShlShrBinOp(self: *Self, inst: Air.Inst.Index) !void {
}
break :result dst_mcv;
},
- .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
- .Int => if (@as(?Mir.Inst.FixedTag, switch (lhs_ty.childType(zcu).intInfo(zcu).bits) {
+ .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
+ .int => if (@as(?Mir.Inst.FixedTag, switch (lhs_ty.childType(zcu).intInfo(zcu).bits) {
else => null,
16 => switch (lhs_ty.vectorLen(zcu)) {
else => null,
@@ -6212,7 +6212,7 @@ fn airClz(self: *Self, inst: Air.Inst.Index) !void {
const dst_ty = self.typeOfIndex(inst);
const src_ty = self.typeOf(ty_op.operand);
- if (src_ty.zigTypeTag(zcu) == .Vector) return self.fail("TODO implement airClz for {}", .{
+ if (src_ty.zigTypeTag(zcu) == .vector) return self.fail("TODO implement airClz for {}", .{
src_ty.fmt(pt),
});
@@ -6409,7 +6409,7 @@ fn airCtz(self: *Self, inst: Air.Inst.Index) !void {
const dst_ty = self.typeOfIndex(inst);
const src_ty = self.typeOf(ty_op.operand);
- if (src_ty.zigTypeTag(zcu) == .Vector) return self.fail("TODO implement airCtz for {}", .{
+ if (src_ty.zigTypeTag(zcu) == .vector) return self.fail("TODO implement airCtz for {}", .{
src_ty.fmt(pt),
});
@@ -6571,7 +6571,7 @@ fn airPopCount(self: *Self, inst: Air.Inst.Index) !void {
const src_ty = self.typeOf(ty_op.operand);
const src_abi_size: u32 = @intCast(src_ty.abiSize(zcu));
- if (src_ty.zigTypeTag(zcu) == .Vector or src_abi_size > 16)
+ if (src_ty.zigTypeTag(zcu) == .vector or src_abi_size > 16)
return self.fail("TODO implement airPopCount for {}", .{src_ty.fmt(pt)});
const src_mcv = try self.resolveInst(ty_op.operand);
@@ -6724,7 +6724,7 @@ fn genByteSwap(
const ty_op = self.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
const has_movbe = self.hasFeature(.movbe);
- if (src_ty.zigTypeTag(zcu) == .Vector) return self.fail(
+ if (src_ty.zigTypeTag(zcu) == .vector) return self.fail(
"TODO implement genByteSwap for {}",
.{src_ty.fmt(pt)},
);
@@ -7036,7 +7036,7 @@ fn floatSign(self: *Self, inst: Air.Inst.Index, operand: Air.Inst.Ref, ty: Type)
const result = result: {
const scalar_bits = ty.scalarType(zcu).floatBits(self.target.*);
if (scalar_bits == 80) {
- if (ty.zigTypeTag(zcu) != .Float) return self.fail("TODO implement floatSign for {}", .{
+ if (ty.zigTypeTag(zcu) != .float) return self.fail("TODO implement floatSign for {}", .{
ty.fmt(pt),
});
@@ -7209,14 +7209,14 @@ fn getRoundTag(self: *Self, ty: Type) ?Mir.Inst.FixedTag {
const pt = self.pt;
const zcu = pt.zcu;
return if (self.hasFeature(.sse4_1)) switch (ty.zigTypeTag(zcu)) {
- .Float => switch (ty.floatBits(self.target.*)) {
+ .float => switch (ty.floatBits(self.target.*)) {
32 => if (self.hasFeature(.avx)) .{ .v_ss, .round } else .{ ._ss, .round },
64 => if (self.hasFeature(.avx)) .{ .v_sd, .round } else .{ ._sd, .round },
16, 80, 128 => null,
else => unreachable,
},
- .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
32 => switch (ty.vectorLen(zcu)) {
1 => if (self.hasFeature(.avx)) .{ .v_ss, .round } else .{ ._ss, .round },
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
const zcu = pt.zcu;
if (self.getRoundTag(ty)) |_| return .none;
- if (ty.zigTypeTag(zcu) != .Float)
+ if (ty.zigTypeTag(zcu) != .float)
return self.fail("TODO implement genRound for {}", .{ty.fmt(pt)});
var callee_buf: ["__trunc?".len]u8 = undefined;
@@ -7314,7 +7314,7 @@ fn airAbs(self: *Self, inst: Air.Inst.Index) !void {
const result: MCValue = result: {
const mir_tag = @as(?Mir.Inst.FixedTag, switch (ty.zigTypeTag(zcu)) {
else => null,
- .Int => switch (ty.abiSize(zcu)) {
+ .int => switch (ty.abiSize(zcu)) {
0 => unreachable,
1...8 => {
try self.spillEflagsIfOccupied();
@@ -7442,10 +7442,10 @@ fn airAbs(self: *Self, inst: Air.Inst.Index) !void {
break :result dst_mcv;
},
},
- .Float => return self.floatSign(inst, ty_op.operand, ty),
- .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => return self.floatSign(inst, ty_op.operand, ty),
+ .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
else => null,
- .Int => switch (ty.childType(zcu).intInfo(zcu).bits) {
+ .int => switch (ty.childType(zcu).intInfo(zcu).bits) {
else => null,
8 => switch (ty.vectorLen(zcu)) {
else => null,
@@ -7478,7 +7478,7 @@ fn airAbs(self: *Self, inst: Air.Inst.Index) !void {
5...8 => if (self.hasFeature(.avx2)) .{ .vp_d, .abs } else null,
},
},
- .Float => return self.floatSign(inst, ty_op.operand, ty),
+ .float => return self.floatSign(inst, ty_op.operand, ty),
},
}) orelse return self.fail("TODO implement airAbs for {}", .{ty.fmt(pt)});
@@ -7515,7 +7515,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
const result: MCValue = result: {
switch (ty.zigTypeTag(zcu)) {
- .Float => {
+ .float => {
const float_bits = ty.floatBits(self.target.*);
if (switch (float_bits) {
16 => !self.hasFeature(.f16c),
@@ -7547,7 +7547,7 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
defer if (dst_lock) |lock| self.register_manager.unlockReg(lock);
const mir_tag = @as(?Mir.Inst.FixedTag, switch (ty.zigTypeTag(zcu)) {
- .Float => switch (ty.floatBits(self.target.*)) {
+ .float => switch (ty.floatBits(self.target.*)) {
16 => {
assert(self.hasFeature(.f16c));
const mat_src_reg = if (src_mcv.isRegister())
@@ -7568,8 +7568,8 @@ fn airSqrt(self: *Self, inst: Air.Inst.Index) !void {
64 => if (self.hasFeature(.avx)) .{ .v_sd, .sqrt } else .{ ._sd, .sqrt },
else => unreachable,
},
- .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
16 => if (self.hasFeature(.f16c)) switch (ty.vectorLen(zcu)) {
1 => {
try self.asmRegisterRegister(
@@ -8496,7 +8496,7 @@ fn genUnOp(self: *Self, maybe_inst: ?Air.Inst.Index, tag: Air.Inst.Tag, src_air:
const pt = self.pt;
const zcu = pt.zcu;
const src_ty = self.typeOf(src_air);
- if (src_ty.zigTypeTag(zcu) == .Vector)
+ if (src_ty.zigTypeTag(zcu) == .vector)
return self.fail("TODO implement genUnOp for {}", .{src_ty.fmt(pt)});
var src_mcv = try self.resolveInst(src_air);
@@ -9291,7 +9291,7 @@ fn genShiftBinOp(
) !MCValue {
const pt = self.pt;
const zcu = pt.zcu;
- if (lhs_ty.zigTypeTag(zcu) == .Vector) return self.fail("TODO implement genShiftBinOp for {}", .{
+ if (lhs_ty.zigTypeTag(zcu) == .vector) return self.fail("TODO implement genShiftBinOp for {}", .{
lhs_ty.fmt(pt),
});
@@ -9350,7 +9350,7 @@ fn genMulDivBinOp(
) !MCValue {
const pt = self.pt;
const zcu = pt.zcu;
- if (dst_ty.zigTypeTag(zcu) == .Vector or dst_ty.zigTypeTag(zcu) == .Float) return self.fail(
+ if (dst_ty.zigTypeTag(zcu) == .vector or dst_ty.zigTypeTag(zcu) == .float) return self.fail(
"TODO implement genMulDivBinOp for {s} from {} to {}",
.{ @tagName(tag), src_ty.fmt(pt), dst_ty.fmt(pt) },
);
@@ -9938,8 +9938,8 @@ fn genBinOp(
const sse_op = switch (lhs_ty.zigTypeTag(zcu)) {
else => false,
- .Float => true,
- .Vector => switch (lhs_ty.childType(zcu).toIntern()) {
+ .float => true,
+ .vector => switch (lhs_ty.childType(zcu).toIntern()) {
.bool_type, .u1_type => false,
else => true,
},
@@ -9966,12 +9966,12 @@ fn genBinOp(
const ordered_air: [2]Air.Inst.Ref = if (lhs_ty.isVector(zcu) and
switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
- .Bool => false,
- .Int => switch (air_tag) {
+ .bool => false,
+ .int => switch (air_tag) {
.cmp_lt, .cmp_gte => true,
else => false,
},
- .Float => switch (air_tag) {
+ .float => switch (air_tag) {
.cmp_gte, .cmp_gt => true,
else => false,
},
@@ -10337,7 +10337,7 @@ fn genBinOp(
const dst_reg = registerAlias(dst_mcv.getReg().?, abi_size);
const mir_tag = @as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) {
else => unreachable,
- .Float => switch (lhs_ty.floatBits(self.target.*)) {
+ .float => switch (lhs_ty.floatBits(self.target.*)) {
16 => {
assert(self.hasFeature(.f16c));
const tmp_reg =
@@ -10430,9 +10430,9 @@ fn genBinOp(
80, 128 => null,
else => unreachable,
},
- .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
+ .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
else => null,
- .Int => switch (lhs_ty.childType(zcu).intInfo(zcu).bits) {
+ .int => switch (lhs_ty.childType(zcu).intInfo(zcu).bits) {
8 => switch (lhs_ty.vectorLen(zcu)) {
1...16 => switch (air_tag) {
.add,
@@ -10779,7 +10779,7 @@ fn genBinOp(
},
else => null,
},
- .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
+ .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
16 => tag: {
assert(self.hasFeature(.f16c));
switch (lhs_ty.vectorLen(zcu)) {
@@ -11101,7 +11101,7 @@ fn genBinOp(
lhs_reg,
try src_mcv.mem(self, switch (lhs_ty.zigTypeTag(zcu)) {
else => Memory.Size.fromSize(abi_size),
- .Vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
+ .vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
}),
) else try self.asmRegisterRegisterRegister(
mir_tag,
@@ -11119,7 +11119,7 @@ fn genBinOp(
dst_reg,
try src_mcv.mem(self, switch (lhs_ty.zigTypeTag(zcu)) {
else => Memory.Size.fromSize(abi_size),
- .Vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
+ .vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
}),
) else try self.asmRegisterRegister(
mir_tag,
@@ -11147,7 +11147,7 @@ fn genBinOp(
lhs_reg,
try src_mcv.mem(self, switch (lhs_ty.zigTypeTag(zcu)) {
else => Memory.Size.fromSize(abi_size),
- .Vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
+ .vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
}),
imm,
) else try self.asmRegisterRegisterRegisterImmediate(
@@ -11167,7 +11167,7 @@ fn genBinOp(
dst_reg,
try src_mcv.mem(self, switch (lhs_ty.zigTypeTag(zcu)) {
else => Memory.Size.fromSize(abi_size),
- .Vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
+ .vector => Memory.Size.fromBitSize(dst_reg.bitSize()),
}),
imm,
) else try self.asmRegisterRegisterImmediate(
@@ -11199,14 +11199,14 @@ fn genBinOp(
try self.asmRegisterRegisterRegisterImmediate(
@as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => switch (lhs_ty.floatBits(self.target.*)) {
+ .float => switch (lhs_ty.floatBits(self.target.*)) {
32 => .{ .v_ss, .cmp },
64 => .{ .v_sd, .cmp },
16, 80, 128 => null,
else => unreachable,
},
- .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
32 => switch (lhs_ty.vectorLen(zcu)) {
1 => .{ .v_ss, .cmp },
2...8 => .{ .v_ps, .cmp },
@@ -11233,14 +11233,14 @@ fn genBinOp(
);
try self.asmRegisterRegisterRegisterRegister(
@as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => switch (lhs_ty.floatBits(self.target.*)) {
+ .float => switch (lhs_ty.floatBits(self.target.*)) {
32 => .{ .v_ps, .blendv },
64 => .{ .v_pd, .blendv },
16, 80, 128 => null,
else => unreachable,
},
- .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
32 => switch (lhs_ty.vectorLen(zcu)) {
1...8 => .{ .v_ps, .blendv },
else => null,
@@ -11267,14 +11267,14 @@ fn genBinOp(
const has_blend = self.hasFeature(.sse4_1);
try self.asmRegisterRegisterImmediate(
@as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => switch (lhs_ty.floatBits(self.target.*)) {
+ .float => switch (lhs_ty.floatBits(self.target.*)) {
32 => .{ ._ss, .cmp },
64 => .{ ._sd, .cmp },
16, 80, 128 => null,
else => unreachable,
},
- .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
32 => switch (lhs_ty.vectorLen(zcu)) {
1 => .{ ._ss, .cmp },
2...4 => .{ ._ps, .cmp },
@@ -11300,14 +11300,14 @@ fn genBinOp(
);
if (has_blend) try self.asmRegisterRegisterRegister(
@as(?Mir.Inst.FixedTag, switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => switch (lhs_ty.floatBits(self.target.*)) {
+ .float => switch (lhs_ty.floatBits(self.target.*)) {
32 => .{ ._ps, .blendv },
64 => .{ ._pd, .blendv },
16, 80, 128 => null,
else => unreachable,
},
- .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
32 => switch (lhs_ty.vectorLen(zcu)) {
1...4 => .{ ._ps, .blendv },
else => null,
@@ -11330,14 +11330,14 @@ fn genBinOp(
mask_reg,
) else {
const mir_fixes = @as(?Mir.Inst.Fixes, switch (lhs_ty.zigTypeTag(zcu)) {
- .Float => switch (lhs_ty.floatBits(self.target.*)) {
+ .float => switch (lhs_ty.floatBits(self.target.*)) {
32 => ._ps,
64 => ._pd,
16, 80, 128 => null,
else => unreachable,
},
- .Vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (lhs_ty.childType(zcu).floatBits(self.target.*)) {
32 => switch (lhs_ty.vectorLen(zcu)) {
1...4 => ._ps,
else => null,
@@ -11362,7 +11362,7 @@ fn genBinOp(
},
.cmp_lt, .cmp_lte, .cmp_eq, .cmp_gte, .cmp_gt, .cmp_neq => {
switch (lhs_ty.childType(zcu).zigTypeTag(zcu)) {
- .Int => switch (air_tag) {
+ .int => switch (air_tag) {
.cmp_lt,
.cmp_eq,
.cmp_gt,
@@ -11396,7 +11396,7 @@ fn genBinOp(
},
else => unreachable,
},
- .Float => {},
+ .float => {},
else => unreachable,
}
@@ -12268,8 +12268,8 @@ fn genCall(self: *Self, info: union(enum) {
.air => |callee| fn_info: {
const callee_ty = self.typeOf(callee);
break :fn_info switch (callee_ty.zigTypeTag(zcu)) {
- .Fn => callee_ty,
- .Pointer => callee_ty.childType(zcu),
+ .@"fn" => callee_ty,
+ .pointer => callee_ty.childType(zcu),
else => unreachable,
};
},
@@ -12544,7 +12544,7 @@ fn genCall(self: *Self, info: union(enum) {
else => return self.fail("TODO implement calling bitcasted functions", .{}),
}
} else {
- assert(self.typeOf(callee).zigTypeTag(zcu) == .Pointer);
+ assert(self.typeOf(callee).zigTypeTag(zcu) == .pointer);
try self.genSetReg(.rax, Type.usize, .{ .air_ref = callee }, .{});
try self.asmRegister(.{ ._, .call }, .rax);
},
@@ -12650,7 +12650,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
defer for (rhs_locks) |rhs_lock| if (rhs_lock) |lock| self.register_manager.unlockReg(lock);
switch (ty.zigTypeTag(zcu)) {
- .Float => {
+ .float => {
const float_bits = ty.floatBits(self.target.*);
if (switch (float_bits) {
16 => !self.hasFeature(.f16c),
@@ -12685,7 +12685,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
};
}
},
- .Optional => if (!ty.optionalReprIsPayload(zcu)) {
+ .optional => if (!ty.optionalReprIsPayload(zcu)) {
const opt_ty = ty;
const opt_abi_size: u31 = @intCast(opt_ty.abiSize(zcu));
ty = opt_ty.optionalChild(zcu);
@@ -12982,7 +12982,7 @@ fn airCmp(self: *Self, inst: Air.Inst.Index, op: math.CompareOperator) !void {
},
);
},
- .Float => {
+ .float => {
const flipped = switch (op) {
.lt, .lte => true,
.eq, .gte, .gt, .neq => false,
@@ -14659,7 +14659,7 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo
else => {},
}
},
- .Float => switch (ty.floatBits(self.target.*)) {
+ .float => switch (ty.floatBits(self.target.*)) {
16 => return if (self.hasFeature(.avx)) .{ .vex_insert_extract = .{
.insert = .{ .vp_w, .insr },
.extract = .{ .vp_w, .extr },
@@ -14680,15 +14680,15 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo
else if (aligned) .{ ._, .movdqa } else .{ ._, .movdqu } },
else => {},
},
- .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
- .Bool => switch (ty.vectorLen(zcu)) {
+ .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
+ .bool => switch (ty.vectorLen(zcu)) {
33...64 => return .{ .move = if (self.hasFeature(.avx))
.{ .v_q, .mov }
else
.{ ._q, .mov } },
else => {},
},
- .Int => switch (ty.childType(zcu).intInfo(zcu).bits) {
+ .int => switch (ty.childType(zcu).intInfo(zcu).bits) {
1...8 => switch (ty.vectorLen(zcu)) {
1...16 => return .{ .move = if (self.hasFeature(.avx))
if (aligned) .{ .v_, .movdqa } else .{ .v_, .movdqu }
@@ -14754,7 +14754,7 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo
},
else => {},
},
- .Pointer, .Optional => if (ty.childType(zcu).isPtrAtRuntime(zcu))
+ .pointer, .optional => if (ty.childType(zcu).isPtrAtRuntime(zcu))
switch (ty.vectorLen(zcu)) {
1...2 => return .{ .move = if (self.hasFeature(.avx))
if (aligned) .{ .v_, .movdqa } else .{ .v_, .movdqu }
@@ -14768,7 +14768,7 @@ fn moveStrategy(self: *Self, ty: Type, class: Register.Class, aligned: bool) !Mo
}
else
unreachable,
- .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
+ .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
16 => switch (ty.vectorLen(zcu)) {
1...8 => return .{ .move = if (self.hasFeature(.avx))
if (aligned) .{ .v_, .movdqa } else .{ .v_, .movdqu }
@@ -15072,7 +15072,7 @@ fn genSetReg(
17...32 => if (self.hasFeature(.avx)) .{ .v_, .movdqa } else null,
else => null,
},
- .Float => switch (ty.scalarType(zcu).floatBits(self.target.*)) {
+ .float => switch (ty.scalarType(zcu).floatBits(self.target.*)) {
16, 128 => switch (abi_size) {
2...16 => if (self.hasFeature(.avx))
.{ .v_, .movdqa }
@@ -15368,7 +15368,7 @@ fn genSetMem(
}
},
.register_overflow => |ro| switch (ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
try self.genSetMem(
base,
disp + @as(i32, @intCast(ty.structFieldOffset(0, zcu))),
@@ -15384,7 +15384,7 @@ fn genSetMem(
opts,
);
},
- .Optional => {
+ .optional => {
assert(!ty.optionalReprIsPayload(zcu));
const child_ty = ty.optionalChild(zcu);
try self.genSetMem(base, disp, child_ty, .{ .register = ro.reg }, opts);
@@ -15768,7 +15768,7 @@ fn airFloatFromInt(self: *Self, inst: Air.Inst.Index) !void {
defer self.register_manager.unlockReg(dst_lock);
const mir_tag = @as(?Mir.Inst.FixedTag, switch (dst_ty.zigTypeTag(zcu)) {
- .Float => switch (dst_ty.floatBits(self.target.*)) {
+ .float => switch (dst_ty.floatBits(self.target.*)) {
32 => if (self.hasFeature(.avx)) .{ .v_ss, .cvtsi2 } else .{ ._ss, .cvtsi2 },
64 => if (self.hasFeature(.avx)) .{ .v_sd, .cvtsi2 } else .{ ._sd, .cvtsi2 },
16, 80, 128 => null,
@@ -16702,7 +16702,7 @@ fn airSplat(self: *Self, inst: Air.Inst.Index) !void {
const result: MCValue = result: {
switch (scalar_ty.zigTypeTag(zcu)) {
else => {},
- .Bool => {
+ .bool => {
const regs =
try self.register_manager.allocRegs(2, .{ inst, null }, abi.RegisterClass.gp);
const reg_locks = self.register_manager.lockRegsAssumeUnused(2, regs);
@@ -16742,7 +16742,7 @@ fn airSplat(self: *Self, inst: Air.Inst.Index) !void {
);
break :result .{ .register = regs[0] };
},
- .Int => if (self.hasFeature(.avx2)) avx2: {
+ .int => if (self.hasFeature(.avx2)) avx2: {
const mir_tag = @as(?Mir.Inst.FixedTag, switch (scalar_ty.intInfo(zcu).bits) {
else => null,
1...8 => switch (vector_len) {
@@ -16835,7 +16835,7 @@ fn airSplat(self: *Self, inst: Air.Inst.Index) !void {
);
break :result .{ .register = dst_reg };
},
- .Float => switch (scalar_ty.floatBits(self.target.*)) {
+ .float => switch (scalar_ty.floatBits(self.target.*)) {
32 => switch (vector_len) {
1 => {
const src_mcv = try self.resolveInst(ty_op.operand);
@@ -17264,7 +17264,7 @@ fn airSelect(self: *Self, inst: Air.Inst.Index) !void {
const mir_tag = @as(?Mir.Inst.FixedTag, switch (ty.childType(zcu).zigTypeTag(zcu)) {
else => null,
- .Int => switch (abi_size) {
+ .int => switch (abi_size) {
0 => unreachable,
1...16 => if (has_avx)
.{ .vp_b, .blendv }
@@ -17278,7 +17278,7 @@ fn airSelect(self: *Self, inst: Air.Inst.Index) !void {
null,
else => null,
},
- .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
+ .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
else => unreachable,
16, 80, 128 => null,
32 => switch (vec_len) {
@@ -17334,8 +17334,8 @@ fn airSelect(self: *Self, inst: Air.Inst.Index) !void {
) else {
const mir_fixes = @as(?Mir.Inst.Fixes, switch (elem_ty.zigTypeTag(zcu)) {
else => null,
- .Int => .p_,
- .Float => switch (elem_ty.floatBits(self.target.*)) {
+ .int => .p_,
+ .float => switch (elem_ty.floatBits(self.target.*)) {
32 => ._ps,
64 => ._pd,
16, 80, 128 => null,
@@ -18132,8 +18132,8 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void {
if (has_avx) try self.asmRegisterRegisterRegister(
.{ switch (elem_ty.zigTypeTag(zcu)) {
else => break :result null,
- .Int => .vp_,
- .Float => switch (elem_ty.floatBits(self.target.*)) {
+ .int => .vp_,
+ .float => switch (elem_ty.floatBits(self.target.*)) {
32 => .v_ps,
64 => .v_pd,
16, 80, 128 => break :result null,
@@ -18146,8 +18146,8 @@ fn airShuffle(self: *Self, inst: Air.Inst.Index) !void {
) else try self.asmRegisterRegister(
.{ switch (elem_ty.zigTypeTag(zcu)) {
else => break :result null,
- .Int => .p_,
- .Float => switch (elem_ty.floatBits(self.target.*)) {
+ .int => .p_,
+ .float => switch (elem_ty.floatBits(self.target.*)) {
32 => ._ps,
64 => ._pd,
16, 80, 128 => break :result null,
@@ -18235,7 +18235,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra[ty_pl.payload..][0..len]);
const result: MCValue = result: {
switch (result_ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
const frame_index = try self.allocFrameIndex(FrameAlloc.initSpill(result_ty, zcu));
if (result_ty.containerLayout(zcu) == .@"packed") {
const struct_obj = zcu.typeToStruct(result_ty).?;
@@ -18342,7 +18342,7 @@ fn airAggregateInit(self: *Self, inst: Air.Inst.Index) !void {
}
break :result .{ .load_frame = .{ .index = frame_index } };
},
- .Array, .Vector => {
+ .array, .vector => {
const elem_ty = result_ty.childType(zcu);
if (result_ty.isVector(zcu) and elem_ty.toIntern() == .bool_type) {
const result_size: u32 = @intCast(result_ty.abiSize(zcu));
@@ -18483,7 +18483,7 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
32, 64 => !self.hasFeature(.fma),
else => unreachable,
}) {
- if (ty.zigTypeTag(zcu) != .Float) return self.fail("TODO implement airMulAdd for {}", .{
+ if (ty.zigTypeTag(zcu) != .float) return self.fail("TODO implement airMulAdd for {}", .{
ty.fmt(pt),
});
@@ -18533,14 +18533,14 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
const mir_tag = @as(?Mir.Inst.FixedTag, if (mem.eql(u2, &order, &.{ 1, 3, 2 }) or
mem.eql(u2, &order, &.{ 3, 1, 2 }))
switch (ty.zigTypeTag(zcu)) {
- .Float => switch (ty.floatBits(self.target.*)) {
+ .float => switch (ty.floatBits(self.target.*)) {
32 => .{ .v_ss, .fmadd132 },
64 => .{ .v_sd, .fmadd132 },
16, 80, 128 => null,
else => unreachable,
},
- .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
32 => switch (ty.vectorLen(zcu)) {
1 => .{ .v_ss, .fmadd132 },
2...8 => .{ .v_ps, .fmadd132 },
@@ -18560,14 +18560,14 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
}
else if (mem.eql(u2, &order, &.{ 2, 1, 3 }) or mem.eql(u2, &order, &.{ 1, 2, 3 }))
switch (ty.zigTypeTag(zcu)) {
- .Float => switch (ty.floatBits(self.target.*)) {
+ .float => switch (ty.floatBits(self.target.*)) {
32 => .{ .v_ss, .fmadd213 },
64 => .{ .v_sd, .fmadd213 },
16, 80, 128 => null,
else => unreachable,
},
- .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
32 => switch (ty.vectorLen(zcu)) {
1 => .{ .v_ss, .fmadd213 },
2...8 => .{ .v_ps, .fmadd213 },
@@ -18587,14 +18587,14 @@ fn airMulAdd(self: *Self, inst: Air.Inst.Index) !void {
}
else if (mem.eql(u2, &order, &.{ 2, 3, 1 }) or mem.eql(u2, &order, &.{ 3, 2, 1 }))
switch (ty.zigTypeTag(zcu)) {
- .Float => switch (ty.floatBits(self.target.*)) {
+ .float => switch (ty.floatBits(self.target.*)) {
32 => .{ .v_ss, .fmadd231 },
64 => .{ .v_sd, .fmadd231 },
16, 80, 128 => null,
else => unreachable,
},
- .Vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
- .Float => switch (ty.childType(zcu).floatBits(self.target.*)) {
+ .vector => switch (ty.childType(zcu).zigTypeTag(zcu)) {
+ .float => switch (ty.childType(zcu).floatBits(self.target.*)) {
32 => switch (ty.vectorLen(zcu)) {
1 => .{ .v_ss, .fmadd231 },
2...8 => .{ .v_ps, .fmadd231 },
@@ -18971,7 +18971,7 @@ fn getResolvedInstValue(self: *Self, inst: Air.Inst.Index) *InstTracking {
/// and as a register.
fn limitImmediateType(self: *Self, operand: Air.Inst.Ref, comptime T: type) !MCValue {
const mcv = try self.resolveInst(operand);
- const ti = @typeInfo(T).Int;
+ const ti = @typeInfo(T).int;
switch (mcv) {
.immediate => |imm| {
// This immediate is unsigned.
@@ -19078,7 +19078,7 @@ fn resolveCallingConventionValues(
}
// Return values
- if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (ret_ty.zigTypeTag(zcu) == .noreturn) {
result.return_value = InstTracking.init(.unreach);
} else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
// TODO: is this even possible for C calling convention?
@@ -19266,7 +19266,7 @@ fn resolveCallingConventionValues(
result.stack_align = .@"16";
// Return values
- if (ret_ty.zigTypeTag(zcu) == .NoReturn) {
+ if (ret_ty.zigTypeTag(zcu) == .noreturn) {
result.return_value = InstTracking.init(.unreach);
} else if (!ret_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
result.return_value = InstTracking.init(.none);
@@ -19372,7 +19372,7 @@ fn memSize(self: *Self, ty: Type) Memory.Size {
const pt = self.pt;
const zcu = pt.zcu;
return switch (ty.zigTypeTag(zcu)) {
- .Float => Memory.Size.fromBitSize(ty.floatBits(self.target.*)),
+ .float => Memory.Size.fromBitSize(ty.floatBits(self.target.*)),
else => Memory.Size.fromSize(@intCast(ty.abiSize(zcu))),
};
}
@@ -19467,7 +19467,7 @@ fn regBitSize(self: *Self, ty: Type) u64 {
5...8 => 64,
else => unreachable,
},
- .Float => switch (abi_size) {
+ .float => switch (abi_size) {
1...16 => 128,
17...32 => 256,
else => unreachable,
diff --git a/src/arch/x86_64/Encoding.zig b/src/arch/x86_64/Encoding.zig
index 641008d5d84a..1738a382f60a 100644
--- a/src/arch/x86_64/Encoding.zig
+++ b/src/arch/x86_64/Encoding.zig
@@ -845,7 +845,7 @@ fn estimateInstructionLength(prefix: Prefix, encoding: Encoding, ops: []const Op
const mnemonic_to_encodings_map = init: {
@setEvalBranchQuota(5_000);
- const mnemonic_count = @typeInfo(Mnemonic).Enum.fields.len;
+ const mnemonic_count = @typeInfo(Mnemonic).@"enum".fields.len;
var mnemonic_map: [mnemonic_count][]Data = .{&.{}} ** mnemonic_count;
const encodings = @import("encodings.zig");
for (encodings.table) |entry| mnemonic_map[@intFromEnum(entry[0])].len += 1;
@@ -856,8 +856,8 @@ const mnemonic_to_encodings_map = init: {
storage_i += value.len;
}
var mnemonic_i: [mnemonic_count]usize = .{0} ** mnemonic_count;
- const ops_len = @typeInfo(std.meta.FieldType(Data, .ops)).Array.len;
- const opc_len = @typeInfo(std.meta.FieldType(Data, .opc)).Array.len;
+ const ops_len = @typeInfo(std.meta.FieldType(Data, .ops)).array.len;
+ const opc_len = @typeInfo(std.meta.FieldType(Data, .opc)).array.len;
for (encodings.table) |entry| {
const i = &mnemonic_i[@intFromEnum(entry[0])];
mnemonic_map[@intFromEnum(entry[0])][i.*] = .{
diff --git a/src/arch/x86_64/Lower.zig b/src/arch/x86_64/Lower.zig
index 2c5192f1c241..76e068ece95b 100644
--- a/src/arch/x86_64/Lower.zig
+++ b/src/arch/x86_64/Lower.zig
@@ -571,7 +571,7 @@ fn generic(lower: *Lower, inst: Mir.Inst) Error!void {
@setEvalBranchQuota(2_000);
comptime var max_len = 0;
- inline for (@typeInfo(Mnemonic).Enum.fields) |field| max_len = @max(field.name.len, max_len);
+ inline for (@typeInfo(Mnemonic).@"enum".fields) |field| max_len = @max(field.name.len, max_len);
var buf: [max_len]u8 = undefined;
const fixes_name = @tagName(fixes);
diff --git a/src/arch/x86_64/Mir.zig b/src/arch/x86_64/Mir.zig
index a42ec0635ad0..14de8ee69ce0 100644
--- a/src/arch/x86_64/Mir.zig
+++ b/src/arch/x86_64/Mir.zig
@@ -1185,8 +1185,8 @@ pub const Memory = struct {
extra: u32,
pub const Info = packed struct(u32) {
- base: @typeInfo(bits.Memory.Base).Union.tag_type.?,
- mod: @typeInfo(bits.Memory.Mod).Union.tag_type.?,
+ base: @typeInfo(bits.Memory.Base).@"union".tag_type.?,
+ mod: @typeInfo(bits.Memory.Mod).@"union".tag_type.?,
size: bits.Memory.Size,
index: Register,
scale: bits.Memory.Scale,
diff --git a/src/arch/x86_64/abi.zig b/src/arch/x86_64/abi.zig
index 23fba0bb1ca8..2e411e0381df 100644
--- a/src/arch/x86_64/abi.zig
+++ b/src/arch/x86_64/abi.zig
@@ -54,26 +54,26 @@ pub fn classifyWindows(ty: Type, zcu: *Zcu) Class {
// "Structs and unions of size 8, 16, 32, or 64 bits, and __m64 types, are passed
// as if they were integers of the same size."
switch (ty.zigTypeTag(zcu)) {
- .Pointer,
- .Int,
- .Bool,
- .Enum,
- .Void,
- .NoReturn,
- .ErrorSet,
- .Struct,
- .Union,
- .Optional,
- .Array,
- .ErrorUnion,
- .AnyFrame,
- .Frame,
+ .pointer,
+ .int,
+ .bool,
+ .@"enum",
+ .void,
+ .noreturn,
+ .error_set,
+ .@"struct",
+ .@"union",
+ .optional,
+ .array,
+ .error_union,
+ .@"anyframe",
+ .frame,
=> switch (ty.abiSize(zcu)) {
0 => unreachable,
1, 2, 4, 8 => return .integer,
else => switch (ty.zigTypeTag(zcu)) {
- .Int => return .win_i128,
- .Struct, .Union => if (ty.containerLayout(zcu) == .@"packed") {
+ .int => return .win_i128,
+ .@"struct", .@"union" => if (ty.containerLayout(zcu) == .@"packed") {
return .win_i128;
} else {
return .memory;
@@ -82,16 +82,16 @@ pub fn classifyWindows(ty: Type, zcu: *Zcu) Class {
},
},
- .Float, .Vector => return .sse,
+ .float, .vector => return .sse,
- .Type,
- .ComptimeFloat,
- .ComptimeInt,
- .Undefined,
- .Null,
- .Fn,
- .Opaque,
- .EnumLiteral,
+ .type,
+ .comptime_float,
+ .comptime_int,
+ .undefined,
+ .null,
+ .@"fn",
+ .@"opaque",
+ .enum_literal,
=> unreachable,
}
}
@@ -107,7 +107,7 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
};
var result = [1]Class{.none} ** 8;
switch (ty.zigTypeTag(zcu)) {
- .Pointer => switch (ty.ptrSize(zcu)) {
+ .pointer => switch (ty.ptrSize(zcu)) {
.Slice => {
result[0] = .integer;
result[1] = .integer;
@@ -118,7 +118,7 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
return result;
},
},
- .Int, .Enum, .ErrorSet => {
+ .int, .@"enum", .error_set => {
const bits = ty.intInfo(zcu).bits;
if (bits <= 64) {
result[0] = .integer;
@@ -144,11 +144,11 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
}
return memory_class;
},
- .Bool, .Void, .NoReturn => {
+ .bool, .void, .noreturn => {
result[0] = .integer;
return result;
},
- .Float => switch (ty.floatBits(target)) {
+ .float => switch (ty.floatBits(target)) {
16 => {
if (ctx == .field) {
result[0] = .memory;
@@ -184,7 +184,7 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
},
else => unreachable,
},
- .Vector => {
+ .vector => {
const elem_ty = ty.childType(zcu);
const bits = elem_ty.bitSize(zcu) * ty.arrayLen(zcu);
if (elem_ty.toIntern() == .bool_type) {
@@ -249,14 +249,14 @@ pub fn classifySystemV(ty: Type, zcu: *Zcu, target: std.Target, ctx: Context) [8
};
return memory_class;
},
- .Optional => {
+ .optional => {
if (ty.isPtrLikeOptional(zcu)) {
result[0] = .integer;
return result;
}
return memory_class;
},
- .Struct, .Union => {
+ .@"struct", .@"union" => {
// "If the size of an object is larger than eight eightbytes, or
// it contains unaligned fields, it has class MEMORY"
// "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
}
return result;
},
- .Array => {
+ .array => {
const ty_size = ty.abiSize(zcu);
if (ty_size <= 8) {
result[0] = .integer;
diff --git a/src/arch/x86_64/bits.zig b/src/arch/x86_64/bits.zig
index e1f587d5a6b6..95397e80642a 100644
--- a/src/arch/x86_64/bits.zig
+++ b/src/arch/x86_64/bits.zig
@@ -423,7 +423,7 @@ pub const FrameIndex = enum(u32) {
// Other indices are used for local variable stack slots
_,
- pub const named_count = @typeInfo(FrameIndex).Enum.fields.len;
+ pub const named_count = @typeInfo(FrameIndex).@"enum".fields.len;
pub fn isNamed(fi: FrameIndex) bool {
return @intFromEnum(fi) < named_count;
@@ -463,7 +463,7 @@ pub const Memory = struct {
frame: FrameIndex,
reloc: u32,
- pub const Tag = @typeInfo(Base).Union.tag_type.?;
+ pub const Tag = @typeInfo(Base).@"union".tag_type.?;
pub fn isExtended(self: Base) bool {
return switch (self) {
diff --git a/src/arch/x86_64/encoder.zig b/src/arch/x86_64/encoder.zig
index 484b7fde26ff..0dc1dbb7c979 100644
--- a/src/arch/x86_64/encoder.zig
+++ b/src/arch/x86_64/encoder.zig
@@ -2262,7 +2262,7 @@ const Assembler = struct {
}
fn mnemonicFromString(bytes: []const u8) ?Instruction.Mnemonic {
- const ti = @typeInfo(Instruction.Mnemonic).Enum;
+ const ti = @typeInfo(Instruction.Mnemonic).@"enum";
inline for (ti.fields) |field| {
if (std.mem.eql(u8, bytes, field.name)) {
return @field(Instruction.Mnemonic, field.name);
@@ -2278,7 +2278,7 @@ const Assembler = struct {
_ = try as.expect(.comma);
try as.skip(1, .{.space});
}
- if (@typeInfo(@TypeOf(cond)) != .EnumLiteral) {
+ if (@typeInfo(@TypeOf(cond)) != .enum_literal) {
@compileError("invalid condition in the rule: " ++ @typeName(@TypeOf(cond)));
}
switch (cond) {
@@ -2315,7 +2315,7 @@ const Assembler = struct {
}
fn registerFromString(bytes: []const u8) ?Register {
- const ti = @typeInfo(Register).Enum;
+ const ti = @typeInfo(Register).@"enum";
inline for (ti.fields) |field| {
if (std.mem.eql(u8, bytes, field.name)) {
return @field(Register, field.name);
@@ -2405,7 +2405,7 @@ const Assembler = struct {
fn parseMemoryRule(as: *Assembler, rule: anytype) ParseError!MemoryParseResult {
var res: MemoryParseResult = .{};
inline for (rule, 0..) |cond, i| {
- if (@typeInfo(@TypeOf(cond)) != .EnumLiteral) {
+ if (@typeInfo(@TypeOf(cond)) != .enum_literal) {
@compileError("unsupported condition type in the rule: " ++ @typeName(@TypeOf(cond)));
}
switch (cond) {
diff --git a/src/codegen.zig b/src/codegen.zig
index 7e6a911f5fda..67217c37e87c 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -113,8 +113,8 @@ pub fn generateLazyFunction(
fn writeFloat(comptime F: type, f: F, target: std.Target, endian: std.builtin.Endian, code: []u8) void {
_ = target;
- const bits = @typeInfo(F).Float.bits;
- const Int = @Type(.{ .Int = .{ .signedness = .unsigned, .bits = bits } });
+ const bits = @typeInfo(F).float.bits;
+ const Int = @Type(.{ .int = .{ .signedness = .unsigned, .bits = bits } });
const int: Int = @bitCast(f);
mem.writeInt(Int, code[0..@divExact(bits, 8)], int, endian);
}
@@ -167,7 +167,7 @@ pub fn generateLazySymbol(
}
mem.writeInt(u32, code.items[offset..][0..4], @intCast(code.items.len), endian);
return Result.ok;
- } else if (Type.fromInterned(lazy_sym.ty).zigTypeTag(pt.zcu) == .Enum) {
+ } else if (Type.fromInterned(lazy_sym.ty).zigTypeTag(pt.zcu) == .@"enum") {
alignment.* = .@"1";
const enum_ty = Type.fromInterned(lazy_sym.ty);
const tag_names = enum_ty.enumFields(pt.zcu);
@@ -519,7 +519,7 @@ pub fn generateSymbol(
// pointer may point to a decl which must be marked used
// but can also result in a relocation. Therefore we handle those separately.
- if (Type.fromInterned(field_ty).zigTypeTag(zcu) == .Pointer) {
+ if (Type.fromInterned(field_ty).zigTypeTag(zcu) == .pointer) {
const field_size = math.cast(usize, Type.fromInterned(field_ty).abiSize(zcu)) orelse
return error.Overflow;
var tmp_list = try std.ArrayList(u8).initCapacity(code.allocator, field_size);
@@ -678,7 +678,7 @@ fn lowerPtr(
const base_ptr = Value.fromInterned(field.base);
const base_ty = base_ptr.typeOf(zcu).childType(zcu);
const field_off: u64 = switch (base_ty.zigTypeTag(zcu)) {
- .Pointer => off: {
+ .pointer => off: {
assert(base_ty.isSlice(zcu));
break :off switch (field.index) {
Value.slice_ptr_index => 0,
@@ -686,7 +686,7 @@ fn lowerPtr(
else => unreachable,
};
},
- .Struct, .Union => switch (base_ty.containerLayout(zcu)) {
+ .@"struct", .@"union" => switch (base_ty.containerLayout(zcu)) {
.auto => base_ty.structFieldOffset(@intCast(field.index), zcu),
.@"extern", .@"packed" => unreachable,
},
@@ -721,7 +721,7 @@ fn lowerUavRef(
const uav_val = uav.val;
const uav_ty = Type.fromInterned(ip.typeOf(uav_val));
log.debug("lowerUavRef: ty = {}", .{uav_ty.fmt(pt)});
- const is_fn_body = uav_ty.zigTypeTag(zcu) == .Fn;
+ const is_fn_body = uav_ty.zigTypeTag(zcu) == .@"fn";
if (!is_fn_body and !uav_ty.hasRuntimeBits(zcu)) {
try code.appendNTimes(0xaa, ptr_width_bytes);
return Result.ok;
@@ -768,7 +768,7 @@ fn lowerNavRef(
const ptr_width = target.ptrBitWidth();
const nav_ty = Type.fromInterned(ip.getNav(nav_index).typeOf(ip));
- const is_fn_body = nav_ty.zigTypeTag(zcu) == .Fn;
+ const is_fn_body = nav_ty.zigTypeTag(zcu) == .@"fn";
if (!is_fn_body and !nav_ty.hasRuntimeBits(zcu)) {
try code.appendNTimes(0xaa, @divExact(ptr_width, 8));
return Result.ok;
@@ -880,7 +880,7 @@ fn genNavRef(
if (zcu.typeToFunc(fn_ty).?.is_generic) {
return .{ .mcv = .{ .immediate = fn_ty.abiAlignment(zcu).toByteUnits().? } };
}
- } else if (ty.zigTypeTag(zcu) == .Pointer) {
+ } else if (ty.zigTypeTag(zcu) == .pointer) {
const elem_ty = ty.elemType2(zcu);
if (!elem_ty.hasRuntimeBits(zcu)) {
return .{ .mcv = .{ .immediate = elem_ty.abiAlignment(zcu).toByteUnits().? } };
@@ -955,8 +955,8 @@ pub fn genTypedValue(
if (val.isUndef(zcu)) return .{ .mcv = .undef };
switch (ty.zigTypeTag(zcu)) {
- .Void => return .{ .mcv = .none },
- .Pointer => switch (ty.ptrSize(zcu)) {
+ .void => return .{ .mcv = .none },
+ .pointer => switch (ty.ptrSize(zcu)) {
.Slice => {},
else => switch (val.toIntern()) {
.null_value => {
@@ -991,7 +991,7 @@ pub fn genTypedValue(
},
},
},
- .Int => {
+ .int => {
const info = ty.intInfo(zcu);
if (info.bits <= target.ptrBitWidth()) {
const unsigned: u64 = switch (info.signedness) {
@@ -1001,10 +1001,10 @@ pub fn genTypedValue(
return .{ .mcv = .{ .immediate = unsigned } };
}
},
- .Bool => {
+ .bool => {
return .{ .mcv = .{ .immediate = @intFromBool(val.toBool()) } };
},
- .Optional => {
+ .optional => {
if (ty.isPtrLikeOptional(zcu)) {
return genTypedValue(
lf,
@@ -1017,7 +1017,7 @@ pub fn genTypedValue(
return .{ .mcv = .{ .immediate = @intFromBool(!val.isNull(zcu)) } };
}
},
- .Enum => {
+ .@"enum" => {
const enum_tag = ip.indexToKey(val.toIntern()).enum_tag;
return genTypedValue(
lf,
@@ -1027,12 +1027,12 @@ pub fn genTypedValue(
target,
);
},
- .ErrorSet => {
+ .error_set => {
const err_name = ip.indexToKey(val.toIntern()).err.name;
const error_index = try pt.getErrorValue(err_name);
return .{ .mcv = .{ .immediate = error_index } };
},
- .ErrorUnion => {
+ .error_union => {
const err_type = ty.errorUnionSet(zcu);
const payload_type = ty.errorUnionPayload(zcu);
if (!payload_type.hasRuntimeBitsIgnoreComptime(zcu)) {
@@ -1060,14 +1060,14 @@ pub fn genTypedValue(
}
},
- .ComptimeInt => unreachable,
- .ComptimeFloat => unreachable,
- .Type => unreachable,
- .EnumLiteral => unreachable,
- .NoReturn => unreachable,
- .Undefined => unreachable,
- .Null => unreachable,
- .Opaque => unreachable,
+ .comptime_int => unreachable,
+ .comptime_float => unreachable,
+ .type => unreachable,
+ .enum_literal => unreachable,
+ .noreturn => unreachable,
+ .undefined => unreachable,
+ .null => unreachable,
+ .@"opaque" => unreachable,
else => {},
}
diff --git a/src/codegen/c.zig b/src/codegen/c.zig
index 8703e9b12448..f3b8c7e72a51 100644
--- a/src/codegen/c.zig
+++ b/src/codegen/c.zig
@@ -1401,7 +1401,7 @@ pub const DeclGen = struct {
try writer.writeByte('(');
try dg.renderCType(writer, ctype);
try writer.writeByte(')');
- } else if (field_ty.zigTypeTag(zcu) == .Float) {
+ } else if (field_ty.zigTypeTag(zcu) == .float) {
try writer.writeByte('(');
try dg.renderCType(writer, ctype);
try writer.writeByte(')');
@@ -4473,8 +4473,8 @@ fn airCall(
const callee_ty = f.typeOf(pl_op.operand);
const fn_info = zcu.typeToFunc(switch (callee_ty.zigTypeTag(zcu)) {
- .Fn => callee_ty,
- .Pointer => callee_ty.childType(zcu),
+ .@"fn" => callee_ty,
+ .pointer => callee_ty.childType(zcu),
else => unreachable,
}).?;
const ret_ty = Type.fromInterned(fn_info.return_type);
@@ -5848,7 +5848,7 @@ fn airUnwrapErrUnionErr(f: *Function, inst: Air.Inst.Index) !CValue {
const operand_ty = f.typeOf(ty_op.operand);
try reap(f, inst, &.{ty_op.operand});
- const operand_is_ptr = operand_ty.zigTypeTag(zcu) == .Pointer;
+ const operand_is_ptr = operand_ty.zigTypeTag(zcu) == .pointer;
const error_union_ty = if (operand_is_ptr) operand_ty.childType(zcu) else operand_ty;
const error_ty = error_union_ty.errorUnionSet(zcu);
const payload_ty = error_union_ty.errorUnionPayload(zcu);
@@ -7011,23 +7011,23 @@ fn airReduce(f: *Function, inst: Air.Inst.Index) !CValue {
.Or => if (use_operator) .{ .infix = " |= " } else .{ .builtin = .{ .operation = "or" } },
.Xor => if (use_operator) .{ .infix = " ^= " } else .{ .builtin = .{ .operation = "xor" } },
.Min => switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => if (use_operator) .{ .ternary = " < " } else .{ .builtin = .{ .operation = "min" } },
- .Float => .{ .builtin = .{ .operation = "min" } },
+ .int => if (use_operator) .{ .ternary = " < " } else .{ .builtin = .{ .operation = "min" } },
+ .float => .{ .builtin = .{ .operation = "min" } },
else => unreachable,
},
.Max => switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => if (use_operator) .{ .ternary = " > " } else .{ .builtin = .{ .operation = "max" } },
- .Float => .{ .builtin = .{ .operation = "max" } },
+ .int => if (use_operator) .{ .ternary = " > " } else .{ .builtin = .{ .operation = "max" } },
+ .float => .{ .builtin = .{ .operation = "max" } },
else => unreachable,
},
.Add => switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => if (use_operator) .{ .infix = " += " } else .{ .builtin = .{ .operation = "addw", .info = .bits } },
- .Float => .{ .builtin = .{ .operation = "add" } },
+ .int => if (use_operator) .{ .infix = " += " } else .{ .builtin = .{ .operation = "addw", .info = .bits } },
+ .float => .{ .builtin = .{ .operation = "add" } },
else => unreachable,
},
.Mul => switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => if (use_operator) .{ .infix = " *= " } else .{ .builtin = .{ .operation = "mulw", .info = .bits } },
- .Float => .{ .builtin = .{ .operation = "mul" } },
+ .int => if (use_operator) .{ .infix = " *= " } else .{ .builtin = .{ .operation = "mulw", .info = .bits } },
+ .float => .{ .builtin = .{ .operation = "mul" } },
else => unreachable,
},
};
@@ -7050,38 +7050,38 @@ fn airReduce(f: *Function, inst: Air.Inst.Index) !CValue {
try f.object.dg.renderValue(writer, switch (reduce.operation) {
.Or, .Xor => switch (scalar_ty.zigTypeTag(zcu)) {
- .Bool => Value.false,
- .Int => try pt.intValue(scalar_ty, 0),
+ .bool => Value.false,
+ .int => try pt.intValue(scalar_ty, 0),
else => unreachable,
},
.And => switch (scalar_ty.zigTypeTag(zcu)) {
- .Bool => Value.true,
- .Int => switch (scalar_ty.intInfo(zcu).signedness) {
+ .bool => Value.true,
+ .int => switch (scalar_ty.intInfo(zcu).signedness) {
.unsigned => try scalar_ty.maxIntScalar(pt, scalar_ty),
.signed => try pt.intValue(scalar_ty, -1),
},
else => unreachable,
},
.Add => switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => try pt.intValue(scalar_ty, 0),
- .Float => try pt.floatValue(scalar_ty, 0.0),
+ .int => try pt.intValue(scalar_ty, 0),
+ .float => try pt.floatValue(scalar_ty, 0.0),
else => unreachable,
},
.Mul => switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => try pt.intValue(scalar_ty, 1),
- .Float => try pt.floatValue(scalar_ty, 1.0),
+ .int => try pt.intValue(scalar_ty, 1),
+ .float => try pt.floatValue(scalar_ty, 1.0),
else => unreachable,
},
.Min => switch (scalar_ty.zigTypeTag(zcu)) {
- .Bool => Value.true,
- .Int => try scalar_ty.maxIntScalar(pt, scalar_ty),
- .Float => try pt.floatValue(scalar_ty, std.math.nan(f128)),
+ .bool => Value.true,
+ .int => try scalar_ty.maxIntScalar(pt, scalar_ty),
+ .float => try pt.floatValue(scalar_ty, std.math.nan(f128)),
else => unreachable,
},
.Max => switch (scalar_ty.zigTypeTag(zcu)) {
- .Bool => Value.false,
- .Int => try scalar_ty.minIntScalar(pt, scalar_ty),
- .Float => try pt.floatValue(scalar_ty, std.math.nan(f128)),
+ .bool => Value.false,
+ .int => try scalar_ty.minIntScalar(pt, scalar_ty),
+ .float => try pt.floatValue(scalar_ty, std.math.nan(f128)),
else => unreachable,
},
}, .Initializer);
@@ -7765,7 +7765,7 @@ fn fmtStringLiteral(str: []const u8, sentinel: ?u8) std.fmt.Formatter(formatStri
}
fn undefPattern(comptime IntType: type) IntType {
- const int_info = @typeInfo(IntType).Int;
+ const int_info = @typeInfo(IntType).int;
const UnsignedType = std.meta.Int(.unsigned, int_info.bits);
return @as(IntType, @bitCast(@as(UnsignedType, (1 << (int_info.bits | 1)) / 3)));
}
@@ -8027,7 +8027,7 @@ const Vectorize = struct {
pub fn start(f: *Function, inst: Air.Inst.Index, writer: anytype, ty: Type) !Vectorize {
const pt = f.object.dg.pt;
const zcu = pt.zcu;
- return if (ty.zigTypeTag(zcu) == .Vector) index: {
+ return if (ty.zigTypeTag(zcu) == .vector) index: {
const local = try f.allocLocal(inst, Type.usize);
try writer.writeAll("for (");
@@ -8063,7 +8063,7 @@ const Vectorize = struct {
fn lowersToArray(ty: Type, pt: Zcu.PerThread) bool {
const zcu = pt.zcu;
return switch (ty.zigTypeTag(zcu)) {
- .Array, .Vector => return true,
+ .array, .vector => return true,
else => return ty.isAbiInt(zcu) and toCIntBits(@as(u32, @intCast(ty.bitSize(zcu)))) == null,
};
}
diff --git a/src/codegen/c/Type.zig b/src/codegen/c/Type.zig
index 018b0586d088..1e0c23a96b82 100644
--- a/src/codegen/c/Type.zig
+++ b/src/codegen/c/Type.zig
@@ -669,7 +669,7 @@ const Index = enum(u32) {
_,
- const first_pool_index: u32 = @typeInfo(CType.Index).Enum.fields.len;
+ const first_pool_index: u32 = @typeInfo(CType.Index).@"enum".fields.len;
const basic_hashes = init: {
@setEvalBranchQuota(1_600);
var basic_hashes_init: [first_pool_index]Pool.Map.Hash = undefined;
@@ -740,7 +740,7 @@ pub const Info = union(enum) {
aggregate: Aggregate,
function: Function,
- const Tag = @typeInfo(Info).Union.tag_type.?;
+ const Tag = @typeInfo(Info).@"union".tag_type.?;
pub const Pointer = struct {
elem_ctype: CType,
@@ -783,7 +783,7 @@ pub const Info = union(enum) {
pub fn at(slice: Field.Slice, index: usize, pool: *const Pool) Field {
assert(index < slice.len);
const extra = pool.getExtra(Pool.Field, @intCast(slice.extra_index +
- index * @typeInfo(Pool.Field).Struct.fields.len));
+ index * @typeInfo(Pool.Field).@"struct".fields.len));
return .{
.name = .{ .index = extra.name },
.ctype = .{ .index = extra.ctype },
@@ -991,7 +991,7 @@ pub const Pool = struct {
_,
const first_named_index: u32 = 1 << 31;
- const first_pool_index: u32 = first_named_index + @typeInfo(String.Index).Enum.fields.len;
+ const first_pool_index: u32 = first_named_index + @typeInfo(String.Index).@"enum".fields.len;
};
const Adapter = struct {
@@ -1127,7 +1127,7 @@ pub const Pool = struct {
allocator,
FwdDeclAnon,
extra,
- fields.len * @typeInfo(Field).Struct.fields.len,
+ fields.len * @typeInfo(Field).@"struct".fields.len,
);
for (fields, field_ctypes) |field, field_ctype| pool.addHashedExtraAssumeCapacity(
&hasher,
@@ -1184,7 +1184,7 @@ pub const Pool = struct {
allocator,
AggregateAnon,
extra,
- aggregate_info.fields.len * @typeInfo(Field).Struct.fields.len,
+ aggregate_info.fields.len * @typeInfo(Field).@"struct".fields.len,
);
for (aggregate_info.fields) |field| pool.addHashedExtraAssumeCapacity(&hasher, Field, .{
.name = field.name.index,
@@ -1213,7 +1213,7 @@ pub const Pool = struct {
allocator,
Aggregate,
extra,
- aggregate_info.fields.len * @typeInfo(Field).Struct.fields.len,
+ aggregate_info.fields.len * @typeInfo(Field).@"struct".fields.len,
);
for (aggregate_info.fields) |field| pool.addHashedExtraAssumeCapacity(&hasher, Field, .{
.name = field.name.index,
@@ -1672,7 +1672,7 @@ pub const Pool = struct {
defer scratch.shrinkRetainingCapacity(scratch_top);
try scratch.ensureUnusedCapacity(
allocator,
- loaded_struct.field_types.len * @typeInfo(Field).Struct.fields.len,
+ loaded_struct.field_types.len * @typeInfo(Field).@"struct".fields.len,
);
var hasher = Hasher.init;
var tag: Pool.Tag = .aggregate_struct;
@@ -1709,14 +1709,14 @@ pub const Pool = struct {
}
const fields_len: u32 = @intCast(@divExact(
scratch.items.len - scratch_top,
- @typeInfo(Field).Struct.fields.len,
+ @typeInfo(Field).@"struct".fields.len,
));
if (fields_len == 0) return CType.void;
try pool.ensureUnusedCapacity(allocator, 1);
const extra_index = try pool.addHashedExtra(allocator, &hasher, Aggregate, .{
.fwd_decl = fwd_decl.index,
.fields_len = fields_len,
- }, fields_len * @typeInfo(Field).Struct.fields.len);
+ }, fields_len * @typeInfo(Field).@"struct".fields.len);
pool.extra.appendSliceAssumeCapacity(scratch.items[scratch_top..]);
return pool.tagTrailingExtraAssumeCapacity(hasher, tag, extra_index);
},
@@ -1734,7 +1734,7 @@ pub const Pool = struct {
const scratch_top = scratch.items.len;
defer scratch.shrinkRetainingCapacity(scratch_top);
try scratch.ensureUnusedCapacity(allocator, anon_struct_info.types.len *
- @typeInfo(Field).Struct.fields.len);
+ @typeInfo(Field).@"struct".fields.len);
var hasher = Hasher.init;
for (0..anon_struct_info.types.len) |field_index| {
if (anon_struct_info.values.get(ip)[field_index] != .none) continue;
@@ -1765,7 +1765,7 @@ pub const Pool = struct {
}
const fields_len: u32 = @intCast(@divExact(
scratch.items.len - scratch_top,
- @typeInfo(Field).Struct.fields.len,
+ @typeInfo(Field).@"struct".fields.len,
));
if (fields_len == 0) return CType.void;
if (kind.isForward()) {
@@ -1775,7 +1775,7 @@ pub const Pool = struct {
&hasher,
FwdDeclAnon,
.{ .fields_len = fields_len },
- fields_len * @typeInfo(Field).Struct.fields.len,
+ fields_len * @typeInfo(Field).@"struct".fields.len,
);
pool.extra.appendSliceAssumeCapacity(scratch.items[scratch_top..]);
return pool.tagTrailingExtra(
@@ -1790,7 +1790,7 @@ pub const Pool = struct {
const extra_index = try pool.addHashedExtra(allocator, &hasher, Aggregate, .{
.fwd_decl = fwd_decl.index,
.fields_len = fields_len,
- }, fields_len * @typeInfo(Field).Struct.fields.len);
+ }, fields_len * @typeInfo(Field).@"struct".fields.len);
pool.extra.appendSliceAssumeCapacity(scratch.items[scratch_top..]);
return pool.tagTrailingExtraAssumeCapacity(hasher, .aggregate_struct, extra_index);
},
@@ -1812,7 +1812,7 @@ pub const Pool = struct {
defer scratch.shrinkRetainingCapacity(scratch_top);
try scratch.ensureUnusedCapacity(
allocator,
- loaded_union.field_types.len * @typeInfo(Field).Struct.fields.len,
+ loaded_union.field_types.len * @typeInfo(Field).@"struct".fields.len,
);
var hasher = Hasher.init;
var tag: Pool.Tag = .aggregate_union;
@@ -1850,7 +1850,7 @@ pub const Pool = struct {
}
const fields_len: u32 = @intCast(@divExact(
scratch.items.len - scratch_top,
- @typeInfo(Field).Struct.fields.len,
+ @typeInfo(Field).@"struct".fields.len,
));
if (!has_tag) {
if (fields_len == 0) return CType.void;
@@ -1860,7 +1860,7 @@ pub const Pool = struct {
&hasher,
Aggregate,
.{ .fwd_decl = fwd_decl.index, .fields_len = fields_len },
- fields_len * @typeInfo(Field).Struct.fields.len,
+ fields_len * @typeInfo(Field).@"struct".fields.len,
);
pool.extra.appendSliceAssumeCapacity(scratch.items[scratch_top..]);
return pool.tagTrailingExtraAssumeCapacity(hasher, tag, extra_index);
@@ -1898,7 +1898,7 @@ pub const Pool = struct {
.id = 0,
.fields_len = fields_len,
},
- fields_len * @typeInfo(Field).Struct.fields.len,
+ fields_len * @typeInfo(Field).@"struct".fields.len,
);
pool.extra.appendSliceAssumeCapacity(scratch.items[scratch_top..]);
break :payload_ctype pool.tagTrailingExtraAssumeCapacity(
@@ -2087,7 +2087,7 @@ pub const Pool = struct {
.tag = tag,
.data = try pool.addExtra(allocator, FwdDeclAnon, .{
.fields_len = fields.len,
- }, fields.len * @typeInfo(Field).Struct.fields.len),
+ }, fields.len * @typeInfo(Field).@"struct".fields.len),
});
for (0..fields.len) |field_index| {
const field = fields.at(field_index, source_pool);
@@ -2115,11 +2115,11 @@ pub const Pool = struct {
.index = anon.index,
.id = anon.id,
.fields_len = aggregate_info.fields.len,
- }, aggregate_info.fields.len * @typeInfo(Field).Struct.fields.len),
+ }, aggregate_info.fields.len * @typeInfo(Field).@"struct".fields.len),
.fwd_decl => |fwd_decl| try pool.addExtra(allocator, Aggregate, .{
.fwd_decl = pool_adapter.copy(fwd_decl).index,
.fields_len = aggregate_info.fields.len,
- }, aggregate_info.fields.len * @typeInfo(Field).Struct.fields.len),
+ }, aggregate_info.fields.len * @typeInfo(Field).@"struct".fields.len),
},
});
for (0..aggregate_info.fields.len) |field_index| {
@@ -2182,7 +2182,7 @@ pub const Pool = struct {
const init: Hasher = .{ .impl = Impl.init(0) };
fn updateExtra(hasher: *Hasher, comptime Extra: type, extra: Extra, pool: *const Pool) void {
- inline for (@typeInfo(Extra).Struct.fields) |field| {
+ inline for (@typeInfo(Extra).@"struct".fields) |field| {
const value = @field(extra, field.name);
switch (field.type) {
Pool.Tag, String, CType => unreachable,
@@ -2429,7 +2429,7 @@ pub const Pool = struct {
) !ExtraIndex {
try pool.extra.ensureUnusedCapacity(
allocator,
- @typeInfo(Extra).Struct.fields.len + trailing_len,
+ @typeInfo(Extra).@"struct".fields.len + trailing_len,
);
defer pool.addExtraAssumeCapacity(Extra, extra);
return @intCast(pool.extra.items.len);
@@ -2442,7 +2442,7 @@ pub const Pool = struct {
comptime Extra: type,
extra: Extra,
) void {
- inline for (@typeInfo(Extra).Struct.fields) |field| {
+ inline for (@typeInfo(Extra).@"struct".fields) |field| {
const value = @field(extra, field.name);
array.appendAssumeCapacity(switch (field.type) {
u32 => value,
@@ -2505,7 +2505,7 @@ pub const Pool = struct {
extra_index: ExtraIndex,
) struct { extra: Extra, trail: ExtraTrail } {
var extra: Extra = undefined;
- const fields = @typeInfo(Extra).Struct.fields;
+ const fields = @typeInfo(Extra).@"struct".fields;
inline for (fields, pool.extra.items[extra_index..][0..fields.len]) |field, value|
@field(extra, field.name) = switch (field.type) {
u32 => value,
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 1352e6e3a14b..e7cb57d76ea6 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -1538,7 +1538,7 @@ pub const Object = struct {
try attributes.addParamAttr(llvm_arg_i, .@"noalias", &o.builder);
}
}
- if (param_ty.zigTypeTag(zcu) != .Optional) {
+ if (param_ty.zigTypeTag(zcu) != .optional) {
try attributes.addParamAttr(llvm_arg_i, .nonnull, &o.builder);
}
if (ptr_info.flags.is_const) {
@@ -1907,8 +1907,8 @@ pub const Object = struct {
if (o.debug_type_map.get(ty)) |debug_type| return debug_type;
switch (ty.zigTypeTag(zcu)) {
- .Void,
- .NoReturn,
+ .void,
+ .noreturn,
=> {
const debug_void_type = try o.builder.debugSignedType(
try o.builder.metadataString("void"),
@@ -1917,7 +1917,7 @@ pub const Object = struct {
try o.debug_type_map.put(gpa, ty, debug_void_type);
return debug_void_type;
},
- .Int => {
+ .int => {
const info = ty.intInfo(zcu);
assert(info.bits != 0);
const name = try o.allocTypeName(ty);
@@ -1931,7 +1931,7 @@ pub const Object = struct {
try o.debug_type_map.put(gpa, ty, debug_int_type);
return debug_int_type;
},
- .Enum => {
+ .@"enum" => {
if (!ty.hasRuntimeBitsIgnoreComptime(zcu)) {
const debug_enum_type = try o.makeEmptyNamespaceDebugType(ty);
try o.debug_type_map.put(gpa, ty, debug_enum_type);
@@ -1985,7 +1985,7 @@ pub const Object = struct {
try o.debug_enums.append(gpa, debug_enum_type);
return debug_enum_type;
},
- .Float => {
+ .float => {
const bits = ty.floatBits(target);
const name = try o.allocTypeName(ty);
defer gpa.free(name);
@@ -1996,7 +1996,7 @@ pub const Object = struct {
try o.debug_type_map.put(gpa, ty, debug_float_type);
return debug_float_type;
},
- .Bool => {
+ .bool => {
const debug_bool_type = try o.builder.debugBoolType(
try o.builder.metadataString("bool"),
8, // lldb cannot handle non-byte sized types
@@ -2004,7 +2004,7 @@ pub const Object = struct {
try o.debug_type_map.put(gpa, ty, debug_bool_type);
return debug_bool_type;
},
- .Pointer => {
+ .pointer => {
// Normalize everything that the debug info does not represent.
const ptr_info = ty.ptrInfo(zcu);
@@ -2126,7 +2126,7 @@ pub const Object = struct {
return debug_ptr_type;
},
- .Opaque => {
+ .@"opaque" => {
if (ty.toIntern() == .anyopaque_type) {
const debug_opaque_type = try o.builder.debugSignedType(
try o.builder.metadataString("anyopaque"),
@@ -2158,7 +2158,7 @@ pub const Object = struct {
try o.debug_type_map.put(gpa, ty, debug_opaque_type);
return debug_opaque_type;
},
- .Array => {
+ .array => {
const debug_array_type = try o.builder.debugArrayType(
.none, // Name
.none, // File
@@ -2177,14 +2177,14 @@ pub const Object = struct {
try o.debug_type_map.put(gpa, ty, debug_array_type);
return debug_array_type;
},
- .Vector => {
+ .vector => {
const elem_ty = ty.elemType2(zcu);
// Vector elements cannot be padded since that would make
// @bitSizOf(elem) * len > @bitSizOf(vec).
// Neither gdb nor lldb seem to be able to display non-byte sized
// vectors properly.
const debug_elem_type = switch (elem_ty.zigTypeTag(zcu)) {
- .Int => blk: {
+ .int => blk: {
const info = elem_ty.intInfo(zcu);
assert(info.bits != 0);
const name = try o.allocTypeName(ty);
@@ -2195,7 +2195,7 @@ pub const Object = struct {
.unsigned => try o.builder.debugUnsignedType(builder_name, info.bits),
};
},
- .Bool => try o.builder.debugBoolType(
+ .bool => try o.builder.debugBoolType(
try o.builder.metadataString("bool"),
1,
),
@@ -2221,7 +2221,7 @@ pub const Object = struct {
try o.debug_type_map.put(gpa, ty, debug_vector_type);
return debug_vector_type;
},
- .Optional => {
+ .optional => {
const name = try o.allocTypeName(ty);
defer gpa.free(name);
const child_ty = ty.optionalChild(zcu);
@@ -2302,7 +2302,7 @@ pub const Object = struct {
return debug_optional_type;
},
- .ErrorUnion => {
+ .error_union => {
const payload_ty = ty.errorUnionPayload(zcu);
if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
// TODO: Maybe remove?
@@ -2375,7 +2375,7 @@ pub const Object = struct {
try o.debug_type_map.put(gpa, ty, debug_error_union_type);
return debug_error_union_type;
},
- .ErrorSet => {
+ .error_set => {
const debug_error_set = try o.builder.debugUnsignedType(
try o.builder.metadataString("anyerror"),
16,
@@ -2383,7 +2383,7 @@ pub const Object = struct {
try o.debug_type_map.put(gpa, ty, debug_error_set);
return debug_error_set;
},
- .Struct => {
+ .@"struct" => {
const name = try o.allocTypeName(ty);
defer gpa.free(name);
@@ -2531,7 +2531,7 @@ pub const Object = struct {
return debug_struct_type;
},
- .Union => {
+ .@"union" => {
const name = try o.allocTypeName(ty);
defer gpa.free(name);
@@ -2693,7 +2693,7 @@ pub const Object = struct {
return debug_tagged_union_type;
},
- .Fn => {
+ .@"fn" => {
const fn_info = zcu.typeToFunc(ty).?;
var debug_param_types = std.ArrayList(Builder.Metadata).init(gpa);
@@ -2741,15 +2741,15 @@ pub const Object = struct {
try o.debug_type_map.put(gpa, ty, debug_function_type);
return debug_function_type;
},
- .ComptimeInt => unreachable,
- .ComptimeFloat => unreachable,
- .Type => unreachable,
- .Undefined => unreachable,
- .Null => unreachable,
- .EnumLiteral => unreachable,
+ .comptime_int => unreachable,
+ .comptime_float => unreachable,
+ .type => unreachable,
+ .undefined => unreachable,
+ .null => unreachable,
+ .enum_literal => unreachable,
- .Frame => @panic("TODO implement lowerDebugType for Frame types"),
- .AnyFrame => @panic("TODO implement lowerDebugType for AnyFrame types"),
+ .frame => @panic("TODO implement lowerDebugType for Frame types"),
+ .@"anyframe" => @panic("TODO implement lowerDebugType for AnyFrame types"),
}
}
@@ -3539,9 +3539,9 @@ pub const Object = struct {
const pt = o.pt;
const zcu = pt.zcu;
const lower_elem_ty = switch (elem_ty.zigTypeTag(zcu)) {
- .Opaque => true,
- .Fn => !zcu.typeToFunc(elem_ty).?.is_generic,
- .Array => elem_ty.childType(zcu).hasRuntimeBitsIgnoreComptime(zcu),
+ .@"opaque" => true,
+ .@"fn" => !zcu.typeToFunc(elem_ty).?.is_generic,
+ .array => elem_ty.childType(zcu).hasRuntimeBitsIgnoreComptime(zcu),
else => elem_ty.hasRuntimeBitsIgnoreComptime(zcu),
};
return if (lower_elem_ty) try o.lowerType(elem_ty) else .i8;
@@ -3883,7 +3883,7 @@ pub const Object = struct {
},
else => |payload| try o.lowerValue(payload),
};
- assert(payload_ty.zigTypeTag(zcu) != .Fn);
+ assert(payload_ty.zigTypeTag(zcu) != .@"fn");
var fields: [3]Builder.Type = undefined;
var vals: [3]Builder.Constant = undefined;
@@ -4303,7 +4303,7 @@ pub const Object = struct {
.field => |field| {
const agg_ty = Value.fromInterned(field.base).typeOf(zcu).childType(zcu);
const field_off: u64 = switch (agg_ty.zigTypeTag(zcu)) {
- .Pointer => off: {
+ .pointer => off: {
assert(agg_ty.isSlice(zcu));
break :off switch (field.index) {
Value.slice_ptr_index => 0,
@@ -4311,7 +4311,7 @@ pub const Object = struct {
else => unreachable,
};
},
- .Struct, .Union => switch (agg_ty.containerLayout(zcu)) {
+ .@"struct", .@"union" => switch (agg_ty.containerLayout(zcu)) {
.auto => agg_ty.structFieldOffset(@intCast(field.index), zcu),
.@"extern", .@"packed" => unreachable,
},
@@ -4344,7 +4344,7 @@ pub const Object = struct {
const ptr_ty = Type.fromInterned(uav.orig_ty);
- const is_fn_body = uav_ty.zigTypeTag(zcu) == .Fn;
+ const is_fn_body = uav_ty.zigTypeTag(zcu) == .@"fn";
if ((!is_fn_body and !uav_ty.hasRuntimeBits(zcu)) or
(is_fn_body and zcu.typeToFunc(uav_ty).?.is_generic)) return o.lowerPtrToVoid(ptr_ty);
@@ -4383,7 +4383,7 @@ pub const Object = struct {
const nav_ty = Type.fromInterned(owner_nav.typeOf(ip));
const ptr_ty = try pt.navPtrType(owner_nav_index);
- const is_fn_body = nav_ty.zigTypeTag(zcu) == .Fn;
+ const is_fn_body = nav_ty.zigTypeTag(zcu) == .@"fn";
if ((!is_fn_body and !nav_ty.hasRuntimeBits(zcu)) or
(is_fn_body and zcu.typeToFunc(nav_ty).?.is_generic))
{
@@ -4435,13 +4435,13 @@ pub const Object = struct {
const pt = o.pt;
const zcu = pt.zcu;
const int_ty = switch (ty.zigTypeTag(zcu)) {
- .Int => ty,
- .Enum => ty.intTagType(zcu),
- .Float => {
+ .int => ty,
+ .@"enum" => ty.intTagType(zcu),
+ .float => {
if (!is_rmw_xchg) return .none;
return o.builder.intType(@intCast(ty.abiSize(zcu) * 8));
},
- .Bool => return .i8,
+ .bool => return .i8,
else => return .none,
};
const bit_count = int_ty.intInfo(zcu).bits;
@@ -4693,7 +4693,7 @@ pub const NavGen = struct {
const global_index = o.nav_map.get(nav_index).?;
const decl_name = decl_name: {
- if (zcu.getTarget().isWasm() and ty.zigTypeTag(zcu) == .Fn) {
+ if (zcu.getTarget().isWasm() and ty.zigTypeTag(zcu) == .@"fn") {
if (lib_name.toSlice(ip)) |lib_name_slice| {
if (!std.mem.eql(u8, lib_name_slice, "c")) {
break :decl_name try o.builder.strtabStringFmt("{}|{s}", .{ nav.name.fmt(ip), lib_name_slice });
@@ -5192,8 +5192,8 @@ pub const FuncGen = struct {
const ip = &zcu.intern_pool;
const callee_ty = self.typeOf(pl_op.operand);
const zig_fn_ty = switch (callee_ty.zigTypeTag(zcu)) {
- .Fn => callee_ty,
- .Pointer => callee_ty.childType(zcu),
+ .@"fn" => callee_ty,
+ .pointer => callee_ty.childType(zcu),
else => unreachable,
};
const fn_info = zcu.typeToFunc(zig_fn_ty).?;
@@ -5410,7 +5410,7 @@ pub const FuncGen = struct {
try attributes.addParamAttr(llvm_arg_i, .@"noalias", &o.builder);
}
}
- if (param_ty.zigTypeTag(zcu) != .Optional) {
+ if (param_ty.zigTypeTag(zcu) != .optional) {
try attributes.addParamAttr(llvm_arg_i, .nonnull, &o.builder);
}
if (ptr_info.flags.is_const) {
@@ -5773,9 +5773,9 @@ pub const FuncGen = struct {
const zcu = pt.zcu;
const scalar_ty = operand_ty.scalarType(zcu);
const int_ty = switch (scalar_ty.zigTypeTag(zcu)) {
- .Enum => scalar_ty.intTagType(zcu),
- .Int, .Bool, .Pointer, .ErrorSet => scalar_ty,
- .Optional => blk: {
+ .@"enum" => scalar_ty.intTagType(zcu),
+ .int, .bool, .pointer, .error_set => scalar_ty,
+ .optional => blk: {
const payload_ty = operand_ty.optionalChild(zcu);
if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu) or
operand_ty.optionalReprIsPayload(zcu))
@@ -5848,7 +5848,7 @@ pub const FuncGen = struct {
);
return phi.toValue();
},
- .Float => return self.buildFloatCmp(fast, op, operand_ty, .{ lhs, rhs }),
+ .float => return self.buildFloatCmp(fast, op, operand_ty, .{ lhs, rhs }),
else => unreachable,
};
const is_signed = int_ty.isSignedInt(zcu);
@@ -5909,7 +5909,7 @@ pub const FuncGen = struct {
// a pointer to it. LLVM IR allows the call instruction to use function bodies instead
// of function pointers, however the phi makes it a runtime value and therefore
// the LLVM type has to be wrapped in a pointer.
- if (inst_ty.zigTypeTag(zcu) == .Fn or isByRef(inst_ty, zcu)) {
+ if (inst_ty.zigTypeTag(zcu) == .@"fn" or isByRef(inst_ty, zcu)) {
break :ty .ptr;
}
break :ty raw_llvm_ty;
@@ -6605,7 +6605,7 @@ pub const FuncGen = struct {
if (!isByRef(struct_ty, zcu)) {
assert(!isByRef(field_ty, zcu));
switch (struct_ty.zigTypeTag(zcu)) {
- .Struct => switch (struct_ty.containerLayout(zcu)) {
+ .@"struct" => switch (struct_ty.containerLayout(zcu)) {
.@"packed" => {
const struct_type = zcu.typeToStruct(struct_ty).?;
const bit_offset = pt.structPackedFieldBitOffset(struct_type, field_index);
@@ -6614,7 +6614,7 @@ pub const FuncGen = struct {
try o.builder.intValue(containing_int.typeOfWip(&self.wip), bit_offset);
const shifted_value = try self.wip.bin(.lshr, containing_int, shift_amt, "");
const elem_llvm_ty = try o.lowerType(field_ty);
- if (field_ty.zigTypeTag(zcu) == .Float or field_ty.zigTypeTag(zcu) == .Vector) {
+ if (field_ty.zigTypeTag(zcu) == .float or field_ty.zigTypeTag(zcu) == .vector) {
const same_size_int = try o.builder.intType(@intCast(field_ty.bitSize(zcu)));
const truncated_int =
try self.wip.cast(.trunc, shifted_value, same_size_int, "");
@@ -6632,11 +6632,11 @@ pub const FuncGen = struct {
return self.wip.extractValue(struct_llvm_val, &.{llvm_field_index}, "");
},
},
- .Union => {
+ .@"union" => {
assert(struct_ty.containerLayout(zcu) == .@"packed");
const containing_int = struct_llvm_val;
const elem_llvm_ty = try o.lowerType(field_ty);
- if (field_ty.zigTypeTag(zcu) == .Float or field_ty.zigTypeTag(zcu) == .Vector) {
+ if (field_ty.zigTypeTag(zcu) == .float or field_ty.zigTypeTag(zcu) == .vector) {
const same_size_int = try o.builder.intType(@intCast(field_ty.bitSize(zcu)));
const truncated_int =
try self.wip.cast(.trunc, containing_int, same_size_int, "");
@@ -6654,7 +6654,7 @@ pub const FuncGen = struct {
}
switch (struct_ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
const layout = struct_ty.containerLayout(zcu);
assert(layout != .@"packed");
const struct_llvm_ty = try o.lowerType(struct_ty);
@@ -6677,7 +6677,7 @@ pub const FuncGen = struct {
return self.load(field_ptr, field_ptr_ty);
}
},
- .Union => {
+ .@"union" => {
const union_llvm_ty = try o.lowerType(struct_ty);
const layout = struct_ty.unionGetLayout(zcu);
const payload_index = @intFromBool(layout.tag_align.compare(.gte, layout.payload_align));
@@ -6934,7 +6934,7 @@ pub const FuncGen = struct {
if (output != .none) {
const output_inst = try self.resolveInst(output);
const output_ty = self.typeOf(output);
- assert(output_ty.zigTypeTag(zcu) == .Pointer);
+ assert(output_ty.zigTypeTag(zcu) == .pointer);
const elem_llvm_ty = try o.lowerPtrElemTy(output_ty.childType(zcu));
switch (constraint[0]) {
@@ -8280,7 +8280,7 @@ pub const FuncGen = struct {
.gte => .sge,
};
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const vec_len = ty.vectorLen(zcu);
const vector_result_ty = try o.builder.vectorType(.normal, vec_len, .i32);
@@ -8457,7 +8457,7 @@ pub const FuncGen = struct {
([1]Builder.Type{scalar_llvm_ty} ** 3)[0..params.len],
scalar_llvm_ty,
);
- if (ty.zigTypeTag(zcu) == .Vector) {
+ if (ty.zigTypeTag(zcu) == .vector) {
const result = try o.builder.poisonValue(llvm_ty);
return self.buildElementwiseCall(libc_fn, ¶ms, result, ty.vectorLen(zcu));
}
@@ -8658,7 +8658,7 @@ pub const FuncGen = struct {
const scalar_ty = operand_ty.scalarType(zcu);
switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => return self.wip.callIntrinsic(
+ .int => return self.wip.callIntrinsic(
.normal,
.none,
.abs,
@@ -8666,7 +8666,7 @@ pub const FuncGen = struct {
&.{ operand, try o.builder.intValue(.i1, 0) },
"",
),
- .Float => return self.buildFloatOp(.fabs, .normal, operand_ty, 1, .{operand}),
+ .float => return self.buildFloatOp(.fabs, .normal, operand_ty, 1, .{operand}),
else => unreachable,
}
}
@@ -8806,11 +8806,11 @@ pub const FuncGen = struct {
return self.wip.conv(.unsigned, operand, llvm_dest_ty, "");
}
- if (operand_ty.zigTypeTag(zcu) == .Int and inst_ty.isPtrAtRuntime(zcu)) {
+ if (operand_ty.zigTypeTag(zcu) == .int and inst_ty.isPtrAtRuntime(zcu)) {
return self.wip.cast(.inttoptr, operand, llvm_dest_ty, "");
}
- if (operand_ty.zigTypeTag(zcu) == .Vector and inst_ty.zigTypeTag(zcu) == .Array) {
+ if (operand_ty.zigTypeTag(zcu) == .vector and inst_ty.zigTypeTag(zcu) == .array) {
const elem_ty = operand_ty.childType(zcu);
if (!result_is_ref) {
return self.ng.todo("implement bitcast vector to non-ref array", .{});
@@ -8837,7 +8837,7 @@ pub const FuncGen = struct {
}
}
return array_ptr;
- } else if (operand_ty.zigTypeTag(zcu) == .Array and inst_ty.zigTypeTag(zcu) == .Vector) {
+ } else if (operand_ty.zigTypeTag(zcu) == .array and inst_ty.zigTypeTag(zcu) == .vector) {
const elem_ty = operand_ty.childType(zcu);
const llvm_vector_ty = try o.lowerType(inst_ty);
if (!operand_is_ref) return self.ng.todo("implement bitcast non-ref array to vector", .{});
@@ -8883,7 +8883,7 @@ pub const FuncGen = struct {
}
if (llvm_dest_ty.isStruct(&o.builder) or
- ((operand_ty.zigTypeTag(zcu) == .Vector or inst_ty.zigTypeTag(zcu) == .Vector) and
+ ((operand_ty.zigTypeTag(zcu) == .vector or inst_ty.zigTypeTag(zcu) == .vector) and
operand_ty.bitSize(zcu) != inst_ty.bitSize(zcu)))
{
// Both our operand and our result are values, not pointers,
@@ -9687,7 +9687,7 @@ pub const FuncGen = struct {
// If not an even byte-multiple, we need zero-extend + shift-left 1 byte
// The truncated result at the end will be the correct bswap
const scalar_ty = try o.builder.intType(@intCast(bits + 8));
- if (operand_ty.zigTypeTag(zcu) == .Vector) {
+ if (operand_ty.zigTypeTag(zcu) == .vector) {
const vec_len = operand_ty.vectorLen(zcu);
llvm_operand_ty = try o.builder.vectorType(.normal, vec_len, scalar_ty);
} else llvm_operand_ty = scalar_ty;
@@ -9993,7 +9993,7 @@ pub const FuncGen = struct {
else => unreachable,
}, &.{llvm_operand_ty}, &.{operand}, ""),
.Min, .Max => switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => return self.wip.callIntrinsic(.normal, .none, switch (reduce.operation) {
+ .int => return self.wip.callIntrinsic(.normal, .none, switch (reduce.operation) {
.Min => if (scalar_ty.isSignedInt(zcu))
.@"vector.reduce.smin"
else
@@ -10004,7 +10004,7 @@ pub const FuncGen = struct {
.@"vector.reduce.umax",
else => unreachable,
}, &.{llvm_operand_ty}, &.{operand}, ""),
- .Float => if (intrinsicsAllowed(scalar_ty, target))
+ .float => if (intrinsicsAllowed(scalar_ty, target))
return self.wip.callIntrinsic(fast, .none, switch (reduce.operation) {
.Min => .@"vector.reduce.fmin",
.Max => .@"vector.reduce.fmax",
@@ -10013,12 +10013,12 @@ pub const FuncGen = struct {
else => unreachable,
},
.Add, .Mul => switch (scalar_ty.zigTypeTag(zcu)) {
- .Int => return self.wip.callIntrinsic(.normal, .none, switch (reduce.operation) {
+ .int => return self.wip.callIntrinsic(.normal, .none, switch (reduce.operation) {
.Add => .@"vector.reduce.add",
.Mul => .@"vector.reduce.mul",
else => unreachable,
}, &.{llvm_operand_ty}, &.{operand}, ""),
- .Float => if (intrinsicsAllowed(scalar_ty, target))
+ .float => if (intrinsicsAllowed(scalar_ty, target))
return self.wip.callIntrinsic(fast, .none, switch (reduce.operation) {
.Add => .@"vector.reduce.fadd",
.Mul => .@"vector.reduce.fmul",
@@ -10095,7 +10095,7 @@ pub const FuncGen = struct {
const llvm_result_ty = try o.lowerType(result_ty);
switch (result_ty.zigTypeTag(zcu)) {
- .Vector => {
+ .vector => {
var vector = try o.builder.poisonValue(llvm_result_ty);
for (elements, 0..) |elem, i| {
const index_u32 = try o.builder.intValue(.i32, i);
@@ -10104,7 +10104,7 @@ pub const FuncGen = struct {
}
return vector;
},
- .Struct => {
+ .@"struct" => {
if (zcu.typeToPackedStruct(result_ty)) |struct_type| {
const backing_int_ty = struct_type.backingIntTypeUnordered(ip);
assert(backing_int_ty != .none);
@@ -10170,7 +10170,7 @@ pub const FuncGen = struct {
return result;
}
},
- .Array => {
+ .array => {
assert(isByRef(result_ty, zcu));
const llvm_usize = try o.lowerType(Type.usize);
@@ -10577,7 +10577,7 @@ pub const FuncGen = struct {
const zcu = pt.zcu;
const struct_ty = struct_ptr_ty.childType(zcu);
switch (struct_ty.zigTypeTag(zcu)) {
- .Struct => switch (struct_ty.containerLayout(zcu)) {
+ .@"struct" => switch (struct_ty.containerLayout(zcu)) {
.@"packed" => {
const result_ty = self.typeOfIndex(inst);
const result_ty_info = result_ty.ptrInfo(zcu);
@@ -10618,7 +10618,7 @@ pub const FuncGen = struct {
}
},
},
- .Union => {
+ .@"union" => {
const layout = struct_ty.unionGetLayout(zcu);
if (layout.payload_size == 0 or struct_ty.containerLayout(zcu) == .@"packed") return struct_ptr;
const payload_index = @intFromBool(layout.tag_align.compare(.gte, layout.payload_align));
@@ -10761,7 +10761,7 @@ pub const FuncGen = struct {
return result_ptr;
}
- if (elem_ty.zigTypeTag(zcu) == .Float or elem_ty.zigTypeTag(zcu) == .Vector) {
+ if (elem_ty.zigTypeTag(zcu) == .float or elem_ty.zigTypeTag(zcu) == .vector) {
const same_size_int = try o.builder.intType(@intCast(elem_bits));
const truncated_int = try self.wip.cast(.trunc, shifted_value, same_size_int, "");
return self.wip.cast(.bitcast, truncated_int, elem_llvm_ty, "");
@@ -11432,7 +11432,7 @@ const ParamTypeIterator = struct {
it.zig_index += 1;
it.llvm_index += 1;
if (ty.isSlice(zcu) or
- (ty.zigTypeTag(zcu) == .Optional and ty.optionalChild(zcu).isSlice(zcu) and !ty.ptrAllowsZero(zcu)))
+ (ty.zigTypeTag(zcu) == .optional and ty.optionalChild(zcu).isSlice(zcu) and !ty.ptrAllowsZero(zcu)))
{
it.llvm_index += 1;
return .slice;
@@ -11707,8 +11707,8 @@ fn ccAbiPromoteInt(
else => {},
}
const int_info = switch (ty.zigTypeTag(zcu)) {
- .Bool => Type.u1.intInfo(zcu),
- .Int, .Enum, .ErrorSet => ty.intInfo(zcu),
+ .bool => Type.u1.intInfo(zcu),
+ .int, .@"enum", .error_set => ty.intInfo(zcu),
else => return null,
};
return switch (target.os.tag) {
@@ -11753,30 +11753,30 @@ fn isByRef(ty: Type, zcu: *Zcu) bool {
const ip = &zcu.intern_pool;
switch (ty.zigTypeTag(zcu)) {
- .Type,
- .ComptimeInt,
- .ComptimeFloat,
- .EnumLiteral,
- .Undefined,
- .Null,
- .Opaque,
+ .type,
+ .comptime_int,
+ .comptime_float,
+ .enum_literal,
+ .undefined,
+ .null,
+ .@"opaque",
=> unreachable,
- .NoReturn,
- .Void,
- .Bool,
- .Int,
- .Float,
- .Pointer,
- .ErrorSet,
- .Fn,
- .Enum,
- .Vector,
- .AnyFrame,
+ .noreturn,
+ .void,
+ .bool,
+ .int,
+ .float,
+ .pointer,
+ .error_set,
+ .@"fn",
+ .@"enum",
+ .vector,
+ .@"anyframe",
=> return false,
- .Array, .Frame => return ty.hasRuntimeBits(zcu),
- .Struct => {
+ .array, .frame => return ty.hasRuntimeBits(zcu),
+ .@"struct" => {
const struct_type = switch (ip.indexToKey(ty.toIntern())) {
.anon_struct_type => |tuple| {
var count: usize = 0;
@@ -11807,18 +11807,18 @@ fn isByRef(ty: Type, zcu: *Zcu) bool {
}
return false;
},
- .Union => switch (ty.containerLayout(zcu)) {
+ .@"union" => switch (ty.containerLayout(zcu)) {
.@"packed" => return false,
else => return ty.hasRuntimeBits(zcu),
},
- .ErrorUnion => {
+ .error_union => {
const payload_ty = ty.errorUnionPayload(zcu);
if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
return false;
}
return true;
},
- .Optional => {
+ .optional => {
const payload_ty = ty.optionalChild(zcu);
if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
return false;
@@ -11833,21 +11833,21 @@ fn isByRef(ty: Type, zcu: *Zcu) bool {
fn isScalar(zcu: *Zcu, ty: Type) bool {
return switch (ty.zigTypeTag(zcu)) {
- .Void,
- .Bool,
- .NoReturn,
- .Int,
- .Float,
- .Pointer,
- .Optional,
- .ErrorSet,
- .Enum,
- .AnyFrame,
- .Vector,
+ .void,
+ .bool,
+ .noreturn,
+ .int,
+ .float,
+ .pointer,
+ .optional,
+ .error_set,
+ .@"enum",
+ .@"anyframe",
+ .vector,
=> true,
- .Struct => ty.containerLayout(zcu) == .@"packed",
- .Union => ty.containerLayout(zcu) == .@"packed",
+ .@"struct" => ty.containerLayout(zcu) == .@"packed",
+ .@"union" => ty.containerLayout(zcu) == .@"packed",
else => false,
};
}
diff --git a/src/codegen/llvm/BitcodeReader.zig b/src/codegen/llvm/BitcodeReader.zig
index 668e610a6990..940b96534001 100644
--- a/src/codegen/llvm/BitcodeReader.zig
+++ b/src/codegen/llvm/BitcodeReader.zig
@@ -273,7 +273,7 @@ fn startBlock(bc: *BitcodeReader, block_id: ?u32, new_abbrev_len: u6) !void {
};
try state.abbrevs.abbrevs.ensureTotalCapacity(
bc.allocator,
- @typeInfo(Abbrev.Builtin).Enum.fields.len + abbrevs.len,
+ @typeInfo(Abbrev.Builtin).@"enum".fields.len + abbrevs.len,
);
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 {
.{ .encoding = .{ .vbr = 6 } }, // ops
},
});
- assert(state.abbrevs.abbrevs.items.len == @typeInfo(Abbrev.Builtin).Enum.fields.len);
+ assert(state.abbrevs.abbrevs.items.len == @typeInfo(Abbrev.Builtin).@"enum".fields.len);
for (abbrevs) |abbrev| try state.abbrevs.addAbbrevAssumeCapacity(bc.allocator, abbrev);
}
@@ -448,7 +448,7 @@ const Abbrev = struct {
define_abbrev,
unabbrev_record,
- const first_record_id: u32 = std.math.maxInt(u32) - @typeInfo(Builtin).Enum.fields.len + 1;
+ const first_record_id: u32 = std.math.maxInt(u32) - @typeInfo(Builtin).@"enum".fields.len + 1;
fn toRecordId(builtin: Builtin) u32 {
return first_record_id + @intFromEnum(builtin);
}
diff --git a/src/codegen/llvm/Builder.zig b/src/codegen/llvm/Builder.zig
index 9ada51acadf5..50b43319da0f 100644
--- a/src/codegen/llvm/Builder.zig
+++ b/src/codegen/llvm/Builder.zig
@@ -1115,7 +1115,7 @@ pub const Attribute = union(Kind) {
=> |kind| {
const field = comptime blk: {
@setEvalBranchQuota(10_000);
- for (@typeInfo(Attribute).Union.fields) |field| {
+ for (@typeInfo(Attribute).@"union".fields) |field| {
if (std.mem.eql(u8, field.name, @tagName(kind))) break :blk field;
}
unreachable;
@@ -1232,11 +1232,11 @@ pub const Attribute = union(Kind) {
.dereferenceable_or_null,
=> |size| try writer.print(" {s}({d})", .{ @tagName(attribute), size }),
.nofpclass => |fpclass| {
- const Int = @typeInfo(FpClass).Struct.backing_integer.?;
+ const Int = @typeInfo(FpClass).@"struct".backing_integer.?;
try writer.print(" {s}(", .{@tagName(attribute)});
var any = false;
var remaining: Int = @bitCast(fpclass);
- inline for (@typeInfo(FpClass).Struct.decls) |decl| {
+ inline for (@typeInfo(FpClass).@"struct".decls) |decl| {
const pattern: Int = @bitCast(@field(FpClass, decl.name));
if (remaining & pattern == pattern) {
if (!any) {
@@ -1259,7 +1259,7 @@ pub const Attribute = union(Kind) {
.allockind => |allockind| {
try writer.print(" {s}(\"", .{@tagName(attribute)});
var any = false;
- inline for (@typeInfo(AllocKind).Struct.fields) |field| {
+ inline for (@typeInfo(AllocKind).@"struct".fields) |field| {
if (comptime std.mem.eql(u8, field.name, "_")) continue;
if (@field(allockind, field.name)) {
if (!any) {
@@ -1418,7 +1418,7 @@ pub const Attribute = union(Kind) {
none = std.math.maxInt(u32),
_,
- pub const len = @typeInfo(Kind).Enum.fields.len - 2;
+ pub const len = @typeInfo(Kind).@"enum".fields.len - 2;
pub fn fromString(str: String) Kind {
assert(!str.isAnon());
@@ -5037,7 +5037,7 @@ pub const Function = struct {
index: Instruction.ExtraIndex,
) struct { data: T, trail: ExtraDataTrail } {
var result: T = undefined;
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
inline for (fields, self.extra[index..][0..fields.len]) |field, value|
@field(result, field.name) = switch (field.type) {
u32 => value,
@@ -6151,7 +6151,7 @@ pub const WipFunction = struct {
fn addExtra(wip_extra: *@This(), extra: anytype) Instruction.ExtraIndex {
const result = wip_extra.index;
- inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
const value = @field(extra, field.name);
wip_extra.items[wip_extra.index] = switch (field.type) {
u32 => value,
@@ -6175,7 +6175,7 @@ pub const WipFunction = struct {
}
fn appendSlice(wip_extra: *@This(), slice: anytype) void {
- if (@typeInfo(@TypeOf(slice)).Pointer.child == Value)
+ if (@typeInfo(@TypeOf(slice)).pointer.child == Value)
@compileError("use appendMappedValues");
const data: []const u32 = @ptrCast(slice);
@memcpy(wip_extra.items[wip_extra.index..][0..data.len], data);
@@ -6760,7 +6760,7 @@ pub const WipFunction = struct {
) Allocator.Error!void {
try self.extra.ensureUnusedCapacity(
self.builder.gpa,
- count * (@typeInfo(Extra).Struct.fields.len + trail_len),
+ count * (@typeInfo(Extra).@"struct".fields.len + trail_len),
);
}
@@ -6799,7 +6799,7 @@ pub const WipFunction = struct {
fn addExtraAssumeCapacity(self: *WipFunction, extra: anytype) Instruction.ExtraIndex {
const result: Instruction.ExtraIndex = @intCast(self.extra.items.len);
- inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
const value = @field(extra, field.name);
self.extra.appendAssumeCapacity(switch (field.type) {
u32 => value,
@@ -6848,7 +6848,7 @@ pub const WipFunction = struct {
index: Instruction.ExtraIndex,
) struct { data: T, trail: ExtraDataTrail } {
var result: T = undefined;
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
inline for (fields, self.extra.items[index..][0..fields.len]) |field, value|
@field(result, field.name) = switch (field.type) {
u32 => value,
@@ -7926,17 +7926,17 @@ pub const Metadata = enum(u32) {
writer: anytype,
) @TypeOf(writer).Error!void {
var need_pipe = false;
- inline for (@typeInfo(DIFlags).Struct.fields) |field| {
+ inline for (@typeInfo(DIFlags).@"struct".fields) |field| {
switch (@typeInfo(field.type)) {
- .Bool => if (@field(self, field.name)) {
+ .bool => if (@field(self, field.name)) {
if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
try writer.print("DIFlag{s}", .{field.name});
},
- .Enum => if (@field(self, field.name) != .Zero) {
+ .@"enum" => if (@field(self, field.name) != .Zero) {
if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
try writer.print("DIFlag{s}", .{@tagName(@field(self, field.name))});
},
- .Int => assert(@field(self, field.name) == 0),
+ .int => assert(@field(self, field.name) == 0),
else => @compileError("bad field type: " ++ field.name ++ ": " ++
@typeName(field.type)),
}
@@ -7988,17 +7988,17 @@ pub const Metadata = enum(u32) {
writer: anytype,
) @TypeOf(writer).Error!void {
var need_pipe = false;
- inline for (@typeInfo(DISPFlags).Struct.fields) |field| {
+ inline for (@typeInfo(DISPFlags).@"struct".fields) |field| {
switch (@typeInfo(field.type)) {
- .Bool => if (@field(self, field.name)) {
+ .bool => if (@field(self, field.name)) {
if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
try writer.print("DISPFlag{s}", .{field.name});
},
- .Enum => if (@field(self, field.name) != .Zero) {
+ .@"enum" => if (@field(self, field.name) != .Zero) {
if (need_pipe) try writer.writeAll(" | ") else need_pipe = true;
try writer.print("DISPFlag{s}", .{@tagName(@field(self, field.name))});
},
- .Int => assert(@field(self, field.name) == 0),
+ .int => assert(@field(self, field.name) == 0),
else => @compileError("bad field type: " ++ field.name ++ ": " ++
@typeName(field.type)),
}
@@ -8281,16 +8281,16 @@ pub const Metadata = enum(u32) {
}!std.fmt.Formatter(format) {
const Node = @TypeOf(node);
const MaybeNode = switch (@typeInfo(Node)) {
- .Optional => Node,
- .Null => ?noreturn,
+ .optional => Node,
+ .null => ?noreturn,
else => ?Node,
};
- const Some = @typeInfo(MaybeNode).Optional.child;
+ const Some = @typeInfo(MaybeNode).optional.child;
return .{ .data = .{
.formatter = formatter,
.prefix = prefix,
.node = if (@as(MaybeNode, node)) |some| switch (@typeInfo(Some)) {
- .Enum => |enum_info| switch (Some) {
+ .@"enum" => |enum_info| switch (Some) {
Metadata => switch (some) {
.none => .none,
else => try formatter.refUnwrapped(some.unwrap(formatter.builder)),
@@ -8301,18 +8301,18 @@ pub const Metadata = enum(u32) {
else
@compileError("unknown type to format: " ++ @typeName(Node)),
},
- .EnumLiteral => .{ .raw = @tagName(some) },
- .Bool => .{ .bool = some },
- .Struct => switch (Some) {
+ .enum_literal => .{ .raw = @tagName(some) },
+ .bool => .{ .bool = some },
+ .@"struct" => switch (Some) {
DIFlags => .{ .di_flags = some },
Subprogram.DISPFlags => .{ .sp_flags = some },
else => @compileError("unknown type to format: " ++ @typeName(Node)),
},
- .Int, .ComptimeInt => .{ .u64 = some },
- .Pointer => .{ .raw = some },
+ .int, .comptime_int => .{ .u64 = some },
+ .pointer => .{ .raw = some },
else => @compileError("unknown type to format: " ++ @typeName(Node)),
} else switch (@typeInfo(Node)) {
- .Optional, .Null => .none,
+ .optional, .null => .none,
else => unreachable,
},
} };
@@ -8414,7 +8414,7 @@ pub const Metadata = enum(u32) {
}
fmt_str = fmt_str ++ ")\n";
- var fmt_args: @Type(.{ .Struct = .{
+ var fmt_args: @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &fields,
.decls = &.{},
@@ -8501,10 +8501,10 @@ pub fn init(options: Options) Allocator.Error!Builder {
}
{
- const static_len = @typeInfo(Type).Enum.fields.len - 1;
+ const static_len = @typeInfo(Type).@"enum".fields.len - 1;
try self.type_map.ensureTotalCapacity(self.gpa, static_len);
try self.type_items.ensureTotalCapacity(self.gpa, static_len);
- inline for (@typeInfo(Type.Simple).Enum.fields) |simple_field| {
+ inline for (@typeInfo(Type.Simple).@"enum".fields) |simple_field| {
const result = self.getOrPutTypeNoExtraAssumeCapacity(
.{ .tag = .simple, .data = simple_field.value },
);
@@ -9031,14 +9031,14 @@ pub fn getIntrinsic(
pub fn intConst(self: *Builder, ty: Type, value: anytype) Allocator.Error!Constant {
const int_value = switch (@typeInfo(@TypeOf(value))) {
- .Int, .ComptimeInt => value,
- .Enum => @intFromEnum(value),
+ .int, .comptime_int => value,
+ .@"enum" => @intFromEnum(value),
else => @compileError("intConst expected an integral value, got " ++ @typeName(@TypeOf(value))),
};
var limbs: [
switch (@typeInfo(@TypeOf(int_value))) {
- .Int => |info| std.math.big.int.calcTwosCompLimbCount(info.bits),
- .ComptimeInt => std.math.big.int.calcLimbLen(int_value),
+ .int => |info| std.math.big.int.calcTwosCompLimbCount(info.bits),
+ .comptime_int => std.math.big.int.calcLimbLen(int_value),
else => unreachable,
}
]std.math.big.Limb = undefined;
@@ -10759,7 +10759,7 @@ fn ensureUnusedTypeCapacity(
try self.type_items.ensureUnusedCapacity(self.gpa, count);
try self.type_extra.ensureUnusedCapacity(
self.gpa,
- count * (@typeInfo(Extra).Struct.fields.len + trail_len),
+ count * (@typeInfo(Extra).@"struct".fields.len + trail_len),
);
}
@@ -10789,7 +10789,7 @@ fn getOrPutTypeNoExtraAssumeCapacity(self: *Builder, item: Type.Item) struct { n
fn addTypeExtraAssumeCapacity(self: *Builder, extra: anytype) Type.Item.ExtraIndex {
const result: Type.Item.ExtraIndex = @intCast(self.type_extra.items.len);
- inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
const value = @field(extra, field.name);
self.type_extra.appendAssumeCapacity(switch (field.type) {
u32 => value,
@@ -10827,7 +10827,7 @@ fn typeExtraDataTrail(
index: Type.Item.ExtraIndex,
) struct { data: T, trail: TypeExtraDataTrail } {
var result: T = undefined;
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
inline for (fields, self.type_extra.items[index..][0..fields.len]) |field, value|
@field(result, field.name) = switch (field.type) {
u32 => value,
@@ -11642,7 +11642,7 @@ fn ensureUnusedConstantCapacity(
try self.constant_items.ensureUnusedCapacity(self.gpa, count);
try self.constant_extra.ensureUnusedCapacity(
self.gpa,
- count * (@typeInfo(Extra).Struct.fields.len + trail_len),
+ count * (@typeInfo(Extra).@"struct".fields.len + trail_len),
);
}
@@ -11717,7 +11717,7 @@ fn getOrPutConstantAggregateAssumeCapacity(
fn addConstantExtraAssumeCapacity(self: *Builder, extra: anytype) Constant.Item.ExtraIndex {
const result: Constant.Item.ExtraIndex = @intCast(self.constant_extra.items.len);
- inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
const value = @field(extra, field.name);
self.constant_extra.appendAssumeCapacity(switch (field.type) {
u32 => value,
@@ -11756,7 +11756,7 @@ fn constantExtraDataTrail(
index: Constant.Item.ExtraIndex,
) struct { data: T, trail: ConstantExtraDataTrail } {
var result: T = undefined;
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
inline for (fields, self.constant_extra.items[index..][0..fields.len]) |field, value|
@field(result, field.name) = switch (field.type) {
u32 => value,
@@ -11784,13 +11784,13 @@ fn ensureUnusedMetadataCapacity(
try self.metadata_items.ensureUnusedCapacity(self.gpa, count);
try self.metadata_extra.ensureUnusedCapacity(
self.gpa,
- count * (@typeInfo(Extra).Struct.fields.len + trail_len),
+ count * (@typeInfo(Extra).@"struct".fields.len + trail_len),
);
}
fn addMetadataExtraAssumeCapacity(self: *Builder, extra: anytype) Metadata.Item.ExtraIndex {
const result: Metadata.Item.ExtraIndex = @intCast(self.metadata_extra.items.len);
- inline for (@typeInfo(@TypeOf(extra)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(extra)).@"struct".fields) |field| {
const value = @field(extra, field.name);
self.metadata_extra.appendAssumeCapacity(switch (field.type) {
u32 => value,
@@ -11829,7 +11829,7 @@ fn metadataExtraDataTrail(
index: Metadata.Item.ExtraIndex,
) struct { data: T, trail: MetadataExtraDataTrail } {
var result: T = undefined;
- const fields = @typeInfo(T).Struct.fields;
+ const fields = @typeInfo(T).@"struct".fields;
inline for (fields, self.metadata_extra.items[index..][0..fields.len]) |field, value|
@field(result, field.name) = switch (field.type) {
u32 => value,
@@ -13921,7 +13921,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
const MetadataKindBlock = ir.MetadataKindBlock;
var metadata_kind_block = try module_block.enterSubBlock(MetadataKindBlock, true);
- inline for (@typeInfo(ir.FixedMetadataKind).Enum.fields) |field| {
+ inline for (@typeInfo(ir.FixedMetadataKind).@"enum".fields) |field| {
// don't include `dbg` in stripped functions
if (!(self.strip and std.mem.eql(u8, field.name, "dbg"))) {
try metadata_kind_block.writeAbbrev(MetadataKindBlock.Kind{
@@ -14197,7 +14197,7 @@ pub fn toBitcode(self: *Builder, allocator: Allocator) bitcode_writer.Error![]co
const limbs_len = std.math.divCeil(u32, extra.bit_width, 64) catch unreachable;
try record.ensureTotalCapacity(self.gpa, 3 + limbs_len);
record.appendAssumeCapacity(@as(
- @typeInfo(MetadataBlock.Enumerator.Flags).Struct.backing_integer.?,
+ @typeInfo(MetadataBlock.Enumerator.Flags).@"struct".backing_integer.?,
@bitCast(flags),
));
record.appendAssumeCapacity(extra.bit_width);
diff --git a/src/codegen/llvm/bitcode_writer.zig b/src/codegen/llvm/bitcode_writer.zig
index 0b821a32e7e1..049a15fe179c 100644
--- a/src/codegen/llvm/bitcode_writer.zig
+++ b/src/codegen/llvm/bitcode_writer.zig
@@ -407,14 +407,14 @@ fn charTo6Bit(c: u8) u8 {
fn BufType(comptime T: type, comptime min_len: usize) type {
return std.meta.Int(.unsigned, @max(min_len, @bitSizeOf(switch (@typeInfo(T)) {
- .ComptimeInt => u32,
- .Int => |info| if (info.signedness == .unsigned)
+ .comptime_int => u32,
+ .int => |info| if (info.signedness == .unsigned)
T
else
@compileError("Unsupported type: " ++ @typeName(T)),
- .Enum => |info| info.tag_type,
- .Bool => u1,
- .Struct => |info| switch (info.layout) {
+ .@"enum" => |info| info.tag_type,
+ .bool => u1,
+ .@"struct" => |info| switch (info.layout) {
.auto, .@"extern" => @compileError("Unsupported type: " ++ @typeName(T)),
.@"packed" => std.meta.Int(.unsigned, @bitSizeOf(T)),
},
@@ -424,10 +424,10 @@ fn BufType(comptime T: type, comptime min_len: usize) type {
fn bufValue(value: anytype, comptime min_len: usize) BufType(@TypeOf(value), min_len) {
return switch (@typeInfo(@TypeOf(value))) {
- .ComptimeInt, .Int => @intCast(value),
- .Enum => @intFromEnum(value),
- .Bool => @intFromBool(value),
- .Struct => @intCast(@as(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))),
+ .comptime_int, .int => @intCast(value),
+ .@"enum" => @intFromEnum(value),
+ .bool => @intFromBool(value),
+ .@"struct" => @intCast(@as(std.meta.Int(.unsigned, @bitSizeOf(@TypeOf(value))), @bitCast(value))),
else => unreachable,
};
}
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig
index d1df1ba77ead..345e80a23c4c 100644
--- a/src/codegen/spirv.zig
+++ b/src/codegen/spirv.zig
@@ -439,7 +439,7 @@ const NavGen = struct {
const zcu = pt.zcu;
if (try self.air.value(inst, pt)) |val| {
const ty = self.typeOf(inst);
- if (ty.zigTypeTag(zcu) == .Fn) {
+ if (ty.zigTypeTag(zcu) == .@"fn") {
const fn_nav = switch (zcu.intern_pool.indexToKey(val.ip_index)) {
.@"extern" => |@"extern"| @"extern".owner_nav,
.func => |func| func.owner_nav,
@@ -641,16 +641,16 @@ const NavGen = struct {
fn isSpvVector(self: *NavGen, ty: Type) bool {
const zcu = self.pt.zcu;
const target = self.getTarget();
- if (ty.zigTypeTag(zcu) != .Vector) return false;
+ if (ty.zigTypeTag(zcu) != .vector) return false;
// TODO: This check must be expanded for types that can be represented
// as integers (enums / packed structs?) and types that are represented
// by multiple SPIR-V values.
const scalar_ty = ty.scalarType(zcu);
switch (scalar_ty.zigTypeTag(zcu)) {
- .Bool,
- .Int,
- .Float,
+ .bool,
+ .int,
+ .float,
=> {},
else => return false,
}
@@ -668,26 +668,26 @@ const NavGen = struct {
const zcu = self.pt.zcu;
const target = self.getTarget();
var scalar_ty = ty.scalarType(zcu);
- if (scalar_ty.zigTypeTag(zcu) == .Enum) {
+ if (scalar_ty.zigTypeTag(zcu) == .@"enum") {
scalar_ty = scalar_ty.intTagType(zcu);
}
const vector_len = if (ty.isVector(zcu)) ty.vectorLen(zcu) else null;
return switch (scalar_ty.zigTypeTag(zcu)) {
- .Bool => ArithmeticTypeInfo{
+ .bool => ArithmeticTypeInfo{
.bits = 1, // Doesn't matter for this class.
.backing_bits = self.backingIntBits(1).?,
.vector_len = vector_len,
.signedness = .unsigned, // Technically, but doesn't matter for this class.
.class = .bool,
},
- .Float => ArithmeticTypeInfo{
+ .float => ArithmeticTypeInfo{
.bits = scalar_ty.floatBits(target),
.backing_bits = scalar_ty.floatBits(target), // TODO: F80?
.vector_len = vector_len,
.signedness = .signed, // Technically, but doesn't matter for this class.
.class = .float,
},
- .Int => blk: {
+ .int => blk: {
const int_info = scalar_ty.intInfo(zcu);
// TODO: Maybe it's useful to also return this value.
const maybe_backing_bits = self.backingIntBits(int_info.bits);
@@ -705,8 +705,8 @@ const NavGen = struct {
.composite_integer,
};
},
- .Enum => unreachable,
- .Vector => unreachable,
+ .@"enum" => unreachable,
+ .vector => unreachable,
else => unreachable, // Unhandled arithmetic type
};
}
@@ -748,8 +748,8 @@ const NavGen = struct {
const backing_bits = self.backingIntBits(int_info.bits).?; // Assertion failure means big int
const signedness: Signedness = switch (@typeInfo(@TypeOf(value))) {
- .Int => |int| int.signedness,
- .ComptimeInt => if (value < 0) .signed else .unsigned,
+ .int => |int| int.signedness,
+ .comptime_int => if (value < 0) .signed else .unsigned,
else => unreachable,
};
@@ -1243,7 +1243,7 @@ const NavGen = struct {
else => {},
}
- // const is_fn_body = decl_ty.zigTypeTag(zcu) == .Fn;
+ // const is_fn_body = decl_ty.zigTypeTag(zcu) == .@"fn";
if (!uav_ty.isFnOrHasRuntimeBitsIgnoreComptime(zcu)) {
// Pointer to nothing - return undefined
return self.spv.constUndef(ty_id);
@@ -1539,11 +1539,11 @@ const NavGen = struct {
const section = &self.spv.sections.types_globals_constants;
switch (ty.zigTypeTag(zcu)) {
- .NoReturn => {
+ .noreturn => {
assert(repr == .direct);
return try self.spv.voidType();
},
- .Void => switch (repr) {
+ .void => switch (repr) {
.direct => {
return try self.spv.voidType();
},
@@ -1557,11 +1557,11 @@ const NavGen = struct {
return result_id;
},
},
- .Bool => switch (repr) {
+ .bool => switch (repr) {
.direct => return try self.spv.boolType(),
.indirect => return try self.resolveType(Type.u1, .indirect),
},
- .Int => {
+ .int => {
const int_info = ty.intInfo(zcu);
if (int_info.bits == 0) {
// Some times, the backend will be asked to generate a pointer to i0. OpTypeInt
@@ -1576,11 +1576,11 @@ const NavGen = struct {
}
return try self.intType(int_info.signedness, int_info.bits);
},
- .Enum => {
+ .@"enum" => {
const tag_ty = ty.intTagType(zcu);
return try self.resolveType(tag_ty, repr);
},
- .Float => {
+ .float => {
// We can (and want) not really emulate floating points with other floating point types like with the integer types,
// so if the float is not supported, just return an error.
const bits = ty.floatBits(target);
@@ -1598,7 +1598,7 @@ const NavGen = struct {
return try self.spv.floatType(bits);
},
- .Array => {
+ .array => {
const elem_ty = ty.childType(zcu);
const elem_ty_id = try self.resolveType(elem_ty, .indirect);
const total_len = std.math.cast(u32, ty.arrayLenIncludingSentinel(zcu)) orelse {
@@ -1633,7 +1633,7 @@ const NavGen = struct {
return try self.arrayType(total_len, elem_ty_id);
}
},
- .Fn => switch (repr) {
+ .@"fn" => switch (repr) {
.direct => {
const fn_info = zcu.typeToFunc(ty).?;
@@ -1676,7 +1676,7 @@ const NavGen = struct {
return try self.resolveType(Type.usize, .indirect);
},
},
- .Pointer => {
+ .pointer => {
const ptr_info = ty.ptrInfo(zcu);
const storage_class = self.spvStorageClass(ptr_info.flags.address_space);
@@ -1692,7 +1692,7 @@ const NavGen = struct {
&.{ "ptr", "len" },
);
},
- .Vector => {
+ .vector => {
const elem_ty = ty.childType(zcu);
const elem_ty_id = try self.resolveType(elem_ty, repr);
const len = ty.vectorLen(zcu);
@@ -1703,7 +1703,7 @@ const NavGen = struct {
return try self.arrayType(len, elem_ty_id);
}
},
- .Struct => {
+ .@"struct" => {
const struct_type = switch (ip.indexToKey(ty.toIntern())) {
.anon_struct_type => |tuple| {
const member_types = try self.gpa.alloc(IdRef, tuple.values.len);
@@ -1757,7 +1757,7 @@ const NavGen = struct {
try self.spv.debugName(result_id, type_name);
return result_id;
},
- .Optional => {
+ .optional => {
const payload_ty = ty.optionalChild(zcu);
if (!payload_ty.hasRuntimeBitsIgnoreComptime(zcu)) {
// Just use a bool.
@@ -1779,9 +1779,9 @@ const NavGen = struct {
&.{ "payload", "valid" },
);
},
- .Union => return try self.resolveUnionType(ty),
- .ErrorSet => return try self.resolveType(Type.u16, repr),
- .ErrorUnion => {
+ .@"union" => return try self.resolveUnionType(ty),
+ .error_set => return try self.resolveType(Type.u16, repr),
+ .error_union => {
const payload_ty = ty.errorUnionPayload(zcu);
const error_ty_id = try self.resolveType(Type.anyerror, .indirect);
@@ -1808,7 +1808,7 @@ const NavGen = struct {
return try self.spv.structType(&member_types, &member_names);
},
- .Opaque => {
+ .@"opaque" => {
const type_name = try self.resolveTypeName(ty);
defer self.gpa.free(type_name);
@@ -1820,15 +1820,15 @@ const NavGen = struct {
return result_id;
},
- .Null,
- .Undefined,
- .EnumLiteral,
- .ComptimeFloat,
- .ComptimeInt,
- .Type,
+ .null,
+ .undefined,
+ .enum_literal,
+ .comptime_float,
+ .comptime_int,
+ .type,
=> unreachable, // Must be comptime.
- .Frame, .AnyFrame => unreachable, // TODO
+ .frame, .@"anyframe" => unreachable, // TODO
}
}
@@ -2429,7 +2429,7 @@ const NavGen = struct {
const op_result_ty_id = try self.resolveType(op_result_ty, .direct);
const result_ty = try v.resultType(self, lhs.ty);
- assert(condition.ty.scalarType(zcu).zigTypeTag(zcu) == .Bool);
+ assert(condition.ty.scalarType(zcu).zigTypeTag(zcu) == .bool);
const cond = try v.prepare(self, condition);
const object_1 = try v.prepare(self, lhs);
@@ -3119,7 +3119,7 @@ const NavGen = struct {
fn convertToDirect(self: *NavGen, ty: Type, operand_id: IdRef) !IdRef {
const zcu = self.pt.zcu;
switch (ty.scalarType(zcu).zigTypeTag(zcu)) {
- .Bool => {
+ .bool => {
const false_id = try self.constBool(false, .indirect);
// The operation below requires inputs in direct representation, but the operand
// is actually in indirect representation.
@@ -3145,7 +3145,7 @@ const NavGen = struct {
fn convertToIndirect(self: *NavGen, ty: Type, operand_id: IdRef) !IdRef {
const zcu = self.pt.zcu;
switch (ty.scalarType(zcu).zigTypeTag(zcu)) {
- .Bool => {
+ .bool => {
const result = try self.intFromBool(Temporary.init(ty, operand_id));
return try result.materialize(self);
},
@@ -4281,17 +4281,17 @@ const NavGen = struct {
const is_vector = lhs.ty.isVector(zcu);
switch (scalar_ty.zigTypeTag(zcu)) {
- .Int, .Bool, .Float => {},
- .Enum => {
+ .int, .bool, .float => {},
+ .@"enum" => {
assert(!is_vector);
const ty = lhs.ty.intTagType(zcu);
return try self.cmp(op, lhs.pun(ty), rhs.pun(ty));
},
- .ErrorSet => {
+ .error_set => {
assert(!is_vector);
return try self.cmp(op, lhs.pun(Type.u16), rhs.pun(Type.u16));
},
- .Pointer => {
+ .pointer => {
assert(!is_vector);
// Note that while SPIR-V offers OpPtrEqual and OpPtrNotEqual, they are
// currently not implemented in the SPIR-V LLVM translator. Thus, we emit these using
@@ -4317,7 +4317,7 @@ const NavGen = struct {
const rhs_int = Temporary.init(Type.usize, rhs_int_id);
return try self.cmp(op, lhs_int, rhs_int);
},
- .Optional => {
+ .optional => {
assert(!is_vector);
const ty = lhs.ty;
@@ -4478,7 +4478,7 @@ const NavGen = struct {
// TODO: Some more cases are missing here
// See fn bitCast in llvm.zig
- if (src_ty.zigTypeTag(zcu) == .Int and dst_ty.isPtrAtRuntime(zcu)) {
+ if (src_ty.zigTypeTag(zcu) == .int and dst_ty.isPtrAtRuntime(zcu)) {
const result_id = self.spv.allocId();
try self.func.body.emit(self.spv.gpa, .OpConvertUToPtr, .{
.id_result_type = dst_ty_id,
@@ -4520,7 +4520,7 @@ const NavGen = struct {
// the result here.
// TODO: This detail could cause stuff like @as(*const i1, @ptrCast(&@as(u1, 1))) to break
// should we change the representation of strange integers?
- if (dst_ty.zigTypeTag(zcu) == .Int) {
+ if (dst_ty.zigTypeTag(zcu) == .int) {
const info = self.arithmeticTypeInfo(dst_ty);
const result = try self.normalize(Temporary.init(dst_ty, result_id), info);
return try result.materialize(self);
@@ -4729,7 +4729,7 @@ const NavGen = struct {
const elements: []const Air.Inst.Ref = @ptrCast(self.air.extra[ty_pl.payload..][0..len]);
switch (result_ty.zigTypeTag(zcu)) {
- .Struct => {
+ .@"struct" => {
if (zcu.typeToPackedStruct(result_ty)) |struct_type| {
_ = struct_type;
unreachable; // TODO
@@ -4777,7 +4777,7 @@ const NavGen = struct {
constituents[0..index],
);
},
- .Vector => {
+ .vector => {
const n_elems = result_ty.vectorLen(zcu);
const elem_ids = try self.gpa.alloc(IdRef, n_elems);
defer self.gpa.free(elem_ids);
@@ -4788,7 +4788,7 @@ const NavGen = struct {
return try self.constructVector(result_ty, elem_ids);
},
- .Array => {
+ .array => {
const array_info = result_ty.arrayInfo(zcu);
const n_elems: usize = @intCast(result_ty.arrayLenIncludingSentinel(zcu));
const elem_ids = try self.gpa.alloc(IdRef, n_elems);
@@ -5153,11 +5153,11 @@ const NavGen = struct {
if (!field_ty.hasRuntimeBitsIgnoreComptime(zcu)) return null;
switch (object_ty.zigTypeTag(zcu)) {
- .Struct => switch (object_ty.containerLayout(zcu)) {
+ .@"struct" => switch (object_ty.containerLayout(zcu)) {
.@"packed" => unreachable, // TODO
else => return try self.extractField(field_ty, object_id, field_index),
},
- .Union => switch (object_ty.containerLayout(zcu)) {
+ .@"union" => switch (object_ty.containerLayout(zcu)) {
.@"packed" => unreachable, // TODO
else => {
// Store, ptr-elem-ptr, pointer-cast, load
@@ -5229,17 +5229,17 @@ const NavGen = struct {
const zcu = self.pt.zcu;
const object_ty = object_ptr_ty.childType(zcu);
switch (object_ty.zigTypeTag(zcu)) {
- .Pointer => {
+ .pointer => {
assert(object_ty.isSlice(zcu));
return self.accessChain(result_ty_id, object_ptr, &.{field_index});
},
- .Struct => switch (object_ty.containerLayout(zcu)) {
+ .@"struct" => switch (object_ty.containerLayout(zcu)) {
.@"packed" => unreachable, // TODO
else => {
return try self.accessChain(result_ty_id, object_ptr, &.{field_index});
},
},
- .Union => switch (object_ty.containerLayout(zcu)) {
+ .@"union" => switch (object_ty.containerLayout(zcu)) {
.@"packed" => unreachable, // TODO
else => {
const layout = self.unionLayout(object_ty);
@@ -6179,15 +6179,15 @@ const NavGen = struct {
var cond_indirect = try self.convertToIndirect(cond_ty, cond);
const cond_words: u32 = switch (cond_ty.zigTypeTag(zcu)) {
- .Bool, .ErrorSet => 1,
- .Int => blk: {
+ .bool, .error_set => 1,
+ .int => blk: {
const bits = cond_ty.intInfo(zcu).bits;
const backing_bits = self.backingIntBits(bits) orelse {
return self.todo("implement composite int switch", .{});
};
break :blk if (backing_bits <= 32) 1 else 2;
},
- .Enum => blk: {
+ .@"enum" => blk: {
const int_ty = cond_ty.intTagType(zcu);
const int_info = int_ty.intInfo(zcu);
const backing_bits = self.backingIntBits(int_info.bits) orelse {
@@ -6195,7 +6195,7 @@ const NavGen = struct {
};
break :blk if (backing_bits <= 32) 1 else 2;
},
- .Pointer => blk: {
+ .pointer => blk: {
cond_indirect = try self.intFromPtr(cond_indirect);
break :blk target.ptrBitWidth() / 32;
},
@@ -6248,13 +6248,13 @@ const NavGen = struct {
for (case.items) |item| {
const value = (try self.air.value(item, pt)) orelse unreachable;
const int_val: u64 = switch (cond_ty.zigTypeTag(zcu)) {
- .Bool, .Int => if (cond_ty.isSignedInt(zcu)) @bitCast(value.toSignedInt(zcu)) else value.toUnsignedInt(zcu),
- .Enum => blk: {
+ .bool, .int => if (cond_ty.isSignedInt(zcu)) @bitCast(value.toSignedInt(zcu)) else value.toUnsignedInt(zcu),
+ .@"enum" => blk: {
// TODO: figure out of cond_ty is correct (something with enum literals)
break :blk (try value.intFromEnum(cond_ty, pt)).toUnsignedInt(zcu); // TODO: composite integer constants
},
- .ErrorSet => value.getErrorInt(zcu),
- .Pointer => value.toUnsignedInt(zcu),
+ .error_set => value.getErrorInt(zcu),
+ .pointer => value.toUnsignedInt(zcu),
else => unreachable,
};
const int_lit: spec.LiteralContextDependentNumber = switch (cond_words) {
@@ -6496,8 +6496,8 @@ const NavGen = struct {
const args: []const Air.Inst.Ref = @ptrCast(self.air.extra[extra.end..][0..extra.data.args_len]);
const callee_ty = self.typeOf(pl_op.operand);
const zig_fn_ty = switch (callee_ty.zigTypeTag(zcu)) {
- .Fn => callee_ty,
- .Pointer => return self.fail("cannot call function pointers", .{}),
+ .@"fn" => callee_ty,
+ .pointer => return self.fail("cannot call function pointers", .{}),
else => unreachable,
};
const fn_info = zcu.typeToFunc(zig_fn_ty).?;
diff --git a/src/codegen/spirv/Section.zig b/src/codegen/spirv/Section.zig
index d857ce7f46a5..20abf8ab70f6 100644
--- a/src/codegen/spirv/Section.zig
+++ b/src/codegen/spirv/Section.zig
@@ -98,7 +98,7 @@ pub fn emitSpecConstantOp(
section.writeOperand(spec.IdRef, operands.id_result);
section.writeOperand(Opcode, opcode);
- const fields = @typeInfo(opcode.Operands()).Struct.fields;
+ const fields = @typeInfo(opcode.Operands()).@"struct".fields;
// First 2 fields are always id_result_type and id_result.
inline for (fields[2..]) |field| {
section.writeOperand(field.type, @field(operands, field.name));
@@ -122,8 +122,8 @@ pub fn writeDoubleWord(section: *Section, dword: DoubleWord) void {
fn writeOperands(section: *Section, comptime Operands: type, operands: Operands) void {
const fields = switch (@typeInfo(Operands)) {
- .Struct => |info| info.fields,
- .Void => return,
+ .@"struct" => |info| info.fields,
+ .void => return,
else => unreachable,
};
@@ -154,24 +154,24 @@ pub fn writeOperand(section: *Section, comptime Operand: type, operand: Operand)
spec.PairIdRefIdRef => section.writeWords(&.{ @intFromEnum(operand[0]), @intFromEnum(operand[1]) }),
else => switch (@typeInfo(Operand)) {
- .Enum => section.writeWord(@intFromEnum(operand)),
- .Optional => |info| if (operand) |child| {
+ .@"enum" => section.writeWord(@intFromEnum(operand)),
+ .optional => |info| if (operand) |child| {
section.writeOperand(info.child, child);
},
- .Pointer => |info| {
+ .pointer => |info| {
std.debug.assert(info.size == .Slice); // Should be no other pointer types in the spec.
for (operand) |item| {
section.writeOperand(info.child, item);
}
},
- .Struct => |info| {
+ .@"struct" => |info| {
if (info.layout == .@"packed") {
section.writeWord(@as(Word, @bitCast(operand)));
} else {
section.writeExtendedMask(Operand, operand);
}
},
- .Union => section.writeExtendedUnion(Operand, operand),
+ .@"union" => section.writeExtendedUnion(Operand, operand),
else => unreachable,
},
}
@@ -207,12 +207,12 @@ fn writeContextDependentNumber(section: *Section, operand: spec.LiteralContextDe
fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand) void {
var mask: Word = 0;
- inline for (@typeInfo(Operand).Struct.fields, 0..) |field, bit| {
+ inline for (@typeInfo(Operand).@"struct".fields, 0..) |field, bit| {
switch (@typeInfo(field.type)) {
- .Optional => if (@field(operand, field.name) != null) {
+ .optional => if (@field(operand, field.name) != null) {
mask |= 1 << @as(u5, @intCast(bit));
},
- .Bool => if (@field(operand, field.name)) {
+ .bool => if (@field(operand, field.name)) {
mask |= 1 << @as(u5, @intCast(bit));
},
else => unreachable,
@@ -221,12 +221,12 @@ fn writeExtendedMask(section: *Section, comptime Operand: type, operand: Operand
section.writeWord(mask);
- inline for (@typeInfo(Operand).Struct.fields) |field| {
+ inline for (@typeInfo(Operand).@"struct".fields) |field| {
switch (@typeInfo(field.type)) {
- .Optional => |info| if (@field(operand, field.name)) |child| {
+ .optional => |info| if (@field(operand, field.name)) |child| {
section.writeOperands(info.child, child);
},
- .Bool => {},
+ .bool => {},
else => unreachable,
}
}
@@ -236,7 +236,7 @@ fn writeExtendedUnion(section: *Section, comptime Operand: type, operand: Operan
const tag = std.meta.activeTag(operand);
section.writeWord(@intFromEnum(tag));
- inline for (@typeInfo(Operand).Union.fields) |field| {
+ inline for (@typeInfo(Operand).@"union".fields) |field| {
if (@field(Operand, field.name) == tag) {
section.writeOperands(field.type, @field(operand, field.name));
return;
@@ -251,8 +251,8 @@ fn instructionSize(comptime opcode: spec.Opcode, operands: opcode.Operands()) us
fn operandsSize(comptime Operands: type, operands: Operands) usize {
const fields = switch (@typeInfo(Operands)) {
- .Struct => |info| info.fields,
- .Void => return 0,
+ .@"struct" => |info| info.fields,
+ .void => return 0,
else => unreachable,
};
@@ -289,9 +289,9 @@ fn operandSize(comptime Operand: type, operand: Operand) usize {
=> 2,
else => switch (@typeInfo(Operand)) {
- .Enum => 1,
- .Optional => |info| if (operand) |child| operandSize(info.child, child) else 0,
- .Pointer => |info| blk: {
+ .@"enum" => 1,
+ .optional => |info| if (operand) |child| operandSize(info.child, child) else 0,
+ .pointer => |info| blk: {
std.debug.assert(info.size == .Slice); // Should be no other pointer types in the spec.
var total: usize = 0;
for (operand) |item| {
@@ -299,8 +299,8 @@ fn operandSize(comptime Operand: type, operand: Operand) usize {
}
break :blk total;
},
- .Struct => |info| if (info.layout == .@"packed") 1 else extendedMaskSize(Operand, operand),
- .Union => extendedUnionSize(Operand, operand),
+ .@"struct" => |info| if (info.layout == .@"packed") 1 else extendedMaskSize(Operand, operand),
+ .@"union" => extendedUnionSize(Operand, operand),
else => unreachable,
},
};
@@ -309,13 +309,13 @@ fn operandSize(comptime Operand: type, operand: Operand) usize {
fn extendedMaskSize(comptime Operand: type, operand: Operand) usize {
var total: usize = 0;
var any_set = false;
- inline for (@typeInfo(Operand).Struct.fields) |field| {
+ inline for (@typeInfo(Operand).@"struct".fields) |field| {
switch (@typeInfo(field.type)) {
- .Optional => |info| if (@field(operand, field.name)) |child| {
+ .optional => |info| if (@field(operand, field.name)) |child| {
total += operandsSize(info.child, child);
any_set = true;
},
- .Bool => if (@field(operand, field.name)) {
+ .bool => if (@field(operand, field.name)) {
any_set = true;
},
else => unreachable,
@@ -326,7 +326,7 @@ fn extendedMaskSize(comptime Operand: type, operand: Operand) usize {
fn extendedUnionSize(comptime Operand: type, operand: Operand) usize {
const tag = std.meta.activeTag(operand);
- inline for (@typeInfo(Operand).Union.fields) |field| {
+ inline for (@typeInfo(Operand).@"union".fields) |field| {
if (@field(Operand, field.name) == tag) {
// Add one for the tag itself.
return 1 + operandsSize(field.type, @field(operand, field.name));
diff --git a/src/link.zig b/src/link.zig
index 409a50407369..508bc81352fc 100644
--- a/src/link.zig
+++ b/src/link.zig
@@ -936,13 +936,11 @@ pub const File = struct {
missing_libc: bool = false,
const Int = blk: {
- const bits = @typeInfo(@This()).Struct.fields.len;
- break :blk @Type(.{
- .Int = .{
- .signedness = .unsigned,
- .bits = bits,
- },
- });
+ const bits = @typeInfo(@This()).@"struct".fields.len;
+ break :blk @Type(.{ .int = .{
+ .signedness = .unsigned,
+ .bits = bits,
+ } });
};
fn isSet(ef: ErrorFlags) bool {
diff --git a/src/link/Coff.zig b/src/link/Coff.zig
index fffa412f03ae..81f9a29830b0 100644
--- a/src/link/Coff.zig
+++ b/src/link/Coff.zig
@@ -1368,7 +1368,7 @@ fn getNavOutputSection(self: *Coff, nav_index: InternPool.Nav.Index) u16 {
switch (zig_ty) {
// TODO: what if this is a function pointer?
- .Fn => break :blk self.text_section_index.?,
+ .@"fn" => break :blk self.text_section_index.?,
else => {
if (val.getVariable(zcu)) |_| {
break :blk self.data_section_index.?;
diff --git a/src/link/Dwarf.zig b/src/link/Dwarf.zig
index e9bcc573dcd7..e20df300cc13 100644
--- a/src/link/Dwarf.zig
+++ b/src/link/Dwarf.zig
@@ -1756,7 +1756,7 @@ pub const WipNav = struct {
var bit: usize = 0;
var carry: u1 = 1;
while (bit < bits) : (bit += 7) {
- const limb_bits = @typeInfo(std.math.big.Limb).Int.bits;
+ const limb_bits = @typeInfo(std.math.big.Limb).int.bits;
const limb_index = bit / limb_bits;
const limb_shift: std.math.Log2Int(std.math.big.Limb) = @intCast(bit % limb_bits);
const low_abs_part: u7 = @truncate(big_int.limbs[limb_index] >> limb_shift);
@@ -2515,7 +2515,7 @@ pub fn updateComptimeNav(dwarf: *Dwarf, pt: Zcu.PerThread, nav_index: InternPool
) != abbrev_code_buf.len) return error.InputOutput;
var abbrev_code_fbs = std.io.fixedBufferStream(&abbrev_code_buf);
const abbrev_code: AbbrevCode = @enumFromInt(
- std.leb.readUleb128(@typeInfo(AbbrevCode).Enum.tag_type, abbrev_code_fbs.reader()) catch unreachable,
+ std.leb.readUleb128(@typeInfo(AbbrevCode).@"enum".tag_type, abbrev_code_fbs.reader()) catch unreachable,
);
switch (abbrev_code) {
else => unreachable,
@@ -3685,7 +3685,7 @@ pub fn freeNav(dwarf: *Dwarf, nav_index: InternPool.Nav.Index) void {
_ = nav_index;
}
-fn refAbbrevCode(dwarf: *Dwarf, abbrev_code: AbbrevCode) UpdateError!@typeInfo(AbbrevCode).Enum.tag_type {
+fn refAbbrevCode(dwarf: *Dwarf, abbrev_code: AbbrevCode) UpdateError!@typeInfo(AbbrevCode).@"enum".tag_type {
assert(abbrev_code != .null);
const entry: Entry.Index = @enumFromInt(@intFromEnum(abbrev_code));
if (dwarf.debug_abbrev.section.getUnit(DebugAbbrev.unit).getEntry(entry).len > 0) return @intFromEnum(abbrev_code);
@@ -4087,7 +4087,7 @@ pub fn resolveRelocs(dwarf: *Dwarf) RelocError!void {
}
fn DeclValEnum(comptime T: type) type {
- const decls = @typeInfo(T).Struct.decls;
+ const decls = @typeInfo(T).@"struct".decls;
@setEvalBranchQuota(7 * decls.len);
var fields: [decls.len]std.builtin.Type.EnumField = undefined;
var fields_len = 0;
@@ -4101,7 +4101,7 @@ fn DeclValEnum(comptime T: type) type {
if (min_value == null or min_value.? > value) min_value = value;
if (max_value == null or max_value.? < value) max_value = value;
}
- return @Type(.{ .Enum = .{
+ return @Type(.{ .@"enum" = .{
.tag_type = std.math.IntFittingRange(min_value orelse 0, max_value orelse 0),
.fields = fields[0..fields_len],
.decls = &.{},
@@ -4665,7 +4665,7 @@ fn addCommonEntry(dwarf: *Dwarf, unit: Unit.Index) UpdateError!Entry.Index {
fn writeInt(dwarf: *Dwarf, buf: []u8, int: u64) void {
switch (buf.len) {
- inline 0...8 => |len| std.mem.writeInt(@Type(.{ .Int = .{
+ inline 0...8 => |len| std.mem.writeInt(@Type(.{ .int = .{
.signedness = .unsigned,
.bits = len * 8,
} }), buf[0..len], @intCast(int), dwarf.endian),
diff --git a/src/link/Elf/Atom.zig b/src/link/Elf/Atom.zig
index 5981b6ef2c87..10a7aa2b798e 100644
--- a/src/link/Elf/Atom.zig
+++ b/src/link/Elf/Atom.zig
@@ -1008,7 +1008,7 @@ const AddExtraOpts = struct {
pub fn addExtra(atom: *Atom, opts: AddExtraOpts, elf_file: *Elf) void {
const file_ptr = atom.file(elf_file).?;
var extras = file_ptr.atomExtra(atom.extra_index);
- inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| {
if (@field(opts, field.name)) |x| {
@field(extras, field.name) = x;
}
diff --git a/src/link/Elf/LdScript.zig b/src/link/Elf/LdScript.zig
index 2b5c64b50ebb..414ce035a48f 100644
--- a/src/link/Elf/LdScript.zig
+++ b/src/link/Elf/LdScript.zig
@@ -108,7 +108,7 @@ const Command = enum {
as_needed,
fn fromString(s: []const u8) ?Command {
- inline for (@typeInfo(Command).Enum.fields) |field| {
+ inline for (@typeInfo(Command).@"enum".fields) |field| {
const upper_name = n: {
comptime var buf: [field.name.len]u8 = undefined;
inline for (field.name, 0..) |c, i| {
diff --git a/src/link/Elf/LinkerDefined.zig b/src/link/Elf/LinkerDefined.zig
index a75453988212..131ed6ad715a 100644
--- a/src/link/Elf/LinkerDefined.zig
+++ b/src/link/Elf/LinkerDefined.zig
@@ -394,14 +394,14 @@ fn addSymbolAssumeCapacity(self: *LinkerDefined) Symbol.Index {
}
pub fn addSymbolExtra(self: *LinkerDefined, allocator: Allocator, extra: Symbol.Extra) !u32 {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addSymbolExtraAssumeCapacity(extra);
}
pub fn addSymbolExtraAssumeCapacity(self: *LinkerDefined, extra: Symbol.Extra) u32 {
const index = @as(u32, @intCast(self.symbols_extra.items.len));
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields) |field| {
self.symbols_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -412,7 +412,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *LinkerDefined, extra: Symbol.Extra) u
}
pub fn symbolExtra(self: *LinkerDefined, index: u32) Symbol.Extra {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
var i: usize = index;
var result: Symbol.Extra = undefined;
inline for (fields) |field| {
@@ -426,7 +426,7 @@ pub fn symbolExtra(self: *LinkerDefined, index: u32) Symbol.Extra {
}
pub fn setSymbolExtra(self: *LinkerDefined, index: u32, extra: Symbol.Extra) void {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.symbols_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
diff --git a/src/link/Elf/Object.zig b/src/link/Elf/Object.zig
index a19d327fcc18..40d09c8ec409 100644
--- a/src/link/Elf/Object.zig
+++ b/src/link/Elf/Object.zig
@@ -1215,14 +1215,14 @@ fn addSymbolAssumeCapacity(self: *Object) Symbol.Index {
}
pub fn addSymbolExtra(self: *Object, allocator: Allocator, extra: Symbol.Extra) !u32 {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addSymbolExtraAssumeCapacity(extra);
}
pub fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 {
const index = @as(u32, @intCast(self.symbols_extra.items.len));
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields) |field| {
self.symbols_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -1233,7 +1233,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 {
}
pub fn symbolExtra(self: *Object, index: u32) Symbol.Extra {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
var i: usize = index;
var result: Symbol.Extra = undefined;
inline for (fields) |field| {
@@ -1247,7 +1247,7 @@ pub fn symbolExtra(self: *Object, index: u32) Symbol.Extra {
}
pub fn setSymbolExtra(self: *Object, index: u32, extra: Symbol.Extra) void {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.symbols_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
@@ -1325,14 +1325,14 @@ pub fn atom(self: *Object, atom_index: Atom.Index) ?*Atom {
}
pub fn addAtomExtra(self: *Object, allocator: Allocator, extra: Atom.Extra) !u32 {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addAtomExtraAssumeCapacity(extra);
}
pub fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 {
const index = @as(u32, @intCast(self.atoms_extra.items.len));
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
inline for (fields) |field| {
self.atoms_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -1343,7 +1343,7 @@ pub fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 {
}
pub fn atomExtra(self: *Object, index: u32) Atom.Extra {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
var i: usize = index;
var result: Atom.Extra = undefined;
inline for (fields) |field| {
@@ -1357,7 +1357,7 @@ pub fn atomExtra(self: *Object, index: u32) Atom.Extra {
}
pub fn setAtomExtra(self: *Object, index: u32, extra: Atom.Extra) void {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.atoms_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
diff --git a/src/link/Elf/SharedObject.zig b/src/link/Elf/SharedObject.zig
index 9463cad75a73..677e63ebafeb 100644
--- a/src/link/Elf/SharedObject.zig
+++ b/src/link/Elf/SharedObject.zig
@@ -423,14 +423,14 @@ fn addSymbolAssumeCapacity(self: *SharedObject) Symbol.Index {
}
pub fn addSymbolExtra(self: *SharedObject, allocator: Allocator, extra: Symbol.Extra) !u32 {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addSymbolExtraAssumeCapacity(extra);
}
pub fn addSymbolExtraAssumeCapacity(self: *SharedObject, extra: Symbol.Extra) u32 {
const index = @as(u32, @intCast(self.symbols_extra.items.len));
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields) |field| {
self.symbols_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -441,7 +441,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *SharedObject, extra: Symbol.Extra) u3
}
pub fn symbolExtra(self: *SharedObject, index: u32) Symbol.Extra {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
var i: usize = index;
var result: Symbol.Extra = undefined;
inline for (fields) |field| {
@@ -455,7 +455,7 @@ pub fn symbolExtra(self: *SharedObject, index: u32) Symbol.Extra {
}
pub fn setSymbolExtra(self: *SharedObject, index: u32, extra: Symbol.Extra) void {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.symbols_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
diff --git a/src/link/Elf/Symbol.zig b/src/link/Elf/Symbol.zig
index 1b1c35b64503..821f9e0bb9c8 100644
--- a/src/link/Elf/Symbol.zig
+++ b/src/link/Elf/Symbol.zig
@@ -255,7 +255,7 @@ const AddExtraOpts = struct {
pub fn addExtra(symbol: *Symbol, opts: AddExtraOpts, elf_file: *Elf) void {
var extras = symbol.extra(elf_file);
- inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| {
if (@field(opts, field.name)) |x| {
@field(extras, field.name) = x;
}
diff --git a/src/link/Elf/ZigObject.zig b/src/link/Elf/ZigObject.zig
index df811dcfb0c9..549657800cf4 100644
--- a/src/link/Elf/ZigObject.zig
+++ b/src/link/Elf/ZigObject.zig
@@ -2034,14 +2034,14 @@ pub fn atom(self: *ZigObject, atom_index: Atom.Index) ?*Atom {
}
fn addAtomExtra(self: *ZigObject, allocator: Allocator, extra: Atom.Extra) !u32 {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addAtomExtraAssumeCapacity(extra);
}
fn addAtomExtraAssumeCapacity(self: *ZigObject, extra: Atom.Extra) u32 {
const index = @as(u32, @intCast(self.atoms_extra.items.len));
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
inline for (fields) |field| {
self.atoms_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -2052,7 +2052,7 @@ fn addAtomExtraAssumeCapacity(self: *ZigObject, extra: Atom.Extra) u32 {
}
pub fn atomExtra(self: ZigObject, index: u32) Atom.Extra {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
var i: usize = index;
var result: Atom.Extra = undefined;
inline for (fields) |field| {
@@ -2067,7 +2067,7 @@ pub fn atomExtra(self: ZigObject, index: u32) Atom.Extra {
pub fn setAtomExtra(self: *ZigObject, index: u32, extra: Atom.Extra) void {
assert(index > 0);
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.atoms_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
@@ -2106,14 +2106,14 @@ fn addSymbolAssumeCapacity(self: *ZigObject) Symbol.Index {
}
pub fn addSymbolExtra(self: *ZigObject, allocator: Allocator, extra: Symbol.Extra) !u32 {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addSymbolExtraAssumeCapacity(extra);
}
pub fn addSymbolExtraAssumeCapacity(self: *ZigObject, extra: Symbol.Extra) u32 {
const index = @as(u32, @intCast(self.symbols_extra.items.len));
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields) |field| {
self.symbols_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -2124,7 +2124,7 @@ pub fn addSymbolExtraAssumeCapacity(self: *ZigObject, extra: Symbol.Extra) u32 {
}
pub fn symbolExtra(self: *ZigObject, index: u32) Symbol.Extra {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
var i: usize = index;
var result: Symbol.Extra = undefined;
inline for (fields) |field| {
@@ -2138,7 +2138,7 @@ pub fn symbolExtra(self: *ZigObject, index: u32) Symbol.Extra {
}
pub fn setSymbolExtra(self: *ZigObject, index: u32, extra: Symbol.Extra) void {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.symbols_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
diff --git a/src/link/MachO/Archive.zig b/src/link/MachO/Archive.zig
index 8cb28b5f295d..a1c8b84deb96 100644
--- a/src/link/MachO/Archive.zig
+++ b/src/link/MachO/Archive.zig
@@ -90,7 +90,7 @@ pub fn writeHeader(
.ar_fmag = undefined,
};
@memset(mem.asBytes(&hdr), 0x20);
- inline for (@typeInfo(ar_hdr).Struct.fields) |field| {
+ inline for (@typeInfo(ar_hdr).@"struct".fields) |field| {
var stream = std.io.fixedBufferStream(&@field(hdr, field.name));
stream.writer().print("0", .{}) catch unreachable;
}
diff --git a/src/link/MachO/Atom.zig b/src/link/MachO/Atom.zig
index d2072278a90a..a0193c20be7b 100644
--- a/src/link/MachO/Atom.zig
+++ b/src/link/MachO/Atom.zig
@@ -129,7 +129,7 @@ const AddExtraOpts = struct {
pub fn addExtra(atom: *Atom, opts: AddExtraOpts, macho_file: *MachO) void {
const file = atom.getFile(macho_file);
var extra = file.getAtomExtra(atom.extra);
- inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| {
if (@field(opts, field.name)) |x| {
@field(extra, field.name) = x;
}
diff --git a/src/link/MachO/Dylib.zig b/src/link/MachO/Dylib.zig
index 7c52f6937681..f5ed166ee0e2 100644
--- a/src/link/MachO/Dylib.zig
+++ b/src/link/MachO/Dylib.zig
@@ -650,14 +650,14 @@ pub fn getSymbolRef(self: Dylib, index: Symbol.Index, macho_file: *MachO) MachO.
}
pub fn addSymbolExtra(self: *Dylib, allocator: Allocator, extra: Symbol.Extra) !u32 {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addSymbolExtraAssumeCapacity(extra);
}
fn addSymbolExtraAssumeCapacity(self: *Dylib, extra: Symbol.Extra) u32 {
const index = @as(u32, @intCast(self.symbols_extra.items.len));
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields) |field| {
self.symbols_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -668,7 +668,7 @@ fn addSymbolExtraAssumeCapacity(self: *Dylib, extra: Symbol.Extra) u32 {
}
pub fn getSymbolExtra(self: Dylib, index: u32) Symbol.Extra {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
var i: usize = index;
var result: Symbol.Extra = undefined;
inline for (fields) |field| {
@@ -682,7 +682,7 @@ pub fn getSymbolExtra(self: Dylib, index: u32) Symbol.Extra {
}
pub fn setSymbolExtra(self: *Dylib, index: u32, extra: Symbol.Extra) void {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.symbols_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
diff --git a/src/link/MachO/InternalObject.zig b/src/link/MachO/InternalObject.zig
index 7e0f375ec172..4054429ef867 100644
--- a/src/link/MachO/InternalObject.zig
+++ b/src/link/MachO/InternalObject.zig
@@ -669,14 +669,14 @@ pub fn getAtoms(self: InternalObject) []const Atom.Index {
}
fn addAtomExtra(self: *InternalObject, allocator: Allocator, extra: Atom.Extra) !u32 {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addAtomExtraAssumeCapacity(extra);
}
fn addAtomExtraAssumeCapacity(self: *InternalObject, extra: Atom.Extra) u32 {
const index = @as(u32, @intCast(self.atoms_extra.items.len));
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
inline for (fields) |field| {
self.atoms_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -687,7 +687,7 @@ fn addAtomExtraAssumeCapacity(self: *InternalObject, extra: Atom.Extra) u32 {
}
pub fn getAtomExtra(self: InternalObject, index: u32) Atom.Extra {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
var i: usize = index;
var result: Atom.Extra = undefined;
inline for (fields) |field| {
@@ -702,7 +702,7 @@ pub fn getAtomExtra(self: InternalObject, index: u32) Atom.Extra {
pub fn setAtomExtra(self: *InternalObject, index: u32, extra: Atom.Extra) void {
assert(index > 0);
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.atoms_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
@@ -750,14 +750,14 @@ pub fn getSymbolRef(self: InternalObject, index: Symbol.Index, macho_file: *Mach
}
pub fn addSymbolExtra(self: *InternalObject, allocator: Allocator, extra: Symbol.Extra) !u32 {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addSymbolExtraAssumeCapacity(extra);
}
fn addSymbolExtraAssumeCapacity(self: *InternalObject, extra: Symbol.Extra) u32 {
const index = @as(u32, @intCast(self.symbols_extra.items.len));
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields) |field| {
self.symbols_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -768,7 +768,7 @@ fn addSymbolExtraAssumeCapacity(self: *InternalObject, extra: Symbol.Extra) u32
}
pub fn getSymbolExtra(self: InternalObject, index: u32) Symbol.Extra {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
var i: usize = index;
var result: Symbol.Extra = undefined;
inline for (fields) |field| {
@@ -782,7 +782,7 @@ pub fn getSymbolExtra(self: InternalObject, index: u32) Symbol.Extra {
}
pub fn setSymbolExtra(self: *InternalObject, index: u32, extra: Symbol.Extra) void {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.symbols_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
diff --git a/src/link/MachO/Object.zig b/src/link/MachO/Object.zig
index ad83777906a7..4d2662a83800 100644
--- a/src/link/MachO/Object.zig
+++ b/src/link/MachO/Object.zig
@@ -2386,14 +2386,14 @@ pub fn getAtoms(self: *Object) []const Atom.Index {
}
fn addAtomExtra(self: *Object, allocator: Allocator, extra: Atom.Extra) !u32 {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addAtomExtraAssumeCapacity(extra);
}
fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 {
const index = @as(u32, @intCast(self.atoms_extra.items.len));
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
inline for (fields) |field| {
self.atoms_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -2404,7 +2404,7 @@ fn addAtomExtraAssumeCapacity(self: *Object, extra: Atom.Extra) u32 {
}
pub fn getAtomExtra(self: Object, index: u32) Atom.Extra {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
var i: usize = index;
var result: Atom.Extra = undefined;
inline for (fields) |field| {
@@ -2419,7 +2419,7 @@ pub fn getAtomExtra(self: Object, index: u32) Atom.Extra {
pub fn setAtomExtra(self: *Object, index: u32, extra: Atom.Extra) void {
assert(index > 0);
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.atoms_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
@@ -2447,14 +2447,14 @@ pub fn getSymbolRef(self: Object, index: Symbol.Index, macho_file: *MachO) MachO
}
pub fn addSymbolExtra(self: *Object, allocator: Allocator, extra: Symbol.Extra) !u32 {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addSymbolExtraAssumeCapacity(extra);
}
fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 {
const index = @as(u32, @intCast(self.symbols_extra.items.len));
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields) |field| {
self.symbols_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -2465,7 +2465,7 @@ fn addSymbolExtraAssumeCapacity(self: *Object, extra: Symbol.Extra) u32 {
}
pub fn getSymbolExtra(self: Object, index: u32) Symbol.Extra {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
var i: usize = index;
var result: Symbol.Extra = undefined;
inline for (fields) |field| {
@@ -2479,7 +2479,7 @@ pub fn getSymbolExtra(self: Object, index: u32) Symbol.Extra {
}
pub fn setSymbolExtra(self: *Object, index: u32, extra: Symbol.Extra) void {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.symbols_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
diff --git a/src/link/MachO/Symbol.zig b/src/link/MachO/Symbol.zig
index 7d8dc9c046f0..7493d3ceab5a 100644
--- a/src/link/MachO/Symbol.zig
+++ b/src/link/MachO/Symbol.zig
@@ -211,7 +211,7 @@ const AddExtraOpts = struct {
pub fn addExtra(symbol: *Symbol, opts: AddExtraOpts, macho_file: *MachO) void {
var extra = symbol.getExtra(macho_file);
- inline for (@typeInfo(@TypeOf(opts)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(opts)).@"struct".fields) |field| {
if (@field(opts, field.name)) |x| {
@field(extra, field.name) = x;
}
diff --git a/src/link/MachO/ZigObject.zig b/src/link/MachO/ZigObject.zig
index fb1630fcd558..6a771a3b8452 100644
--- a/src/link/MachO/ZigObject.zig
+++ b/src/link/MachO/ZigObject.zig
@@ -1581,14 +1581,14 @@ pub fn getAtoms(self: *ZigObject) []const Atom.Index {
}
fn addAtomExtra(self: *ZigObject, allocator: Allocator, extra: Atom.Extra) !u32 {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
try self.atoms_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addAtomExtraAssumeCapacity(extra);
}
fn addAtomExtraAssumeCapacity(self: *ZigObject, extra: Atom.Extra) u32 {
const index = @as(u32, @intCast(self.atoms_extra.items.len));
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
inline for (fields) |field| {
self.atoms_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -1599,7 +1599,7 @@ fn addAtomExtraAssumeCapacity(self: *ZigObject, extra: Atom.Extra) u32 {
}
pub fn getAtomExtra(self: ZigObject, index: u32) Atom.Extra {
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
var i: usize = index;
var result: Atom.Extra = undefined;
inline for (fields) |field| {
@@ -1614,7 +1614,7 @@ pub fn getAtomExtra(self: ZigObject, index: u32) Atom.Extra {
pub fn setAtomExtra(self: *ZigObject, index: u32, extra: Atom.Extra) void {
assert(index > 0);
- const fields = @typeInfo(Atom.Extra).Struct.fields;
+ const fields = @typeInfo(Atom.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.atoms_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
@@ -1642,14 +1642,14 @@ pub fn getSymbolRef(self: ZigObject, index: Symbol.Index, macho_file: *MachO) Ma
}
pub fn addSymbolExtra(self: *ZigObject, allocator: Allocator, extra: Symbol.Extra) !u32 {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
try self.symbols_extra.ensureUnusedCapacity(allocator, fields.len);
return self.addSymbolExtraAssumeCapacity(extra);
}
fn addSymbolExtraAssumeCapacity(self: *ZigObject, extra: Symbol.Extra) u32 {
const index = @as(u32, @intCast(self.symbols_extra.items.len));
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields) |field| {
self.symbols_extra.appendAssumeCapacity(switch (field.type) {
u32 => @field(extra, field.name),
@@ -1660,7 +1660,7 @@ fn addSymbolExtraAssumeCapacity(self: *ZigObject, extra: Symbol.Extra) u32 {
}
pub fn getSymbolExtra(self: ZigObject, index: u32) Symbol.Extra {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
var i: usize = index;
var result: Symbol.Extra = undefined;
inline for (fields) |field| {
@@ -1674,7 +1674,7 @@ pub fn getSymbolExtra(self: ZigObject, index: u32) Symbol.Extra {
}
pub fn setSymbolExtra(self: *ZigObject, index: u32, extra: Symbol.Extra) void {
- const fields = @typeInfo(Symbol.Extra).Struct.fields;
+ const fields = @typeInfo(Symbol.Extra).@"struct".fields;
inline for (fields, 0..) |field, i| {
self.symbols_extra.items[index + i] = switch (field.type) {
u32 => @field(extra, field.name),
diff --git a/src/link/Wasm.zig b/src/link/Wasm.zig
index 749719d5fc7b..23425a2e7c6e 100644
--- a/src/link/Wasm.zig
+++ b/src/link/Wasm.zig
@@ -1169,7 +1169,7 @@ fn setupTLSRelocationsFunction(wasm: *Wasm) !void {
fn validateFeatures(
wasm: *const Wasm,
- to_emit: *[@typeInfo(types.Feature.Tag).Enum.fields.len]bool,
+ to_emit: *[@typeInfo(types.Feature.Tag).@"enum".fields.len]bool,
emit_features_count: *u32,
) !void {
const comp = wasm.base.comp;
@@ -1177,7 +1177,7 @@ fn validateFeatures(
const shared_memory = comp.config.shared_memory;
const cpu_features = target.cpu.features;
const infer = cpu_features.isEmpty(); // when the user did not define any features, we infer them from linked objects.
- const known_features_count = @typeInfo(types.Feature.Tag).Enum.fields.len;
+ const known_features_count = @typeInfo(types.Feature.Tag).@"enum".fields.len;
var allowed = [_]bool{false} ** known_features_count;
var used = [_]u17{0} ** known_features_count;
@@ -1192,7 +1192,7 @@ fn validateFeatures(
// When the user has given an explicit list of features to enable,
// we extract them and insert each into the 'allowed' list.
if (!infer) {
- inline for (@typeInfo(std.Target.wasm.Feature).Enum.fields) |feature_field| {
+ inline for (@typeInfo(std.Target.wasm.Feature).@"enum".fields) |feature_field| {
if (cpu_features.isEnabled(feature_field.value)) {
allowed[feature_field.value] = true;
emit_features_count.* += 1;
@@ -2576,7 +2576,7 @@ pub fn flushModule(wasm: *Wasm, arena: Allocator, tid: Zcu.PerThread.Id, prog_no
if (wasm.base.hasErrors()) return error.FlushFailure;
var emit_features_count: u32 = 0;
- var enabled_features: [@typeInfo(types.Feature.Tag).Enum.fields.len]bool = undefined;
+ var enabled_features: [@typeInfo(types.Feature.Tag).@"enum".fields.len]bool = undefined;
try wasm.validateFeatures(&enabled_features, &emit_features_count);
try wasm.resolveSymbolsInArchives();
if (wasm.base.hasErrors()) return error.FlushFailure;
@@ -2610,7 +2610,7 @@ pub fn flushModule(wasm: *Wasm, arena: Allocator, tid: Zcu.PerThread.Id, prog_no
/// Writes the WebAssembly in-memory module to the file
fn writeToFile(
wasm: *Wasm,
- enabled_features: [@typeInfo(types.Feature.Tag).Enum.fields.len]bool,
+ enabled_features: [@typeInfo(types.Feature.Tag).@"enum".fields.len]bool,
feature_count: u32,
arena: Allocator,
) !void {
@@ -3867,7 +3867,7 @@ fn emitSegmentInfo(wasm: *Wasm, binary_bytes: *std.ArrayList(u8)) !void {
pub fn getUleb128Size(uint_value: anytype) u32 {
const T = @TypeOf(uint_value);
- const U = if (@typeInfo(T).Int.bits < 8) u8 else T;
+ const U = if (@typeInfo(T).int.bits < 8) u8 else T;
var value = @as(U, @intCast(uint_value));
var size: u32 = 0;
diff --git a/src/link/Wasm/Object.zig b/src/link/Wasm/Object.zig
index 06512ae97e22..fa46a1fea4b7 100644
--- a/src/link/Wasm/Object.zig
+++ b/src/link/Wasm/Object.zig
@@ -871,7 +871,7 @@ fn ElementType(comptime ptr: type) type {
/// signedness of the given type `T`.
/// Asserts `T` is an integer.
fn readLeb(comptime T: type, reader: anytype) !T {
- return switch (@typeInfo(T).Int.signedness) {
+ return switch (@typeInfo(T).int.signedness) {
.signed => try leb.readIleb128(T, reader),
.unsigned => try leb.readUleb128(T, reader),
};
@@ -881,7 +881,7 @@ fn readLeb(comptime T: type, reader: anytype) !T {
/// Asserts `T` is an enum
fn readEnum(comptime T: type, reader: anytype) !T {
switch (@typeInfo(T)) {
- .Enum => |enum_type| return @as(T, @enumFromInt(try readLeb(enum_type.tag_type, reader))),
+ .@"enum" => |enum_type| return @as(T, @enumFromInt(try readLeb(enum_type.tag_type, reader))),
else => @compileError("T must be an enum. Instead was given type " ++ @typeName(T)),
}
}
diff --git a/src/link/Wasm/ZigObject.zig b/src/link/Wasm/ZigObject.zig
index eff9bbf638e1..c0d531582ffd 100644
--- a/src/link/Wasm/ZigObject.zig
+++ b/src/link/Wasm/ZigObject.zig
@@ -805,7 +805,7 @@ pub fn getUavVAddr(
const is_wasm32 = target.cpu.arch == .wasm32;
const zcu = wasm_file.base.comp.zcu.?;
const ty = Type.fromInterned(zcu.intern_pool.typeOf(uav));
- if (ty.zigTypeTag(zcu) == .Fn) {
+ if (ty.zigTypeTag(zcu) == .@"fn") {
std.debug.assert(reloc_info.addend == 0); // addend not allowed for function relocations
try parent_atom.relocs.append(gpa, .{
.index = target_symbol_index,
diff --git a/src/link/riscv.zig b/src/link/riscv.zig
index bf23010c802f..7c0282ef3b5f 100644
--- a/src/link/riscv.zig
+++ b/src/link/riscv.zig
@@ -12,7 +12,7 @@ pub fn writeSetSub6(comptime op: enum { set, sub }, code: *[1]u8, addend: anytyp
pub fn writeAddend(
comptime Int: type,
comptime op: enum { add, sub },
- code: *[@typeInfo(Int).Int.bits / 8]u8,
+ code: *[@typeInfo(Int).int.bits / 8]u8,
value: anytype,
) void {
var V: Int = mem.readInt(Int, code, .little);
diff --git a/src/link/tapi/yaml.zig b/src/link/tapi/yaml.zig
index 7afa229401c5..557ba8a91c23 100644
--- a/src/link/tapi/yaml.zig
+++ b/src/link/tapi/yaml.zig
@@ -204,13 +204,13 @@ pub const Value = union(enum) {
fn encode(arena: Allocator, input: anytype) YamlError!?Value {
switch (@typeInfo(@TypeOf(input))) {
- .ComptimeInt,
- .Int,
+ .comptime_int,
+ .int,
=> return Value{ .int = math.cast(i64, input) orelse return error.Overflow },
- .Float => return Value{ .float = math.lossyCast(f64, input) },
+ .float => return Value{ .float = math.lossyCast(f64, input) },
- .Struct => |info| if (info.is_tuple) {
+ .@"struct" => |info| if (info.is_tuple) {
var list = std.ArrayList(Value).init(arena);
errdefer list.deinit();
try list.ensureTotalCapacityPrecise(info.fields.len);
@@ -237,7 +237,7 @@ pub const Value = union(enum) {
return Value{ .map = map };
},
- .Union => |info| if (info.tag_type) |tag_type| {
+ .@"union" => |info| if (info.tag_type) |tag_type| {
inline for (info.fields) |field| {
if (@field(tag_type, field.name) == input) {
return try encode(arena, @field(input, field.name));
@@ -245,11 +245,11 @@ pub const Value = union(enum) {
} else unreachable;
} else return error.UntaggedUnion,
- .Array => return encode(arena, &input),
+ .array => return encode(arena, &input),
- .Pointer => |info| switch (info.size) {
+ .pointer => |info| switch (info.size) {
.One => switch (@typeInfo(info.child)) {
- .Array => |child_info| {
+ .array => |child_info| {
const Slice = []const child_info.child;
return encode(arena, @as(Slice, input));
},
@@ -284,9 +284,9 @@ pub const Value = union(enum) {
// TODO we should probably have an option to encode `null` and also
// allow for some default value too.
- .Optional => return if (input) |val| encode(arena, val) else null,
+ .optional => return if (input) |val| encode(arena, val) else null,
- .Null => return null,
+ .null => return null,
else => {
@compileError("Unhandled type: {s}" ++ @typeName(@TypeOf(input)));
@@ -339,7 +339,7 @@ pub const Yaml = struct {
pub fn parse(self: *Yaml, comptime T: type) Error!T {
if (self.docs.items.len == 0) {
- if (@typeInfo(T) == .Void) return {};
+ if (@typeInfo(T) == .void) return {};
return error.TypeMismatch;
}
@@ -348,14 +348,14 @@ pub const Yaml = struct {
}
switch (@typeInfo(T)) {
- .Array => |info| {
+ .array => |info| {
var parsed: T = undefined;
for (self.docs.items, 0..) |doc, i| {
parsed[i] = try self.parseValue(info.child, doc);
}
return parsed;
},
- .Pointer => |info| {
+ .pointer => |info| {
switch (info.size) {
.Slice => {
var parsed = try self.arena.allocator().alloc(info.child, self.docs.items.len);
@@ -367,35 +367,35 @@ pub const Yaml = struct {
else => return error.TypeMismatch,
}
},
- .Union => return error.Unimplemented,
+ .@"union" => return error.Unimplemented,
else => return error.TypeMismatch,
}
}
fn parseValue(self: *Yaml, comptime T: type, value: Value) Error!T {
return switch (@typeInfo(T)) {
- .Int => math.cast(T, try value.asInt()) orelse return error.Overflow,
- .Float => if (value.asFloat()) |float| {
+ .int => math.cast(T, try value.asInt()) orelse return error.Overflow,
+ .float => if (value.asFloat()) |float| {
return math.lossyCast(T, float);
} else |_| {
return math.lossyCast(T, try value.asInt());
},
- .Struct => self.parseStruct(T, try value.asMap()),
- .Union => self.parseUnion(T, value),
- .Array => self.parseArray(T, try value.asList()),
- .Pointer => if (value.asList()) |list| {
+ .@"struct" => self.parseStruct(T, try value.asMap()),
+ .@"union" => self.parseUnion(T, value),
+ .array => self.parseArray(T, try value.asList()),
+ .pointer => if (value.asList()) |list| {
return self.parsePointer(T, .{ .list = list });
} else |_| {
return self.parsePointer(T, .{ .string = try value.asString() });
},
- .Void => error.TypeMismatch,
- .Optional => unreachable,
+ .void => error.TypeMismatch,
+ .optional => unreachable,
else => error.Unimplemented,
};
}
fn parseUnion(self: *Yaml, comptime T: type, value: Value) Error!T {
- const union_info = @typeInfo(T).Union;
+ const union_info = @typeInfo(T).@"union";
if (union_info.tag_type) |_| {
inline for (union_info.fields) |field| {
@@ -412,12 +412,12 @@ pub const Yaml = struct {
fn parseOptional(self: *Yaml, comptime T: type, value: ?Value) Error!T {
const unwrapped = value orelse return null;
- const opt_info = @typeInfo(T).Optional;
+ const opt_info = @typeInfo(T).optional;
return @as(T, try self.parseValue(opt_info.child, unwrapped));
}
fn parseStruct(self: *Yaml, comptime T: type, map: Map) Error!T {
- const struct_info = @typeInfo(T).Struct;
+ const struct_info = @typeInfo(T).@"struct";
var parsed: T = undefined;
inline for (struct_info.fields) |field| {
@@ -426,7 +426,7 @@ pub const Yaml = struct {
break :blk map.get(field_name);
};
- if (@typeInfo(field.type) == .Optional) {
+ if (@typeInfo(field.type) == .optional) {
@field(parsed, field.name) = try self.parseOptional(field.type, value);
continue;
}
@@ -442,7 +442,7 @@ pub const Yaml = struct {
}
fn parsePointer(self: *Yaml, comptime T: type, value: Value) Error!T {
- const ptr_info = @typeInfo(T).Pointer;
+ const ptr_info = @typeInfo(T).pointer;
const arena = self.arena.allocator();
switch (ptr_info.size) {
@@ -462,7 +462,7 @@ pub const Yaml = struct {
}
fn parseArray(self: *Yaml, comptime T: type, list: List) Error!T {
- const array_info = @typeInfo(T).Array;
+ const array_info = @typeInfo(T).array;
if (array_info.len != list.len) return error.ArraySizeMismatch;
var parsed: T = undefined;
diff --git a/src/main.zig b/src/main.zig
index 226ec7946723..1db2be6f2548 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -130,7 +130,7 @@ var log_scopes: std.ArrayListUnmanaged([]const u8) = .{};
pub fn log(
comptime level: std.log.Level,
- comptime scope: @TypeOf(.EnumLiteral),
+ comptime scope: @Type(.enum_literal),
comptime format: []const u8,
args: anytype,
) void {
@@ -5315,7 +5315,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
var any_errors = false;
while (it.next()) |hash| {
if (hash.len == 0) continue;
- const digest_len = @typeInfo(Package.Manifest.MultiHashHexDigest).Array.len;
+ const digest_len = @typeInfo(Package.Manifest.MultiHashHexDigest).array.len;
if (hash.len != digest_len) {
std.log.err("invalid digest (length {d} instead of {d}): '{s}'", .{
hash.len, digest_len, hash,
diff --git a/src/mutable_value.zig b/src/mutable_value.zig
index 9fcac259df8f..49826c2fb2ad 100644
--- a/src/mutable_value.zig
+++ b/src/mutable_value.zig
@@ -210,19 +210,19 @@ pub const MutableValue = union(enum) {
},
},
.undef => |ty_ip| switch (Type.fromInterned(ty_ip).zigTypeTag(zcu)) {
- .Struct, .Array, .Vector => |type_tag| {
+ .@"struct", .array, .vector => |type_tag| {
const ty = Type.fromInterned(ty_ip);
const opt_sent = ty.sentinel(zcu);
- if (type_tag == .Struct or opt_sent != null or !allow_repeated) {
+ if (type_tag == .@"struct" or opt_sent != null or !allow_repeated) {
const len_no_sent = ip.aggregateTypeLen(ty_ip);
const elems = try arena.alloc(MutableValue, @intCast(len_no_sent + @intFromBool(opt_sent != null)));
switch (type_tag) {
- .Array, .Vector => {
+ .array, .vector => {
const elem_ty = ip.childType(ty_ip);
const undef_elem = try pt.intern(.{ .undef = elem_ty });
@memset(elems[0..@intCast(len_no_sent)], .{ .interned = undef_elem });
},
- .Struct => for (elems[0..@intCast(len_no_sent)], 0..) |*mut_elem, i| {
+ .@"struct" => for (elems[0..@intCast(len_no_sent)], 0..) |*mut_elem, i| {
const field_ty = ty.fieldType(i, zcu).toIntern();
mut_elem.* = .{ .interned = try pt.intern(.{ .undef = field_ty }) };
},
@@ -244,7 +244,7 @@ pub const MutableValue = union(enum) {
} };
}
},
- .Union => {
+ .@"union" => {
const payload = try arena.create(MutableValue);
const backing_ty = try Type.fromInterned(ty_ip).unionBackingType(pt);
payload.* = .{ .interned = try pt.intern(.{ .undef = backing_ty.toIntern() }) };
@@ -254,7 +254,7 @@ pub const MutableValue = union(enum) {
.payload = payload,
} };
},
- .Pointer => {
+ .pointer => {
const ptr_ty = ip.indexToKey(ty_ip).ptr_type;
if (ptr_ty.flags.size != .Slice) return;
const ptr = try arena.create(MutableValue);
@@ -375,7 +375,7 @@ pub const MutableValue = union(enum) {
if (field_val.eqlTrivial(r.child.*)) return;
// We must switch to either the `aggregate` or the `bytes` representation.
const len_inc_sent = ip.aggregateTypeLenIncludingSentinel(r.ty);
- if (Type.fromInterned(r.ty).zigTypeTag(zcu) != .Struct and
+ if (Type.fromInterned(r.ty).zigTypeTag(zcu) != .@"struct" and
is_trivial_int and
Type.fromInterned(r.ty).childType(zcu).toIntern() == .u8_type and
r.child.isTrivialInt(zcu))
@@ -402,7 +402,7 @@ pub const MutableValue = union(enum) {
},
.aggregate => |a| {
a.elems[field_idx] = field_val;
- const is_struct = Type.fromInterned(a.ty).zigTypeTag(zcu) == .Struct;
+ const is_struct = Type.fromInterned(a.ty).zigTypeTag(zcu) == .@"struct";
// Attempt to switch to a more efficient representation.
const is_repeated = for (a.elems) |e| {
if (!e.eqlTrivial(field_val)) break false;
@@ -457,9 +457,9 @@ pub const MutableValue = union(enum) {
.interned => |ip_index| {
const ty = Type.fromInterned(pt.zcu.intern_pool.typeOf(ip_index));
switch (ty.zigTypeTag(pt.zcu)) {
- .Array, .Vector => return .{ .interned = (try Value.fromInterned(ip_index).elemValue(pt, field_idx)).toIntern() },
- .Struct, .Union => return .{ .interned = (try Value.fromInterned(ip_index).fieldValue(pt, field_idx)).toIntern() },
- .Pointer => {
+ .array, .vector => return .{ .interned = (try Value.fromInterned(ip_index).elemValue(pt, field_idx)).toIntern() },
+ .@"struct", .@"union" => return .{ .interned = (try Value.fromInterned(ip_index).fieldValue(pt, field_idx)).toIntern() },
+ .pointer => {
assert(ty.isSlice(pt.zcu));
return switch (field_idx) {
Value.slice_ptr_index => .{ .interned = Value.fromInterned(ip_index).slicePtr(pt.zcu).toIntern() },
@@ -551,7 +551,7 @@ pub const MutableValue = union(enum) {
/// Used for deciding when to switch aggregate representations without fully
/// interning many values.
fn eqlTrivial(a: MutableValue, b: MutableValue) bool {
- const Tag = @typeInfo(MutableValue).Union.tag_type.?;
+ const Tag = @typeInfo(MutableValue).@"union".tag_type.?;
if (@as(Tag, a) != @as(Tag, b)) return false;
return switch (a) {
.interned => |a_ip| a_ip == b.interned,
diff --git a/src/print_env.zig b/src/print_env.zig
index b51423656b98..c68c267af4e1 100644
--- a/src/print_env.zig
+++ b/src/print_env.zig
@@ -47,7 +47,7 @@ pub fn cmdEnv(arena: Allocator, args: []const []const u8, stdout: std.fs.File.Wr
try jws.objectField("env");
try jws.beginObject();
- inline for (@typeInfo(std.zig.EnvVar).Enum.fields) |field| {
+ inline for (@typeInfo(std.zig.EnvVar).@"enum".fields) |field| {
try jws.objectField(field.name);
try jws.write(try @field(std.zig.EnvVar, field.name).get(arena));
}
diff --git a/src/print_value.zig b/src/print_value.zig
index 89e77503698e..9c06c6bcd88c 100644
--- a/src/print_value.zig
+++ b/src/print_value.zig
@@ -207,7 +207,7 @@ fn printAggregate(
const ip = &zcu.intern_pool;
const ty = Type.fromInterned(aggregate.ty);
switch (ty.zigTypeTag(zcu)) {
- .Struct => if (!ty.isTuple(zcu)) {
+ .@"struct" => if (!ty.isTuple(zcu)) {
if (is_ref) try writer.writeByte('&');
if (ty.structFieldCount(zcu) == 0) {
return writer.writeAll(".{}");
@@ -223,7 +223,7 @@ fn printAggregate(
try writer.writeAll(" }");
return;
},
- .Array => {
+ .array => {
switch (aggregate.storage) {
.bytes => |bytes| string: {
const len = ty.arrayLenIncludingSentinel(zcu);
@@ -253,7 +253,7 @@ fn printAggregate(
else => {},
}
},
- .Vector => if (ty.arrayLen(zcu) == 0) {
+ .vector => if (ty.arrayLen(zcu) == 0) {
if (is_ref) try writer.writeByte('&');
return writer.writeAll(".{}");
},
@@ -362,17 +362,17 @@ fn printPtrDerivation(
try printPtrDerivation(field.parent.*, writer, level, pt, have_sema, sema);
const agg_ty = (try field.parent.ptrType(pt)).childType(zcu);
switch (agg_ty.zigTypeTag(zcu)) {
- .Struct => if (agg_ty.structFieldName(field.field_idx, zcu).unwrap()) |field_name| {
+ .@"struct" => if (agg_ty.structFieldName(field.field_idx, zcu).unwrap()) |field_name| {
try writer.print(".{i}", .{field_name.fmt(ip)});
} else {
try writer.print("[{d}]", .{field.field_idx});
},
- .Union => {
+ .@"union" => {
const tag_ty = agg_ty.unionTagTypeHypothetical(zcu);
const field_name = tag_ty.enumFieldName(field.field_idx, zcu);
try writer.print(".{i}", .{field_name.fmt(ip)});
},
- .Pointer => switch (field.field_idx) {
+ .pointer => switch (field.field_idx) {
Value.slice_ptr_index => try writer.writeAll(".ptr"),
Value.slice_len_index => try writer.writeAll(".len"),
else => unreachable,
diff --git a/src/print_zir.zig b/src/print_zir.zig
index 80f1500d0e96..8d70af5f3cd1 100644
--- a/src/print_zir.zig
+++ b/src/print_zir.zig
@@ -907,7 +907,7 @@ const Writer = struct {
fn writeFieldParentPtr(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
const extra = self.code.extraData(Zir.Inst.FieldParentPtr, extended.operand).data;
- const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
+ const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
if (flags.align_cast) try stream.writeAll("align_cast, ");
if (flags.addrspace_cast) try stream.writeAll("addrspace_cast, ");
@@ -1065,7 +1065,7 @@ const Writer = struct {
}
fn writePtrCastFull(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
- const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
+ const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
const extra = self.code.extraData(Zir.Inst.BinNode, extended.operand).data;
if (flags.ptr_cast) try stream.writeAll("ptr_cast, ");
@@ -1081,7 +1081,7 @@ const Writer = struct {
}
fn writePtrCastNoDest(self: *Writer, stream: anytype, extended: Zir.Inst.Extended.InstData) !void {
- const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).Struct.backing_integer.?;
+ const FlagsInt = @typeInfo(Zir.Inst.FullPtrCastFlags).@"struct".backing_integer.?;
const flags: Zir.Inst.FullPtrCastFlags = @bitCast(@as(FlagsInt, @truncate(extended.small)));
const extra = self.code.extraData(Zir.Inst.UnNode, extended.operand).data;
if (flags.const_cast) try stream.writeAll("const_cast, ");
diff --git a/src/translate_c.zig b/src/translate_c.zig
index 835121e0cc30..ef81a5dfdacf 100644
--- a/src/translate_c.zig
+++ b/src/translate_c.zig
@@ -161,7 +161,7 @@ pub fn translate(
context.pattern_list.deinit(gpa);
}
- inline for (@typeInfo(std.zig.c_builtins).Struct.decls) |decl| {
+ inline for (@typeInfo(std.zig.c_builtins).@"struct".decls) |decl| {
const builtin = try Tag.pub_var_simple.create(arena, .{
.name = decl.name,
.init = try Tag.import_c_builtin.create(arena, decl.name),
@@ -1324,7 +1324,7 @@ fn makeShuffleMask(c: *Context, scope: *Scope, expr: *const clang.ShuffleVectorE
fn vectorTypeInfo(arena: mem.Allocator, vec_node: Node, field: []const u8) TransError!Node {
const typeof_call = try Tag.typeof.create(arena, vec_node);
const typeinfo_call = try Tag.typeinfo.create(arena, typeof_call);
- const vector_type_info = try Tag.field_access.create(arena, .{ .lhs = typeinfo_call, .field_name = "Vector" });
+ const vector_type_info = try Tag.field_access.create(arena, .{ .lhs = typeinfo_call, .field_name = "vector" });
return Tag.field_access.create(arena, .{ .lhs = vector_type_info, .field_name = field });
}
@@ -2008,7 +2008,7 @@ fn transImplicitCastExpr(
}
fn isBuiltinDefined(name: []const u8) bool {
- inline for (@typeInfo(std.zig.c_builtins).Struct.decls) |decl| {
+ inline for (@typeInfo(std.zig.c_builtins).@"struct".decls) |decl| {
if (std.mem.eql(u8, name, decl.name)) return true;
}
return false;
@@ -4655,7 +4655,7 @@ fn transCreateNodeAPInt(c: *Context, int: *const clang.APSInt) !Node {
fn transCreateNodeNumber(c: *Context, num: anytype, num_kind: enum { int, float }) !Node {
const fmt_s = switch (@typeInfo(@TypeOf(num))) {
- .Int, .ComptimeInt => "{d}",
+ .int, .comptime_int => "{d}",
else => "{s}",
};
const str = try std.fmt.allocPrint(c.arena, fmt_s, .{num});
diff --git a/test/behavior/abs.zig b/test/behavior/abs.zig
index 802b755c4cdd..1493e2dbd185 100644
--- a/test/behavior/abs.zig
+++ b/test/behavior/abs.zig
@@ -104,7 +104,7 @@ test "@abs big int <= 128 bits" {
try testAbsUnsignedBigInt();
}
-fn abs(comptime T: type, a: T) std.meta.Int(.unsigned, @typeInfo(T).Int.bits) {
+fn abs(comptime T: type, a: T) std.meta.Int(.unsigned, @typeInfo(T).int.bits) {
return @abs(a);
}
diff --git a/test/behavior/align.zig b/test/behavior/align.zig
index 2c3fd6641287..158a079d9fb1 100644
--- a/test/behavior/align.zig
+++ b/test/behavior/align.zig
@@ -7,7 +7,7 @@ const assert = std.debug.assert;
var foo: u8 align(4) = 100;
test "global variable alignment" {
- comptime assert(@typeInfo(@TypeOf(&foo)).Pointer.alignment == 4);
+ comptime assert(@typeInfo(@TypeOf(&foo)).pointer.alignment == 4);
comptime assert(@TypeOf(&foo) == *align(4) u8);
{
const slice = @as(*align(4) [1]u8, &foo)[0..];
diff --git a/test/behavior/async_fn.zig b/test/behavior/async_fn.zig
index 4b17905a3093..17b2a4d99881 100644
--- a/test/behavior/async_fn.zig
+++ b/test/behavior/async_fn.zig
@@ -391,7 +391,7 @@ test "async fn with inferred error set" {
var frame: [1]@Frame(middle) = undefined;
var fn_ptr = middle;
_ = &fn_ptr;
- var result: @typeInfo(@typeInfo(@TypeOf(fn_ptr)).Fn.return_type.?).ErrorUnion.error_set!void = undefined;
+ var result: @typeInfo(@typeInfo(@TypeOf(fn_ptr)).@"fn".return_type.?).error_union.error_set!void = undefined;
_ = @asyncCall(std.mem.sliceAsBytes(frame[0..]), &result, fn_ptr, .{});
resume global_frame;
try std.testing.expectError(error.Fail, result);
@@ -1088,7 +1088,7 @@ test "@asyncCall with comptime-known function, but not awaited directly" {
fn doTheTest() !void {
var frame: [1]@Frame(middle) = undefined;
- var result: @typeInfo(@typeInfo(@TypeOf(middle)).Fn.return_type.?).ErrorUnion.error_set!void = undefined;
+ var result: @typeInfo(@typeInfo(@TypeOf(middle)).@"fn".return_type.?).error_union.error_set!void = undefined;
_ = @asyncCall(std.mem.sliceAsBytes(frame[0..]), &result, middle, .{});
resume global_frame;
try std.testing.expectError(error.Fail, result);
@@ -1166,7 +1166,7 @@ test "@TypeOf an async function call of generic fn with error union type" {
const S = struct {
fn func(comptime x: anytype) anyerror!i32 {
const T = @TypeOf(async func(x));
- comptime assert(T == @typeInfo(@TypeOf(@frame())).Pointer.child);
+ comptime assert(T == @typeInfo(@TypeOf(@frame())).pointer.child);
return undefined;
}
};
diff --git a/test/behavior/atomics.zig b/test/behavior/atomics.zig
index c8e831fedb20..503b987a63ac 100644
--- a/test/behavior/atomics.zig
+++ b/test/behavior/atomics.zig
@@ -414,7 +414,7 @@ fn testAtomicsWithType(comptime T: type, a: T, b: T) !void {
}
fn testAtomicsWithPackedStruct(comptime T: type, a: T, b: T) !void {
- const BackingInt = @typeInfo(T).Struct.backing_integer.?;
+ const BackingInt = @typeInfo(T).@"struct".backing_integer.?;
var x: T = b;
@atomicStore(T, &x, a, .seq_cst);
try expect(@as(BackingInt, @bitCast(x)) == @as(BackingInt, @bitCast(a)));
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index 4e5d0d55aba1..e1ef9ce4e68f 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -1193,7 +1193,7 @@ test "pointer to struct literal with runtime field is constant" {
var runtime_zero: usize = 0;
_ = &runtime_zero;
const ptr = &S{ .data = runtime_zero };
- try expect(@typeInfo(@TypeOf(ptr)).Pointer.is_const);
+ try expect(@typeInfo(@TypeOf(ptr)).pointer.is_const);
}
fn testSignedCmp(comptime T: type) !void {
@@ -1289,7 +1289,7 @@ test "reference to inferred local variable works as expected" {
test "@Type returned from block" {
const T = comptime b: {
- break :b @Type(.{ .Int = .{
+ break :b @Type(.{ .int = .{
.signedness = .unsigned,
.bits = 8,
} });
@@ -1304,7 +1304,7 @@ test "comptime variable initialized with addresses of literals" {
};
_ = &st;
- inline for (@typeInfo(@TypeOf(st)).Struct.fields) |field| {
+ inline for (@typeInfo(@TypeOf(st)).@"struct".fields) |field| {
_ = field;
}
}
@@ -1321,12 +1321,12 @@ test "proper value is returned from labeled block" {
const S = struct {
fn hash(v: *u32, key: anytype) void {
const Key = @TypeOf(key);
- if (@typeInfo(Key) == .ErrorSet) {
+ if (@typeInfo(Key) == .error_set) {
v.* += 1;
return;
}
switch (@typeInfo(Key)) {
- .ErrorUnion => blk: {
+ .error_union => blk: {
const payload = key catch |err| {
hash(v, err);
break :blk;
diff --git a/test/behavior/bit_shifting.zig b/test/behavior/bit_shifting.zig
index e2b63b622ba3..da43fed7bb03 100644
--- a/test/behavior/bit_shifting.zig
+++ b/test/behavior/bit_shifting.zig
@@ -3,7 +3,7 @@ const expect = std.testing.expect;
const builtin = @import("builtin");
fn ShardedTable(comptime Key: type, comptime mask_bit_count: comptime_int, comptime V: type) type {
- const key_bits = @typeInfo(Key).Int.bits;
+ const key_bits = @typeInfo(Key).int.bits;
std.debug.assert(Key == std.meta.Int(.unsigned, key_bits));
std.debug.assert(key_bits >= mask_bit_count);
const shard_key_bits = mask_bit_count;
@@ -120,11 +120,11 @@ test "Saturating Shift Left where lhs is of a computed type" {
const S = struct {
fn getIntShiftType(comptime T: type) type {
- var unsigned_shift_type = @typeInfo(std.math.Log2Int(T)).Int;
+ var unsigned_shift_type = @typeInfo(std.math.Log2Int(T)).int;
unsigned_shift_type.signedness = .signed;
return @Type(.{
- .Int = unsigned_shift_type,
+ .int = unsigned_shift_type,
});
}
diff --git a/test/behavior/bitcast.zig b/test/behavior/bitcast.zig
index 1cb72ac42b9b..73f8e7be18cc 100644
--- a/test/behavior/bitcast.zig
+++ b/test/behavior/bitcast.zig
@@ -361,7 +361,7 @@ test "comptime @bitCast packed struct to int and back" {
vectori: @Vector(2, u8) = .{ 127, 42 },
vectorf: @Vector(2, f16) = .{ 3.14, 2.71 },
};
- const Int = @typeInfo(S).Struct.backing_integer.?;
+ const Int = @typeInfo(S).@"struct".backing_integer.?;
// S -> Int
var s: S = .{};
@@ -373,7 +373,7 @@ test "comptime @bitCast packed struct to int and back" {
_ = &i;
const rt_cast = @as(S, @bitCast(i));
const ct_cast = comptime @as(S, @bitCast(@as(Int, 0)));
- inline for (@typeInfo(S).Struct.fields) |field| {
+ inline for (@typeInfo(S).@"struct".fields) |field| {
try expectEqual(@field(rt_cast, field.name), @field(ct_cast, field.name));
}
}
diff --git a/test/behavior/call.zig b/test/behavior/call.zig
index 4a6e369918c7..3995a24faee9 100644
--- a/test/behavior/call.zig
+++ b/test/behavior/call.zig
@@ -374,7 +374,7 @@ test "Enum constructed by @Type passed as generic argument" {
try expect(@intFromEnum(a) == b);
}
};
- inline for (@typeInfo(S.E).Enum.fields, 0..) |_, i| {
+ inline for (@typeInfo(S.E).@"enum".fields, 0..) |_, i| {
try S.foo(@as(S.E, @enumFromInt(i)), i);
}
}
@@ -578,11 +578,11 @@ test "generic function pointer can be called" {
test "value returned from comptime function is comptime known" {
const S = struct {
fn fields(comptime T: type) switch (@typeInfo(T)) {
- .Struct => []const std.builtin.Type.StructField,
+ .@"struct" => []const std.builtin.Type.StructField,
else => unreachable,
} {
return switch (@typeInfo(T)) {
- .Struct => |info| info.fields,
+ .@"struct" => |info| info.fields,
else => unreachable,
};
}
diff --git a/test/behavior/cast.zig b/test/behavior/cast.zig
index 8118e6ad7639..b414977ad6de 100644
--- a/test/behavior/cast.zig
+++ b/test/behavior/cast.zig
@@ -704,20 +704,20 @@ test "peer type resolution: error set supersets" {
{
const ty = @TypeOf(a, b);
const error_set_info = @typeInfo(ty);
- try expect(error_set_info == .ErrorSet);
- try expect(error_set_info.ErrorSet.?.len == 2);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
+ try expect(error_set_info == .error_set);
+ try expect(error_set_info.error_set.?.len == 2);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
}
// B superset of A
{
const ty = @TypeOf(b, a);
const error_set_info = @typeInfo(ty);
- try expect(error_set_info == .ErrorSet);
- try expect(error_set_info.ErrorSet.?.len == 2);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
+ try expect(error_set_info == .error_set);
+ try expect(error_set_info.error_set.?.len == 2);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
}
}
@@ -732,21 +732,21 @@ test "peer type resolution: disjoint error sets" {
{
const ty = @TypeOf(a, b);
const error_set_info = @typeInfo(ty);
- try expect(error_set_info == .ErrorSet);
- try expect(error_set_info.ErrorSet.?.len == 3);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[2].name, "Three"));
+ try expect(error_set_info == .error_set);
+ try expect(error_set_info.error_set.?.len == 3);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[2].name, "Three"));
}
{
const ty = @TypeOf(b, a);
const error_set_info = @typeInfo(ty);
- try expect(error_set_info == .ErrorSet);
- try expect(error_set_info.ErrorSet.?.len == 3);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[2].name, "Three"));
+ try expect(error_set_info == .error_set);
+ try expect(error_set_info.error_set.?.len == 3);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[2].name, "Three"));
}
}
@@ -762,25 +762,25 @@ test "peer type resolution: error union and error set" {
{
const ty = @TypeOf(a, b);
const info = @typeInfo(ty);
- try expect(info == .ErrorUnion);
+ try expect(info == .error_union);
- const error_set_info = @typeInfo(info.ErrorUnion.error_set);
- try expect(error_set_info.ErrorSet.?.len == 3);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[2].name, "Three"));
+ const error_set_info = @typeInfo(info.error_union.error_set);
+ try expect(error_set_info.error_set.?.len == 3);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[2].name, "Three"));
}
{
const ty = @TypeOf(b, a);
const info = @typeInfo(ty);
- try expect(info == .ErrorUnion);
+ try expect(info == .error_union);
- const error_set_info = @typeInfo(info.ErrorUnion.error_set);
- try expect(error_set_info.ErrorSet.?.len == 3);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[2].name, "Three"));
+ const error_set_info = @typeInfo(info.error_union.error_set);
+ try expect(error_set_info.error_set.?.len == 3);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[2].name, "Three"));
}
}
@@ -795,25 +795,25 @@ test "peer type resolution: error union after non-error" {
{
const ty = @TypeOf(a, b);
const info = @typeInfo(ty);
- try expect(info == .ErrorUnion);
- try expect(info.ErrorUnion.payload == u32);
+ try expect(info == .error_union);
+ try expect(info.error_union.payload == u32);
- const error_set_info = @typeInfo(info.ErrorUnion.error_set);
- try expect(error_set_info.ErrorSet.?.len == 2);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
+ const error_set_info = @typeInfo(info.error_union.error_set);
+ try expect(error_set_info.error_set.?.len == 2);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
}
{
const ty = @TypeOf(b, a);
const info = @typeInfo(ty);
- try expect(info == .ErrorUnion);
- try expect(info.ErrorUnion.payload == u32);
+ try expect(info == .error_union);
+ try expect(info.error_union.payload == u32);
- const error_set_info = @typeInfo(info.ErrorUnion.error_set);
- try expect(error_set_info.ErrorSet.?.len == 2);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
+ const error_set_info = @typeInfo(info.error_union.error_set);
+ try expect(error_set_info.error_set.?.len == 2);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
}
}
@@ -1484,7 +1484,7 @@ test "coerce between pointers of compatible differently-named floats" {
return error.SkipZigTest;
}
- const F = switch (@typeInfo(c_longdouble).Float.bits) {
+ const F = switch (@typeInfo(c_longdouble).float.bits) {
16 => f16,
32 => f32,
64 => f64,
@@ -2151,7 +2151,7 @@ test "peer type resolution: tuples with comptime fields" {
const ti1 = @typeInfo(@TypeOf(a, b));
const ti2 = @typeInfo(@TypeOf(b, a));
inline for (.{ ti1, ti2 }) |ti| {
- const s = ti.Struct;
+ const s = ti.@"struct";
comptime assert(s.is_tuple);
comptime assert(s.fields.len == 2);
comptime assert(s.fields[0].type == u32);
diff --git a/test/behavior/comptime_memory.zig b/test/behavior/comptime_memory.zig
index 968b7be79dde..baca3da72dd4 100644
--- a/test/behavior/comptime_memory.zig
+++ b/test/behavior/comptime_memory.zig
@@ -119,7 +119,7 @@ fn shuffle(ptr: usize, comptime From: type, comptime To: type) usize {
const pResult = @as(*align(1) [array_len]To, @ptrCast(&result));
var i: usize = 0;
while (i < array_len) : (i += 1) {
- inline for (@typeInfo(To).Struct.fields) |f| {
+ inline for (@typeInfo(To).@"struct".fields) |f| {
@field(pResult[i], f.name) = @field(pSource[i], f.name);
}
}
diff --git a/test/behavior/empty_tuple_fields.zig b/test/behavior/empty_tuple_fields.zig
index 788ed19e5e73..dc809b0355f3 100644
--- a/test/behavior/empty_tuple_fields.zig
+++ b/test/behavior/empty_tuple_fields.zig
@@ -9,9 +9,9 @@ test "empty file level struct" {
const T = @import("empty_file_level_struct.zig");
const info = @typeInfo(T);
- try std.testing.expectEqual(@as(usize, 1), info.Struct.fields.len);
- try std.testing.expectEqualStrings("0", info.Struct.fields[0].name);
- try std.testing.expect(@typeInfo(info.Struct.fields[0].type) == .Struct);
+ try std.testing.expectEqual(@as(usize, 1), info.@"struct".fields.len);
+ try std.testing.expectEqualStrings("0", info.@"struct".fields[0].name);
+ try std.testing.expect(@typeInfo(info.@"struct".fields[0].type) == .@"struct");
}
test "empty file level union" {
@@ -22,7 +22,7 @@ test "empty file level union" {
const T = @import("empty_file_level_union.zig");
const info = @typeInfo(T);
- try std.testing.expectEqual(@as(usize, 1), info.Struct.fields.len);
- try std.testing.expectEqualStrings("0", info.Struct.fields[0].name);
- try std.testing.expect(@typeInfo(info.Struct.fields[0].type) == .Union);
+ try std.testing.expectEqual(@as(usize, 1), info.@"struct".fields.len);
+ try std.testing.expectEqualStrings("0", info.@"struct".fields[0].name);
+ try std.testing.expect(@typeInfo(info.@"struct".fields[0].type) == .@"union");
}
diff --git a/test/behavior/enum.zig b/test/behavior/enum.zig
index 354d74c4a67f..05e2f76e16a9 100644
--- a/test/behavior/enum.zig
+++ b/test/behavior/enum.zig
@@ -647,12 +647,12 @@ test "non-exhaustive enum" {
else => true,
});
- try expect(@typeInfo(E).Enum.fields.len == 2);
+ try expect(@typeInfo(E).@"enum".fields.len == 2);
e = @as(E, @enumFromInt(12));
try expect(@intFromEnum(e) == 12);
e = @as(E, @enumFromInt(y));
try expect(@intFromEnum(e) == 52);
- try expect(@typeInfo(E).Enum.is_exhaustive == false);
+ try expect(@typeInfo(E).@"enum".is_exhaustive == false);
}
};
try S.doTheTest(52);
@@ -671,8 +671,8 @@ test "empty non-exhaustive enum" {
});
try expect(@intFromEnum(e) == y);
- try expect(@typeInfo(E).Enum.fields.len == 0);
- try expect(@typeInfo(E).Enum.is_exhaustive == false);
+ try expect(@typeInfo(E).@"enum".fields.len == 0);
+ try expect(@typeInfo(E).@"enum".is_exhaustive == false);
}
};
try S.doTheTest(42);
@@ -708,8 +708,8 @@ test "single field non-exhaustive enum" {
});
try expect(@intFromEnum(@as(E, @enumFromInt(y))) == y);
- try expect(@typeInfo(E).Enum.fields.len == 1);
- try expect(@typeInfo(E).Enum.is_exhaustive == false);
+ try expect(@typeInfo(E).@"enum".fields.len == 1);
+ try expect(@typeInfo(E).@"enum".is_exhaustive == false);
}
};
try S.doTheTest(23);
@@ -1253,9 +1253,9 @@ test "Non-exhaustive enum backed by comptime_int" {
test "matching captures causes enum equivalence" {
const S = struct {
fn Nonexhaustive(comptime I: type) type {
- const UTag = @Type(.{ .Int = .{
+ const UTag = @Type(.{ .int = .{
.signedness = .unsigned,
- .bits = @typeInfo(I).Int.bits,
+ .bits = @typeInfo(I).int.bits,
} });
return enum(UTag) { _ };
}
diff --git a/test/behavior/error.zig b/test/behavior/error.zig
index 1903bac8f738..ee9e961884b0 100644
--- a/test/behavior/error.zig
+++ b/test/behavior/error.zig
@@ -188,9 +188,9 @@ test "error union type " {
fn testErrorUnionType() !void {
const x: anyerror!i32 = 1234;
if (x) |value| try expect(value == 1234) else |_| unreachable;
- try expect(@typeInfo(@TypeOf(x)) == .ErrorUnion);
- try expect(@typeInfo(@typeInfo(@TypeOf(x)).ErrorUnion.error_set) == .ErrorSet);
- try expect(@typeInfo(@TypeOf(x)).ErrorUnion.error_set == anyerror);
+ try expect(@typeInfo(@TypeOf(x)) == .error_union);
+ try expect(@typeInfo(@typeInfo(@TypeOf(x)).error_union.error_set) == .error_set);
+ try expect(@typeInfo(@TypeOf(x)).error_union.error_set == anyerror);
}
test "error set type" {
@@ -204,7 +204,7 @@ const MyErrSet = error{
};
fn testErrorSetType() !void {
- try expect(@typeInfo(MyErrSet).ErrorSet.?.len == 2);
+ try expect(@typeInfo(MyErrSet).error_set.?.len == 2);
const a: MyErrSet!i32 = 5678;
const b: MyErrSet!i32 = MyErrSet.OutOfMemory;
@@ -653,9 +653,9 @@ test "inferred error set equality" {
fn quux() anyerror!void {}
};
- const FooError = @typeInfo(@typeInfo(@TypeOf(S.foo)).Fn.return_type.?).ErrorUnion.error_set;
- const BarError = @typeInfo(@typeInfo(@TypeOf(S.bar)).Fn.return_type.?).ErrorUnion.error_set;
- const BazError = @typeInfo(@typeInfo(@TypeOf(S.baz)).Fn.return_type.?).ErrorUnion.error_set;
+ const FooError = @typeInfo(@typeInfo(@TypeOf(S.foo)).@"fn".return_type.?).error_union.error_set;
+ const BarError = @typeInfo(@typeInfo(@TypeOf(S.bar)).@"fn".return_type.?).error_union.error_set;
+ const BazError = @typeInfo(@typeInfo(@TypeOf(S.baz)).@"fn".return_type.?).error_union.error_set;
try expect(BarError != error{Bad});
@@ -1040,7 +1040,7 @@ test "generic type constructed from inferred error set of unresolved function" {
_ = bytes;
return 0;
}
- const T = std.io.Writer(void, @typeInfo(@typeInfo(@TypeOf(write)).Fn.return_type.?).ErrorUnion.error_set, write);
+ const T = std.io.Writer(void, @typeInfo(@typeInfo(@TypeOf(write)).@"fn".return_type.?).error_union.error_set, write);
fn writer() T {
return .{ .context = {} };
}
diff --git a/test/behavior/eval.zig b/test/behavior/eval.zig
index b32191cbb296..2d7922d2bad6 100644
--- a/test/behavior/eval.zig
+++ b/test/behavior/eval.zig
@@ -538,7 +538,7 @@ test "@tagName of @typeInfo" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
const str = @tagName(@typeInfo(u8));
- try expect(std.mem.eql(u8, str, "Int"));
+ try expect(std.mem.eql(u8, str, "int"));
}
test "static eval list init" {
@@ -951,7 +951,7 @@ test "const local with comptime init through array init" {
const S = struct {
fn declarations(comptime T: type) []const std.builtin.Type.Declaration {
- return @typeInfo(T).Enum.decls;
+ return @typeInfo(T).@"enum".decls;
}
};
diff --git a/test/behavior/export_self_referential_type_info.zig b/test/behavior/export_self_referential_type_info.zig
index 1b1bb35e5b9d..0ec0293d15ff 100644
--- a/test/behavior/export_self_referential_type_info.zig
+++ b/test/behavior/export_self_referential_type_info.zig
@@ -1 +1 @@
-export const self_referential_type_info: c_int = @intFromBool(@typeInfo(@This()).Struct.is_tuple);
+export const self_referential_type_info: c_int = @intFromBool(@typeInfo(@This()).@"struct".is_tuple);
diff --git a/test/behavior/fn.zig b/test/behavior/fn.zig
index ab7aca6ed6b4..0066de128424 100644
--- a/test/behavior/fn.zig
+++ b/test/behavior/fn.zig
@@ -393,7 +393,7 @@ test "ability to give comptime types and non comptime types to same parameter" {
}
fn foo(arg: anytype) i32 {
- if (@typeInfo(@TypeOf(arg)) == .Type and arg == i32) return 20;
+ if (@typeInfo(@TypeOf(arg)) == .type and arg == i32) return 20;
return 9 + arg;
}
};
@@ -406,8 +406,8 @@ test "function with inferred error set but returning no error" {
fn foo() !void {}
};
- const return_ty = @typeInfo(@TypeOf(S.foo)).Fn.return_type.?;
- try expectEqual(0, @typeInfo(@typeInfo(return_ty).ErrorUnion.error_set).ErrorSet.?.len);
+ const return_ty = @typeInfo(@TypeOf(S.foo)).@"fn".return_type.?;
+ try expectEqual(0, @typeInfo(@typeInfo(return_ty).error_union.error_set).error_set.?.len);
}
test "import passed byref to function in return type" {
@@ -567,10 +567,10 @@ test "lazy values passed to anytype parameter" {
test "pass and return comptime-only types" {
const S = struct {
- fn returnNull(comptime x: @Type(.Null)) @Type(.Null) {
+ fn returnNull(comptime x: @Type(.null)) @Type(.null) {
return x;
}
- fn returnUndefined(comptime x: @Type(.Undefined)) @Type(.Undefined) {
+ fn returnUndefined(comptime x: @Type(.undefined)) @Type(.undefined) {
return x;
}
};
diff --git a/test/behavior/generics.zig b/test/behavior/generics.zig
index 0a1304ae1521..95678e0ea7d0 100644
--- a/test/behavior/generics.zig
+++ b/test/behavior/generics.zig
@@ -179,7 +179,7 @@ test "generic fn keeps non-generic parameter types" {
const S = struct {
fn f(comptime T: type, s: []T) !void {
- try expect(A != @typeInfo(@TypeOf(s)).Pointer.alignment);
+ try expect(A != @typeInfo(@TypeOf(s)).pointer.alignment);
}
};
@@ -258,17 +258,17 @@ test "generic function instantiation turns into comptime call" {
}
pub fn fieldInfo(comptime T: type, comptime field: FieldEnum(T)) switch (@typeInfo(T)) {
- .Enum => std.builtin.Type.EnumField,
+ .@"enum" => std.builtin.Type.EnumField,
else => void,
} {
- return @typeInfo(T).Enum.fields[@intFromEnum(field)];
+ return @typeInfo(T).@"enum".fields[@intFromEnum(field)];
}
pub fn FieldEnum(comptime T: type) type {
_ = T;
var enumFields: [1]std.builtin.Type.EnumField = .{.{ .name = "A", .value = 0 }};
return @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u0,
.fields = &enumFields,
.decls = &.{},
@@ -363,7 +363,7 @@ test "nested generic function" {
fn g(_: *const fn (anytype) void) void {}
};
- try expect(@typeInfo(@TypeOf(S.g)).Fn.is_generic);
+ try expect(@typeInfo(@TypeOf(S.g)).@"fn".is_generic);
try S.foo(u32, S.bar, 123);
}
@@ -549,7 +549,7 @@ test "call generic function with from function called by the generic function" {
const ArgSerializer = struct {
fn isCommand(comptime T: type) bool {
const tid = @typeInfo(T);
- return (tid == .Struct or tid == .Enum or tid == .Union) and
+ return (tid == .@"struct" or tid == .@"enum" or tid == .@"union") and
@hasDecl(T, "Redis") and @hasDecl(T.Redis, "Command");
}
fn serializeCommand(command: anytype) void {
diff --git a/test/behavior/math.zig b/test/behavior/math.zig
index 9d911c556bed..7837ffb74b4b 100644
--- a/test/behavior/math.zig
+++ b/test/behavior/math.zig
@@ -135,8 +135,8 @@ fn testOneClzVector(
}
fn expectVectorsEqual(a: anytype, b: anytype) !void {
- const len_a = @typeInfo(@TypeOf(a)).Vector.len;
- const len_b = @typeInfo(@TypeOf(b)).Vector.len;
+ const len_a = @typeInfo(@TypeOf(a)).vector.len;
+ const len_b = @typeInfo(@TypeOf(b)).vector.len;
try expect(len_a == len_b);
var i: usize = 0;
@@ -1683,12 +1683,12 @@ test "signed zeros are represented properly" {
}
fn testOne(comptime T: type) !void {
- const ST = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
+ const ST = std.meta.Int(.unsigned, @typeInfo(T).float.bits);
var as_fp_val = -@as(T, 0.0);
_ = &as_fp_val;
const as_uint_val: ST = @bitCast(as_fp_val);
// Ensure the sign bit is set.
- try expect(as_uint_val >> (@typeInfo(T).Float.bits - 1) == 1);
+ try expect(as_uint_val >> (@typeInfo(T).float.bits - 1) == 1);
}
};
diff --git a/test/behavior/packed-struct.zig b/test/behavior/packed-struct.zig
index 9880aff14eb0..8386f62f7782 100644
--- a/test/behavior/packed-struct.zig
+++ b/test/behavior/packed-struct.zig
@@ -1186,9 +1186,9 @@ test "packed struct field pointer aligned properly" {
};
var f1: *align(16) Foo = @alignCast(@as(*align(1) Foo, @ptrCast(&Foo.buffer[0])));
- try expect(@typeInfo(@TypeOf(f1)).Pointer.alignment == 16);
+ try expect(@typeInfo(@TypeOf(f1)).pointer.alignment == 16);
try expect(@intFromPtr(f1) == @intFromPtr(&f1.a));
- try expect(@typeInfo(@TypeOf(&f1.a)).Pointer.alignment == 16);
+ try expect(@typeInfo(@TypeOf(&f1.a)).pointer.alignment == 16);
}
test "load flag from packed struct in union" {
diff --git a/test/behavior/pointers.zig b/test/behavior/pointers.zig
index f8260d1f0d83..07041e70a129 100644
--- a/test/behavior/pointers.zig
+++ b/test/behavior/pointers.zig
@@ -266,8 +266,8 @@ test "allowzero pointer and slice" {
comptime assert(@TypeOf(slice) == []allowzero i32);
try expect(@intFromPtr(&slice[5]) == 20);
- comptime assert(@typeInfo(@TypeOf(ptr)).Pointer.is_allowzero);
- comptime assert(@typeInfo(@TypeOf(slice)).Pointer.is_allowzero);
+ comptime assert(@typeInfo(@TypeOf(ptr)).pointer.is_allowzero);
+ comptime assert(@typeInfo(@TypeOf(slice)).pointer.is_allowzero);
}
test "assign null directly to C pointer and test null equality" {
@@ -441,15 +441,15 @@ test "pointer-integer arithmetic affects the alignment" {
var x: usize = 1;
_ = .{ &ptr, &x };
- try expect(@typeInfo(@TypeOf(ptr)).Pointer.alignment == 8);
+ try expect(@typeInfo(@TypeOf(ptr)).pointer.alignment == 8);
const ptr1 = ptr + 1; // 1 * 4 = 4 -> lcd(4,8) = 4
- try expect(@typeInfo(@TypeOf(ptr1)).Pointer.alignment == 4);
+ try expect(@typeInfo(@TypeOf(ptr1)).pointer.alignment == 4);
const ptr2 = ptr + 4; // 4 * 4 = 16 -> lcd(16,8) = 8
- try expect(@typeInfo(@TypeOf(ptr2)).Pointer.alignment == 8);
+ try expect(@typeInfo(@TypeOf(ptr2)).pointer.alignment == 8);
const ptr3 = ptr + 0; // no-op
- try expect(@typeInfo(@TypeOf(ptr3)).Pointer.alignment == 8);
+ try expect(@typeInfo(@TypeOf(ptr3)).pointer.alignment == 8);
const ptr4 = ptr + x; // runtime-known addend
- try expect(@typeInfo(@TypeOf(ptr4)).Pointer.alignment == 4);
+ try expect(@typeInfo(@TypeOf(ptr4)).pointer.alignment == 4);
}
{
var ptr: [*]align(8) [3]u8 = undefined;
@@ -457,13 +457,13 @@ test "pointer-integer arithmetic affects the alignment" {
_ = .{ &ptr, &x };
const ptr1 = ptr + 17; // 3 * 17 = 51
- try expect(@typeInfo(@TypeOf(ptr1)).Pointer.alignment == 1);
+ try expect(@typeInfo(@TypeOf(ptr1)).pointer.alignment == 1);
const ptr2 = ptr + x; // runtime-known addend
- try expect(@typeInfo(@TypeOf(ptr2)).Pointer.alignment == 1);
+ try expect(@typeInfo(@TypeOf(ptr2)).pointer.alignment == 1);
const ptr3 = ptr + 8; // 3 * 8 = 24 -> lcd(8,24) = 8
- try expect(@typeInfo(@TypeOf(ptr3)).Pointer.alignment == 8);
+ try expect(@typeInfo(@TypeOf(ptr3)).pointer.alignment == 8);
const ptr4 = ptr + 4; // 3 * 4 = 12 -> lcd(8,12) = 4
- try expect(@typeInfo(@TypeOf(ptr4)).Pointer.alignment == 4);
+ try expect(@typeInfo(@TypeOf(ptr4)).pointer.alignment == 4);
}
}
@@ -560,7 +560,7 @@ test "pointer to constant decl preserves alignment" {
const aligned align(8) = @This(){ .a = 3, .b = 4 };
};
- const alignment = @typeInfo(@TypeOf(&S.aligned)).Pointer.alignment;
+ const alignment = @typeInfo(@TypeOf(&S.aligned)).pointer.alignment;
try std.testing.expect(alignment == 8);
}
@@ -641,24 +641,24 @@ const Box2 = struct {
fn mutable() !void {
var box0: Box0 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).Pointer.is_const == false);
+ try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).pointer.is_const == false);
var box1: Box1 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).Pointer.is_const == false);
+ try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).pointer.is_const == false);
var box2: Box2 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).Pointer.is_const == false);
+ try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).pointer.is_const == false);
}
fn constant() !void {
const box0: Box0 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).Pointer.is_const == true);
+ try std.testing.expect(@typeInfo(@TypeOf(box0.items[0..])).pointer.is_const == true);
const box1: Box1 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).Pointer.is_const == true);
+ try std.testing.expect(@typeInfo(@TypeOf(box1.items[0..])).pointer.is_const == true);
const box2: Box2 = .{ .items = undefined };
- try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).Pointer.is_const == true);
+ try std.testing.expect(@typeInfo(@TypeOf(box2.items[0..])).pointer.is_const == true);
}
test "pointer-to-array constness for zero-size elements, var" {
diff --git a/test/behavior/reflection.zig b/test/behavior/reflection.zig
index aea84bc45ad4..02bc0c9e4ba1 100644
--- a/test/behavior/reflection.zig
+++ b/test/behavior/reflection.zig
@@ -6,7 +6,7 @@ const reflection = @This();
test "reflection: function return type, var args, and param types" {
comptime {
- const info = @typeInfo(@TypeOf(dummy)).Fn;
+ const info = @typeInfo(@TypeOf(dummy)).@"fn";
try expect(info.return_type.? == i32);
try expect(!info.is_var_args);
try expect(info.params.len == 3);
diff --git a/test/behavior/slice.zig b/test/behavior/slice.zig
index 18c876c3e0c4..15db19f1e812 100644
--- a/test/behavior/slice.zig
+++ b/test/behavior/slice.zig
@@ -329,9 +329,9 @@ test "empty array to slice" {
const align_1: []align(1) u8 = empty;
const align_4: []align(4) u8 = empty;
const align_16: []align(16) u8 = empty;
- try expect(1 == @typeInfo(@TypeOf(align_1)).Pointer.alignment);
- try expect(4 == @typeInfo(@TypeOf(align_4)).Pointer.alignment);
- try expect(16 == @typeInfo(@TypeOf(align_16)).Pointer.alignment);
+ try expect(1 == @typeInfo(@TypeOf(align_1)).pointer.alignment);
+ try expect(4 == @typeInfo(@TypeOf(align_4)).pointer.alignment);
+ try expect(16 == @typeInfo(@TypeOf(align_16)).pointer.alignment);
}
};
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig
index c8dd22e98c34..ff70c1450563 100644
--- a/test/behavior/struct.zig
+++ b/test/behavior/struct.zig
@@ -1738,7 +1738,7 @@ test "packed struct field in anonymous struct" {
try std.testing.expect(countFields(.{ .t = T{} }) == 1);
}
fn countFields(v: anytype) usize {
- return @typeInfo(@TypeOf(v)).Struct.fields.len;
+ return @typeInfo(@TypeOf(v)).@"struct".fields.len;
}
test "struct init with no result pointer sets field result types" {
@@ -2144,9 +2144,9 @@ test "struct containing optional pointer to array of @This()" {
test "matching captures causes struct equivalence" {
const S = struct {
fn UnsignedWrapper(comptime I: type) type {
- const bits = @typeInfo(I).Int.bits;
+ const bits = @typeInfo(I).int.bits;
return struct {
- x: @Type(.{ .Int = .{
+ x: @Type(.{ .int = .{
.signedness = .unsigned,
.bits = bits,
} }),
diff --git a/test/behavior/tuple.zig b/test/behavior/tuple.zig
index 495e00c409fc..a511b1c1b332 100644
--- a/test/behavior/tuple.zig
+++ b/test/behavior/tuple.zig
@@ -32,16 +32,16 @@ test "tuple multiplication" {
fn doTheTest() !void {
{
const t = .{} ** 4;
- try expect(@typeInfo(@TypeOf(t)).Struct.fields.len == 0);
+ try expect(@typeInfo(@TypeOf(t)).@"struct".fields.len == 0);
}
{
const t = .{'a'} ** 4;
- try expect(@typeInfo(@TypeOf(t)).Struct.fields.len == 4);
+ try expect(@typeInfo(@TypeOf(t)).@"struct".fields.len == 4);
inline for (t) |x| try expect(x == 'a');
}
{
const t = .{ 1, 2, 3 } ** 4;
- try expect(@typeInfo(@TypeOf(t)).Struct.fields.len == 12);
+ try expect(@typeInfo(@TypeOf(t)).@"struct".fields.len == 12);
inline for (t, 0..) |x, i| try expect(x == 1 + i % 3);
}
}
@@ -133,7 +133,7 @@ test "array-like initializer for tuple types" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
const T = @Type(.{
- .Struct = .{
+ .@"struct" = .{
.is_tuple = true,
.layout = .auto,
.decls = &.{},
@@ -323,7 +323,7 @@ test "zero sized struct in tuple handled correctly" {
const State = struct {
const Self = @This();
data: @Type(.{
- .Struct = .{
+ .@"struct" = .{
.is_tuple = true,
.layout = .auto,
.decls = &.{},
@@ -474,7 +474,7 @@ test "coerce anon tuple to tuple" {
}
test "empty tuple type" {
- const S = @Type(.{ .Struct = .{
+ const S = @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &.{},
.decls = &.{},
diff --git a/test/behavior/tuple_declarations.zig b/test/behavior/tuple_declarations.zig
index e6d5d76fc8d1..cf113c020187 100644
--- a/test/behavior/tuple_declarations.zig
+++ b/test/behavior/tuple_declarations.zig
@@ -10,7 +10,7 @@ test "tuple declaration type info" {
{
const T = struct { comptime u32 align(2) = 1, []const u8 };
- const info = @typeInfo(T).Struct;
+ const info = @typeInfo(T).@"struct";
try expect(info.layout == .auto);
try expect(info.backing_integer == null);
diff --git a/test/behavior/type.zig b/test/behavior/type.zig
index ba2964077453..4ebcfa7eee14 100644
--- a/test/behavior/type.zig
+++ b/test/behavior/type.zig
@@ -11,32 +11,32 @@ fn testTypes(comptime types: []const type) !void {
}
test "Type.MetaType" {
- try testing.expect(type == @Type(.{ .Type = {} }));
+ try testing.expect(type == @Type(.{ .type = {} }));
try testTypes(&[_]type{type});
}
test "Type.Void" {
- try testing.expect(void == @Type(.{ .Void = {} }));
+ try testing.expect(void == @Type(.{ .void = {} }));
try testTypes(&[_]type{void});
}
test "Type.Bool" {
- try testing.expect(bool == @Type(.{ .Bool = {} }));
+ try testing.expect(bool == @Type(.{ .bool = {} }));
try testTypes(&[_]type{bool});
}
test "Type.NoReturn" {
- try testing.expect(noreturn == @Type(.{ .NoReturn = {} }));
+ try testing.expect(noreturn == @Type(.{ .noreturn = {} }));
try testTypes(&[_]type{noreturn});
}
test "Type.Int" {
- try testing.expect(u1 == @Type(.{ .Int = .{ .signedness = .unsigned, .bits = 1 } }));
- try testing.expect(i1 == @Type(.{ .Int = .{ .signedness = .signed, .bits = 1 } }));
- try testing.expect(u8 == @Type(.{ .Int = .{ .signedness = .unsigned, .bits = 8 } }));
- try testing.expect(i8 == @Type(.{ .Int = .{ .signedness = .signed, .bits = 8 } }));
- try testing.expect(u64 == @Type(.{ .Int = .{ .signedness = .unsigned, .bits = 64 } }));
- try testing.expect(i64 == @Type(.{ .Int = .{ .signedness = .signed, .bits = 64 } }));
+ try testing.expect(u1 == @Type(.{ .int = .{ .signedness = .unsigned, .bits = 1 } }));
+ try testing.expect(i1 == @Type(.{ .int = .{ .signedness = .signed, .bits = 1 } }));
+ try testing.expect(u8 == @Type(.{ .int = .{ .signedness = .unsigned, .bits = 8 } }));
+ try testing.expect(i8 == @Type(.{ .int = .{ .signedness = .signed, .bits = 8 } }));
+ try testing.expect(u64 == @Type(.{ .int = .{ .signedness = .unsigned, .bits = 64 } }));
+ try testing.expect(i64 == @Type(.{ .int = .{ .signedness = .signed, .bits = 64 } }));
try testTypes(&[_]type{ u8, u32, i64 });
}
@@ -105,31 +105,31 @@ test "Type.Pointer" {
}
test "Type.Float" {
- try testing.expect(f16 == @Type(.{ .Float = .{ .bits = 16 } }));
- try testing.expect(f32 == @Type(.{ .Float = .{ .bits = 32 } }));
- try testing.expect(f64 == @Type(.{ .Float = .{ .bits = 64 } }));
- try testing.expect(f80 == @Type(.{ .Float = .{ .bits = 80 } }));
- try testing.expect(f128 == @Type(.{ .Float = .{ .bits = 128 } }));
+ try testing.expect(f16 == @Type(.{ .float = .{ .bits = 16 } }));
+ try testing.expect(f32 == @Type(.{ .float = .{ .bits = 32 } }));
+ try testing.expect(f64 == @Type(.{ .float = .{ .bits = 64 } }));
+ try testing.expect(f80 == @Type(.{ .float = .{ .bits = 80 } }));
+ try testing.expect(f128 == @Type(.{ .float = .{ .bits = 128 } }));
try testTypes(&[_]type{ f16, f32, f64, f80, f128 });
}
test "Type.Array" {
try testing.expect([123]u8 == @Type(.{
- .Array = .{
+ .array = .{
.len = 123,
.child = u8,
.sentinel = null,
},
}));
try testing.expect([2]u32 == @Type(.{
- .Array = .{
+ .array = .{
.len = 2,
.child = u32,
.sentinel = null,
},
}));
try testing.expect([2:0]u32 == @Type(.{
- .Array = .{
+ .array = .{
.len = 2,
.child = u32,
.sentinel = &@as(u32, 0),
@@ -140,7 +140,7 @@ test "Type.Array" {
test "@Type create slice with null sentinel" {
const Slice = @Type(.{
- .Pointer = .{
+ .pointer = .{
.size = .Slice,
.is_const = true,
.is_volatile = false,
@@ -205,7 +205,7 @@ test "Type.Opaque" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
const Opaque = @Type(.{
- .Opaque = .{
+ .@"opaque" = .{
.decls = &.{},
},
});
@@ -213,7 +213,7 @@ test "Type.Opaque" {
try testing.expectEqualSlices(
Type.Declaration,
&.{},
- @typeInfo(Opaque).Opaque.decls,
+ @typeInfo(Opaque).@"opaque".decls,
);
}
@@ -246,7 +246,7 @@ fn add(a: i32, b: i32) i32 {
}
test "Type.ErrorSet" {
- try testing.expect(@Type(.{ .ErrorSet = null }) == anyerror);
+ try testing.expect(@Type(.{ .error_set = null }) == anyerror);
// error sets don't compare equal so just check if they compile
inline for (.{ error{}, error{A}, error{ A, B, C } }) |T| {
@@ -262,7 +262,7 @@ test "Type.Struct" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
const A = @Type(@typeInfo(struct { x: u8, y: u32 }));
- const infoA = @typeInfo(A).Struct;
+ const infoA = @typeInfo(A).@"struct";
try testing.expectEqual(Type.ContainerLayout.auto, infoA.layout);
try testing.expectEqualSlices(u8, "x", infoA.fields[0].name);
try testing.expectEqual(u8, infoA.fields[0].type);
@@ -280,7 +280,7 @@ test "Type.Struct" {
try testing.expectEqual(@as(u32, 2), a.y);
const B = @Type(@typeInfo(extern struct { x: u8, y: u32 = 5 }));
- const infoB = @typeInfo(B).Struct;
+ const infoB = @typeInfo(B).@"struct";
try testing.expectEqual(Type.ContainerLayout.@"extern", infoB.layout);
try testing.expectEqualSlices(u8, "x", infoB.fields[0].name);
try testing.expectEqual(u8, infoB.fields[0].type);
@@ -292,7 +292,7 @@ test "Type.Struct" {
try testing.expectEqual(@as(bool, false), infoB.is_tuple);
const C = @Type(@typeInfo(packed struct { x: u8 = 3, y: u32 = 5 }));
- const infoC = @typeInfo(C).Struct;
+ const infoC = @typeInfo(C).@"struct";
try testing.expectEqual(Type.ContainerLayout.@"packed", infoC.layout);
try testing.expectEqualSlices(u8, "x", infoC.fields[0].name);
try testing.expectEqual(u8, infoC.fields[0].type);
@@ -305,7 +305,7 @@ test "Type.Struct" {
// anon structs
const D = @Type(@typeInfo(@TypeOf(.{ .x = 3, .y = 5 })));
- const infoD = @typeInfo(D).Struct;
+ const infoD = @typeInfo(D).@"struct";
try testing.expectEqual(Type.ContainerLayout.auto, infoD.layout);
try testing.expectEqualSlices(u8, "x", infoD.fields[0].name);
try testing.expectEqual(comptime_int, infoD.fields[0].type);
@@ -318,7 +318,7 @@ test "Type.Struct" {
// tuples
const E = @Type(@typeInfo(@TypeOf(.{ 1, 2 })));
- const infoE = @typeInfo(E).Struct;
+ const infoE = @typeInfo(E).@"struct";
try testing.expectEqual(Type.ContainerLayout.auto, infoE.layout);
try testing.expectEqualSlices(u8, "0", infoE.fields[0].name);
try testing.expectEqual(comptime_int, infoE.fields[0].type);
@@ -331,14 +331,14 @@ test "Type.Struct" {
// empty struct
const F = @Type(@typeInfo(struct {}));
- const infoF = @typeInfo(F).Struct;
+ const infoF = @typeInfo(F).@"struct";
try testing.expectEqual(Type.ContainerLayout.auto, infoF.layout);
try testing.expect(infoF.fields.len == 0);
try testing.expectEqual(@as(bool, false), infoF.is_tuple);
// empty tuple
const G = @Type(@typeInfo(@TypeOf(.{})));
- const infoG = @typeInfo(G).Struct;
+ const infoG = @typeInfo(G).@"struct";
try testing.expectEqual(Type.ContainerLayout.auto, infoG.layout);
try testing.expect(infoG.fields.len == 0);
try testing.expectEqual(@as(bool, true), infoG.is_tuple);
@@ -349,7 +349,7 @@ test "Type.Enum" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
const Foo = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u8,
.fields = &.{
.{ .name = "a", .value = 1 },
@@ -359,11 +359,11 @@ test "Type.Enum" {
.is_exhaustive = true,
},
});
- try testing.expectEqual(true, @typeInfo(Foo).Enum.is_exhaustive);
+ try testing.expectEqual(true, @typeInfo(Foo).@"enum".is_exhaustive);
try testing.expectEqual(@as(u8, 1), @intFromEnum(Foo.a));
try testing.expectEqual(@as(u8, 5), @intFromEnum(Foo.b));
const Bar = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u32,
.fields = &.{
.{ .name = "a", .value = 1 },
@@ -373,7 +373,7 @@ test "Type.Enum" {
.is_exhaustive = false,
},
});
- try testing.expectEqual(false, @typeInfo(Bar).Enum.is_exhaustive);
+ try testing.expectEqual(false, @typeInfo(Bar).@"enum".is_exhaustive);
try testing.expectEqual(@as(u32, 1), @intFromEnum(Bar.a));
try testing.expectEqual(@as(u32, 5), @intFromEnum(Bar.b));
try testing.expectEqual(@as(u32, 6), @intFromEnum(@as(Bar, @enumFromInt(6))));
@@ -385,7 +385,7 @@ test "Type.Union" {
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
const Untagged = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .@"extern",
.tag_type = null,
.fields = &.{
@@ -401,7 +401,7 @@ test "Type.Union" {
try testing.expectEqual(@as(i32, 3), untagged.int);
const PackedUntagged = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .@"packed",
.tag_type = null,
.fields = &.{
@@ -417,7 +417,7 @@ test "Type.Union" {
try testing.expectEqual(~@as(u32, 0), packed_untagged.unsigned);
const Tag = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u1,
.fields = &.{
.{ .name = "signed", .value = 0 },
@@ -428,7 +428,7 @@ test "Type.Union" {
},
});
const Tagged = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = Tag,
.fields = &.{
@@ -446,7 +446,7 @@ test "Type.Union" {
test "Type.Union from Type.Enum" {
const Tag = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u0,
.fields = &.{
.{ .name = "working_as_expected", .value = 0 },
@@ -456,7 +456,7 @@ test "Type.Union from Type.Enum" {
},
});
const T = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = Tag,
.fields = &.{
@@ -465,13 +465,13 @@ test "Type.Union from Type.Enum" {
.decls = &.{},
},
});
- _ = @typeInfo(T).Union;
+ _ = @typeInfo(T).@"union";
}
test "Type.Union from regular enum" {
const E = enum { working_as_expected };
const T = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = E,
.fields = &.{
@@ -480,13 +480,13 @@ test "Type.Union from regular enum" {
.decls = &.{},
},
});
- _ = @typeInfo(T).Union;
+ _ = @typeInfo(T).@"union";
}
test "Type.Union from empty regular enum" {
const E = enum {};
const U = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = E,
.fields = &.{},
@@ -498,7 +498,7 @@ test "Type.Union from empty regular enum" {
test "Type.Union from empty Type.Enum" {
const E = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u0,
.fields = &.{},
.decls = &.{},
@@ -506,7 +506,7 @@ test "Type.Union from empty Type.Enum" {
},
});
const U = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = E,
.fields = &.{},
@@ -525,7 +525,7 @@ test "Type.Fn" {
const T = fn (c_int, some_ptr) callconv(.C) void;
{
- const fn_info = std.builtin.Type{ .Fn = .{
+ const fn_info = std.builtin.Type{ .@"fn" = .{
.calling_convention = .C,
.is_generic = false,
.is_var_args = false,
@@ -551,7 +551,7 @@ test "reified struct field name from optional payload" {
comptime {
const m_name: ?[1:0]u8 = "a".*;
if (m_name) |*name| {
- const T = @Type(.{ .Struct = .{
+ const T = @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &.{.{
.name = name,
@@ -573,7 +573,7 @@ test "reified union uses @alignOf" {
const S = struct {
fn CreateUnion(comptime T: type) type {
return @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = null,
.fields = &[_]std.builtin.Type.UnionField{
@@ -595,7 +595,7 @@ test "reified struct uses @alignOf" {
const S = struct {
fn NamespacedGlobals(comptime modules: anytype) type {
return @Type(.{
- .Struct = .{
+ .@"struct" = .{
.layout = .auto,
.is_tuple = false,
.fields = &.{
@@ -627,7 +627,7 @@ test "reified error set initialized with field pointer" {
},
};
const Foo = @Type(.{
- .ErrorSet = &info.args,
+ .error_set = &info.args,
});
};
try testing.expect(S.Foo == error{bar});
@@ -640,7 +640,7 @@ test "reified function type params initialized with field pointer" {
},
};
const Bar = @Type(.{
- .Fn = .{
+ .@"fn" = .{
.calling_convention = .Unspecified,
.is_generic = false,
.is_var_args = false,
@@ -649,14 +649,14 @@ test "reified function type params initialized with field pointer" {
},
});
};
- try testing.expect(@typeInfo(S.Bar) == .Fn);
+ try testing.expect(@typeInfo(S.Bar) == .@"fn");
}
test "empty struct assigned to reified struct field" {
const S = struct {
fn NamespacedComponents(comptime modules: anytype) type {
return @Type(.{
- .Struct = .{
+ .@"struct" = .{
.layout = .auto,
.is_tuple = false,
.fields = &.{.{
@@ -689,7 +689,7 @@ test "@Type should resolve its children types" {
const dense = enum(u2) { a, b, c, d };
comptime var sparse_info = @typeInfo(anyerror!sparse);
- sparse_info.ErrorUnion.payload = dense;
+ sparse_info.error_union.payload = dense;
const B = @Type(sparse_info);
try testing.expectEqual(anyerror!dense, B);
}
@@ -718,7 +718,7 @@ test "struct field names sliced at comptime from larger string" {
}
const T = @Type(.{
- .Struct = .{
+ .@"struct" = .{
.layout = .auto,
.is_tuple = false,
.fields = fields,
@@ -726,7 +726,7 @@ test "struct field names sliced at comptime from larger string" {
},
});
- const gen_fields = @typeInfo(T).Struct.fields;
+ const gen_fields = @typeInfo(T).@"struct".fields;
try testing.expectEqual(3, gen_fields.len);
try testing.expectEqualStrings("f1", gen_fields[0].name);
try testing.expectEqualStrings("f2", gen_fields[1].name);
@@ -737,9 +737,9 @@ test "struct field names sliced at comptime from larger string" {
test "matching captures causes opaque equivalence" {
const S = struct {
fn UnsignedId(comptime I: type) type {
- const U = @Type(.{ .Int = .{
+ const U = @Type(.{ .int = .{
.signedness = .unsigned,
- .bits = @typeInfo(I).Int.bits,
+ .bits = @typeInfo(I).int.bits,
} });
return opaque {
fn id(x: U) U {
@@ -765,7 +765,7 @@ test "reify enum where fields refers to part of array" {
.{ .name = "bar", .value = 1 },
undefined,
};
- const E = @Type(.{ .Enum = .{
+ const E = @Type(.{ .@"enum" = .{
.tag_type = u8,
.fields = fields[0..2],
.decls = &.{},
diff --git a/test/behavior/type_info.zig b/test/behavior/type_info.zig
index 46af309f0fe7..d74c03e4366f 100644
--- a/test/behavior/type_info.zig
+++ b/test/behavior/type_info.zig
@@ -16,13 +16,13 @@ test "type info: integer, floating point type info" {
fn testIntFloat() !void {
const u8_info = @typeInfo(u8);
- try expect(u8_info == .Int);
- try expect(u8_info.Int.signedness == .unsigned);
- try expect(u8_info.Int.bits == 8);
+ try expect(u8_info == .int);
+ try expect(u8_info.int.signedness == .unsigned);
+ try expect(u8_info.int.bits == 8);
const f64_info = @typeInfo(f64);
- try expect(f64_info == .Float);
- try expect(f64_info.Float.bits == 64);
+ try expect(f64_info == .float);
+ try expect(f64_info.float.bits == 64);
}
test "type info: optional type info" {
@@ -32,8 +32,8 @@ test "type info: optional type info" {
fn testOptional() !void {
const null_info = @typeInfo(?void);
- try expect(null_info == .Optional);
- try expect(null_info.Optional.child == void);
+ try expect(null_info == .optional);
+ try expect(null_info.optional.child == void);
}
test "type info: C pointer type info" {
@@ -43,19 +43,19 @@ test "type info: C pointer type info" {
fn testCPtr() !void {
const ptr_info = @typeInfo([*c]align(4) const i8);
- try expect(ptr_info == .Pointer);
- try expect(ptr_info.Pointer.size == .C);
- try expect(ptr_info.Pointer.is_const);
- try expect(!ptr_info.Pointer.is_volatile);
- try expect(ptr_info.Pointer.alignment == 4);
- try expect(ptr_info.Pointer.child == i8);
+ try expect(ptr_info == .pointer);
+ try expect(ptr_info.pointer.size == .C);
+ try expect(ptr_info.pointer.is_const);
+ try expect(!ptr_info.pointer.is_volatile);
+ try expect(ptr_info.pointer.alignment == 4);
+ try expect(ptr_info.pointer.child == i8);
}
test "type info: value is correctly copied" {
comptime {
var ptrInfo = @typeInfo([]u32);
- ptrInfo.Pointer.size = .One;
- try expect(@typeInfo([]u32).Pointer.size == .Slice);
+ ptrInfo.pointer.size = .One;
+ try expect(@typeInfo([]u32).pointer.size == .Slice);
}
}
@@ -65,10 +65,10 @@ test "type info: tag type, void info" {
}
fn testBasic() !void {
- try expect(@typeInfo(Type).Union.tag_type == TypeId);
+ try expect(@typeInfo(Type).@"union".tag_type == TypeId);
const void_info = @typeInfo(void);
- try expect(void_info == TypeId.Void);
- try expect(void_info.Void == {});
+ try expect(void_info == TypeId.void);
+ try expect(void_info.void == {});
}
test "type info: pointer type info" {
@@ -78,13 +78,13 @@ test "type info: pointer type info" {
fn testPointer() !void {
const u32_ptr_info = @typeInfo(*u32);
- try expect(u32_ptr_info == .Pointer);
- try expect(u32_ptr_info.Pointer.size == .One);
- try expect(u32_ptr_info.Pointer.is_const == false);
- try expect(u32_ptr_info.Pointer.is_volatile == false);
- try expect(u32_ptr_info.Pointer.alignment == @alignOf(u32));
- try expect(u32_ptr_info.Pointer.child == u32);
- try expect(u32_ptr_info.Pointer.sentinel == null);
+ try expect(u32_ptr_info == .pointer);
+ try expect(u32_ptr_info.pointer.size == .One);
+ try expect(u32_ptr_info.pointer.is_const == false);
+ try expect(u32_ptr_info.pointer.is_volatile == false);
+ try expect(u32_ptr_info.pointer.alignment == @alignOf(u32));
+ try expect(u32_ptr_info.pointer.child == u32);
+ try expect(u32_ptr_info.pointer.sentinel == null);
}
test "type info: unknown length pointer type info" {
@@ -94,13 +94,13 @@ test "type info: unknown length pointer type info" {
fn testUnknownLenPtr() !void {
const u32_ptr_info = @typeInfo([*]const volatile f64);
- try expect(u32_ptr_info == .Pointer);
- try expect(u32_ptr_info.Pointer.size == .Many);
- try expect(u32_ptr_info.Pointer.is_const == true);
- try expect(u32_ptr_info.Pointer.is_volatile == true);
- try expect(u32_ptr_info.Pointer.sentinel == null);
- try expect(u32_ptr_info.Pointer.alignment == @alignOf(f64));
- try expect(u32_ptr_info.Pointer.child == f64);
+ try expect(u32_ptr_info == .pointer);
+ try expect(u32_ptr_info.pointer.size == .Many);
+ try expect(u32_ptr_info.pointer.is_const == true);
+ try expect(u32_ptr_info.pointer.is_volatile == true);
+ try expect(u32_ptr_info.pointer.sentinel == null);
+ try expect(u32_ptr_info.pointer.alignment == @alignOf(f64));
+ try expect(u32_ptr_info.pointer.child == f64);
}
test "type info: null terminated pointer type info" {
@@ -110,13 +110,13 @@ test "type info: null terminated pointer type info" {
fn testNullTerminatedPtr() !void {
const ptr_info = @typeInfo([*:0]u8);
- try expect(ptr_info == .Pointer);
- try expect(ptr_info.Pointer.size == .Many);
- try expect(ptr_info.Pointer.is_const == false);
- try expect(ptr_info.Pointer.is_volatile == false);
- try expect(@as(*const u8, @ptrCast(ptr_info.Pointer.sentinel.?)).* == 0);
+ try expect(ptr_info == .pointer);
+ try expect(ptr_info.pointer.size == .Many);
+ try expect(ptr_info.pointer.is_const == false);
+ try expect(ptr_info.pointer.is_volatile == false);
+ try expect(@as(*const u8, @ptrCast(ptr_info.pointer.sentinel.?)).* == 0);
- try expect(@typeInfo([:0]u8).Pointer.sentinel != null);
+ try expect(@typeInfo([:0]u8).pointer.sentinel != null);
}
test "type info: slice type info" {
@@ -126,12 +126,12 @@ test "type info: slice type info" {
fn testSlice() !void {
const u32_slice_info = @typeInfo([]u32);
- try expect(u32_slice_info == .Pointer);
- try expect(u32_slice_info.Pointer.size == .Slice);
- try expect(u32_slice_info.Pointer.is_const == false);
- try expect(u32_slice_info.Pointer.is_volatile == false);
- try expect(u32_slice_info.Pointer.alignment == 4);
- try expect(u32_slice_info.Pointer.child == u32);
+ try expect(u32_slice_info == .pointer);
+ try expect(u32_slice_info.pointer.size == .Slice);
+ try expect(u32_slice_info.pointer.is_const == false);
+ try expect(u32_slice_info.pointer.is_volatile == false);
+ try expect(u32_slice_info.pointer.alignment == 4);
+ try expect(u32_slice_info.pointer.child == u32);
}
test "type info: array type info" {
@@ -142,18 +142,18 @@ test "type info: array type info" {
fn testArray() !void {
{
const info = @typeInfo([42]u8);
- try expect(info == .Array);
- try expect(info.Array.len == 42);
- try expect(info.Array.child == u8);
- try expect(info.Array.sentinel == null);
+ try expect(info == .array);
+ try expect(info.array.len == 42);
+ try expect(info.array.child == u8);
+ try expect(info.array.sentinel == null);
}
{
const info = @typeInfo([10:0]u8);
- try expect(info.Array.len == 10);
- try expect(info.Array.child == u8);
- try expect(@as(*const u8, @ptrCast(info.Array.sentinel.?)).* == @as(u8, 0));
- try expect(@sizeOf([10:0]u8) == info.Array.len + 1);
+ try expect(info.array.len == 10);
+ try expect(info.array.child == u8);
+ try expect(@as(*const u8, @ptrCast(info.array.sentinel.?)).* == @as(u8, 0));
+ try expect(@sizeOf([10:0]u8) == info.array.len + 1);
}
}
@@ -174,18 +174,18 @@ fn testErrorSet() !void {
};
const error_set_info = @typeInfo(TestErrorSet);
- try expect(error_set_info == .ErrorSet);
- try expect(error_set_info.ErrorSet.?.len == 3);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "First"));
+ try expect(error_set_info == .error_set);
+ try expect(error_set_info.error_set.?.len == 3);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "First"));
const error_union_info = @typeInfo(TestErrorSet!usize);
- try expect(error_union_info == .ErrorUnion);
- try expect(error_union_info.ErrorUnion.error_set == TestErrorSet);
- try expect(error_union_info.ErrorUnion.payload == usize);
+ try expect(error_union_info == .error_union);
+ try expect(error_union_info.error_union.error_set == TestErrorSet);
+ try expect(error_union_info.error_union.payload == usize);
const global_info = @typeInfo(anyerror);
- try expect(global_info == .ErrorSet);
- try expect(global_info.ErrorSet == null);
+ try expect(global_info == .error_set);
+ try expect(global_info.error_set == null);
}
test "type info: error set single value" {
@@ -196,9 +196,9 @@ test "type info: error set single value" {
const TestSet = error.One;
const error_set_info = @typeInfo(@TypeOf(TestSet));
- try expect(error_set_info == .ErrorSet);
- try expect(error_set_info.ErrorSet.?.len == 1);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
+ try expect(error_set_info == .error_set);
+ try expect(error_set_info.error_set.?.len == 1);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
}
test "type info: error set merged" {
@@ -209,11 +209,11 @@ test "type info: error set merged" {
const TestSet = error{ One, Two } || error{Three};
const error_set_info = @typeInfo(TestSet);
- try expect(error_set_info == .ErrorSet);
- try expect(error_set_info.ErrorSet.?.len == 3);
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[0].name, "One"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[1].name, "Two"));
- try expect(mem.eql(u8, error_set_info.ErrorSet.?[2].name, "Three"));
+ try expect(error_set_info == .error_set);
+ try expect(error_set_info.error_set.?.len == 3);
+ try expect(mem.eql(u8, error_set_info.error_set.?[0].name, "One"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[1].name, "Two"));
+ try expect(mem.eql(u8, error_set_info.error_set.?[2].name, "Three"));
}
test "type info: enum info" {
@@ -234,12 +234,12 @@ fn testEnum() !void {
};
const os_info = @typeInfo(Os);
- try expect(os_info == .Enum);
- try expect(os_info.Enum.fields.len == 4);
- try expect(mem.eql(u8, os_info.Enum.fields[1].name, "Macos"));
- try expect(os_info.Enum.fields[3].value == 3);
- try expect(os_info.Enum.tag_type == u2);
- try expect(os_info.Enum.decls.len == 0);
+ try expect(os_info == .@"enum");
+ try expect(os_info.@"enum".fields.len == 4);
+ try expect(mem.eql(u8, os_info.@"enum".fields[1].name, "Macos"));
+ try expect(os_info.@"enum".fields[3].value == 3);
+ try expect(os_info.@"enum".tag_type == u2);
+ try expect(os_info.@"enum".decls.len == 0);
}
test "type info: union info" {
@@ -249,12 +249,12 @@ test "type info: union info" {
fn testUnion() !void {
const typeinfo_info = @typeInfo(Type);
- try expect(typeinfo_info == .Union);
- try expect(typeinfo_info.Union.layout == .auto);
- try expect(typeinfo_info.Union.tag_type.? == TypeId);
- try expect(typeinfo_info.Union.fields.len == 24);
- try expect(typeinfo_info.Union.fields[4].type == @TypeOf(@typeInfo(u8).Int));
- try expect(typeinfo_info.Union.decls.len == 21);
+ try expect(typeinfo_info == .@"union");
+ try expect(typeinfo_info.@"union".layout == .auto);
+ try expect(typeinfo_info.@"union".tag_type.? == TypeId);
+ try expect(typeinfo_info.@"union".fields.len == 24);
+ try expect(typeinfo_info.@"union".fields[4].type == @TypeOf(@typeInfo(u8).int));
+ try expect(typeinfo_info.@"union".decls.len == 21);
const TestNoTagUnion = union {
Foo: void,
@@ -262,22 +262,22 @@ fn testUnion() !void {
};
const notag_union_info = @typeInfo(TestNoTagUnion);
- try expect(notag_union_info == .Union);
- try expect(notag_union_info.Union.tag_type == null);
- try expect(notag_union_info.Union.layout == .auto);
- try expect(notag_union_info.Union.fields.len == 2);
- try expect(notag_union_info.Union.fields[0].alignment == @alignOf(void));
- try expect(notag_union_info.Union.fields[1].type == u32);
- try expect(notag_union_info.Union.fields[1].alignment == @alignOf(u32));
+ try expect(notag_union_info == .@"union");
+ try expect(notag_union_info.@"union".tag_type == null);
+ try expect(notag_union_info.@"union".layout == .auto);
+ try expect(notag_union_info.@"union".fields.len == 2);
+ try expect(notag_union_info.@"union".fields[0].alignment == @alignOf(void));
+ try expect(notag_union_info.@"union".fields[1].type == u32);
+ try expect(notag_union_info.@"union".fields[1].alignment == @alignOf(u32));
const TestExternUnion = extern union {
foo: *anyopaque,
};
const extern_union_info = @typeInfo(TestExternUnion);
- try expect(extern_union_info.Union.layout == .@"extern");
- try expect(extern_union_info.Union.tag_type == null);
- try expect(extern_union_info.Union.fields[0].type == *anyopaque);
+ try expect(extern_union_info.@"union".layout == .@"extern");
+ try expect(extern_union_info.@"union".tag_type == null);
+ try expect(extern_union_info.@"union".fields[0].type == *anyopaque);
}
test "type info: struct info" {
@@ -289,11 +289,11 @@ test "type info: struct info" {
fn testStruct() !void {
const unpacked_struct_info = @typeInfo(TestStruct);
- try expect(unpacked_struct_info.Struct.is_tuple == false);
- try expect(unpacked_struct_info.Struct.backing_integer == null);
- try expect(unpacked_struct_info.Struct.fields[0].alignment == @alignOf(u32));
- try expect(@as(*align(1) const u32, @ptrCast(unpacked_struct_info.Struct.fields[0].default_value.?)).* == 4);
- try expect(mem.eql(u8, "foobar", @as(*align(1) const *const [6:0]u8, @ptrCast(unpacked_struct_info.Struct.fields[1].default_value.?)).*));
+ try expect(unpacked_struct_info.@"struct".is_tuple == false);
+ try expect(unpacked_struct_info.@"struct".backing_integer == null);
+ try expect(unpacked_struct_info.@"struct".fields[0].alignment == @alignOf(u32));
+ try expect(@as(*align(1) const u32, @ptrCast(unpacked_struct_info.@"struct".fields[0].default_value.?)).* == 4);
+ try expect(mem.eql(u8, "foobar", @as(*align(1) const *const [6:0]u8, @ptrCast(unpacked_struct_info.@"struct".fields[1].default_value.?)).*));
}
const TestStruct = struct {
@@ -308,17 +308,17 @@ test "type info: packed struct info" {
fn testPackedStruct() !void {
const struct_info = @typeInfo(TestPackedStruct);
- try expect(struct_info == .Struct);
- try expect(struct_info.Struct.is_tuple == false);
- try expect(struct_info.Struct.layout == .@"packed");
- try expect(struct_info.Struct.backing_integer == u128);
- try expect(struct_info.Struct.fields.len == 4);
- try expect(struct_info.Struct.fields[0].alignment == 0);
- try expect(struct_info.Struct.fields[2].type == f32);
- try expect(struct_info.Struct.fields[2].default_value == null);
- try expect(@as(*align(1) const u32, @ptrCast(struct_info.Struct.fields[3].default_value.?)).* == 4);
- try expect(struct_info.Struct.fields[3].alignment == 0);
- try expect(struct_info.Struct.decls.len == 1);
+ try expect(struct_info == .@"struct");
+ try expect(struct_info.@"struct".is_tuple == false);
+ try expect(struct_info.@"struct".layout == .@"packed");
+ try expect(struct_info.@"struct".backing_integer == u128);
+ try expect(struct_info.@"struct".fields.len == 4);
+ try expect(struct_info.@"struct".fields[0].alignment == 0);
+ try expect(struct_info.@"struct".fields[2].type == f32);
+ try expect(struct_info.@"struct".fields[2].default_value == null);
+ try expect(@as(*align(1) const u32, @ptrCast(struct_info.@"struct".fields[3].default_value.?)).* == 4);
+ try expect(struct_info.@"struct".fields[3].alignment == 0);
+ try expect(struct_info.@"struct".decls.len == 1);
}
const TestPackedStruct = packed struct {
@@ -345,7 +345,7 @@ fn testOpaque() !void {
};
const foo_info = @typeInfo(Foo);
- try expect(foo_info.Opaque.decls.len == 2);
+ try expect(foo_info.@"opaque".decls.len == 2);
}
test "type info: function type info" {
@@ -358,36 +358,36 @@ test "type info: function type info" {
fn testFunction() !void {
const foo_fn_type = @TypeOf(typeInfoFoo);
const foo_fn_info = @typeInfo(foo_fn_type);
- try expect(foo_fn_info.Fn.calling_convention == .C);
- try expect(!foo_fn_info.Fn.is_generic);
- try expect(foo_fn_info.Fn.params.len == 2);
- try expect(foo_fn_info.Fn.is_var_args);
- try expect(foo_fn_info.Fn.return_type.? == usize);
+ try expect(foo_fn_info.@"fn".calling_convention == .C);
+ try expect(!foo_fn_info.@"fn".is_generic);
+ try expect(foo_fn_info.@"fn".params.len == 2);
+ try expect(foo_fn_info.@"fn".is_var_args);
+ try expect(foo_fn_info.@"fn".return_type.? == usize);
const foo_ptr_fn_info = @typeInfo(@TypeOf(&typeInfoFoo));
- try expect(foo_ptr_fn_info.Pointer.size == .One);
- try expect(foo_ptr_fn_info.Pointer.is_const);
- try expect(!foo_ptr_fn_info.Pointer.is_volatile);
- try expect(foo_ptr_fn_info.Pointer.address_space == .generic);
- try expect(foo_ptr_fn_info.Pointer.child == foo_fn_type);
- try expect(!foo_ptr_fn_info.Pointer.is_allowzero);
- try expect(foo_ptr_fn_info.Pointer.sentinel == null);
+ try expect(foo_ptr_fn_info.pointer.size == .One);
+ try expect(foo_ptr_fn_info.pointer.is_const);
+ try expect(!foo_ptr_fn_info.pointer.is_volatile);
+ try expect(foo_ptr_fn_info.pointer.address_space == .generic);
+ try expect(foo_ptr_fn_info.pointer.child == foo_fn_type);
+ try expect(!foo_ptr_fn_info.pointer.is_allowzero);
+ try expect(foo_ptr_fn_info.pointer.sentinel == null);
const aligned_foo_fn_type = @TypeOf(typeInfoFooAligned);
const aligned_foo_fn_info = @typeInfo(aligned_foo_fn_type);
- try expect(aligned_foo_fn_info.Fn.calling_convention == .C);
- try expect(!aligned_foo_fn_info.Fn.is_generic);
- try expect(aligned_foo_fn_info.Fn.params.len == 2);
- try expect(aligned_foo_fn_info.Fn.is_var_args);
- try expect(aligned_foo_fn_info.Fn.return_type.? == usize);
+ try expect(aligned_foo_fn_info.@"fn".calling_convention == .C);
+ try expect(!aligned_foo_fn_info.@"fn".is_generic);
+ try expect(aligned_foo_fn_info.@"fn".params.len == 2);
+ try expect(aligned_foo_fn_info.@"fn".is_var_args);
+ try expect(aligned_foo_fn_info.@"fn".return_type.? == usize);
const aligned_foo_ptr_fn_info = @typeInfo(@TypeOf(&typeInfoFooAligned));
- try expect(aligned_foo_ptr_fn_info.Pointer.size == .One);
- try expect(aligned_foo_ptr_fn_info.Pointer.is_const);
- try expect(!aligned_foo_ptr_fn_info.Pointer.is_volatile);
- try expect(aligned_foo_ptr_fn_info.Pointer.alignment == 4);
- try expect(aligned_foo_ptr_fn_info.Pointer.address_space == .generic);
- try expect(aligned_foo_ptr_fn_info.Pointer.child == aligned_foo_fn_type);
- try expect(!aligned_foo_ptr_fn_info.Pointer.is_allowzero);
- try expect(aligned_foo_ptr_fn_info.Pointer.sentinel == null);
+ try expect(aligned_foo_ptr_fn_info.pointer.size == .One);
+ try expect(aligned_foo_ptr_fn_info.pointer.is_const);
+ try expect(!aligned_foo_ptr_fn_info.pointer.is_volatile);
+ try expect(aligned_foo_ptr_fn_info.pointer.alignment == 4);
+ try expect(aligned_foo_ptr_fn_info.pointer.address_space == .generic);
+ try expect(aligned_foo_ptr_fn_info.pointer.child == aligned_foo_fn_type);
+ try expect(!aligned_foo_ptr_fn_info.pointer.is_allowzero);
+ try expect(aligned_foo_ptr_fn_info.pointer.sentinel == null);
}
extern 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
test "type info: generic function types" {
const G1 = @typeInfo(@TypeOf(generic1));
- try expect(G1.Fn.params.len == 1);
- try expect(G1.Fn.params[0].is_generic == true);
- try expect(G1.Fn.params[0].type == null);
- try expect(G1.Fn.return_type == void);
+ try expect(G1.@"fn".params.len == 1);
+ try expect(G1.@"fn".params[0].is_generic == true);
+ try expect(G1.@"fn".params[0].type == null);
+ try expect(G1.@"fn".return_type == void);
const G2 = @typeInfo(@TypeOf(generic2));
- try expect(G2.Fn.params.len == 3);
- try expect(G2.Fn.params[0].is_generic == false);
- try expect(G2.Fn.params[0].type == type);
- try expect(G2.Fn.params[1].is_generic == true);
- try expect(G2.Fn.params[1].type == null);
- try expect(G2.Fn.params[2].is_generic == false);
- try expect(G2.Fn.params[2].type == u8);
- try expect(G2.Fn.return_type == void);
+ try expect(G2.@"fn".params.len == 3);
+ try expect(G2.@"fn".params[0].is_generic == false);
+ try expect(G2.@"fn".params[0].type == type);
+ try expect(G2.@"fn".params[1].is_generic == true);
+ try expect(G2.@"fn".params[1].type == null);
+ try expect(G2.@"fn".params[2].is_generic == false);
+ try expect(G2.@"fn".params[2].type == u8);
+ try expect(G2.@"fn".return_type == void);
const G3 = @typeInfo(@TypeOf(generic3));
- try expect(G3.Fn.params.len == 1);
- try expect(G3.Fn.params[0].is_generic == true);
- try expect(G3.Fn.params[0].type == null);
- try expect(G3.Fn.return_type == null);
+ try expect(G3.@"fn".params.len == 1);
+ try expect(G3.@"fn".params[0].is_generic == true);
+ try expect(G3.@"fn".params[0].type == null);
+ try expect(G3.@"fn".return_type == null);
const G4 = @typeInfo(@TypeOf(generic4));
- try expect(G4.Fn.params.len == 1);
- try expect(G4.Fn.params[0].is_generic == true);
- try expect(G4.Fn.params[0].type == null);
- try expect(G4.Fn.return_type == null);
+ try expect(G4.@"fn".params.len == 1);
+ try expect(G4.@"fn".params[0].is_generic == true);
+ try expect(G4.@"fn".params[0].type == null);
+ try expect(G4.@"fn".return_type == null);
}
fn generic1(param: anytype) void {
@@ -450,9 +450,9 @@ test "type info: vectors" {
fn testVector() !void {
const vec_info = @typeInfo(@Vector(4, i32));
- try expect(vec_info == .Vector);
- try expect(vec_info.Vector.len == 4);
- try expect(vec_info.Vector.child == i32);
+ try expect(vec_info == .vector);
+ try expect(vec_info.vector.len == 4);
+ try expect(vec_info.vector.child == i32);
}
test "type info: anyframe and anyframe->T" {
@@ -468,14 +468,14 @@ test "type info: anyframe and anyframe->T" {
fn testAnyFrame() !void {
{
const anyframe_info = @typeInfo(anyframe->i32);
- try expect(anyframe_info == .AnyFrame);
- try expect(anyframe_info.AnyFrame.child.? == i32);
+ try expect(anyframe_info == .@"anyframe");
+ try expect(anyframe_info.@"anyframe".child.? == i32);
}
{
const anyframe_info = @typeInfo(anyframe);
- try expect(anyframe_info == .AnyFrame);
- try expect(anyframe_info.AnyFrame.child == null);
+ try expect(anyframe_info == .@"anyframe");
+ try expect(anyframe_info.@"anyframe".child == null);
}
}
@@ -490,13 +490,13 @@ fn passTypeInfo(comptime info: Type) type {
}
test "type info: TypeId -> Type impl cast" {
- _ = passTypeInfo(TypeId.Void);
- _ = comptime passTypeInfo(TypeId.Void);
+ _ = passTypeInfo(TypeId.void);
+ _ = comptime passTypeInfo(TypeId.void);
}
test "sentinel of opaque pointer type" {
const c_void_info = @typeInfo(*anyopaque);
- try expect(c_void_info.Pointer.sentinel == null);
+ try expect(c_void_info.pointer.sentinel == null);
}
test "@typeInfo does not force declarations into existence" {
@@ -507,7 +507,7 @@ test "@typeInfo does not force declarations into existence" {
@compileError("test failed");
}
};
- comptime assert(@typeInfo(S).Struct.fields.len == 1);
+ comptime assert(@typeInfo(S).@"struct".fields.len == 1);
}
fn add(a: i32, b: i32) i32 {
@@ -521,7 +521,7 @@ test "type info for async frames" {
}
switch (@typeInfo(@Frame(add))) {
- .Frame => |frame| {
+ .frame => |frame| {
try expect(@as(@TypeOf(add), @ptrCast(frame.function)) == add);
},
else => unreachable,
@@ -538,7 +538,7 @@ test "Declarations are returned in declaration order" {
pub const d = 4;
pub const e = 5;
};
- const d = @typeInfo(S).Struct.decls;
+ const d = @typeInfo(S).@"struct".decls;
try expect(std.mem.eql(u8, d[0].name, "a"));
try expect(std.mem.eql(u8, d[1].name, "b"));
try expect(std.mem.eql(u8, d[2].name, "c"));
@@ -547,19 +547,19 @@ test "Declarations are returned in declaration order" {
}
test "Struct.is_tuple for anon list literal" {
- try expect(@typeInfo(@TypeOf(.{0})).Struct.is_tuple);
+ try expect(@typeInfo(@TypeOf(.{0})).@"struct".is_tuple);
}
test "Struct.is_tuple for anon struct literal" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
const info = @typeInfo(@TypeOf(.{ .a = 0 }));
- try expect(!info.Struct.is_tuple);
- try expect(std.mem.eql(u8, info.Struct.fields[0].name, "a"));
+ try expect(!info.@"struct".is_tuple);
+ try expect(std.mem.eql(u8, info.@"struct".fields[0].name, "a"));
}
test "StructField.is_comptime" {
- const info = @typeInfo(struct { x: u8 = 3, comptime y: u32 = 5 }).Struct;
+ const info = @typeInfo(struct { x: u8 = 3, comptime y: u32 = 5 }).@"struct";
try expect(!info.fields[0].is_comptime);
try expect(info.fields[1].is_comptime);
}
@@ -574,7 +574,7 @@ test "typeInfo resolves usingnamespace declarations" {
pub usingnamespace A;
};
- const decls = @typeInfo(B).Struct.decls;
+ const decls = @typeInfo(B).@"struct".decls;
try expect(decls.len == 2);
try expectEqualStrings(decls[0].name, "f0");
try expectEqualStrings(decls[1].name, "f1");
@@ -582,7 +582,7 @@ test "typeInfo resolves usingnamespace declarations" {
test "value from struct @typeInfo default_value can be loaded at comptime" {
comptime {
- const a = @typeInfo(@TypeOf(.{ .foo = @as(u8, 1) })).Struct.fields[0].default_value;
+ const a = @typeInfo(@TypeOf(.{ .foo = @as(u8, 1) })).@"struct".fields[0].default_value;
try expect(@as(*const u8, @ptrCast(a)).* == 1);
}
}
@@ -603,7 +603,7 @@ test "@typeInfo decls and usingnamespace" {
test {}
};
- const decls = @typeInfo(B).Struct.decls;
+ const decls = @typeInfo(B).@"struct".decls;
try expect(decls.len == 3);
try expectEqualStrings(decls[0].name, "z");
try expectEqualStrings(decls[1].name, "x");
@@ -613,7 +613,7 @@ test "@typeInfo decls and usingnamespace" {
test "@typeInfo decls ignore dependency loops" {
const S = struct {
pub fn Def(comptime T: type) type {
- std.debug.assert(@typeInfo(T).Struct.decls.len == 1);
+ std.debug.assert(@typeInfo(T).@"struct".decls.len == 1);
return struct {
const foo = u32;
};
@@ -624,7 +624,7 @@ test "@typeInfo decls ignore dependency loops" {
}
test "type info of tuple of string literal default value" {
- const struct_field = @typeInfo(@TypeOf(.{"hi"})).Struct.fields[0];
+ const struct_field = @typeInfo(@TypeOf(.{"hi"})).@"struct".fields[0];
const value = @as(*align(1) const *const [2:0]u8, @ptrCast(struct_field.default_value.?)).*;
comptime std.debug.assert(value[0] == 'h');
}
@@ -648,7 +648,7 @@ test "@typeInfo only contains pub decls" {
};
};
const ti = @typeInfo(other);
- const decls = ti.Struct.decls;
+ const decls = ti.@"struct".decls;
try std.testing.expectEqual(2, decls.len);
try std.testing.expectEqualStrings("Enum", decls[0].name);
diff --git a/test/behavior/type_info_mul_linksection_addrspace_decls.zig b/test/behavior/type_info_mul_linksection_addrspace_decls.zig
index cfb9b556dfed..6fa438a4e73d 100644
--- a/test/behavior/type_info_mul_linksection_addrspace_decls.zig
+++ b/test/behavior/type_info_mul_linksection_addrspace_decls.zig
@@ -7,6 +7,6 @@ pub const c addrspace("space_c") = 0;
pub const d addrspace("space_d") = 0;
test {
- const decls = @typeInfo(@This()).Struct.decls;
+ const decls = @typeInfo(@This()).@"struct".decls;
try expect(decls.len == 4);
}
diff --git a/test/behavior/typename.zig b/test/behavior/typename.zig
index cd83e4048563..dd1172395274 100644
--- a/test/behavior/typename.zig
+++ b/test/behavior/typename.zig
@@ -110,7 +110,7 @@ test "top level decl" {
);
// regular fn inside struct, with error
try expectEqualStrings(
- "fn () @typeInfo(@typeInfo(@TypeOf(behavior.typename.B.doTest)).Fn.return_type.?).ErrorUnion.error_set!void",
+ "fn () @typeInfo(@typeInfo(@TypeOf(behavior.typename.B.doTest)).@\"fn\".return_type.?).error_union.error_set!void",
@typeName(@TypeOf(B.doTest)),
);
// generic fn
diff --git a/test/behavior/union.zig b/test/behavior/union.zig
index 56ea22f3cce5..13d8862dea9a 100644
--- a/test/behavior/union.zig
+++ b/test/behavior/union.zig
@@ -479,7 +479,7 @@ test "global union with single field is correctly initialized" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
glbl = Foo1{
- .f = @typeInfo(Foo1).Union.fields[0].type{ .x = 123 },
+ .f = @typeInfo(Foo1).@"union".fields[0].type{ .x = 123 },
};
try expect(glbl.f.x == 123);
}
@@ -600,8 +600,8 @@ test "tagged union type" {
const baz = Baz.B;
try expect(baz == Baz.B);
- try expect(@typeInfo(TaggedFoo).Union.fields.len == 3);
- try expect(@typeInfo(Baz).Enum.fields.len == 4);
+ try expect(@typeInfo(TaggedFoo).@"union".fields.len == 3);
+ try expect(@typeInfo(Baz).@"enum".fields.len == 4);
try expect(@sizeOf(TaggedFoo) == @sizeOf(FooNoVoid));
try expect(@sizeOf(Baz) == 1);
}
@@ -2305,13 +2305,13 @@ test "create union(enum) from other union(enum)" {
test "matching captures causes union equivalence" {
const S = struct {
fn SignedUnsigned(comptime I: type) type {
- const bits = @typeInfo(I).Int.bits;
+ const bits = @typeInfo(I).int.bits;
return union {
- u: @Type(.{ .Int = .{
+ u: @Type(.{ .int = .{
.signedness = .unsigned,
.bits = bits,
} }),
- i: @Type(.{ .Int = .{
+ i: @Type(.{ .int = .{
.signedness = .signed,
.bits = bits,
} }),
diff --git a/test/behavior/usingnamespace.zig b/test/behavior/usingnamespace.zig
index 418cae3ca3e6..d4f01fd58e27 100644
--- a/test/behavior/usingnamespace.zig
+++ b/test/behavior/usingnamespace.zig
@@ -109,7 +109,7 @@ test "container member access usingnamespace decls" {
usingnamespace opaque {};
-usingnamespace @Type(.{ .Struct = .{
+usingnamespace @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &.{},
.decls = &.{},
diff --git a/test/behavior/vector.zig b/test/behavior/vector.zig
index 214fda28d645..08c81fd28bb0 100644
--- a/test/behavior/vector.zig
+++ b/test/behavior/vector.zig
@@ -564,7 +564,7 @@ test "vector division operators" {
const S = struct {
fn doTheTestDiv(comptime T: type, x: @Vector(4, T), y: @Vector(4, T)) !void {
const is_signed_int = switch (@typeInfo(T)) {
- .Int => |info| info.signedness == .signed,
+ .int => |info| info.signedness == .signed,
else => false,
};
if (!is_signed_int) {
@@ -589,10 +589,10 @@ test "vector division operators" {
fn doTheTestMod(comptime T: type, x: @Vector(4, T), y: @Vector(4, T)) !void {
const is_signed_int = switch (@typeInfo(T)) {
- .Int => |info| info.signedness == .signed,
+ .int => |info| info.signedness == .signed,
else => false,
};
- if (!is_signed_int and @typeInfo(T) != .Float) {
+ if (!is_signed_int and @typeInfo(T) != .float) {
const r0 = x % y;
for (@as([4]T, r0), 0..) |v, i| {
try expect(x[i] % y[i] == v);
@@ -686,9 +686,9 @@ test "vector shift operators" {
const S = struct {
fn doTheTestShift(x: anytype, y: anytype) !void {
- const N = @typeInfo(@TypeOf(x)).Array.len;
- const TX = @typeInfo(@TypeOf(x)).Array.child;
- const TY = @typeInfo(@TypeOf(y)).Array.child;
+ const N = @typeInfo(@TypeOf(x)).array.len;
+ const TX = @typeInfo(@TypeOf(x)).array.child;
+ const TY = @typeInfo(@TypeOf(y)).array.child;
const xv = @as(@Vector(N, TX), x);
const yv = @as(@Vector(N, TY), y);
@@ -703,9 +703,9 @@ test "vector shift operators" {
}
}
fn doTheTestShiftExact(x: anytype, y: anytype, dir: enum { Left, Right }) !void {
- const N = @typeInfo(@TypeOf(x)).Array.len;
- const TX = @typeInfo(@TypeOf(x)).Array.child;
- const TY = @typeInfo(@TypeOf(y)).Array.child;
+ const N = @typeInfo(@TypeOf(x)).array.len;
+ const TX = @typeInfo(@TypeOf(x)).array.child;
+ const TY = @typeInfo(@TypeOf(y)).array.child;
const xv = @as(@Vector(N, TX), x);
const yv = @as(@Vector(N, TY), y);
@@ -777,13 +777,13 @@ test "vector reduce operation" {
const S = struct {
fn testReduce(comptime op: std.builtin.ReduceOp, x: anytype, expected: anytype) !void {
- const N = @typeInfo(@TypeOf(x)).Array.len;
- const TX = @typeInfo(@TypeOf(x)).Array.child;
+ const N = @typeInfo(@TypeOf(x)).array.len;
+ const TX = @typeInfo(@TypeOf(x)).array.child;
const r = @reduce(op, @as(@Vector(N, TX), x));
switch (@typeInfo(TX)) {
- .Int, .Bool => try expect(expected == r),
- .Float => {
+ .int, .bool => try expect(expected == r),
+ .float => {
const expected_nan = math.isNan(expected);
const got_nan = math.isNan(r);
@@ -941,10 +941,10 @@ test "mask parameter of @shuffle is comptime scope" {
var v4_b = __v4hi{ 5, 6, 7, 8 };
_ = .{ &v4_a, &v4_b };
const shuffled: __v4hi = @shuffle(i16, v4_a, v4_b, @Vector(4, i32){
- std.zig.c_translation.shuffleVectorIndex(0, @typeInfo(@TypeOf(v4_a)).Vector.len),
- std.zig.c_translation.shuffleVectorIndex(2, @typeInfo(@TypeOf(v4_a)).Vector.len),
- std.zig.c_translation.shuffleVectorIndex(4, @typeInfo(@TypeOf(v4_a)).Vector.len),
- std.zig.c_translation.shuffleVectorIndex(6, @typeInfo(@TypeOf(v4_a)).Vector.len),
+ std.zig.c_translation.shuffleVectorIndex(0, @typeInfo(@TypeOf(v4_a)).vector.len),
+ std.zig.c_translation.shuffleVectorIndex(2, @typeInfo(@TypeOf(v4_a)).vector.len),
+ std.zig.c_translation.shuffleVectorIndex(4, @typeInfo(@TypeOf(v4_a)).vector.len),
+ std.zig.c_translation.shuffleVectorIndex(6, @typeInfo(@TypeOf(v4_a)).vector.len),
});
try expect(shuffled[0] == 1);
try expect(shuffled[1] == 3);
diff --git a/test/c_import/macros.zig b/test/c_import/macros.zig
index 661d8e38470f..4ef026fecdd6 100644
--- a/test/c_import/macros.zig
+++ b/test/c_import/macros.zig
@@ -222,7 +222,7 @@ test "Macro that uses remainder operator. Issue #13346" {
test "@typeInfo on @cImport result" {
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
- try expect(@typeInfo(h).Struct.decls.len > 1);
+ try expect(@typeInfo(h).@"struct".decls.len > 1);
}
test "Macro that uses Long type concatenation casting" {
diff --git a/test/cases/compile_errors/@errorCast_with_bad_type.zig b/test/cases/compile_errors/@errorCast_with_bad_type.zig
index 6fc42f79f3c0..b71b781ccabf 100644
--- a/test/cases/compile_errors/@errorCast_with_bad_type.zig
+++ b/test/cases/compile_errors/@errorCast_with_bad_type.zig
@@ -23,8 +23,8 @@ pub export fn entry4() void {
// backend=stage2
// target=x86_64-linux
//
-// :4:25: error: expected error set or error union type, found 'ComptimeInt'
-// :8:20: error: expected error set or error union type, found 'Int'
+// :4:25: error: expected error set or error union type, found 'comptime_int'
+// :8:20: error: expected error set or error union type, found 'int'
// :13:25: error: cannot cast an error union type to error set
// :18:29: error: payload types of error unions must match
// :18:29: note: destination payload is 'f32'
diff --git a/test/cases/compile_errors/access_invalid_typeInfo_decl.zig b/test/cases/compile_errors/access_invalid_typeInfo_decl.zig
index 13fda8fa7b0d..6fc9f2085ffc 100644
--- a/test/cases/compile_errors/access_invalid_typeInfo_decl.zig
+++ b/test/cases/compile_errors/access_invalid_typeInfo_decl.zig
@@ -1,6 +1,6 @@
const A = B;
test "Crash" {
- _ = @typeInfo(@This()).Struct.decls[0];
+ _ = @typeInfo(@This()).@"struct".decls[0];
}
// error
diff --git a/test/cases/compile_errors/addition_with_non_numbers.zig b/test/cases/compile_errors/addition_with_non_numbers.zig
index 1b60d1ba9a64..d1401d95ebe7 100644
--- a/test/cases/compile_errors/addition_with_non_numbers.zig
+++ b/test/cases/compile_errors/addition_with_non_numbers.zig
@@ -11,4 +11,4 @@ export fn entry() usize {
// backend=llvm
// target=native
//
-// :4:29: error: invalid operands to binary expression: 'Struct' and 'Struct'
+// :4:29: error: invalid operands to binary expression: 'struct' and 'struct'
diff --git a/test/cases/compile_errors/array_init_generic_fn_with_inferred_error_set.zig b/test/cases/compile_errors/array_init_generic_fn_with_inferred_error_set.zig
index 08cee687b1e0..f2819c8c3b14 100644
--- a/test/cases/compile_errors/array_init_generic_fn_with_inferred_error_set.zig
+++ b/test/cases/compile_errors/array_init_generic_fn_with_inferred_error_set.zig
@@ -8,5 +8,5 @@ fn my_func(comptime T: type) !T {}
// error
//
-// :2:9: error: expected type 'type', found 'fn (comptime type) @typeInfo(@typeInfo(@TypeOf(tmp.my_func)).Fn.return_type.?).ErrorUnion.error_set!anytype'
-// :5:9: error: expected type 'type', found 'fn (comptime type) @typeInfo(@typeInfo(@TypeOf(tmp.my_func)).Fn.return_type.?).ErrorUnion.error_set!anytype'
+// :2:9: error: expected type 'type', found 'fn (comptime type) @typeInfo(@typeInfo(@TypeOf(tmp.my_func)).@"fn".return_type.?).error_union.error_set!anytype'
+// :5:9: error: expected type 'type', found 'fn (comptime type) @typeInfo(@typeInfo(@TypeOf(tmp.my_func)).@"fn".return_type.?).error_union.error_set!anytype'
diff --git a/test/cases/compile_errors/attempt_to_create_17_bit_float_type.zig b/test/cases/compile_errors/attempt_to_create_17_bit_float_type.zig
index 6748fa1edc6f..1f39222fd743 100644
--- a/test/cases/compile_errors/attempt_to_create_17_bit_float_type.zig
+++ b/test/cases/compile_errors/attempt_to_create_17_bit_float_type.zig
@@ -1,6 +1,6 @@
const builtin = @import("std").builtin;
comptime {
- _ = @Type(.{ .Float = .{ .bits = 17 } });
+ _ = @Type(.{ .float = .{ .bits = 17 } });
}
// error
diff --git a/test/cases/compile_errors/binary_OR_operator_on_error_sets.zig b/test/cases/compile_errors/binary_OR_operator_on_error_sets.zig
index ae239d300e85..2a028913a81d 100644
--- a/test/cases/compile_errors/binary_OR_operator_on_error_sets.zig
+++ b/test/cases/compile_errors/binary_OR_operator_on_error_sets.zig
@@ -9,4 +9,4 @@ export fn entry() void {
// backend=stage2
// target=native
//
-// :2:18: error: invalid operands to binary bitwise expression: 'ErrorSet' and 'ErrorSet'
+// :2:18: error: invalid operands to binary bitwise expression: 'error_set' and 'error_set'
diff --git a/test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig b/test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig
index 7951b4dec0ab..519deb195211 100644
--- a/test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig
+++ b/test/cases/compile_errors/comptime_store_in_comptime_switch_in_runtime_if.zig
@@ -6,7 +6,7 @@ pub export fn entry() void {
const Widget = union(enum) { a: u0 };
comptime var a = 1;
- const info = @typeInfo(Widget).Union;
+ const info = @typeInfo(Widget).@"union";
inline for (info.fields) |field| {
if (foo()) {
switch (field.type) {
diff --git a/test/cases/compile_errors/dereference_anyopaque.zig b/test/cases/compile_errors/dereference_anyopaque.zig
index 88598149d853..c4e464989236 100644
--- a/test/cases/compile_errors/dereference_anyopaque.zig
+++ b/test/cases/compile_errors/dereference_anyopaque.zig
@@ -13,13 +13,13 @@ fn parse(comptime T: type, allocator: std.mem.Allocator) !void {
fn parseFree(comptime T: type, value: T, allocator: std.mem.Allocator) void {
switch (@typeInfo(T)) {
- .Struct => |structInfo| {
+ .@"struct" => |structInfo| {
inline for (structInfo.fields) |field| {
if (!field.is_comptime)
parseFree(field.type, undefined, allocator);
}
},
- .Pointer => |ptrInfo| {
+ .pointer => |ptrInfo| {
switch (ptrInfo.size) {
.One => {
parseFree(ptrInfo.child, value.*, allocator);
diff --git a/test/cases/compile_errors/error_set_membership.zig b/test/cases/compile_errors/error_set_membership.zig
index 5683e9594b45..f8fa18f7f81b 100644
--- a/test/cases/compile_errors/error_set_membership.zig
+++ b/test/cases/compile_errors/error_set_membership.zig
@@ -27,5 +27,5 @@ pub fn main() Error!void {
// backend=llvm
// target=native
//
-// :23:29: error: expected type 'error{InvalidCharacter}', found '@typeInfo(@typeInfo(@TypeOf(tmp.fooey)).Fn.return_type.?).ErrorUnion.error_set'
+// :23:29: error: expected type 'error{InvalidCharacter}', found '@typeInfo(@typeInfo(@TypeOf(tmp.fooey)).@"fn".return_type.?).error_union.error_set'
// :23:29: note: 'error.InvalidDirection' not a member of destination error set
diff --git a/test/cases/compile_errors/for_loop_error_union.zig b/test/cases/compile_errors/for_loop_error_union.zig
index d7a8d1952edc..7d9f05b6a467 100644
--- a/test/cases/compile_errors/for_loop_error_union.zig
+++ b/test/cases/compile_errors/for_loop_error_union.zig
@@ -10,6 +10,6 @@ export fn a() void {
// backend=stage2
// target=native
//
-// :6:11: error: type '@typeInfo(@typeInfo(@TypeOf(tmp.b)).Fn.return_type.?).ErrorUnion.error_set!u32' is not indexable and not a range
+// :6:11: error: type '@typeInfo(@typeInfo(@TypeOf(tmp.b)).@"fn".return_type.?).error_union.error_set!u32' is not indexable and not a range
// :6:11: note: for loop operand must be a range, array, slice, tuple, or vector
// :6:11: note: consider using 'try', 'catch', or 'if'
diff --git a/test/cases/compile_errors/generic_instantiation_failure_in_generic_function_return_type.zig b/test/cases/compile_errors/generic_instantiation_failure_in_generic_function_return_type.zig
index 317834a9c978..a4aaf8eb917c 100644
--- a/test/cases/compile_errors/generic_instantiation_failure_in_generic_function_return_type.zig
+++ b/test/cases/compile_errors/generic_instantiation_failure_in_generic_function_return_type.zig
@@ -5,7 +5,7 @@ pub export fn entry() void {
_ = sliceAsBytes(ohnoes);
_ = &ohnoes;
}
-fn sliceAsBytes(slice: anytype) isPtrTo(.Array)(@TypeOf(slice)) {}
+fn sliceAsBytes(slice: anytype) isPtrTo(.array)(@TypeOf(slice)) {}
pub const TraitFn = fn (type) bool;
@@ -20,8 +20,8 @@ pub fn isPtrTo(comptime id: std.builtin.TypeId) TraitFn {
}
pub fn isSingleItemPtr(comptime T: type) bool {
- if (comptime is(.Pointer)(T)) {
- return @typeInfo(T).Pointer.size == .One;
+ if (comptime is(.pointer)(T)) {
+ return @typeInfo(T).pointer.size == .One;
}
return false;
}
diff --git a/test/cases/compile_errors/helpful_return_type_error_message.zig b/test/cases/compile_errors/helpful_return_type_error_message.zig
index 83342c7ec382..2675c5692a63 100644
--- a/test/cases/compile_errors/helpful_return_type_error_message.zig
+++ b/test/cases/compile_errors/helpful_return_type_error_message.zig
@@ -21,12 +21,12 @@ export fn quux() u32 {
//
// :2:18: error: expected type 'u32', found 'error{Ohno}'
// :1:17: note: function cannot return an error
-// :8:5: error: expected type 'void', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).Fn.return_type.?).ErrorUnion.error_set'
+// :8:5: error: expected type 'void', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).@"fn".return_type.?).error_union.error_set'
// :7:17: note: function cannot return an error
-// :11:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).Fn.return_type.?).ErrorUnion.error_set!u32'
+// :11:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).@"fn".return_type.?).error_union.error_set!u32'
// :11:15: note: cannot convert error union to payload type
// :11:15: note: consider using 'try', 'catch', or 'if'
// :10:17: note: function cannot return an error
-// :15:14: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).Fn.return_type.?).ErrorUnion.error_set!u32'
+// :15:14: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.bar)).@"fn".return_type.?).error_union.error_set!u32'
// :15:14: note: cannot convert error union to payload type
// :15:14: note: consider using 'try', 'catch', or 'if'
diff --git a/test/cases/compile_errors/invalid_pointer_arithmetic.zig b/test/cases/compile_errors/invalid_pointer_arithmetic.zig
index 436a3392042a..94a5a2099cbd 100644
--- a/test/cases/compile_errors/invalid_pointer_arithmetic.zig
+++ b/test/cases/compile_errors/invalid_pointer_arithmetic.zig
@@ -45,7 +45,7 @@ comptime {
// :2:11: note: pointer-integer arithmetic only supports addition and subtraction
// :6:11: error: invalid pointer-pointer arithmetic operator
// :6:11: note: pointer-pointer arithmetic only supports subtraction
-// :12:11: error: invalid operands to binary expression: 'Pointer' and 'Pointer'
+// :12:11: error: invalid operands to binary expression: 'pointer' and 'pointer'
// :20:11: error: incompatible pointer arithmetic operands '[*]u8' and '[*]u16'
// :26:11: error: incompatible pointer arithmetic operands '*u8' and '*u16'
// :31:11: error: pointer arithmetic requires element type 'u0' to have runtime bits
diff --git a/test/cases/compile_errors/invalid_pointer_with_reify_type.zig b/test/cases/compile_errors/invalid_pointer_with_reify_type.zig
index dce09234d459..16b96d5327b2 100644
--- a/test/cases/compile_errors/invalid_pointer_with_reify_type.zig
+++ b/test/cases/compile_errors/invalid_pointer_with_reify_type.zig
@@ -1,5 +1,5 @@
export fn entry() void {
- _ = @Type(.{ .Pointer = .{
+ _ = @Type(.{ .pointer = .{
.size = .One,
.is_const = false,
.is_volatile = false,
diff --git a/test/cases/compile_errors/issue_15572_break_on_inline_while.zig b/test/cases/compile_errors/issue_15572_break_on_inline_while.zig
index a09a72fde509..f264e695c0e3 100644
--- a/test/cases/compile_errors/issue_15572_break_on_inline_while.zig
+++ b/test/cases/compile_errors/issue_15572_break_on_inline_while.zig
@@ -6,7 +6,7 @@ pub const DwarfSection = enum {
};
pub fn main() void {
- const section = inline for (@typeInfo(DwarfSection).Enum.fields) |section| {
+ const section = inline for (@typeInfo(DwarfSection).@"enum".fields) |section| {
if (std.mem.eql(u8, section.name, "eh_frame")) break section;
};
diff --git a/test/cases/compile_errors/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig b/test/cases/compile_errors/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig
index 2a518678ce80..5a9cd4ddad3e 100644
--- a/test/cases/compile_errors/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig
+++ b/test/cases/compile_errors/issue_5221_invalid_struct_init_type_referenced_by_typeInfo_and_passed_into_function.zig
@@ -7,7 +7,7 @@ export fn foo() void {
wrong_type: []u8 = "foo",
};
- comptime ignore(@typeInfo(MyStruct).Struct.fields[0]);
+ comptime ignore(@typeInfo(MyStruct).@"struct".fields[0]);
}
// error
diff --git a/test/cases/compile_errors/method_call_on_error_union.zig b/test/cases/compile_errors/method_call_on_error_union.zig
index 4ce6b3baa8d7..f7c0baefd736 100644
--- a/test/cases/compile_errors/method_call_on_error_union.zig
+++ b/test/cases/compile_errors/method_call_on_error_union.zig
@@ -17,5 +17,5 @@ export fn entry() void {
// backend=stage2
// target=native
//
-// :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'
+// :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'
// :13:6: note: consider using 'try', 'catch', or 'if'
diff --git a/test/cases/compile_errors/nested_vectors.zig b/test/cases/compile_errors/nested_vectors.zig
index 500de6bcf069..62798d028943 100644
--- a/test/cases/compile_errors/nested_vectors.zig
+++ b/test/cases/compile_errors/nested_vectors.zig
@@ -1,6 +1,6 @@
export fn entry() void {
const V1 = @Vector(4, u8);
- const V2 = @Type(.{ .Vector = .{ .len = 4, .child = V1 } });
+ const V2 = @Type(.{ .vector = .{ .len = 4, .child = V1 } });
const v: V2 = undefined;
_ = v;
}
diff --git a/test/cases/compile_errors/non-enum_tag_type_passed_to_union.zig b/test/cases/compile_errors/non-enum_tag_type_passed_to_union.zig
index addc97042586..449567bf95cf 100644
--- a/test/cases/compile_errors/non-enum_tag_type_passed_to_union.zig
+++ b/test/cases/compile_errors/non-enum_tag_type_passed_to_union.zig
@@ -2,7 +2,7 @@ const Foo = union(u32) {
A: i32,
};
export fn entry() void {
- const x = @typeInfo(Foo).Union.tag_type.?;
+ const x = @typeInfo(Foo).@"union".tag_type.?;
_ = x;
}
diff --git a/test/cases/compile_errors/non-integer_tag_type_to_automatic_union_enum.zig b/test/cases/compile_errors/non-integer_tag_type_to_automatic_union_enum.zig
index 3483ea8a5cf4..1657db4cc452 100644
--- a/test/cases/compile_errors/non-integer_tag_type_to_automatic_union_enum.zig
+++ b/test/cases/compile_errors/non-integer_tag_type_to_automatic_union_enum.zig
@@ -2,7 +2,7 @@ const Foo = union(enum(f32)) {
A: i32,
};
export fn entry() void {
- const x = @typeInfo(Foo).Union.tag_type.?;
+ const x = @typeInfo(Foo).@"union".tag_type.?;
_ = x;
}
diff --git a/test/cases/compile_errors/not_an_enum_type.zig b/test/cases/compile_errors/not_an_enum_type.zig
index 51f0e458a93a..707e046d4a6e 100644
--- a/test/cases/compile_errors/not_an_enum_type.zig
+++ b/test/cases/compile_errors/not_an_enum_type.zig
@@ -16,5 +16,5 @@ const ExpectedVarDeclOrFn = struct {};
// backend=stage2
// target=native
//
-// :4:9: error: expected type '@typeInfo(tmp.Error).Union.tag_type.?', found 'type'
+// :4:9: error: expected type '@typeInfo(tmp.Error).@"union".tag_type.?', found 'type'
// :8:15: note: enum declared here
diff --git a/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig b/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig
index fe0a42b74a4d..0251c018fac8 100644
--- a/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig
+++ b/test/cases/compile_errors/packed_struct_field_alignment_unavailable_for_reify_type.zig
@@ -1,5 +1,5 @@
export fn entry() void {
- _ = @Type(.{ .Struct = .{ .layout = .@"packed", .fields = &.{
+ _ = @Type(.{ .@"struct" = .{ .layout = .@"packed", .fields = &.{
.{ .name = "one", .type = u4, .default_value = null, .is_comptime = false, .alignment = 2 },
}, .decls = &.{}, .is_tuple = false } });
}
diff --git a/test/cases/compile_errors/range_operator_in_switch_used_on_error_set.zig b/test/cases/compile_errors/range_operator_in_switch_used_on_error_set.zig
index 99dd773f32a6..89aa98ebadf7 100644
--- a/test/cases/compile_errors/range_operator_in_switch_used_on_error_set.zig
+++ b/test/cases/compile_errors/range_operator_in_switch_used_on_error_set.zig
@@ -16,5 +16,5 @@ fn foo(x: i32) !void {
// backend=llvm
// target=native
//
-// :2:34: error: ranges not allowed when switching on type '@typeInfo(@typeInfo(@TypeOf(tmp.foo)).Fn.return_type.?).ErrorUnion.error_set'
+// :2:34: error: ranges not allowed when switching on type '@typeInfo(@typeInfo(@TypeOf(tmp.foo)).@"fn".return_type.?).error_union.error_set'
// :3:18: note: range here
diff --git a/test/cases/compile_errors/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig b/test/cases/compile_errors/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig
index 98a8181c625c..e3b700f48ad5 100644
--- a/test/cases/compile_errors/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig
+++ b/test/cases/compile_errors/regression_test_2980_base_type_u32_is_not_type_checked_properly_when_assigning_a_value_within_a_struct.zig
@@ -18,6 +18,6 @@ export fn entry() void {
// backend=stage2
// target=native
//
-// :12:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.get_uval)).Fn.return_type.?).ErrorUnion.error_set!u32'
+// :12:15: error: expected type 'u32', found '@typeInfo(@typeInfo(@TypeOf(tmp.get_uval)).@"fn".return_type.?).error_union.error_set!u32'
// :12:15: note: cannot convert error union to payload type
// :12:15: note: consider using 'try', 'catch', or 'if'
diff --git a/test/cases/compile_errors/reified_enum_field_value_overflow.zig b/test/cases/compile_errors/reified_enum_field_value_overflow.zig
index d9f0e2057fd4..fd230a70d9ee 100644
--- a/test/cases/compile_errors/reified_enum_field_value_overflow.zig
+++ b/test/cases/compile_errors/reified_enum_field_value_overflow.zig
@@ -1,5 +1,5 @@
comptime {
- const E = @Type(.{ .Enum = .{
+ const E = @Type(.{ .@"enum" = .{
.tag_type = u1,
.fields = &.{
.{ .name = "f0", .value = 0 },
diff --git a/test/cases/compile_errors/reify_enum_with_duplicate_field.zig b/test/cases/compile_errors/reify_enum_with_duplicate_field.zig
index a4779b65efbe..2d1b93247f5c 100644
--- a/test/cases/compile_errors/reify_enum_with_duplicate_field.zig
+++ b/test/cases/compile_errors/reify_enum_with_duplicate_field.zig
@@ -1,6 +1,6 @@
export fn entry() void {
_ = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u32,
.fields = &.{
.{ .name = "A", .value = 0 },
diff --git a/test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig b/test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig
index b9be7cdaed70..cb4aee13b88b 100644
--- a/test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig
+++ b/test/cases/compile_errors/reify_enum_with_duplicate_tag_value.zig
@@ -1,6 +1,6 @@
export fn entry() void {
_ = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u32,
.fields = &.{
.{ .name = "A", .value = 10 },
diff --git a/test/cases/compile_errors/reify_struct.zig b/test/cases/compile_errors/reify_struct.zig
index df00a47b5301..fcea61b46f4c 100644
--- a/test/cases/compile_errors/reify_struct.zig
+++ b/test/cases/compile_errors/reify_struct.zig
@@ -1,5 +1,5 @@
comptime {
- @Type(.{ .Struct = .{
+ @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &.{.{
.name = "foo",
@@ -13,7 +13,7 @@ comptime {
} });
}
comptime {
- @Type(.{ .Struct = .{
+ @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &.{.{
.name = "3",
@@ -27,7 +27,7 @@ comptime {
} });
}
comptime {
- @Type(.{ .Struct = .{
+ @Type(.{ .@"struct" = .{
.layout = .auto,
.fields = &.{.{
.name = "0",
@@ -41,7 +41,7 @@ comptime {
} });
}
comptime {
- @Type(.{ .Struct = .{
+ @Type(.{ .@"struct" = .{
.layout = .@"extern",
.fields = &.{.{
.name = "0",
@@ -55,7 +55,7 @@ comptime {
} });
}
comptime {
- @Type(.{ .Struct = .{
+ @Type(.{ .@"struct" = .{
.layout = .@"packed",
.fields = &.{.{
.name = "0",
diff --git a/test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig b/test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig
index 4ac1312440bb..d2e69c2924a2 100644
--- a/test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig
+++ b/test/cases/compile_errors/reify_type.Fn_with_is_generic_true.zig
@@ -1,5 +1,5 @@
const Foo = @Type(.{
- .Fn = .{
+ .@"fn" = .{
.calling_convention = .Unspecified,
.is_generic = true,
.is_var_args = false,
diff --git a/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig b/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig
index 23ea4f209521..ee5393838948 100644
--- a/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig
+++ b/test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig
@@ -1,5 +1,5 @@
const Foo = @Type(.{
- .Fn = .{
+ .@"fn" = .{
.calling_convention = .Unspecified,
.is_generic = false,
.is_var_args = true,
diff --git a/test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig b/test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig
index 073cf0f4ccf7..50e0b7bc4c2e 100644
--- a/test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig
+++ b/test/cases/compile_errors/reify_type.Fn_with_return_type_null.zig
@@ -1,5 +1,5 @@
const Foo = @Type(.{
- .Fn = .{
+ .@"fn" = .{
.calling_convention = .Unspecified,
.is_generic = false,
.is_var_args = false,
diff --git a/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig b/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig
index b26ec702962a..a62b068975d3 100644
--- a/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig
+++ b/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_non-integer_tag_type.zig
@@ -1,5 +1,5 @@
const Tag = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = bool,
.fields = &.{},
.decls = &.{},
diff --git a/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig b/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig
index fc8f3e1797e8..9ae6be94f415 100644
--- a/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig
+++ b/test/cases/compile_errors/reify_type_for_exhaustive_enum_with_undefined_tag_type.zig
@@ -1,5 +1,5 @@
const Tag = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = undefined,
.fields = &.{},
.decls = &.{},
diff --git a/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig b/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig
index 0ea0b019b9c4..49e7a63a481a 100644
--- a/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig
+++ b/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_enum_field.zig
@@ -1,5 +1,5 @@
const Tag = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u2,
.fields = &.{
.{ .name = "signed", .value = 0 },
@@ -11,7 +11,7 @@ const Tag = @Type(.{
},
});
const Tagged = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = Tag,
.fields = &.{
diff --git a/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig b/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig
index ed6f2245d4b2..9692936db701 100644
--- a/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig
+++ b/test/cases/compile_errors/reify_type_for_tagged_union_with_extra_union_field.zig
@@ -1,5 +1,5 @@
const Tag = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u1,
.fields = &.{
.{ .name = "signed", .value = 0 },
@@ -10,7 +10,7 @@ const Tag = @Type(.{
},
});
const Tagged = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = Tag,
.fields = &.{
diff --git a/test/cases/compile_errors/reify_type_for_tagged_union_with_no_enum_fields.zig b/test/cases/compile_errors/reify_type_for_tagged_union_with_no_enum_fields.zig
index 91c5354c0cb1..992db883776d 100644
--- a/test/cases/compile_errors/reify_type_for_tagged_union_with_no_enum_fields.zig
+++ b/test/cases/compile_errors/reify_type_for_tagged_union_with_no_enum_fields.zig
@@ -1,5 +1,5 @@
const Tag = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u0,
.fields = &.{},
.decls = &.{},
@@ -7,7 +7,7 @@ const Tag = @Type(.{
},
});
const Tagged = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = Tag,
.fields = &.{
diff --git a/test/cases/compile_errors/reify_type_for_tagged_union_with_no_union_fields.zig b/test/cases/compile_errors/reify_type_for_tagged_union_with_no_union_fields.zig
index 2dc983247062..eb8a9ec2b020 100644
--- a/test/cases/compile_errors/reify_type_for_tagged_union_with_no_union_fields.zig
+++ b/test/cases/compile_errors/reify_type_for_tagged_union_with_no_union_fields.zig
@@ -1,5 +1,5 @@
const Tag = @Type(.{
- .Enum = .{
+ .@"enum" = .{
.tag_type = u1,
.fields = &.{
.{ .name = "signed", .value = 0 },
@@ -10,7 +10,7 @@ const Tag = @Type(.{
},
});
const Tagged = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = Tag,
.fields = &.{},
diff --git a/test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig b/test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig
index 568b2291040d..845c11acfbf8 100644
--- a/test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig
+++ b/test/cases/compile_errors/reify_type_for_union_with_opaque_field.zig
@@ -1,5 +1,5 @@
const Untagged = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = null,
.fields = &.{
diff --git a/test/cases/compile_errors/reify_type_union_payload_is_undefined.zig b/test/cases/compile_errors/reify_type_union_payload_is_undefined.zig
index d9eea7dcd416..1a50758554de 100644
--- a/test/cases/compile_errors/reify_type_union_payload_is_undefined.zig
+++ b/test/cases/compile_errors/reify_type_union_payload_is_undefined.zig
@@ -1,5 +1,5 @@
const Foo = @Type(.{
- .Struct = undefined,
+ .@"struct" = undefined,
});
comptime {
_ = Foo;
diff --git a/test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig b/test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig
index 10792cad048b..3dfb2ae1ff5d 100644
--- a/test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig
+++ b/test/cases/compile_errors/reify_type_with_invalid_field_alignment.zig
@@ -1,6 +1,6 @@
comptime {
_ = @Type(.{
- .Union = .{
+ .@"union" = .{
.layout = .auto,
.tag_type = null,
.fields = &.{
@@ -12,7 +12,7 @@ comptime {
}
comptime {
_ = @Type(.{
- .Struct = .{
+ .@"struct" = .{
.layout = .auto,
.fields = &.{.{
.name = "0",
@@ -28,7 +28,7 @@ comptime {
}
comptime {
_ = @Type(.{
- .Pointer = .{
+ .pointer = .{
.size = .Many,
.is_const = true,
.is_volatile = false,
diff --git a/test/cases/compile_errors/reify_type_with_undefined.zig b/test/cases/compile_errors/reify_type_with_undefined.zig
index 4d5f18419499..1c34a2a84ef4 100644
--- a/test/cases/compile_errors/reify_type_with_undefined.zig
+++ b/test/cases/compile_errors/reify_type_with_undefined.zig
@@ -1,9 +1,9 @@
comptime {
- _ = @Type(.{ .Array = .{ .len = 0, .child = u8, .sentinel = undefined } });
+ _ = @Type(.{ .array = .{ .len = 0, .child = u8, .sentinel = undefined } });
}
comptime {
_ = @Type(.{
- .Struct = .{
+ .@"struct" = .{
.fields = undefined,
.decls = undefined,
.is_tuple = false,
@@ -15,7 +15,7 @@ comptime {
const std = @import("std");
const fields: [1]std.builtin.Type.StructField = undefined;
_ = @Type(.{
- .Struct = .{
+ .@"struct" = .{
.layout = .auto,
.fields = &fields,
.decls = &.{},
diff --git a/test/cases/compile_errors/resolve_inferred_error_set_of_generic_fn.zig b/test/cases/compile_errors/resolve_inferred_error_set_of_generic_fn.zig
index 587ff7a87852..a603948e6191 100644
--- a/test/cases/compile_errors/resolve_inferred_error_set_of_generic_fn.zig
+++ b/test/cases/compile_errors/resolve_inferred_error_set_of_generic_fn.zig
@@ -5,8 +5,8 @@ fn foo(a: anytype) !void {
const Error = error{ A, B };
export fn entry() void {
const info = @typeInfo(@TypeOf(foo));
- const ret_type = info.Fn.return_type.?;
- const error_set = @typeInfo(ret_type).ErrorUnion.error_set;
+ const ret_type = info.@"fn".return_type.?;
+ const error_set = @typeInfo(ret_type).error_union.error_set;
_ = Error || error_set;
}
diff --git a/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig b/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig
index 9cd0fe1798a5..31e7a4c73a4b 100644
--- a/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig
+++ b/test/cases/compile_errors/runtime_index_into_comptime_type_slice.zig
@@ -6,7 +6,7 @@ fn getIndex() usize {
}
export fn entry() void {
const index = getIndex();
- const field = @typeInfo(Struct).Struct.fields[index];
+ const field = @typeInfo(Struct).@"struct".fields[index];
_ = field;
}
@@ -14,7 +14,7 @@ export fn entry() void {
// backend=stage2
// target=native
//
-// :9:51: error: values of type '[]const builtin.Type.StructField' must be comptime-known, but index value is runtime-known
+// :9:54: error: values of type '[]const builtin.Type.StructField' must be comptime-known, but index value is runtime-known
// : note: struct requires comptime because of this field
// : note: types are not available at runtime
// : struct requires comptime because of this field
diff --git a/test/cases/compile_errors/saturating_arithmetic_does_not_allow_floats.zig b/test/cases/compile_errors/saturating_arithmetic_does_not_allow_floats.zig
index 3689fa5ec540..9b5b5ed85cd8 100644
--- a/test/cases/compile_errors/saturating_arithmetic_does_not_allow_floats.zig
+++ b/test/cases/compile_errors/saturating_arithmetic_does_not_allow_floats.zig
@@ -6,4 +6,4 @@ export fn a() void {
// backend=stage2
// target=native
//
-// :2:23: error: invalid operands to binary expression: 'Float' and 'Float'
+// :2:23: error: invalid operands to binary expression: 'float' and 'float'
diff --git a/test/cases/compile_errors/switch_on_error_with_non_trivial_switch_operand.zig b/test/cases/compile_errors/switch_on_error_with_non_trivial_switch_operand.zig
index 8ca35b5aaf62..ebcc668fa24b 100644
--- a/test/cases/compile_errors/switch_on_error_with_non_trivial_switch_operand.zig
+++ b/test/cases/compile_errors/switch_on_error_with_non_trivial_switch_operand.zig
@@ -18,5 +18,5 @@ export fn entry2() void {
// backend=stage2
// target=native
//
-// :4:42: error: invalid operands to binary expression: 'ErrorSet' and 'ComptimeInt'
-// :12:35: error: invalid operands to binary expression: 'ErrorSet' and 'ComptimeInt'
+// :4:42: error: invalid operands to binary expression: 'error_set' and 'comptime_int'
+// :12:35: error: invalid operands to binary expression: 'error_set' and 'comptime_int'
diff --git a/test/cases/compile_errors/unable_to_evaluate_comptime_expr.zig b/test/cases/compile_errors/unable_to_evaluate_comptime_expr.zig
index 4d93a42ae1e8..a383961cf467 100644
--- a/test/cases/compile_errors/unable_to_evaluate_comptime_expr.zig
+++ b/test/cases/compile_errors/unable_to_evaluate_comptime_expr.zig
@@ -16,7 +16,7 @@ pub export fn entry2() void {
_ = b;
}
-const Int = @typeInfo(bar).Struct.backing_integer.?;
+const Int = @typeInfo(bar).@"struct".backing_integer.?;
const foo = enum(Int) {
c = @bitCast(bar{
diff --git a/test/cases/compile_errors/union_fields_are_resolved_before_tag_type_is_needed.zig b/test/cases/compile_errors/union_fields_are_resolved_before_tag_type_is_needed.zig
index 7ef4c80d5a11..81a6270227a0 100644
--- a/test/cases/compile_errors/union_fields_are_resolved_before_tag_type_is_needed.zig
+++ b/test/cases/compile_errors/union_fields_are_resolved_before_tag_type_is_needed.zig
@@ -12,5 +12,5 @@ pub export fn entry() void {
// backend=stage2
// target=native
//
-// :8:8: error: no field or member function named 'f' in '@typeInfo(tmp.T).Union.tag_type.?'
+// :8:8: error: no field or member function named 'f' in '@typeInfo(tmp.T).@"union".tag_type.?'
// :1:11: note: enum declared here
diff --git a/test/cases/compile_errors/union_noreturn_field_initialized.zig b/test/cases/compile_errors/union_noreturn_field_initialized.zig
index 341256afef5d..0549e87939d9 100644
--- a/test/cases/compile_errors/union_noreturn_field_initialized.zig
+++ b/test/cases/compile_errors/union_noreturn_field_initialized.zig
@@ -23,7 +23,7 @@ pub export fn entry3() void {
a: noreturn,
b: void,
};
- var e = @typeInfo(U).Union.tag_type.?.a;
+ var e = @typeInfo(U).@"union".tag_type.?.a;
var u: U = undefined;
u = (&e).*;
}
@@ -38,6 +38,6 @@ pub export fn entry3() void {
// :19:10: error: cannot initialize 'noreturn' field of union
// :16:9: note: field 'a' declared here
// :15:15: note: union declared here
-// :28:13: error: runtime coercion from enum '@typeInfo(tmp.entry3.U).Union.tag_type.?' to union 'tmp.entry3.U' which has a 'noreturn' field
+// :28:13: error: runtime coercion from enum '@typeInfo(tmp.entry3.U).@"union".tag_type.?' to union 'tmp.entry3.U' which has a 'noreturn' field
// :23:9: note: 'noreturn' field here
// :22:15: note: union declared here
diff --git a/test/cases/fn_typeinfo_passed_to_comptime_fn.zig b/test/cases/fn_typeinfo_passed_to_comptime_fn.zig
index 494638196819..3518a8384c4c 100644
--- a/test/cases/fn_typeinfo_passed_to_comptime_fn.zig
+++ b/test/cases/fn_typeinfo_passed_to_comptime_fn.zig
@@ -9,7 +9,7 @@ fn someFn(arg: ?*c_int) f64 {
return 8;
}
fn foo(comptime info: std.builtin.Type) !void {
- try std.testing.expect(info.Fn.params[0].type.? == ?*c_int);
+ try std.testing.expect(info.@"fn".params[0].type.? == ?*c_int);
}
// run
diff --git a/test/cases/safety/@tagName on corrupted union value.zig b/test/cases/safety/@tagName on corrupted union value.zig
index f742834d1520..09d8276d2339 100644
--- a/test/cases/safety/@tagName on corrupted union value.zig
+++ b/test/cases/safety/@tagName on corrupted union value.zig
@@ -16,7 +16,7 @@ const U = union(enum(u32)) {
pub fn main() !void {
var u: U = undefined;
@memset(@as([*]u8, @ptrCast(&u))[0..@sizeOf(U)], 0x55);
- const t: @typeInfo(U).Union.tag_type.? = u;
+ const t: @typeInfo(U).@"union".tag_type.? = u;
const n = @tagName(t);
_ = n;
return error.TestFailed;
diff --git a/test/link/build.zig b/test/link/build.zig
index 89db47c209d8..b7535b734894 100644
--- a/test/link/build.zig
+++ b/test/link/build.zig
@@ -23,7 +23,7 @@ pub fn build(b: *std.Build) void {
const dep_name, const dep_hash = available_dep;
const all_pkgs = @import("root").dependencies.packages;
- inline for (@typeInfo(all_pkgs).Struct.decls) |decl| {
+ inline for (@typeInfo(all_pkgs).@"struct".decls) |decl| {
const pkg_hash = decl.name;
if (std.mem.eql(u8, dep_hash, pkg_hash)) {
const pkg = @field(all_pkgs, pkg_hash);
diff --git a/test/src/Cases.zig b/test/src/Cases.zig
index dbf409f53bf5..0e88bdd133a0 100644
--- a/test/src/Cases.zig
+++ b/test/src/Cases.zig
@@ -1188,12 +1188,12 @@ const TestManifest = struct {
}.parse;
switch (@typeInfo(T)) {
- .Int => return struct {
+ .int => return struct {
fn parse(str: []const u8) anyerror!T {
return try std.fmt.parseInt(T, str, 0);
}
}.parse,
- .Bool => return struct {
+ .bool => return struct {
fn parse(str: []const u8) anyerror!T {
if (std.mem.eql(u8, str, "true")) return true;
if (std.mem.eql(u8, str, "false")) return false;
@@ -1201,7 +1201,7 @@ const TestManifest = struct {
return error.InvalidBool;
}
}.parse,
- .Enum => return struct {
+ .@"enum" => return struct {
fn parse(str: []const u8) anyerror!T {
return std.meta.stringToEnum(T, str) orelse {
std.log.err("unknown enum variant for {s}: {s}", .{ @typeName(T), str });
@@ -1209,7 +1209,7 @@ const TestManifest = struct {
};
}
}.parse,
- .Struct => @compileError("no default parser for " ++ @typeName(T)),
+ .@"struct" => @compileError("no default parser for " ++ @typeName(T)),
else => @compileError("no default parser for " ++ @typeName(T)),
}
}
diff --git a/test/standalone/build.zig b/test/standalone/build.zig
index 98b48576adea..5e77524c1155 100644
--- a/test/standalone/build.zig
+++ b/test/standalone/build.zig
@@ -60,7 +60,7 @@ pub fn build(b: *std.Build) void {
if (std.mem.eql(u8, dep_name, "simple")) continue;
const all_pkgs = @import("root").dependencies.packages;
- inline for (@typeInfo(all_pkgs).Struct.decls) |decl| {
+ inline for (@typeInfo(all_pkgs).@"struct".decls) |decl| {
const pkg_hash = decl.name;
if (std.mem.eql(u8, dep_hash, pkg_hash)) {
const pkg = @field(all_pkgs, pkg_hash);
diff --git a/test/standalone/simple/issue_7030.zig b/test/standalone/simple/issue_7030.zig
index 4d4a7279f6b1..d4732c331c01 100644
--- a/test/standalone/simple/issue_7030.zig
+++ b/test/standalone/simple/issue_7030.zig
@@ -6,7 +6,7 @@ pub const std_options = .{
pub fn log(
comptime message_level: std.log.Level,
- comptime scope: @Type(.EnumLiteral),
+ comptime scope: @Type(.enum_literal),
comptime format: []const u8,
args: anytype,
) void {
diff --git a/test/standalone/simple/std_enums_big_enums.zig b/test/standalone/simple/std_enums_big_enums.zig
index 76237d3447a0..c2358bafc095 100644
--- a/test/standalone/simple/std_enums_big_enums.zig
+++ b/test/standalone/simple/std_enums_big_enums.zig
@@ -3,21 +3,19 @@ const std = @import("std");
// big enums should not hit the eval branch quota
pub fn main() void {
const big = struct {
- const Big = @Type(@as(std.builtin.Type, .{
- .Enum = .{
- .tag_type = u16,
- .fields = make_fields: {
- var fields: [1001]std.builtin.Type.EnumField = undefined;
- for (&fields, 0..) |*field, i| {
- field.* = .{ .name = std.fmt.comptimePrint("field_{d}", .{i}), .value = i };
- }
- fields[1000] = .{ .name = "field_9999", .value = 9999 };
- break :make_fields &fields;
- },
- .decls = &.{},
- .is_exhaustive = true,
+ const Big = @Type(.{ .@"enum" = .{
+ .tag_type = u16,
+ .fields = make_fields: {
+ var fields: [1001]std.builtin.Type.EnumField = undefined;
+ for (&fields, 0..) |*field, i| {
+ field.* = .{ .name = std.fmt.comptimePrint("field_{d}", .{i}), .value = i };
+ }
+ fields[1000] = .{ .name = "field_9999", .value = 9999 };
+ break :make_fields &fields;
},
- }));
+ .decls = &.{},
+ .is_exhaustive = true,
+ } });
};
var set = std.enums.EnumSet(big.Big).init(.{});
diff --git a/tools/generate_c_size_and_align_checks.zig b/tools/generate_c_size_and_align_checks.zig
index 397989a3e969..96874635c223 100644
--- a/tools/generate_c_size_and_align_checks.zig
+++ b/tools/generate_c_size_and_align_checks.zig
@@ -43,7 +43,7 @@ pub fn main() !void {
const target = try std.zig.system.resolveTargetQuery(query);
const stdout = std.io.getStdOut().writer();
- inline for (@typeInfo(std.Target.CType).Enum.fields) |field| {
+ inline for (@typeInfo(std.Target.CType).@"enum".fields) |field| {
const c_type: std.Target.CType = @enumFromInt(field.value);
try stdout.print("_Static_assert(sizeof({0s}) == {1d}, \"sizeof({0s}) == {1d}\");\n", .{
cName(c_type),
diff --git a/tools/lldb_pretty_printers.py b/tools/lldb_pretty_printers.py
index e8263fbc2103..7bb6aa78c29c 100644
--- a/tools/lldb_pretty_printers.py
+++ b/tools/lldb_pretty_printers.py
@@ -602,7 +602,7 @@ def type_Type_SummaryProvider(value, _=None):
'error_set': lambda payload: type_tag_handlers['error_set_merged'](payload.GetChildMemberWithName('names')),
'error_set_single': lambda payload: 'error{%s}' % zig_String_AsIdentifier(payload, zig_IsFieldName),
'error_set_merged': lambda payload: 'error{%s}' % ','.join(zig_String_AsIdentifier(child.GetChildMemberWithName('key'), zig_IsFieldName) for child in payload.GetChildMemberWithName('entries').children),
- 'error_set_inferred': lambda payload: '@typeInfo(@typeInfo(@TypeOf(%s)).Fn.return_type.?).ErrorUnion.error_set' % OwnerDecl_RenderFullyQualifiedName(payload.GetChildMemberWithName('func')),
+ 'error_set_inferred': lambda payload: '@typeInfo(@typeInfo(@TypeOf(%s)).@"fn".return_type.?).error_union.error_set' % OwnerDecl_RenderFullyQualifiedName(payload.GetChildMemberWithName('func')),
'enum_full': OwnerDecl_RenderFullyQualifiedName,
'enum_nonexhaustive': OwnerDecl_RenderFullyQualifiedName,
diff --git a/tools/update_clang_options.zig b/tools/update_clang_options.zig
index 595933f7d8db..69f4d589746d 100644
--- a/tools/update_clang_options.zig
+++ b/tools/update_clang_options.zig
@@ -616,7 +616,7 @@ pub fn main() anyerror!void {
var llvm_to_zig_cpu_features = std.StringHashMap([]const u8).init(allocator);
- inline for (@typeInfo(cpu_targets).Struct.decls) |decl| {
+ inline for (@typeInfo(cpu_targets).@"struct".decls) |decl| {
const Feature = @field(cpu_targets, decl.name).Feature;
const all_features = @field(cpu_targets, decl.name).all_features;
diff --git a/tools/update_cpu_features.zig b/tools/update_cpu_features.zig
index 068237e45cd1..fb4deec799f3 100644
--- a/tools/update_cpu_features.zig
+++ b/tools/update_cpu_features.zig
@@ -1348,7 +1348,7 @@ fn processOneTarget(job: Job) anyerror!void {
try w.print(" @setEvalBranchQuota({d});\n", .{branch_quota});
}
try w.writeAll(
- \\ const len = @typeInfo(Feature).Enum.fields.len;
+ \\ const len = @typeInfo(Feature).@"enum".fields.len;
\\ std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
\\ var result: [len]CpuFeature = undefined;
\\
@@ -1417,7 +1417,7 @@ fn processOneTarget(job: Job) anyerror!void {
\\ const ti = @typeInfo(Feature);
\\ for (&result, 0..) |*elem, i| {
\\ elem.index = i;
- \\ elem.name = ti.Enum.fields[i].name;
+ \\ elem.name = ti.@"enum".fields[i].name;
\\ }
\\ break :blk result;
\\};
diff --git a/tools/update_spirv_features.zig b/tools/update_spirv_features.zig
index ac5c0a1bfcc0..6540d2485696 100644
--- a/tools/update_spirv_features.zig
+++ b/tools/update_spirv_features.zig
@@ -129,7 +129,7 @@ pub fn main() !void {
\\
\\pub const all_features = blk: {
\\ @setEvalBranchQuota(2000);
- \\ const len = @typeInfo(Feature).Enum.fields.len;
+ \\ const len = @typeInfo(Feature).@"enum".fields.len;
\\ std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
\\ var result: [len]CpuFeature = undefined;
\\
@@ -210,7 +210,7 @@ pub fn main() !void {
\\ const ti = @typeInfo(Feature);
\\ for (&result, 0..) |*elem, i| {
\\ elem.index = i;
- \\ elem.name = ti.Enum.fields[i].name;
+ \\ elem.name = ti.@"enum".fields[i].name;
\\ }
\\ break :blk result;
\\};