Skip to content

Commit c7bb559

Browse files
committed
replace all @Type usages
1 parent be53529 commit c7bb559

File tree

90 files changed

+556
-1056
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+556
-1056
lines changed

doc/langref/std_options.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub const std_options: std.Options = .{
1111

1212
fn myLogFn(
1313
comptime level: std.log.Level,
14-
comptime scope: @Type(.enum_literal),
14+
comptime scope: @TypeOf(.enum_literal),
1515
comptime format: []const u8,
1616
args: anytype,
1717
) void {

lib/compiler/aro/aro/Attribute.zig

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -712,13 +712,11 @@ pub const Arguments = blk: {
712712
};
713713
}
714714

715-
break :blk @Type(.{
716-
.@"union" = .{
717-
.layout = .auto,
718-
.tag_type = null,
719-
.fields = &union_fields,
720-
.decls = &.{},
721-
},
715+
break :blk @Union(.{
716+
.layout = .auto,
717+
.tag_type = null,
718+
.fields = &union_fields,
719+
.decls = &.{},
722720
});
723721
};
724722

lib/compiler/resinator/code_pages.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,12 @@ pub const UnsupportedCodePage = enum(u16) {
179179

180180
pub const CodePage = blk: {
181181
const fields = @typeInfo(SupportedCodePage).@"enum".fields ++ @typeInfo(UnsupportedCodePage).@"enum".fields;
182-
break :blk @Type(.{ .@"enum" = .{
182+
break :blk @Enum(.{
183183
.tag_type = u16,
184184
.decls = &.{},
185185
.fields = fields,
186186
.is_exhaustive = true,
187-
} });
187+
});
188188
};
189189

190190
pub fn isSupported(code_page: CodePage) bool {

lib/compiler/resinator/errors.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,12 +872,12 @@ pub const ErrorDetailsWithoutCodePage = blk: {
872872
i += 1;
873873
}
874874
std.debug.assert(i == fields_without_codepage.len);
875-
break :blk @Type(.{ .@"struct" = .{
875+
break :blk @Struct(.{
876876
.layout = .auto,
877877
.fields = &fields_without_codepage,
878878
.decls = &.{},
879879
.is_tuple = false,
880-
} });
880+
});
881881
};
882882

883883
fn cellCount(code_page: SupportedCodePage, source: []const u8, start_index: usize, end_index: usize) usize {

lib/compiler/test_runner.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ fn mainTerminal() void {
264264

265265
pub fn log(
266266
comptime message_level: std.log.Level,
267-
comptime scope: @Type(.enum_literal),
267+
comptime scope: @TypeOf(.enum_literal),
268268
comptime format: []const u8,
269269
args: anytype,
270270
) void {

lib/compiler_rt/common.zig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,7 @@ pub fn normalize(comptime T: type, significand: *std.meta.Int(.unsigned, @typeIn
252252
pub inline fn fneg(a: anytype) @TypeOf(a) {
253253
const F = @TypeOf(a);
254254
const bits = @typeInfo(F).float.bits;
255-
const U = @Type(.{ .int = .{
256-
.signedness = .unsigned,
257-
.bits = bits,
258-
} });
255+
const U = @Int(.unsigned, bits);
259256
const sign_bit_mask = @as(U, 1) << (bits - 1);
260257
const negated = @as(U, @bitCast(a)) ^ sign_bit_mask;
261258
return @bitCast(negated);

lib/compiler_rt/float_from_int.zig

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,17 @@ pub inline fn floatFromBigInt(comptime T: type, comptime signedness: std.builtin
6666
switch (x.len) {
6767
0 => return 0,
6868
inline 1...4 => |limbs_len| return @floatFromInt(@as(
69-
@Type(.{ .int = .{ .signedness = signedness, .bits = 32 * limbs_len } }),
69+
@Int(signedness, 32 * limbs_len),
7070
@bitCast(x[0..limbs_len].*),
7171
)),
7272
else => {},
7373
}
7474

7575
// sign implicit fraction round sticky
76-
const I = comptime @Type(.{ .int = .{
77-
.signedness = signedness,
78-
.bits = @as(u16, @intFromBool(signedness == .signed)) + 1 + math.floatFractionalBits(T) + 1 + 1,
79-
} });
76+
const I = comptime @Int(
77+
signedness,
78+
@as(u16, @intFromBool(signedness == .signed)) + 1 + math.floatFractionalBits(T) + 1 + 1,
79+
);
8080

8181
const clrsb = clrsb: {
8282
var clsb: usize = 0;

lib/compiler_rt/int_from_float.zig

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub inline fn bigIntFromFloat(comptime signedness: std.builtin.Signedness, resul
5656
0 => return,
5757
inline 1...4 => |limbs_len| {
5858
result[0..limbs_len].* = @bitCast(@as(
59-
@Type(.{ .int = .{ .signedness = signedness, .bits = 32 * limbs_len } }),
59+
@Int(signedness, 32 * limbs_len),
6060
@intFromFloat(a),
6161
));
6262
return;
@@ -66,10 +66,7 @@ pub inline fn bigIntFromFloat(comptime signedness: std.builtin.Signedness, resul
6666

6767
// sign implicit fraction
6868
const significand_bits = 1 + math.floatFractionalBits(@TypeOf(a));
69-
const I = @Type(comptime .{ .int = .{
70-
.signedness = signedness,
71-
.bits = @as(u16, @intFromBool(signedness == .signed)) + significand_bits,
72-
} });
69+
const I = @Int(signedness, @as(u16, @intFromBool(signedness == .signed)) + significand_bits);
7370

7471
const parts = math.frexp(a);
7572
const significand_bits_adjusted_to_handle_smin = @as(i32, significand_bits) +

lib/compiler_rt/memcpy.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ inline fn copyFixedLength(
159159
else if (len > @sizeOf(usize))
160160
@Vector(len, u8)
161161
else
162-
@Type(.{ .int = .{ .signedness = .unsigned, .bits = len * 8 } });
162+
@Int(.unsigned, len * 8);
163163

164164
const loop_count = @divExact(len, @sizeOf(T));
165165

lib/fuzzer.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var log_file: ?std.fs.File = null;
1313

1414
fn logOverride(
1515
comptime level: std.log.Level,
16-
comptime scope: @Type(.enum_literal),
16+
comptime scope: @TypeOf(.enum_literal),
1717
comptime format: []const u8,
1818
args: anytype,
1919
) void {

0 commit comments

Comments
 (0)