aboutsummaryrefslogtreecommitdiff
path: root/test/cases/compile_errors
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-07-28 22:21:49 +0300
committerVeikka Tuominen <git@vexu.eu>2022-07-30 11:07:37 +0300
commit02dc0732604236a57b43b9612d9b0571f06f905a (patch)
treedc20d0b237f86761fb636d2238ceddf92493024f /test/cases/compile_errors
parentd26d696ee01d3a17d17cde24c8841e7f551ba5f2 (diff)
downloadzig-02dc0732604236a57b43b9612d9b0571f06f905a.tar.gz
zig-02dc0732604236a57b43b9612d9b0571f06f905a.zip
Sema: check comptime slice sentinel
Diffstat (limited to 'test/cases/compile_errors')
-rw-r--r--test/cases/compile_errors/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig (renamed from test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig)23
-rw-r--r--test/cases/compile_errors/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig (renamed from test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig)23
-rw-r--r--test/cases/compile_errors/comptime_slice-sentinel_does_not_match_target-sentinel.zig (renamed from test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_target-sentinel.zig)23
-rw-r--r--test/cases/compile_errors/comptime_slice-sentinel_is_out_of_bounds_terminated.zig (renamed from test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_terminated.zig)16
-rw-r--r--test/cases/compile_errors/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig (renamed from test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig)16
-rw-r--r--test/cases/compile_errors/comptime_slice_of_an_undefined_slice.zig (renamed from test/cases/compile_errors/stage1/obj/comptime_slice_of_an_undefined_slice.zig)4
6 files changed, 63 insertions, 42 deletions
diff --git a/test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig b/test/cases/compile_errors/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig
index 598d23a305..ffa21af10a 100644
--- a/test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig
+++ b/test/cases/compile_errors/comptime_slice-sentinel_does_not_match_memory_at_target_index_terminated.zig
@@ -55,13 +55,20 @@ export fn foo_slice() void {
}
// error
-// backend=stage1
+// backend=stage2
// target=native
//
-// :4:29: error: slice-sentinel does not match memory at target index
-// :12:29: error: slice-sentinel does not match memory at target index
-// :20:29: error: slice-sentinel does not match memory at target index
-// :28:29: error: slice-sentinel does not match memory at target index
-// :36:29: error: slice-sentinel does not match memory at target index
-// :44:29: error: slice-sentinel does not match memory at target index
-// :52:29: error: slice-sentinel does not match memory at target index
+// :4:29: error: value in memory does not match slice sentinel
+// :4:29: note: expected '0', found '100'
+// :12:29: error: value in memory does not match slice sentinel
+// :12:29: note: expected '0', found '100'
+// :20:29: error: value in memory does not match slice sentinel
+// :20:29: note: expected '0', found '100'
+// :28:29: error: value in memory does not match slice sentinel
+// :28:29: note: expected '0', found '100'
+// :36:29: error: value in memory does not match slice sentinel
+// :36:29: note: expected '0', found '100'
+// :44:29: error: value in memory does not match slice sentinel
+// :44:29: note: expected '0', found '100'
+// :52:29: error: value in memory does not match slice sentinel
+// :52:29: note: expected '0', found '100'
diff --git a/test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig b/test/cases/compile_errors/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig
index d6b469aaf1..c5bb2d9643 100644
--- a/test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig
+++ b/test/cases/compile_errors/comptime_slice-sentinel_does_not_match_memory_at_target_index_unterminated.zig
@@ -55,13 +55,20 @@ export fn foo_slice() void {
}
// error
-// backend=stage1
+// backend=stage2
// target=native
//
-// :4:29: error: slice-sentinel does not match memory at target index
-// :12:29: error: slice-sentinel does not match memory at target index
-// :20:29: error: slice-sentinel does not match memory at target index
-// :28:29: error: slice-sentinel does not match memory at target index
-// :36:29: error: slice-sentinel does not match memory at target index
-// :44:29: error: slice-sentinel does not match memory at target index
-// :52:29: error: slice-sentinel does not match memory at target index
+// :4:29: error: value in memory does not match slice sentinel
+// :4:29: note: expected '0', found '100'
+// :12:29: error: value in memory does not match slice sentinel
+// :12:29: note: expected '0', found '100'
+// :20:29: error: value in memory does not match slice sentinel
+// :20:29: note: expected '0', found '100'
+// :28:29: error: value in memory does not match slice sentinel
+// :28:29: note: expected '0', found '100'
+// :36:29: error: value in memory does not match slice sentinel
+// :36:29: note: expected '0', found '100'
+// :44:29: error: value in memory does not match slice sentinel
+// :44:29: note: expected '0', found '100'
+// :52:29: error: value in memory does not match slice sentinel
+// :52:29: note: expected '0', found '100'
diff --git a/test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_target-sentinel.zig b/test/cases/compile_errors/comptime_slice-sentinel_does_not_match_target-sentinel.zig
index b204cfc684..b574df8833 100644
--- a/test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_does_not_match_target-sentinel.zig
+++ b/test/cases/compile_errors/comptime_slice-sentinel_does_not_match_target-sentinel.zig
@@ -55,13 +55,20 @@ export fn foo_slice() void {
}
// error
-// backend=stage1
+// backend=stage2
// target=native
//
-// :4:29: error: slice-sentinel does not match target-sentinel
-// :12:29: error: slice-sentinel does not match target-sentinel
-// :20:29: error: slice-sentinel does not match target-sentinel
-// :28:29: error: slice-sentinel does not match target-sentinel
-// :36:29: error: slice-sentinel does not match target-sentinel
-// :44:29: error: slice-sentinel does not match target-sentinel
-// :52:29: error: slice-sentinel does not match target-sentinel
+// :4:29: error: value in memory does not match slice sentinel
+// :4:29: note: expected '255', found '0'
+// :12:29: error: value in memory does not match slice sentinel
+// :12:29: note: expected '255', found '0'
+// :20:29: error: value in memory does not match slice sentinel
+// :20:29: note: expected '255', found '0'
+// :28:29: error: value in memory does not match slice sentinel
+// :28:29: note: expected '255', found '0'
+// :36:29: error: value in memory does not match slice sentinel
+// :36:29: note: expected '255', found '0'
+// :44:29: error: value in memory does not match slice sentinel
+// :44:29: note: expected '255', found '0'
+// :52:29: error: value in memory does not match slice sentinel
+// :52:29: note: expected '255', found '0'
diff --git a/test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_terminated.zig b/test/cases/compile_errors/comptime_slice-sentinel_is_out_of_bounds_terminated.zig
index 82c19126c0..86bd4ce8bb 100644
--- a/test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_terminated.zig
+++ b/test/cases/compile_errors/comptime_slice-sentinel_is_out_of_bounds_terminated.zig
@@ -55,13 +55,13 @@ export fn foo_slice() void {
}
// error
-// backend=stage1
+// backend=stage2
// target=native
//
-// :4:29: error: out of bounds slice
-// :12:29: error: out of bounds slice
-// :20:29: error: out of bounds slice
-// :28:29: error: out of bounds slice
-// :36:29: error: out of bounds slice
-// :44:29: error: out of bounds slice
-// :52:29: error: out of bounds slice
+// :4:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'
+// :12:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'
+// :20:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'
+// :28:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'
+// :36:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'
+// :44:33: error: slice end index 15 exceeds bounds of containing decl of type '[14:0]u8'
+// :52:33: error: end index 15 out of bounds for slice of length 14
diff --git a/test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig b/test/cases/compile_errors/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig
index 952b17600a..e1b8a5bc2d 100644
--- a/test/cases/compile_errors/stage1/obj/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig
+++ b/test/cases/compile_errors/comptime_slice-sentinel_is_out_of_bounds_unterminated.zig
@@ -55,13 +55,13 @@ export fn foo_slice() void {
}
// error
-// backend=stage1
+// backend=stage2
// target=native
//
-// :4:29: error: slice-sentinel is out of bounds
-// :12:29: error: slice-sentinel is out of bounds
-// :20:29: error: slice-sentinel is out of bounds
-// :28:29: error: slice-sentinel is out of bounds
-// :36:29: error: slice-sentinel is out of bounds
-// :44:29: error: slice-sentinel is out of bounds
-// :52:29: error: slice-sentinel is out of bounds
+// :4:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'
+// :12:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'
+// :20:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'
+// :28:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'
+// :36:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'
+// :44:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'
+// :52:33: error: slice end index 14 exceeds bounds of containing decl of type '[14]u8'
diff --git a/test/cases/compile_errors/stage1/obj/comptime_slice_of_an_undefined_slice.zig b/test/cases/compile_errors/comptime_slice_of_an_undefined_slice.zig
index 4aa519f41e..d1b22d86b7 100644
--- a/test/cases/compile_errors/stage1/obj/comptime_slice_of_an_undefined_slice.zig
+++ b/test/cases/compile_errors/comptime_slice_of_an_undefined_slice.zig
@@ -5,7 +5,7 @@ comptime {
}
// error
-// backend=stage1
+// backend=stage2
// target=native
//
-// tmp.zig:3:14: error: slice of undefined
+// :3:14: error: slice of undefined