aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig16
1 files changed, 16 insertions, 0 deletions
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
@@ -2,6 +2,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;
\\export fn entry() void {