| ... | ... | @@ -1,6 +1,22 @@ |
| 1 | 1 | const tests = @import("tests.zig"); |
| 2 | 2 | |
| 3 | 3 | pub fn addCases(cases: *tests.CompileErrorContext) void { |
| 4 | cases.add( |
| 5 | "switch with invalid expression parameter", |
| 6 | \\export fn entry() void { |
| 7 | \\ Test(i32); |
| 8 | \\} |
| 9 | \\fn Test(comptime T: type) void { |
| 10 | \\ const x = switch (T) { |
| 11 | \\ []u8 => |x| 123, |
| 12 | \\ i32 => |x| 456, |
| 13 | \\ else => unreachable, |
| 14 | \\ }; |
| 15 | \\} |
| 16 | , |
| 17 | ".tmp_source.zig:7:17: error: switch on type 'type' provides no expression parameter", |
| 18 | ); |
| 19 | |
| 4 | 20 | cases.add( |
| 5 | 21 | "function protoype with no body", |
| 6 | 22 | \\fn foo() void; |