| ... | @@ -2,6 +2,16 @@ const tests = @import("tests.zig"); | ... | @@ -2,6 +2,16 @@ const tests = @import("tests.zig"); |
| 2 | const builtin = @import("builtin"); | 2 | const builtin = @import("builtin"); |
| 3 | | 3 | |
| 4 | pub fn addCases(cases: *tests.CompileErrorContext) void { | 4 | pub fn addCases(cases: *tests.CompileErrorContext) void { |
| | 5 | cases.add( |
| | 6 | "empty switch on an integer", |
| | 7 | \\export fn entry() void { |
| | 8 | \\ var x: u32 = 0; |
| | 9 | \\ switch(x) {} |
| | 10 | \\} |
| | 11 | , |
| | 12 | "tmp.zig:3:5: error: switch must handle all possibilities", |
| | 13 | ); |
| | 14 | |
| 5 | cases.add( | 15 | cases.add( |
| 6 | "regression test #2980: base type u32 is not type checked properly when assigning a value within a struct", | 16 | "regression test #2980: base type u32 is not type checked properly when assigning a value within a struct", |
| 7 | \\const Foo = struct { | 17 | \\const Foo = struct { |