diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-11-06 11:09:14 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-11-06 11:09:14 -0500 |
| commit | 63f636e7b775bc8d2881104248f9579a089c4240 (patch) | |
| tree | 25e7432ccd228f0507aa3cb8665ad66762e29db6 /test/compile_errors.zig | |
| parent | a08b65720b7a6b78ff59b36fff1b3a6910483609 (diff) | |
| download | zig-63f636e7b775bc8d2881104248f9579a089c4240.tar.gz zig-63f636e7b775bc8d2881104248f9579a089c4240.zip | |
limit integer types to maximum bit width of 65535
closes #1541
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig index b9cb9f158f..d14fdff684 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2,6 +2,19 @@ const tests = @import("tests.zig"); pub fn addCases(cases: *tests.CompileErrorContext) void { cases.add( + "exceeded maximum bit width of integer", + \\export fn entry1() void { + \\ const T = @IntType(false, 65536); + \\} + \\export fn entry2() void { + \\ var x: i65536 = 1; + \\} + , + ".tmp_source.zig:2:31: error: integer value 65536 cannot be implicitly casted to type 'u16'", + ".tmp_source.zig:5:12: error: primitive integer type 'i65536' exceeds maximum bit width of 65535", + ); + + cases.add( "Panic declared with wrong type signature in tests", \\test "" {} \\ @@ -535,15 +548,6 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { ); cases.add( - "bit count of @IntType too large", - \\comptime { - \\ _ = @IntType(false, @import("std").math.maxInt(u32) + 1); - \\} - , - ".tmp_source.zig:2:57: error: integer value 4294967296 cannot be implicitly casted to type 'u32'", - ); - - cases.add( "optional pointer to void in extern struct", \\const Foo = extern struct.{ \\ x: ?*const void, @@ -4278,7 +4282,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ const a: u16 = 300; \\} , - ".tmp_source.zig:1:1: error: declaration shadows type 'u16'", + ".tmp_source.zig:1:1: error: declaration shadows primitive type 'u16'", ); cases.add( |
