authorgravatar for mitchell.hashimoto@gmail.comMitchell Hashimoto <mitchell.hashimoto@gmail.com> 2022-03-03 11:04:04-08:00
committergravatar for mitchell.hashimoto@gmail.comMitchell Hashimoto <mitchell.hashimoto@gmail.com> 2022-03-03 11:04:04-08:00
log0924f17a234c48c4a7a17e44a1ffac6a9026d5e5
treef6381f3f3e80bab71c88867b6461da9059f67304
parent65943010c70b33e711a038dff5f80066045ee1b7
signaturelock-open Commit is signed but in an unrecognized format.

stage2: peer resolve const u8 slices correctly


2 files changed, 7 insertions(+), 3 deletions(-)

src/Sema.zig+2-2
...@@ -18230,7 +18230,7 @@ fn resolvePeerTypes(...@@ -18230,7 +18230,7 @@ fn resolvePeerTypes(
18230 convert_to_slice = false; // it already is a slice18230 convert_to_slice = false; // it already is a slice
1823118231
18232 // If the pointer is const then we need to const18232 // If the pointer is const then we need to const
18233 if (candidate_ty.childType().isConstPtr())18233 if (candidate_ty.isConstPtr())
18234 seen_const = true;18234 seen_const = true;
1823518235
18236 continue;18236 continue;
...@@ -18253,7 +18253,7 @@ fn resolvePeerTypes(...@@ -18253,7 +18253,7 @@ fn resolvePeerTypes(
18253 convert_to_slice = false; // it already is a slice18253 convert_to_slice = false; // it already is a slice
1825418254
18255 // If the prev pointer is const then we need to const18255 // If the prev pointer is const then we need to const
18256 if (chosen_child_ty.isConstPtr())18256 if (chosen_ty.isConstPtr())
18257 seen_const = true;18257 seen_const = true;
1825818258
18259 continue;18259 continue;
test/behavior/cast.zig+5-1
...@@ -964,7 +964,11 @@ test "cast between C pointer with different but compatible types" {...@@ -964,7 +964,11 @@ test "cast between C pointer with different but compatible types" {
964}964}
965965
966test "peer type resolve string lit with sentinel-terminated mutable slice" {966test "peer type resolve string lit with sentinel-terminated mutable slice" {
967 if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO967 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
968 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
969 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
970 if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
971 if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
968972
969 var array: [4:0]u8 = undefined;973 var array: [4:0]u8 = undefined;
970 array[4] = 0; // TODO remove this when #4372 is solved974 array[4] = 0; // TODO remove this when #4372 is solved