Merge remote-tracking branch 'origin/master' into null-terminated-pointers

This commit is contained in:
Andrew Kelley
2019-11-24 20:28:46 -05:00
33 changed files with 1571 additions and 1619 deletions

View File

@@ -29,6 +29,37 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
);
cases.add(
"empty switch on an integer",
\\export fn entry() void {
\\ var x: u32 = 0;
\\ switch(x) {}
\\}
,
"tmp.zig:3:5: error: switch must handle all possibilities",
);
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 {