diff --git a/test/compare_output.zig b/test/compare_output.zig index eec077ef85..b60b844b1c 100644 --- a/test/compare_output.zig +++ b/test/compare_output.zig @@ -331,8 +331,8 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ } \\ const small: f32 = 3.25; \\ const x: f64 = small; - \\ const y = i32(x); - \\ const z = f64(y); + \\ const y = @floatToInt(i32, x); + \\ const z = @intToFloat(f64, y); \\ _ = c.printf(c"%.2f\n%d\n%.2f\n%.2f\n", x, y, z, f64(-0.4)); \\ return 0; \\} diff --git a/test/compile_errors.zig b/test/compile_errors.zig index ed46e43066..b51a6e9761 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2931,10 +2931,10 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { "cast negative value to unsigned integer", \\comptime { \\ const value: i32 = -1; - \\ const unsigned = u32(value); + \\ const unsigned = @intCast(u32, value); \\} , - ".tmp_source.zig:3:25: error: attempt to cast negative value to unsigned integer", + ".tmp_source.zig:3:22: error: attempt to cast negative value to unsigned integer", ); cases.add( @@ -2963,10 +2963,10 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { "compile-time integer cast truncates bits", \\comptime { \\ const spartan_count: u16 = 300; - \\ const byte = u8(spartan_count); + \\ const byte = @intCast(u8, spartan_count); \\} , - ".tmp_source.zig:3:20: error: cast from 'u16' to 'u8' truncates bits", + ".tmp_source.zig:3:18: error: cast from 'u16' to 'u8' truncates bits", ); cases.add( diff --git a/test/runtime_safety.zig b/test/runtime_safety.zig index 61eba9458e..96384066e5 100644 --- a/test/runtime_safety.zig +++ b/test/runtime_safety.zig @@ -188,7 +188,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ if (x == 0) return error.Whatever; \\} \\fn shorten_cast(x: i32) i8 { - \\ return i8(x); + \\ return @intCast(i8, x); \\} ); @@ -201,7 +201,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ if (x == 0) return error.Whatever; \\} \\fn unsigned_cast(x: i32) u32 { - \\ return u32(x); + \\ return @intCast(u32, x); \\} );