| author | |
| committer | |
| log | 3c12ba718029adac707eeb6e86399f71b74c892e |
| tree | 013d26d427f1e93423b18929c7e872444757d6ca |
| parent | 79120612267f55901029dd57290ee90c0a3ec987 |
3 files changed, 8 insertions(+), 8 deletions(-)
test/compare_output.zig+2-2| ... | ... | @@ -331,8 +331,8 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 331 | 331 | \\ } |
| 332 | 332 | \\ const small: f32 = 3.25; |
| 333 | 333 | \\ const x: f64 = small; |
| 334 | \\ const y = i32(x); | |
| 335 | \\ const z = f64(y); | |
| 334 | \\ const y = @floatToInt(i32, x); | |
| 335 | \\ const z = @intToFloat(f64, y); | |
| 336 | 336 | \\ _ = c.printf(c"%.2f\n%d\n%.2f\n%.2f\n", x, y, z, f64(-0.4)); |
| 337 | 337 | \\ return 0; |
| 338 | 338 | \\} |
test/compile_errors.zig+4-4| ... | ... | @@ -2931,10 +2931,10 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 2931 | 2931 | "cast negative value to unsigned integer", |
| 2932 | 2932 | \\comptime { |
| 2933 | 2933 | \\ const value: i32 = -1; |
| 2934 | \\ const unsigned = u32(value); | |
| 2934 | \\ const unsigned = @intCast(u32, value); | |
| 2935 | 2935 | \\} |
| 2936 | 2936 | , |
| 2937 | ".tmp_source.zig:3:25: error: attempt to cast negative value to unsigned integer", | |
| 2937 | ".tmp_source.zig:3:22: error: attempt to cast negative value to unsigned integer", | |
| 2938 | 2938 | ); |
| 2939 | 2939 | |
| 2940 | 2940 | cases.add( |
| ... | ... | @@ -2963,10 +2963,10 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 2963 | 2963 | "compile-time integer cast truncates bits", |
| 2964 | 2964 | \\comptime { |
| 2965 | 2965 | \\ const spartan_count: u16 = 300; |
| 2966 | \\ const byte = u8(spartan_count); | |
| 2966 | \\ const byte = @intCast(u8, spartan_count); | |
| 2967 | 2967 | \\} |
| 2968 | 2968 | , |
| 2969 | ".tmp_source.zig:3:20: error: cast from 'u16' to 'u8' truncates bits", | |
| 2969 | ".tmp_source.zig:3:18: error: cast from 'u16' to 'u8' truncates bits", | |
| 2970 | 2970 | ); |
| 2971 | 2971 | |
| 2972 | 2972 | cases.add( |
test/runtime_safety.zig+2-2| ... | ... | @@ -188,7 +188,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 188 | 188 | \\ if (x == 0) return error.Whatever; |
| 189 | 189 | \\} |
| 190 | 190 | \\fn shorten_cast(x: i32) i8 { |
| 191 | \\ return i8(x); | |
| 191 | \\ return @intCast(i8, x); | |
| 192 | 192 | \\} |
| 193 | 193 | ); |
| 194 | 194 | |
| ... | ... | @@ -201,7 +201,7 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { |
| 201 | 201 | \\ if (x == 0) return error.Whatever; |
| 202 | 202 | \\} |
| 203 | 203 | \\fn unsigned_cast(x: i32) u32 { |
| 204 | \\ return u32(x); | |
| 204 | \\ return @intCast(u32, x); | |
| 205 | 205 | \\} |
| 206 | 206 | ); |
| 207 | 207 |