diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 5405b7b8a8..9979ed666c 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -1,6 +1,22 @@ const tests = @import("tests.zig"); pub fn addCases(cases: *tests.CompileErrorContext) void { + cases.add( + "switch with invalid expression parameter", + \\export fn entry() void { + \\ Test(i32); + \\} + \\fn Test(comptime T: type) void { + \\ const x = switch (T) { + \\ []u8 => |x| 123, + \\ i32 => |x| 456, + \\ else => unreachable, + \\ }; + \\} + , + ".tmp_source.zig:7:17: error: switch on type 'type' provides no expression parameter", + ); + cases.add( "function protoype with no body", \\fn foo() void;