| ... | ... | @@ -1,6 +1,33 @@ |
| 1 | 1 | const tests = @import("tests.zig"); |
| 2 | 2 | |
| 3 | 3 | pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 4 | cases.add( |
| 5 | "non int passed to @intToFloat", |
| 6 | \\export fn entry() void { |
| 7 | \\ const x = @intToFloat(f32, 1.1); |
| 8 | \\} |
| 9 | , |
| 10 | ".tmp_source.zig:2:32: error: expected int type, found 'comptime_float'", |
| 11 | ); |
| 12 | |
| 13 | cases.add( |
| 14 | "non float passed to @floatToInt", |
| 15 | \\export fn entry() void { |
| 16 | \\ const x = @floatToInt(i32, i32(54)); |
| 17 | \\} |
| 18 | , |
| 19 | ".tmp_source.zig:2:35: error: expected float type, found 'i32'", |
| 20 | ); |
| 21 | |
| 22 | cases.add( |
| 23 | "out of range comptime_int passed to @floatToInt", |
| 24 | \\export fn entry() void { |
| 25 | \\ const x = @floatToInt(i8, 200); |
| 26 | \\} |
| 27 | , |
| 28 | ".tmp_source.zig:2:31: error: integer value 200 cannot be implicitly casted to type 'i8'", |
| 29 | ); |
| 30 | |
| 4 | 31 | cases.add( |
| 5 | 32 | "load too many bytes from comptime reinterpreted pointer", |
| 6 | 33 | \\export fn entry() void { |
| ... | ... | @@ -486,24 +513,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 486 | 513 | ".tmp_source.zig:2:20: error: return type cannot be opaque", |
| 487 | 514 | ); |
| 488 | 515 | |
| 489 | | cases.add( |
| 490 | | "non int passed to @intToFloat", |
| 491 | | \\export fn entry() void { |
| 492 | | \\ const x = @intToFloat(f32, 1.1); |
| 493 | | \\} |
| 494 | | , |
| 495 | | ".tmp_source.zig:2:32: error: expected int type, found 'comptime_float'", |
| 496 | | ); |
| 497 | | |
| 498 | | cases.add( |
| 499 | | "non float passed to @floatToInt", |
| 500 | | \\export fn entry() void { |
| 501 | | \\ const x = @floatToInt(i32, 54); |
| 502 | | \\} |
| 503 | | , |
| 504 | | ".tmp_source.zig:2:32: error: expected float type, found 'comptime_int'", |
| 505 | | ); |
| 506 | | |
| 507 | 516 | cases.add( |
| 508 | 517 | "use implicit casts to assign null to non-nullable pointer", |
| 509 | 518 | \\export fn entry() void { |