mirror of
https://github.com/ziglang/zig.git
synced 2025-12-20 13:13:16 +00:00
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
26 lines
598 B
Zig
26 lines
598 B
Zig
export fn entry1() i8 {
|
|
var x: u32 = 10;
|
|
return @truncate(x);
|
|
}
|
|
export fn entry2() u8 {
|
|
var x: i32 = -10;
|
|
return @truncate(x);
|
|
}
|
|
export fn entry3() i8 {
|
|
comptime var x: u32 = 10;
|
|
return @truncate(x);
|
|
}
|
|
export fn entry4() u8 {
|
|
comptime var x: i32 = -10;
|
|
return @truncate(x);
|
|
}
|
|
|
|
// error
|
|
// backend=stage2
|
|
// target=native
|
|
//
|
|
// :3:22: error: expected signed integer type, found 'u32'
|
|
// :7:22: error: expected unsigned integer type, found 'i32'
|
|
// :11:22: error: expected signed integer type, found 'u32'
|
|
// :15:22: error: expected unsigned integer type, found 'i32'
|