all: migrate code to new cast builtin syntax

Most of this migration was performed automatically with `zig fmt`. There
were a few exceptions which I had to manually fix:

* `@alignCast` and `@addrSpaceCast` cannot be automatically rewritten
* `@truncate`'s fixup is incorrect for vectors
* Test cases are not formatted, and their error locations change
This commit is contained in:
mlugg
2023-06-22 18:46:56 +01:00
committed by Andrew Kelley
parent 447ca4e3ff
commit f26dda2117
651 changed files with 8967 additions and 9039 deletions

View File

@@ -166,10 +166,10 @@ test "zig fmt: respect line breaks after var declarations" {
\\ lookup_tables[1][p[6]] ^
\\ lookup_tables[2][p[5]] ^
\\ lookup_tables[3][p[4]] ^
\\ lookup_tables[4][@truncate(u8, self.crc >> 24)] ^
\\ lookup_tables[5][@truncate(u8, self.crc >> 16)] ^
\\ lookup_tables[6][@truncate(u8, self.crc >> 8)] ^
\\ lookup_tables[7][@truncate(u8, self.crc >> 0)];
\\ lookup_tables[4][@as(u8, self.crc >> 24)] ^
\\ lookup_tables[5][@as(u8, self.crc >> 16)] ^
\\ lookup_tables[6][@as(u8, self.crc >> 8)] ^
\\ lookup_tables[7][@as(u8, self.crc >> 0)];
\\
);
}
@@ -1108,7 +1108,7 @@ test "zig fmt: async function" {
\\ handleRequestFn: fn (*Server, *const std.net.Address, File) callconv(.Async) void,
\\};
\\test "hi" {
\\ var ptr = @ptrCast(fn (i32) callconv(.Async) void, other);
\\ var ptr: fn (i32) callconv(.Async) void = @ptrCast(other);
\\}
\\
);
@@ -1825,10 +1825,10 @@ test "zig fmt: respect line breaks after infix operators" {
\\ lookup_tables[1][p[6]] ^
\\ lookup_tables[2][p[5]] ^
\\ lookup_tables[3][p[4]] ^
\\ lookup_tables[4][@truncate(u8, self.crc >> 24)] ^
\\ lookup_tables[5][@truncate(u8, self.crc >> 16)] ^
\\ lookup_tables[6][@truncate(u8, self.crc >> 8)] ^
\\ lookup_tables[7][@truncate(u8, self.crc >> 0)];
\\ lookup_tables[4][@as(u8, self.crc >> 24)] ^
\\ lookup_tables[5][@as(u8, self.crc >> 16)] ^
\\ lookup_tables[6][@as(u8, self.crc >> 8)] ^
\\ lookup_tables[7][@as(u8, self.crc >> 0)];
\\}
\\
);
@@ -4814,7 +4814,7 @@ test "zig fmt: use of comments and multiline string literals may force the param
\\ \\ unknown-length pointers and C pointers cannot be hashed deeply.
\\ \\ Consider providing your own hash function.
\\ );
\\ return @intCast(i1, doMemCheckClientRequestExpr(0, // default return
\\ return @intCast(doMemCheckClientRequestExpr(0, // default return
\\ .MakeMemUndefined, @intFromPtr(qzz.ptr), qzz.len, 0, 0, 0));
\\}
\\