stage2: peer resolve const u8 slices correctly

This commit is contained in:
Mitchell Hashimoto 2022-03-03 11:04:04 -08:00
parent 65943010c7
commit 0924f17a23
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 7 additions and 3 deletions

View File

@ -18230,7 +18230,7 @@ fn resolvePeerTypes(
convert_to_slice = false; // it already is a slice convert_to_slice = false; // it already is a slice
// If the pointer is const then we need to const // If the pointer is const then we need to const
if (candidate_ty.childType().isConstPtr()) if (candidate_ty.isConstPtr())
seen_const = true; seen_const = true;
continue; continue;
@ -18253,7 +18253,7 @@ fn resolvePeerTypes(
convert_to_slice = false; // it already is a slice convert_to_slice = false; // it already is a slice
// If the prev pointer is const then we need to const // If the prev pointer is const then we need to const
if (chosen_child_ty.isConstPtr()) if (chosen_ty.isConstPtr())
seen_const = true; seen_const = true;
continue; continue;

View File

@ -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" { 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; var array: [4:0]u8 = undefined;
array[4] = 0; // TODO remove this when #4372 is solved array[4] = 0; // TODO remove this when #4372 is solved