diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-11-21 23:24:58 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-11-21 23:25:02 -0500 |
| commit | ad0871ea4bf2dfbed07282ffe14738b5347d5d32 (patch) | |
| tree | 17497337d26c37cf2bbc7d68d2813c22fea5c661 /test/compile_errors.zig | |
| parent | 94299d16d1443cd8b731e2eba9b4d1e3fb8048bd (diff) | |
| parent | 4e6c1b676b30920fb333a6aa270bb42dc4cecc79 (diff) | |
| download | zig-ad0871ea4bf2dfbed07282ffe14738b5347d5d32.tar.gz zig-ad0871ea4bf2dfbed07282ffe14738b5347d5d32.zip | |
Merge branch 'Vexu-missing-cast'
Closes #3336
Closes #3718
Diffstat (limited to 'test/compile_errors.zig')
| -rw-r--r-- | test/compile_errors.zig | 21 |
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, |
