disallow declarations between container fields

This commit is contained in:
Vexu
2020-04-18 19:42:45 +03:00
parent 6c907a3509
commit fff00c3bbb
2 changed files with 52 additions and 0 deletions

View File

@@ -2,6 +2,21 @@ const tests = @import("tests.zig");
const std = @import("std");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add("declaration between fields",
\\const S = struct {
\\ a: usize,
\\ const foo = 2;
\\ const bar = 2;
\\ const baz = 2;
\\ b: usize,
\\};
\\comptime {
\\ _ = S;
\\}
, &[_][]const u8{
"tmp.zig:3:5: error: declarations are not allowed between container fields",
});
cases.add("non-extern function with var args",
\\fn foo(args: ...) void {}
\\export fn entry() void {