Commit 0924f17a23

Mitchell Hashimoto <mitchell.hashimoto@gmail.com>
2022-03-03 20:04:04
stage2: peer resolve const u8 slices correctly
1 parent 6594301
Changed files (2)
src
test
behavior
src/Sema.zig
@@ -18230,7 +18230,7 @@ fn resolvePeerTypes(
                         convert_to_slice = false; // it already is a slice
 
                         // If the pointer is const then we need to const
-                        if (candidate_ty.childType().isConstPtr())
+                        if (candidate_ty.isConstPtr())
                             seen_const = true;
 
                         continue;
@@ -18253,7 +18253,7 @@ fn resolvePeerTypes(
                         convert_to_slice = false; // it already is a slice
 
                         // If the prev pointer is const then we need to const
-                        if (chosen_child_ty.isConstPtr())
+                        if (chosen_ty.isConstPtr())
                             seen_const = true;
 
                         continue;
test/behavior/cast.zig
@@ -964,7 +964,11 @@ test "cast between C pointer with different but compatible types" {
 }
 
 test "peer type resolve string lit with sentinel-terminated mutable slice" {
-    if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
 
     var array: [4:0]u8 = undefined;
     array[4] = 0; // TODO remove this when #4372 is solved