aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/compile_errors.zig21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 04355261f9..9e47d2a458 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -13,6 +13,27 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
);
cases.add(
+ "incorrect return type",
+ \\ pub export fn entry() void{
+ \\ _ = foo();
+ \\ }
+ \\ const A = struct {
+ \\ a: u32,
+ \\ };
+ \\ fn foo() A {
+ \\ return bar();
+ \\ }
+ \\ const B = struct {
+ \\ a: u32,
+ \\ };
+ \\ fn bar() B {
+ \\ unreachable;
+ \\ }
+ ,
+ "tmp.zig:8:16: error: expected type 'A', found 'B'",
+ );
+
+ cases.add(
"regression test #2980: base type u32 is not type checked properly when assigning a value within a struct",
\\const Foo = struct {
\\ ptr: ?*usize,