aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-11-12 01:40:31 +0000
committerGitHub <noreply@github.com>2019-11-12 01:40:31 +0000
commit5502160bd23f14b91ac2bd3726a93bdd0b40cc53 (patch)
tree81ced0f54f4c02eb7fd3bdd5d3d1248014f356a6 /test/compile_errors.zig
parentae0a219d1f5495acc4d82421fa24d84186c2a40d (diff)
parent0c315e7f7613b085a203e9c94d222e846b5b9e46 (diff)
downloadzig-5502160bd23f14b91ac2bd3726a93bdd0b40cc53.tar.gz
zig-5502160bd23f14b91ac2bd3726a93bdd0b40cc53.zip
Merge pull request #3652 from ziglang/anon-container-lit
implement anonymous struct literals and anonymous list literals
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig21
1 files changed, 19 insertions, 2 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 0917c3dbb4..1adf3c3f8e 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -3,6 +3,23 @@ const builtin = @import("builtin");
pub fn addCases(cases: *tests.CompileErrorContext) void {
cases.add(
+ "missing const in slice with nested array type",
+ \\const Geo3DTex2D = struct { vertices: [][2]f32 };
+ \\pub fn getGeo3DTex2D() Geo3DTex2D {
+ \\ return Geo3DTex2D{
+ \\ .vertices = [_][2]f32{
+ \\ [_]f32{ -0.5, -0.5},
+ \\ },
+ \\ };
+ \\}
+ \\export fn entry() void {
+ \\ var geo_data = getGeo3DTex2D();
+ \\}
+ ,
+ "tmp.zig:4:30: error: expected type '[][2]f32', found '[1][2]f32'",
+ );
+
+ cases.add(
"slicing of global undefined pointer",
\\var buf: *[1]u8 = undefined;
\\export fn entry() void {
@@ -216,9 +233,9 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
\\ const obj = AstObject{ .lhsExpr = lhsExpr };
\\}
,
- "tmp.zig:4:19: error: union 'AstObject' depends on itself",
- "tmp.zig:2:5: note: while checking this field",
+ "tmp.zig:1:17: error: struct 'LhsExpr' depends on itself",
"tmp.zig:5:5: note: while checking this field",
+ "tmp.zig:2:5: note: while checking this field",
);
cases.add(