aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-22 15:58:19 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-22 15:58:19 -0700
commit44f9061b718e9bdcd43d258291f89930b74aa56a (patch)
treebb753832ef6ab9ed8fb3bc873222627453033639 /src
parent60d8c4739de14823c407245f01c9b7483f3b6e7f (diff)
downloadzig-44f9061b718e9bdcd43d258291f89930b74aa56a.tar.gz
zig-44f9061b718e9bdcd43d258291f89930b74aa56a.zip
fix merge conflicts and test cases
Diffstat (limited to 'src')
-rw-r--r--src/Sema.zig17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index 2428db5b0f..e6447ea2ef 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -19732,7 +19732,10 @@ fn analyzeSlice(
block,
end_src,
"end index {} out of bounds for array of length {}",
- .{ end_val.fmtValue(Type.usize), len_val.fmtValue(Type.usize) },
+ .{
+ end_val.fmtValue(Type.usize, target),
+ len_val.fmtValue(Type.usize, target),
+ },
);
}
if (end_val.eql(len_val, Type.usize, target)) {
@@ -19758,7 +19761,10 @@ fn analyzeSlice(
block,
end_src,
"end index {} out of bounds for slice of length {}",
- .{ end_val.fmtValue(Type.usize), slice_len_val.fmtValue(Type.usize) },
+ .{
+ end_val.fmtValue(Type.usize, target),
+ slice_len_val.fmtValue(Type.usize, target),
+ },
);
}
if (end_val.eql(slice_len_val, Type.usize, target)) {
@@ -19794,12 +19800,15 @@ fn analyzeSlice(
// requirement: start <= end
if (try sema.resolveDefinedValue(block, src, end)) |end_val| {
if (try sema.resolveDefinedValue(block, src, start)) |start_val| {
- if (start_val.compare(.gt, end_val, Type.usize)) {
+ if (start_val.compare(.gt, end_val, Type.usize, target)) {
return sema.fail(
block,
start_src,
"start index {} is larger than end index {}",
- .{ start_val.fmtValue(Type.usize), end_val.fmtValue(Type.usize) },
+ .{
+ start_val.fmtValue(Type.usize, target),
+ end_val.fmtValue(Type.usize, target),
+ },
);
}
}