authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-22 15:58:19-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-22 15:58:19-07:00
log44f9061b718e9bdcd43d258291f89930b74aa56a
treebb753832ef6ab9ed8fb3bc873222627453033639
parent60d8c4739de14823c407245f01c9b7483f3b6e7f

fix merge conflicts and test cases


2 files changed, 14 insertions(+), 5 deletions(-)

src/Sema.zig+13-4
...@@ -19732,7 +19732,10 @@ fn analyzeSlice(...@@ -19732,7 +19732,10 @@ fn analyzeSlice(
19732 block,19732 block,
19733 end_src,19733 end_src,
19734 "end index {} out of bounds for array of length {}",19734 "end index {} out of bounds for array of length {}",
19735 .{ end_val.fmtValue(Type.usize), len_val.fmtValue(Type.usize) },19735 .{
19736 end_val.fmtValue(Type.usize, target),
19737 len_val.fmtValue(Type.usize, target),
19738 },
19736 );19739 );
19737 }19740 }
19738 if (end_val.eql(len_val, Type.usize, target)) {19741 if (end_val.eql(len_val, Type.usize, target)) {
...@@ -19758,7 +19761,10 @@ fn analyzeSlice(...@@ -19758,7 +19761,10 @@ fn analyzeSlice(
19758 block,19761 block,
19759 end_src,19762 end_src,
19760 "end index {} out of bounds for slice of length {}",19763 "end index {} out of bounds for slice of length {}",
19761 .{ end_val.fmtValue(Type.usize), slice_len_val.fmtValue(Type.usize) },19764 .{
19765 end_val.fmtValue(Type.usize, target),
19766 slice_len_val.fmtValue(Type.usize, target),
19767 },
19762 );19768 );
19763 }19769 }
19764 if (end_val.eql(slice_len_val, Type.usize, target)) {19770 if (end_val.eql(slice_len_val, Type.usize, target)) {
...@@ -19794,12 +19800,15 @@ fn analyzeSlice(...@@ -19794,12 +19800,15 @@ fn analyzeSlice(
19794 // requirement: start <= end19800 // requirement: start <= end
19795 if (try sema.resolveDefinedValue(block, src, end)) |end_val| {19801 if (try sema.resolveDefinedValue(block, src, end)) |end_val| {
19796 if (try sema.resolveDefinedValue(block, src, start)) |start_val| {19802 if (try sema.resolveDefinedValue(block, src, start)) |start_val| {
19797 if (start_val.compare(.gt, end_val, Type.usize)) {19803 if (start_val.compare(.gt, end_val, Type.usize, target)) {
19798 return sema.fail(19804 return sema.fail(
19799 block,19805 block,
19800 start_src,19806 start_src,
19801 "start index {} is larger than end index {}",19807 "start index {} is larger than end index {}",
19802 .{ start_val.fmtValue(Type.usize), end_val.fmtValue(Type.usize) },19808 .{
19809 start_val.fmtValue(Type.usize, target),
19810 end_val.fmtValue(Type.usize, target),
19811 },
19803 );19812 );
19804 }19813 }
19805 }19814 }
test/stage2/x86_64.zig+1-1
...@@ -1166,7 +1166,7 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -1166,7 +1166,7 @@ pub fn addCases(ctx: *TestContext) !void {
1166 \\ _ = x;1166 \\ _ = x;
1167 \\}1167 \\}
1168 , &[_][]const u8{1168 , &[_][]const u8{
1169 ":2:9: error: variable of type '@Type(.Null)' must be const or comptime",1169 ":2:9: error: variable of type '@TypeOf(null)' must be const or comptime",
1170 });1170 });
1171 }1171 }
11721172