Commit 44f9061b71

Andrew Kelley <andrew@ziglang.org>
2022-03-22 23:58:19
fix merge conflicts and test cases
1 parent 60d8c47
Changed files (2)
src
test
stage2
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),
+                    },
                 );
             }
         }
test/stage2/x86_64.zig
@@ -1166,7 +1166,7 @@ pub fn addCases(ctx: *TestContext) !void {
                 \\    _ = x;
                 \\}
             , &[_][]const u8{
-                ":2:9: error: variable of type '@Type(.Null)' must be const or comptime",
+                ":2:9: error: variable of type '@TypeOf(null)' must be const or comptime",
             });
         }