aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-09-02 19:13:21 -0400
committerGitHub <noreply@github.com>2020-09-02 19:13:21 -0400
commitc86108dd63349cbd99a8821fb4d628f31958e0ed (patch)
treee68a54f384a8908b37e560cadb11c0a91d6af603 /test/compile_errors.zig
parent405c7215a8054680a789cf94afe41fd66c7d61c7 (diff)
parentdd4994a4e4379454f6b58779276f1b6aa9ed6e1b (diff)
downloadzig-c86108dd63349cbd99a8821fb4d628f31958e0ed.tar.gz
zig-c86108dd63349cbd99a8821fb4d628f31958e0ed.zip
Merge pull request #6229 from LemonBoy/fix-6054
ir: Typecheck the sentinel value in *[N:S1]T to [S2]T casts
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 9e81ed27a7..f6e00e1dbb 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -2,6 +2,14 @@ const tests = @import("tests.zig");
const std = @import("std");
pub fn addCases(cases: *tests.CompileErrorContext) void {
+ cases.add("slice sentinel mismatch",
+ \\export fn entry() void {
+ \\ const y: [:1]const u8 = &[_:2]u8{ 1, 2 };
+ \\}
+ , &[_][]const u8{
+ "tmp.zig:2:37: error: expected type '[:1]const u8', found '*const [2:2]u8'",
+ });
+
cases.add("@Type with undefined",
\\comptime {
\\ _ = @Type(.{ .Array = .{ .len = 0, .child = u8, .sentinel = undefined } });