disallow declarations between container fields
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user